Browse Source

all: fix plugins installation in fresh install

my-config
NTBBloodbath 4 years ago
parent
commit
1c991a4f7d
No known key found for this signature in database GPG Key ID: 18D6730BC846AAC5
  1. 7
      doomrc
  2. 19
      install.sh
  3. 29
      lua/doom/autocmds/init.lua
  4. 19
      lua/doom/config/init.lua
  5. 116
      lua/plugins/init.lua

7
doomrc

@ -94,7 +94,7 @@ Doom = {
-- @default = true
split_right = true,
-- Automatically split right
-- Automatically split above
-- false : splits above (horizontally)
-- true : splits below (horizontally)
-- @default = true
@ -153,6 +153,11 @@ Doom = {
-- @default = false
check_updates = false,
-- Auto install plugins on launch, useful if you don't want to run
-- PackerInstall every time you add a new plugin
-- @default = true
auto_install_plugins = true,
-- Disable dashboard status line (does not work perfectly)
-- false : disables dashboard status line
-- true : enables dashboard status line

19
install.sh

@ -32,7 +32,7 @@ BYellow='\033[1;33m' # Yellow
# }}}
# Doom Nvim version
DoomNvimVersion='2.3.1'
DoomNvimVersion='2.3.2'
# System OS
System="$(uname -s)"
@ -148,8 +148,8 @@ backup_neovim() {
}
# }}}
# Doom Nvim updating
# ==================
# Doom Nvim installing/updating
# =============================
# {{{
update_repo() {
if [[ -d "$HOME/.config/doom-nvim" ]]; then
@ -189,6 +189,15 @@ install_nvim_nightly() {
log_success "Successfully installed Neovim Nightly under $HOME/.local/bin/ directory"
}
install_packer() {
if [[ -d "$HOME/.local/share/nvim/site/pack/packer/start/packer.nvim" ]]; then
log_info "Installing packer plugin manager ..."
# NOTE: stop installing that branch when merged into the main branch
git clone -q -b fix/premature-display-opening https://github.com/wbthomason/packer.nvim \
$HOME/.local/share/nvim/site/pack/packer/start/packer.nvim
fi
}
install_fonts() {
if [[ ! -d "$HOME/.local/share/fonts" ]]; then
mkdir -p $HOME/.local/share/fonts
@ -324,6 +333,7 @@ main() {
welcome
check_all
update_repo "main"
install_packer
install_fonts
backup_neovim
install_done
@ -333,6 +343,7 @@ main() {
welcome
check_all
update_repo "develop"
install_packer
install_fonts
backup_neovim
install_done
@ -342,6 +353,7 @@ main() {
welcome
check_all
update_repo "main"
install_packer
backup_neovim
install_nvim_nightly
install_done
@ -368,6 +380,7 @@ main() {
welcome
check_all
update_repo "main"
install_packer
backup_neovim
install_fonts
check_requirements

29
lua/doom/autocmds/init.lua

@ -10,8 +10,12 @@ local autocmds = {
{ 'BufNewFile,BufRead', 'doomrc', 'set ft=lua' },
-- Ensure every file does full syntax highlight
{ 'BufEnter', '*', ':syntax sync fromstart' },
{ 'BufEnter', '*', ':set signcolumn=yes'},
{ 'BufEnter', '*', ':set pumblend='..Doom.complete_transparency},
{ 'BufEnter', '*', ':set signcolumn=yes' },
{
'BufEnter',
'*',
':set pumblend=' .. Doom.complete_transparency,
},
-- Compile new plugins changes at save
{
'BufWritePost',
@ -45,6 +49,15 @@ if Doom.relative_num then
})
end
-- Install plugins on launch
if Doom.auto_install_plugins then
table.insert(autocmds['doom_core'], {
'VimEnter',
'*',
'PackerInstall',
})
end
-- Set autosave
if Doom.autosave then
table.insert(autocmds['doom_core'], {
@ -57,14 +70,22 @@ end
-- Enable auto comment
if not Doom.auto_comment then
table.insert(autocmds['doom_core'], {
{'BufWinEnter', '*', 'setlocal formatoptions-=c formatoptions-=r formatoptions-=o'},
{
'BufWinEnter',
'*',
'setlocal formatoptions-=c formatoptions-=r formatoptions-=o',
},
})
end
-- Enable highlight on yank
if Doom.highlight_yank then
table.insert(autocmds['doom_core'], {
{'TextYankPost', '*', 'lua require(\'vim.highlight\').on_yank({higroup = \'Search\', timeout = 200})'},
{
'TextYankPost',
'*',
"lua require('vim.highlight').on_yank({higroup = 'Search', timeout = 200})",
},
})
end

19
lua/doom/config/init.lua

@ -4,7 +4,7 @@
-- License: MIT --
---[[---------------------------------------]]---
-- Doom Nvim version
Doom_version = '2.3.1'
Doom_version = '2.3.2'
-- Check if running Neovim or Vim and fails if:
-- 1. Running Vim instead of Neovim
@ -21,21 +21,6 @@ else
)
end
-- If packer.nvim is not installed then install it and install core plugins after that
local packer_install_path = Fn.stdpath('data')
.. '/site/pack/packer/start/packer.nvim'
if Fn.empty(Fn.glob(packer_install_path)) > 0 then
Execute(
'silent !git clone https://github.com/wbthomason/packer.nvim '
.. packer_install_path
)
Execute('packadd packer.nvim')
-- Install plugins and then reload configs
Execute('PackerInstall')
Execute('luafile $MYVIMRC')
end
-- Set some configs on load
if Fn.has('vim_starting') then
-- Set encoding
@ -59,7 +44,9 @@ Default_options()
require('plugins')
require('doom.config.load_plugins')
-- Load the user-defined settings (global variables, autocmds, mappings)
Custom_commands()
if Doom.check_updates then
Check_updates()
end

116
lua/plugins/init.lua

@ -18,8 +18,6 @@
-- 2. We do not provide other LSP integration like coc.nvim,
-- please refer to our FAQ to see why.
--- Set disabled plugins modules and plugins
local disabled_plugins = {}
--- Disabled modules
local disabled_git = Has_value(Doom.disabled_modules, 'git')
local disabled_lsp = Has_value(Doom.disabled_modules, 'lsp')
@ -31,8 +29,12 @@ return packer.startup(function()
-----[[------------]]-----
--- Essentials ---
-----]]------------[[-----
-- Plugins manager
use('wbthomason/packer.nvim')
-- Plugins manager, remove the branch field when that branch is merged
-- in the main branch.
use({
'wbthomason/packer.nvim',
branch = 'fix/premature-display-opening',
})
-- Auxiliar functions for using Lua in Neovim
use('svermeulen/vimpeccable')
@ -40,9 +42,6 @@ return packer.startup(function()
-- Tree-Sitter
local disabled_treesitter =
Has_value(Doom.disabled_plugins, 'treesitter')
if disabled_files and not disabled_treesitter then
table.insert(disabled_plugins, 'treesitter')
end
use({
'nvim-treesitter/nvim-treesitter',
run = ':TSUpdate',
@ -63,21 +62,22 @@ return packer.startup(function()
use({ 'glepnir/dashboard-nvim', disable = false })
-- Colorschemes
-- cannot be disabled at the moment
local disabled_colorschemes =
Has_value(Doom.disabled_plugins, 'colorschemes')
use({
'sainnhe/sonokai',
'sainnhe/edge',
'sainnhe/everforest',
'wadackel/vim-dogrun',
'joshdick/onedark.vim',
'ajmwagar/vim-deus',
{ 'sainnhe/sonokai', disable = disabled_colorschemes },
{ 'sainnhe/edge', disable = disabled_colorschemes },
{ 'sainnhe/everforest', disable = disabled_colorschemes },
{ 'wadackel/vim-dogrun', disable = disabled_colorschemes },
{
'joshdick/onedark.vim',
disable = disabled_colorschemes,
},
{ 'ajmwagar/vim-deus', disable = disabled_colorschemes },
})
-- File tree
local disabled_tree = Has_value(Doom.disabled_plugins, 'tree')
if disabled_tree then
table.insert(disabled_plugins, 'tree')
end
use({
'kyazdani42/nvim-tree.lua',
requires = { 'kyazdani42/nvim-web-devicons' },
@ -88,9 +88,6 @@ return packer.startup(function()
-- can be disabled to use your own statusline
local disabled_statusline =
Has_value(Doom.disabled_plugins, 'statusline')
if disabled_statusline then
table.insert(disabled_plugins, 'statusline')
end
use({
'glepnir/galaxyline.nvim',
disable = disabled_statusline,
@ -99,38 +96,26 @@ return packer.startup(function()
-- Tabline
-- can be disabled to use your own tabline
local disabled_tabline = Has_value(Doom.disabled_plugins, 'tabline')
if disabled_tabline then
table.insert(disabled_plugins, 'tabline')
end
use({ 'romgrk/barbar.nvim', disable = disabled_tabline })
-- Better terminal
-- can be disabled to use your own terminal plugin
local disabled_terminal = Has_value(Doom.disabled_plugins, 'terminal')
if disabled_terminal then
table.insert(disabled_plugins, 'terminal')
end
use({
'akinsho/nvim-toggleterm.lua',
disable = disabled_terminal,
})
-- Viewer & finder for LSP symbols and tags
local disabled_tagbar = Has_value(Doom.disabled_plugins, 'tagbar')
if disabled_tagbar then
table.insert(disabled_plugins, 'tagbar')
end
local disabled_outline = Has_value(Doom.disabled_plugins, 'outline')
use({
'simrat39/symbols-outline.nvim',
disable = disabled_tagbar,
disable = disabled_outline,
})
-- Minimap
-- Depends on wfxr/code-minimap to work!
local disabled_minimap = Has_value(Doom.disabled_plugins, 'minimap')
if disabled_minimap then
table.insert(disabled_plugins, 'minimap')
end
use({ 'wfxr/minimap.vim', disable = disabled_minimap })
-- Keybindings menu like Emacs's guide-key
@ -139,9 +124,6 @@ return packer.startup(function()
-- Distraction free environment
local disabled_zen = Has_value(Doom.disabled_plugins, 'zen')
if disabled_zen then
table.insert(disabled_plugins, 'zen')
end
use({ 'kdav5758/TrueZen.nvim', disable = disabled_zen })
-----[[--------------]]-----
@ -159,9 +141,6 @@ return packer.startup(function()
-- Git gutter better alternative, written in Lua
-- can be disabled to use your own git gutter plugin
local disabled_gitsigns = Has_value(Doom.disabled_plugins, 'gitsigns')
if disabled_git and not disabled_gitsigns then
table.insert(disabled_plugins, 'gitsigns')
end
use({
'lewis6991/gitsigns.nvim',
disable = (disabled_git and true or disabled_gitsigns),
@ -169,9 +148,6 @@ return packer.startup(function()
-- LazyGit integration
local disabled_lazygit = Has_value(Doom.disabled_plugins, 'lazygit')
if disabled_git and not disabled_lazygit then
table.insert(disabled_plugins, 'lazygit')
end
use({
'kdheepak/lazygit.nvim',
requires = { 'nvim-lua/plenary.nvim' },
@ -184,9 +160,6 @@ return packer.startup(function()
-- Built-in LSP Config
-- NOTE: It should not be disabled if you are going to use LSP!
local disabled_lspconfig = Has_value(Doom.disabled_plugins, 'lspconfig')
if disabled_lsp and not disabled_lspconfig then
table.insert(disabled_plugins, 'lspconfig')
end
use({
'neovim/nvim-lspconfig',
disable = (disabled_lsp and true or disabled_lspconfig),
@ -194,9 +167,6 @@ return packer.startup(function()
-- Completion plugin
-- can be disabled to use your own completion plugin
local disabled_compe = Has_value(Doom.disabled_plugins, 'compe')
if disabled_lsp and not disabled_compe then
table.insert(disabled_plugins, 'compe')
end
use({
'hrsh7th/nvim-compe',
requires = {
@ -207,21 +177,20 @@ return packer.startup(function()
disable = (disabled_lsp and true or disabled_compe),
})
-- install lsp saga
local disabled_lspsaga =
Has_value(Doom.disabled_plugins, 'lspsaga')
if disabled_lsp and not disabled_lspsaga then
table.insert(disabled_plugins, 'lspsaga')
end
use({'glepnir/lspsaga.nvim', disable = (disabled_lsp and true or disabled_lspsaga) })
-- install lsp saga
local disabled_lspsaga = Has_value(Doom.disabled_plugins, 'lspsaga')
use({
'glepnir/lspsaga.nvim',
disable = (disabled_lsp and true or disabled_lspsaga),
})
-- provides the missing `:LspInstall` for `nvim-lspconfig`.
local disabled_lspinstall =
Has_value(Doom.disabled_plugins, 'lspinstall')
if disabled_lsp and not disabled_lspinstall then
table.insert(disabled_plugins, 'lspinstall')
end
use('kabouzeid/nvim-lspinstall')
use({
'kabouzeid/nvim-lspinstall',
disable = (disabled_lsp and true or disabled_lspinstall),
})
-----[[--------------]]-----
--- File Related ---
@ -229,9 +198,6 @@ return packer.startup(function()
-- Write / Read files without permissions (e.G. /etc files) without having
-- to use `sudo nvim /path/to/file`
local disabled_suda = Has_value(Doom.disabled_plugins, 'suda')
if disabled_files and not disabled_suda then
table.insert(disabled_plugins, 'suda')
end
use({
'lambdalisue/suda.vim',
disable = (disabled_files and true or disabled_suda),
@ -240,9 +206,6 @@ return packer.startup(function()
-- File formatting
-- can be disabled to use your own file formatter
local disabled_formatter = Has_value(Doom.disabled_plugins, 'formatter')
if disabled_files and not disabled_formatter then
table.insert(disabled_plugins, 'formatter')
end
use({
'lukas-reineke/format.nvim',
disable = (disabled_files and true or disabled_formatter),
@ -251,9 +214,6 @@ return packer.startup(function()
-- Autopairs
-- can be disabled to use your own autopairs
local disabled_autopairs = Has_value(Doom.disabled_plugins, 'autopairs')
if disabled_files and not disabled_autopairs then
table.insert(disabled_plugins, 'autopairs')
end
use({
'steelsojka/pears.nvim',
disable = (disabled_files and true or disabled_autopairs),
@ -262,9 +222,6 @@ return packer.startup(function()
-- Indent Lines
local disabled_indent_lines =
Has_value(Doom.disabled_plugins, 'indentlines')
if disabled_files and not disabled_indent_lines then
table.insert(disabled_plugins, 'indentlines')
end
use({
'lukas-reineke/indent-blankline.nvim',
branch = 'lua',
@ -274,9 +231,6 @@ return packer.startup(function()
-- EditorConfig support
local disabled_editorconfig =
Has_value(Doom.disabled_plugins, 'editorconfig')
if disabled_files and not disabled_editorconfig then
table.insert(disabled_plugins, 'editorconfig')
end
use({
'editorconfig/editorconfig-vim',
disable = (disabled_files and true or disabled_editorconfig),
@ -286,9 +240,6 @@ return packer.startup(function()
-- can be disabled to use your own comments plugin
local disabled_kommentary =
Has_value(Doom.disabled_plugins, 'kommentary')
if disabled_files and not disabled_kommentary then
table.insert(disabled_plugins, 'kommentary')
end
use({
'b3nj5m1n/kommentary',
disable = (disabled_files and true or disabled_kommentary),
@ -299,9 +250,6 @@ return packer.startup(function()
-----]]-------------[[-----
-- Fastest colorizer without external dependencies!
local disabled_colorizer = Has_value(Doom.disabled_plugins, 'colorizer')
if disabled_web and not disabled_colorizer then
table.insert(disabled_plugins, 'colorizer')
end
use({
'norcalli/nvim-colorizer.lua',
disable = (disabled_web and true or disabled_colorizer),
@ -311,9 +259,6 @@ return packer.startup(function()
-- Depends on bayne/dot-http to work!
local disabled_restclient =
Has_value(Doom.disabled_plugins, 'restclient')
if disabled_web and not disabled_restclient then
table.insert(disabled_plugins, 'restclient')
end
use({
'bayne/vim-dot-http',
disable = (disabled_web and true or disabled_restclient),
@ -321,9 +266,6 @@ return packer.startup(function()
-- Emmet plugin
local disabled_emmet = Has_value(Doom.disabled_plugins, 'emmet')
if disabled_web and not disabled_emmet then
table.insert(disabled_plugins, 'emmet')
end
use({
'mattn/emmet-vim',
disable = (disabled_web and true or disabled_emmet),

Loading…
Cancel
Save