diff --git a/autoload/doom.vim b/autoload/doom.vim index 2545cf0..9b5c8de 100644 --- a/autoload/doom.vim +++ b/autoload/doom.vim @@ -76,8 +76,8 @@ let g:doom_disabled_plugins = [] " Disabled plugins groups " @default = ['git', 'lsp', 'web'] " example: -" let g:doom_disabled_plugins_group = ['web'] -let g:doom_disabled_plugins_group = ['git', 'lsp', 'web'] +" let g:doom_disabled_plugins_groups = ['web'] +let g:doom_disabled_plugins_groups = ['git', 'lsp', 'web'] " Install custom plugins " @default = [] @@ -147,9 +147,13 @@ function! doom#end() abort call doom#system#grepconfig('config', 'gui.vim', 1) call doom#system#grepconfig('config', 'keybindings.vim', 1) - " Plugins - call doom#system#grepconfig('config/plugins/', 'vista.vim', 1) - call doom#system#grepconfig('config/plugins/', 'neoformat.vim', 1) + " Plugins, configs are loaded only if the plugin is enabled. + if index(g:doom_disabled_plugins, 'vista') == -1 + call doom#system#grepconfig('config/plugins/', 'vista.vim', 1) + endif + if index(g:doom_disabled_plugins, 'neoformat') == -1 + call doom#system#grepconfig('config/plugins/', 'neoformat.vim', 1) + endif call doom#system#grepconfig('config/plugins/', 'leader-mapper.vim', 1) " Check updates diff --git a/config/keybindings.vim b/config/keybindings.vim index d18597c..b3525f8 100644 --- a/config/keybindings.vim +++ b/config/keybindings.vim @@ -33,148 +33,16 @@ let g:mapleader = " " "===========================" " LSP Keybindings " "===========================" -" https://github.com/hrsh7th/nvim-compe#mappings -inoremap compe#complete() -inoremap compe#confirm('') -inoremap compe#close('') -inoremap compe#scroll({ 'delta': +4 }) -inoremap compe#scroll({ 'delta': -4 }) - -"===========================" -" Leader Keybindings " -"===========================" -" - LSP Menu -" Show type definition -nnoremap lD lua vim.lsp.buf.type_definition() -" Show line diagnostics -nnoremap le lua vim.lsp.diagnostic.show_line_diagnostics() -" Diagnostics into location list -nnoremap lq lua vim.lsp.diagnostic.set_loclist() - -" - Git Menu -" Open LazyGit -nnoremap go :LazyGit -" Pull -nnoremap gP :TermExec git pull -" Push -nnoremap gp :TermExec git push -" Status -nnoremap gs :TermExec git status - -" - Plugins Menu -" Clean disabled or unused plugins -nnoremap pc :PackerClean -" Install missing plugins -nnoremap pi :PackerInstall -" Performs PackerClean and then PackerUpdate -nnoremap ps :PackerSync -" Update your plugins -nnoremap pu :PackerUpdate - -" - Buffer Menu -" Go to buffer 1 -nnoremap b1 :BufferGoto 1 -" Go to buffer 2 -nnoremap b2 :BufferGoto 2 -" Go to buffer 3 -nnoremap b3 :BufferGoto 3 -" Go to buffer 4 -nnoremap b4 :BufferGoto 4 -" Go to buffer 5 -nnoremap b5 :BufferGoto 5 -" Go to buffer 6 -nnoremap b6 :BufferGoto 6 -" Go to buffer 7 -nnoremap b7 :BufferGoto 7 -" Go to buffer 8 -nnoremap b8 :BufferGoto 8 -" Go to last buffer -nnoremap b9 :BufferLast -" Close current buffer -nnoremap bc :BufferClose -" Format buffer -nnoremap bf :Neoformat -" Next buffer -nnoremap bn :BufferNext -" Pick buffer -nnoremap bP :BufferPick -" Previous buffer -nnoremap bp :BufferPrevious - -" - Order buffer menu -" Sort by directory -nnoremap od :BufferOrderByDirectory -" Sort by language -nnoremap ol :BufferOrderByLanguage -" Re-order buffer to next -nnoremap on :BufferMoveNext -" Re-order buffer to previous -nnoremap op :BufferMovePrevious - -" - File Menu -" Bookmarks -nnoremap fb :Telescope marks -" Edit Neovim configuration -nnoremap fc :e $MYVIMRC -" Find file -nnoremap ff :Telescope find_files -" Find word -nnoremap fg :Telescope live_grep -" Help tags -nnoremap ft :Telescope help_tags -" Write file with sudo permissions (For unwritable files) -nnoremap fw :SudaWrite -" Re-open file with sudo permissions (For unreadable files only!) -nnoremap fr :SudaRead -" Override existing telescope fh mapping -autocmd VimEnter * noremap fh :Telescope oldfiles -" Recently opened files -nnoremap fh :Telescope oldfiles -" Create a new unnamed buffer -nnoremap fn :new - -" - Window Menu -" Close all other windows -nnoremap wC :only -" Close current window -nnoremap wc :close -" Split horizontally -nnoremap wh :split -" Split vertically -nnoremap wv :vsplit - -" - Runner Menu -" Run dot-http on the line that the cursor is currently on -nnoremap rh :DotHttp - -" - Session Menu -" Save session -nmap ss :SessionSave -" Load session -nmap sl :SessionLoad - -" ToggleTerm custom function to avoid having -" line numbers inside the terminal buffer -" because that is not from God. -function ToggleTerm() - execute "ToggleTerm" - set nonumber norelativenumber -endfunction -" Toggle Menu -" Change colorscheme -nnoremap tc :DashboardChangeColorscheme -" Toggle Tree Explorer -nnoremap te :NvimTreeToggle -" Toggle Minimap -nnoremap tm :MinimapToggle -" Toggle Line Numbers -nnoremap tn :set number! relativenumber! -" Open start screen -nnoremap ts :Dashboard -" Toggle Tags view -nnoremap tT :Vista!! -" Open a new terminal -nnoremap tt :call ToggleTerm() +" If the LSP group is not disabled or the nvim-compe plugin is not disabled +" then set its mappings. +if index(g:doom_disabled_plugins_groups, 'lsp') == -1 + " https://github.com/hrsh7th/nvim-compe#mappings + inoremap compe#complete() + inoremap compe#confirm('') + inoremap compe#close('') + inoremap compe#scroll({ 'delta': +4 }) + inoremap compe#scroll({ 'delta': -4 }) +endif " tab to cycle buffers too, why not? nnoremap :bnext @@ -184,11 +52,20 @@ nnoremap :bprevious nnoremap :noh " F keybindings -nnoremap :Vista!! -nnoremap :NvimTreeToggle -nnoremap :MinimapToggle -nnoremap :Goyo -nnoremap :DotHttp +if index(g:doom_disabled_plugins, 'vista') == -1 + nnoremap :Vista!! +endif +if index(g:doom_disabled_plugins, 'tree') == -1 + nnoremap :NvimTreeToggle +if index(g:doom_disabled_plugins, 'minimap') == -1 + nnoremap :MinimapToggle +endif +if index(g:doom_disabled_plugins, 'goyo') == -1 + nnoremap :Goyo +endif +if index(g:doom_disabled_plugins_groups, 'web') == -1 + nnoremap :DotHttp +endif "=====================" " Disable keys " @@ -205,5 +82,7 @@ nnoremap q " Fast exit from Doom Nvim nnoremap ZZ :call doom#functions#quit_doom(1,1) -" Set-up vim_buffer_ previewer -autocmd User TelescopePreviewerLoaded setlocal wrap +if index(g:doom_disabled_plugins_groups, 'fuzzy') == -1 || index(g:doom_disabled_plugins, 'telescope') == -1 + " Set-up vim_buffer_ previewer + autocmd User TelescopePreviewerLoaded setlocal wrap +endif diff --git a/config/plugins/leader-mapper.vim b/config/plugins/leader-mapper.vim index 3012fec..2a685dd 100644 --- a/config/plugins/leader-mapper.vim +++ b/config/plugins/leader-mapper.vim @@ -2,87 +2,232 @@ let g:lmap = {} " LSP Menu -let g:lmap.l = {"name": "LSP Menu"} -let g:lmap.l.D = "Show type definition" -let g:lmap.l.e = "Show line diagnostics" -let g:lmap.l.q = "Diagnostics into location list" +if index(g:doom_disabled_plugins_groups, 'lsp') == -1 && index(g:doom_disabled_plugins, 'compe') == -1 + let g:lmap.l = {'name': 'LSP Menu'} + " Show type definition + nnoremap lD lua vim.lsp.buf.type_definition() + let g:lmap.l.D = 'Show type definition' + " Show line diagnostics + nnoremap le lua vim.lsp.diagnostic.show_line_diagnostics() + let g:lmap.l.e = 'Show line diagnostics' + " Diagnostics into location list + nnoremap lq lua vim.lsp.diagnostic.set_loclist() + let g:lmap.l.q = 'Diagnostics into location list' +endif " Git Menu -let g:lmap.g = {"name": "Git Menu"} -let g:lmap.g.o = "Open LazyGit" -let g:lmap.g.P = "Pull" -let g:lmap.g.p = "Push" -let g:lmap.g.s = "Status" +if index(g:doom_disabled_plugins_groups, 'git') == -1 && index(g:doom_disabled_plugins, 'lazygit') == -1 || + \ index(g:doom_disabled_plugins_groups, 'git') == -1 && index(g:doom_disabled_plugins, 'toggleterm') == -1 + let g:lmap.g = {'name': 'Git Menu'} + if index(g:doom_disabled_plugins, 'lazygit') == -1 + " Open LazyGit + nnoremap go :LazyGit + let g:lmap.g.o = 'Open LazyGit' + endif + if index(g:doom_disabled_plugins, 'toggleterm') == -1 + " Pull + nnoremap gP :TermExec git pull + let g:lmap.g.P = 'Pull' + " Push + nnoremap gp :TermExec git push + let g:lmap.g.p = 'Push' + " Status + nnoremap gs :TermExec git status + let g:lmap.g.s = 'Status' + endif +endif " Plugin Menu -let g:lmap.p = {"name": "Plugin Menu"} -let g:lmap.p.c = "Clean disabled or unused plugins" -let g:lmap.p.i = "Install missing plugins" -let g:lmap.p.s = "Performs PackerClean and then PackerUpdate" -let g:lmap.p.u = "Update your plugins" +let g:lmap.p = {'name': 'Plugin Menu'} +" Clean disabled or unused plugins +nnoremap pc :PackerClean +let g:lmap.p.c = 'Clean disabled or unused plugins' +" Install missing plugins +nnoremap pi :PackerInstall +let g:lmap.p.i = 'Install missing plugins' +" Performs PackerClean and then PackerUpdate +nnoremap ps :PackerSync +let g:lmap.p.s = 'Performs PackerClean and then PackerUpdate' +" Update your plugins +nnoremap pu :PackerUpdate +let g:lmap.p.u = 'Update your plugins' " Buffer Menu -let g:lmap.b = {"name": "Buffer Menu"} -let g:lmap.b.1 = "Buffer 1" -let g:lmap.b.2 = "Buffer 2" -let g:lmap.b.3 = "Buffer 3" -let g:lmap.b.4 = "Buffer 4" -let g:lmap.b.5 = "Buffer 5" -let g:lmap.b.6 = "Buffer 6" -let g:lmap.b.7 = "Buffer 7" -let g:lmap.b.8 = "Buffer 8" -let g:lmap.b.9 = "Last buffer" -let g:lmap.b.c = "Close buffer" -let g:lmap.b.f = "Format buffer" -let g:lmap.b.n = "Next buffer" -let g:lmap.b.P = "Pick buffer" -let g:lmap.b.p = "Previous buffer" +let g:lmap.b = {'name': 'Buffer Menu'} +" Go to buffer 1 +nnoremap b1 :BufferGoto 1 +let g:lmap.b.1 = 'Buffer 1' +" Go to buffer 2 +nnoremap b2 :BufferGoto 2 +let g:lmap.b.2 = 'Buffer 2' +" Go to buffer 3 +nnoremap b3 :BufferGoto 3 +let g:lmap.b.3 = 'Buffer 3' +" Go to buffer 4 +nnoremap b4 :BufferGoto 4 +let g:lmap.b.4 = 'Buffer 4' +" Go to buffer 5 +nnoremap b5 :BufferGoto 5 +let g:lmap.b.5 = 'Buffer 5' +" Go to buffer 6 +nnoremap b6 :BufferGoto 6 +let g:lmap.b.6 = 'Buffer 6' +" Go to buffer 7 +nnoremap b7 :BufferGoto 7 +let g:lmap.b.7 = 'Buffer 7' +" Go to buffer 8 +nnoremap b8 :BufferGoto 8 +let g:lmap.b.8 = 'Buffer 8' +" Go to last buffer +nnoremap b9 :BufferLast +let g:lmap.b.9 = 'Last buffer' +" Close current buffer +nnoremap bc :BufferClose +let g:lmap.b.c = 'Close buffer' +" Format buffer +nnoremap bf :Neoformat +let g:lmap.b.f = 'Format buffer' +" Next buffer +nnoremap bn :BufferNext +let g:lmap.b.n = 'Next buffer' +" Pick buffer +nnoremap bP :BufferPick +let g:lmap.b.P = 'Pick buffer' +" Previous buffer +nnoremap bp :BufferPrevious +let g:lmap.b.p = 'Previous buffer' " Order Buffer Menu -let g:lmap.o = {"name": "Order Menu"} -let g:lmap.o.d = "Sort by directory" -let g:lmap.o.l = "Sort by language" -let g:lmap.o.n = "Re-order buffer to next" -let g:lmap.o.p = "Re-order buffer to previous" +let g:lmap.o = {'name': 'Order Menu'} +" Sort by directory +nnoremap od :BufferOrderByDirectory +let g:lmap.o.d = 'Sort by directory' +" Sort by language +nnoremap ol :BufferOrderByLanguage +let g:lmap.o.l = 'Sort by language' +" Re-order buffer to next +nnoremap on :BufferMoveNext +let g:lmap.o.n = 'Re-order buffer to next' +" Re-order buffer to previous +nnoremap op :BufferMovePrevious +let g:lmap.o.p = 'Re-order buffer to previous' " File Menu -let g:lmap.f = {"name": "File Menu"} -let g:lmap.f.b = "Bookmarks" -let g:lmap.f.c = "Edit Neovim configuration" -let g:lmap.f.f = "Find file" -let g:lmap.f.g = "Find word" -let g:lmap.f.t = "Help Tags" -let g:lmap.f.w = "Write file with sudo permissions (For unwritable files)" -let g:lmap.f.r = "Re-open file with sudo permissions (For unreadable files only!)" -let g:lmap.f.h = "Recently opened files" -let g:lmap.f.n = "Create a new unnamed buffer" +let g:lmap.f = {'name': 'File Menu'} +" Edit Neovim configuration +nnoremap fc :e $MYVIMRC +let g:lmap.f.c = 'Edit Neovim configuration' +" Create a new unnamed buffer +nnoremap fn :new +let g:lmap.f.n = 'Create a new unnamed buffer' +if index(g:doom_disabled_plugins, 'telescope') == -1 + " Bookmarks + nnoremap fb :Telescope marks + let g:lmap.f.b = 'Bookmarks' + " Find file + nnoremap ff :Telescope find_files + let g:lmap.f.f = 'Find file' + " Find word + nnoremap fg :Telescope live_grep + let g:lmap.f.g = 'Find word' + " Help tags + nnoremap ft :Telescope help_tags + let g:lmap.f.t = 'Help Tags' + " Override existing telescope fh mapping + autocmd VimEnter * noremap fh :Telescope oldfiles + " Recently opened files + nnoremap fh :Telescope oldfiles + let g:lmap.f.h = 'Recently opened files' +endif +if index(g:doom_disabled_plugins, 'suda') == -1 + " Write file with sudo permissions (For unwritable files) + nnoremap fw :SudaWrite + let g:lmap.f.w = 'Write file with sudo permissions (For unwritable files)' + " Re-open file with sudo permissions (For unreadable files only!) + nnoremap fr :SudaRead + let g:lmap.f.r = 'Re-open file with sudo permissions (For unreadable files only!)' +endif " Window Menu -let g:lmap.w = {"name": "Window Menu"} -let g:lmap.w.C = "Close all other windows" -let g:lmap.w.c = "Close current window" -let g:lmap.w.h = "Split horizontally" -let g:lmap.w.v = "Split vertically" +let g:lmap.w = {'name': 'Window Menu'} +" Close all other windows +nnoremap wC :only +let g:lmap.w.C = 'Close all other windows' +" Close current window +nnoremap wc :close +let g:lmap.w.c = 'Close current window' +" Split horizontally +nnoremap wh :split +let g:lmap.w.h = 'Split horizontally' +" Split vertically +nnoremap wv :vsplit +let g:lmap.w.v = 'Split vertically' " Runner Menu -let g:lmap.r = {"name": "Runner Menu"} -let g:lmap.r.h = "Run dot-http on the line that the cursor is currently on" +if index(g:doom_disabled_plugins_groups, 'web') == -1 + let g:lmap.r = {'name': 'Runner Menu'} + if index(g:doom_disabled_plugins, 'dot-http') == -1 + " Run dot-http on the line that the cursor is currently on + nnoremap rh :DotHttp + let g:lmap.r.h = 'Run dot-http on the line that the cursor is currently on' + endif +endif " Session Menu -let g:lmap.s = {"name": "Session Menu"} -let g:lmap.s.s = "Save session" -let g:lmap.s.l = "Load session" +let g:lmap.s = {'name': 'Session Menu'} +" Save session +nmap ss :SessionSave +let g:lmap.s.s = 'Save session' +" Load session +nmap sl :SessionLoad +let g:lmap.s.l = 'Load session' +" ToggleNumbers function, +function ToggleNumbers() + if g:doom_relative_num ==# 1 + set number! relativenumber! + else + set number! + endif +endfunction +" ToggleTerm custom function to avoid having +" line numbers inside the terminal buffer +" because that is not from God. +function ToggleTerm() + execute "ToggleTerm" + set nonumber norelativenumber +endfunction " Toggle Menu -let g:lmap.t = {"name": "Toggler Menu"} -let g:lmap.t.c = "Change colorscheme" -let g:lmap.t.e = "Toggle Tree Explorer" -let g:lmap.t.m = "Toggle Minimap" -let g:lmap.t.n = "Toggle Line Numbers" -let g:lmap.t.q = "Auto toggle nvim-bqf" -let g:lmap.t.s = "Open start screen" -let g:lmap.t.T = "Toggle Tags view" -let g:lmap.t.t = "Toggle terminal" +let g:lmap.t = {'name': 'Toggler Menu'} +" Toggle Line Numbers +nnoremap tn :call ToggleNumbers() +let g:lmap.t.n = 'Toggle Line Numbers' +" Open start screen +nnoremap ts :Dashboard +let g:lmap.t.s = 'Open start screen' +" Change colorscheme +nnoremap tc :DashboardChangeColorscheme +let g:lmap.t.c = 'Change colorscheme' +if index(g:doom_disabled_plugins, 'tree') == -1 + " Toggle Tree Explorer + nnoremap te :NvimTreeToggle + let g:lmap.t.e = 'Toggle Tree Explorer' +endif +if index(g:doom_disabled_plugins, 'minimap') == -1 + " Toggle Minimap + nnoremap tm :MinimapToggle + let g:lmap.t.m = 'Toggle Minimap' +endif +if index(g:doom_disabled_plugins, 'vista') == -1 + " Toggle Tags view + nnoremap tT :Vista!! + let g:lmap.t.T = 'Toggle Tags view' +endif +if index(g:doom_disabled_plugins, 'toggleterm') == -1 + " Open a new terminal + nnoremap tt :call ToggleTerm() + let g:lmap.t.t = 'Toggle terminal' +endif " Display menus with a `+` in-front of the description (à la emacs-which-key). let g:leaderGuide_display_plus_menus = 1 diff --git a/lua/plugins.lua b/lua/plugins.lua index d81615c..8e26324 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -1,5 +1,6 @@ -- Manage vim global variables g = vim.g +nvim_set_var = vim.api.nvim_set_var -- Useful function to see if the Vim variable have the value we are looking for function has_value(tabl, val) @@ -12,18 +13,27 @@ function has_value(tabl, val) return false end +--- Set disabled plugins groups and plugins +disabled_plugins = {} +--- Disabled groups +disabled_fuzzy = has_value(g.doom_disabled_plugins_groups, 'fuzzy') +disabled_git = has_value(g.doom_disabled_plugins_groups, 'git') +disabled_completion = has_value(g.doom_disabled_plugins_groups, 'lsp') +disabled_files = has_value(g.doom_disabled_plugins_groups, 'files') +disabled_web = has_value(g.doom_disabled_plugins_groups, 'web') + -- Required if you have packer in your `opt` pack -- /home/user/.local/share/nvim/site/pack/packer/opt vim.cmd [[packadd packer.nvim]] ----- Plugins groups --- Essentials, ! cannot be disabled (Plugin manager, vimpeccable and languages) --- UI Related, / can be disabled (All look-and-feel plugins) --- Fuzzy Search, + can be disabled (Fuzzy search & more) --- Git Integration, + can be disabled (Some git plugins, including LazyGit) --- Completion, + can be disabled (Built-in LSP configurations) --- File-related, + can be disabled (EditorConfig, formatting, Tree-sitter, etc) --- Web-related, + can be disabled (Colorizer, emmet, http client) +-- Essentials, ! cannot be disabled (Plugin manager, vimpeccable and languages) +-- UI Related, / can be disabled (All look-and-feel plugins) +-- Fuzzy Search (fuzzy), + can be disabled (Fuzzy search & more) +-- Git Integration (git), + can be disabled (Some git plugins, including LazyGit) +-- Completion (lsp), + can be disabled (Built-in LSP configurations) +-- File-related (files), + can be disabled (EditorConfig, formatting, Tree-sitter, etc) +-- Web-related (web), + can be disabled (Colorizer, emmet, rest client) -- -- Legend: -- ! : The group and its plugins cannot be disabled @@ -66,49 +76,84 @@ return require('packer').startup(function() 'joshdick/onedark.vim' } -- File tree - -- do not use the latest commit because it is broken, at least for me + -- do not use the latest commit because it is broken, at least for me + disabled_tree = has_value(g.doom_disabled_plugins, 'tree') + if disabled_tree then + table.insert(disabled_plugins, 'tree') + nvim_set_var('doom_disabled_plugins', disabled_plugins) + end use { 'kyazdani42/nvim-tree.lua', requires = { 'kyazdani42/nvim-web-devicons' }, commit = '491fd68d62cebd4a07642cc052028d9d3b55f62e', - disabled = has_value(g.doom_disabled_plugins, 'nvim-tree.lua') + disabled = disabled_tree } -- Statusline -- can be disabled to use your own statusline + disabled_statusline = has_value(g.doom_disabled_plugins, 'statusline') + if disabled_statusline then + table.insert(disabled_plugins, 'statusline') + nvim_set_var('doom_disabled_plugins', disabled_plugins) + end use { 'glepnir/galaxyline.nvim', - disabled = has_value(g.doom_disabled_plugins, 'galaxyline.nvim') + disabled = disabled_statusline } -- Tabline -- can be disabled to use your own tabline + disabled_tabline = has_value(g.doom_disabled_plugins, 'tabline') + if disabled_tabline then + table.insert(disabled_plugins, 'tabline') + nvim_set_var('doom_disabled_plugins', disabled_plugins) + end use { 'romgrk/barbar.nvim', - disabled = has_value(g.doom_disabled_plugins, 'barbar.nvim') + disabled = disabled_tabline } -- Better splits -- NOTE: we are using this specific branch because the main still does not have - -- the ignore filetypes feature, thanks to its owner per adding it <3 + -- the ignore filetypes feature, thanks to its owner per adding it <3 + disabled_focus = has_value(g.doom_disabled_plugins, 'focus') + if disabled_focus then + table.insert(disabled_plugins, 'focus') + nvim_set_var('doom_disabled_plugins', disabled_plugins) + end use { 'beauwilliams/focus.nvim', branch = 'cust_filetypes', - disabled = has_value(g.doom_disabled_plugins, 'focus.nvim') + disabled = disabled_focus } -- Better terminal -- can be disabled to use your own terminal plugin + disabled_terminal = has_value(g.doom_disabled_plugins, 'terminal') + if disabled_terminal then + table.insert(disabled_plugins, 'terminal') + nvim_set_var('doom_disabled_plugins', disabled_plugins) + end use { 'akinsho/nvim-toggleterm.lua', - disabled = has_value(g.doom_disabled_plugins, 'nvim-toggleterm.lua') + disabled = disabled_terminal } -- Viewer & finder for LSP symbols and tags + disabled_tagbar = has_value(g.doom_disabled_plugins, 'tagbar') + if disabled_tagbar then + table.insert(disabled_plugins, 'tagbar') + nvim_set_var('doom_disabled_plugins', disabled_plugins) + end use { 'liuchengxu/vista.vim', - disabled = has_value(g.doom_disabled_plugins, 'vista.vim') + disabled = disabled_tagbar } -- Minimap -- Depends on wfxr/code-minimap to work! + disabled_minimap = has_value(g.doom_disabled_plugins, 'minimap') + if disabled_minimap then + table.insert(disabled_plugins, 'minimap') + nvim_set_var('doom_disabled_plugins', disabled_plugins) + end use { 'wfxr/minimap.vim', - disabled = has_value(g.doom_disabled_plugins, 'minimap.vim') + disabled = disabled_minimap } -- Keybindings menu like Emacs's guide-key -- cannot be disabled @@ -117,115 +162,186 @@ return require('packer').startup(function() disabled = false } -- Distraction free environment + disabled_goyo = has_value(g.doom_disabled_plugins, 'goyo') + if disabled_goyo then + table.insert(disabled_plugins, 'goyo') + nvim_set_var('doom_disabled_plugins', disabled_plugins) + end use { 'junegunn/goyo.vim', - disabled = has_value(g.doom_disabled_plugins, 'goyo.vim') + disabled = disabled_goyo } -----[[--------------]]----- --- Fuzzy Search --- -----]]--------------[[----- - disabled_fuzzy = has_value(g.doom_disabled_plugins_group, 'fuzzy') + disabled_telescope = has_value(g.doom_disabled_plugins, 'telescope') + if disabled_fuzzy and (not disabled_telescope) then + table.insert(disabled_plugins, 'telescope') + nvim_set_var('doom_disabled_plugins', disabled_plugins) + end use { 'nvim-telescope/telescope.nvim', requires = { {'nvim-lua/popup.nvim'}, {'nvim-lua/plenary.nvim'} }, - disable = (disabled_fuzzy and true or has_value(g.doom_disabled_plugins, 'telescope.nvim')) + disable = (disabled_fuzzy and true or disabled_telescope) } -----[[-------------]]----- --- GIT RELATED --- -----]]-------------[[----- - disabled_git = has_value(g.doom_disabled_plugins_group, 'git') -- Git gutter better alternative + -- can be disabled to use your own git gutter plugin + disabled_signify = has_value(g.doom_disabled_plugins, 'signify') + if disabled_git and (not disabled_signify) then + table.insert(disabled_plugins, 'signify') + nvim_set_var('doom_disabled_plugins', disabled_plugins) + end use { 'mhinz/vim-signify', - disable = (disabled_git and true or has_value(g.doom_disabled_plugins, 'vim-signify')) + disable = (disabled_git and true or disabled_signify) } -- LazyGit integration + disabled_lazygit = has_value(g.doom_disabled_plugins, 'lazygit') + if disabled_git and (not disabled_lazygit) then + table.insert(disabled_plugins, 'lazygit') + nvim_set_var('doom_disabled_plugins', disabled_plugins) + end use { 'kdheepak/lazygit.nvim', - disable = disabled_git and true or has_value(g.doom_disabled_plugins, 'lazygit.nvim') + disable = (disabled_git and true or disabled_lazygit) } -----[[------------]]----- --- Completion --- -----]]------------[[----- - disabled_completion = has_value(g.doom_disabled_plugins_group, 'lsp') -- Built-in LSP Config -- NOTE: It should not be disabled if you are going to use LSP! + disabled_lspconfig = has_value(g.doom_disabled_plugins, 'lspconfig') + if disabled_lsp and (not disabled_lspconfig) then + table.insert(disabled_plugins, 'lspconfig') + nvim_set_var('doom_disabled_plugins', disabled_plugins) + end use { 'neovim/nvim-lspconfig', commit = '11a581d1860a7ad2b6c1ee1e0ebbb000e81b9950', - disable = (disabled_completion and true or has_value(g.doom_disabled_plugins, 'nvim-lspconfig')) + disable = (disabled_completion and true or disabled_lspconfig) } -- Completion plugin -- can be disabled to use your own completion plugin + disabled_compe = has_value(g.doom_disabled_plugins, 'compe') + if disabled_lsp and (not disabled_compe) then + table.insert(disabled_plugins, 'compe') + nvim_set_var('doom_disabled_plugins', disabled_plugins) + end use { 'hrsh7th/nvim-compe', requires = { {'ray-x/lsp_signature.nvim'}, {'onsails/lspkind-nvim'}, {'norcalli/snippets.nvim'} }, - disable = (disabled_completion and true or has_value(g.doom_disabled_plugins, 'nvim-compe')) + disable = (disabled_completion and true or disabled_compe) } -----[[--------------]]----- --- File Related --- -----]]--------------[[----- - disabled_files = has_value(g.doom_disabled_plugins_group, 'files') -- Write / Read files without permissions (e.g. /etc files) without having to use `sudo nvim /path/to/file` + disabled_suda = has_value(g.doom_disabled_plugins, 'suda') + if disabled_files and (not disabled_suda) then + table.insert(disabled_plugins, 'suda') + nvim_set_var('doom_disabled_plugins', disabled_plugins) + end use { 'lambdalisue/suda.vim', - disable = (disabled_files and true or has_value(g.doom_disabled_plugins, 'suda.vim')) + disable = (disabled_files and true or disabled_suda) } -- File formatting -- can be disabled to use your own file formatter + disabled_neoformat = has_value(g.doom_disabled_plugins, 'neoformat') + if disabled_files and (not disabled_neoformat) then + table.insert(disabled_plugins, 'neoformat') + nvim_set_var('doom_disabled_plugins', disabled_plugins) + end use { 'sbdchd/neoformat', - disable = (disabled_files and true or has_value(g.doom_disabled_plugins, 'neoformat')) + disable = (disabled_files and true or disabled_neoformat) } -- Autopairs -- can be disabled to use your own autopairs + disabled_autopairs = has_value(g.doom_disabled_plugins, 'autopairs') + if disabled_files and (not disabled_autopairs) then + table.insert(disabled_plugins, 'autopairs') + nvim_set_var('doom_disabled_plugins', disabled_plugins) + end use { 'windwp/nvim-autopairs', - disable = (disabled_files and true or has_value(g.doom_disabled_plugins, 'nvim-autopairs')) + disable = (disabled_files and true or disabled_autopairs) } -- EditorConfig support + disabled_editorconfig = has_value(g.doom_disabled_plugins, 'editorconfig') + if disabled_files and (not disabled_editorconfig) then + table.insert(disabled_plugins, 'editorconfig') + nvim_set_var('doom_disabled_plugins', disabled_plugins) + end use { 'editorconfig/editorconfig-vim', - disable = (disabled_files and true or has_value(g.doom_disabled_plugins, 'editorconfig-vim')) + disable = (disabled_files and true or disabled_editorconfig) } -- Tree-Sitter + disabled_treesitter = has_value(g.doom_disabled_plugins, 'treesitter') + if disabled_files and (not disabled_treesitter) then + table.insert(disabled_plugins, 'treesitter') + nvim_set_var('doom_disabled_plugins', disabled_plugins) + end use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate', - disable = (disabled_files and true or has_value(g.doom_disabled_plugins, 'tree-sitter')) + disable = (disabled_files and true or disabled_treesitter) } -- Comments -- can be disabled to use your own comments plugin + disabled_kommentary = has_value(g.doom_disabled_plugins, 'kommentary') + if disabled_files and (not disabled_kommentary) then + table.insert(disabled_plugins, 'kommentary') + nvim_set_var('doom_disabled_plugins', disabled_plugins) + end use { 'b3nj5m1n/kommentary', - disable = (disabled_files and true or has_value(g.doom_disabled_plugins, 'kommentary')) + disable = (disabled_files and true or disabled_kommentary) } -----[[-------------]]----- --- Web Related --- -----]]-------------[[----- - disabled_web = has_value(g.doom_disabled_plugins_group, 'web') -- Fastest colorizer without external dependencies! + disabled_colorizer = has_value(g.doom_disabled_plugins, 'colorizer') + if disabled_web and (not disabled_colorizer) then + table.insert(disabled_plugins, 'colorizer') + nvim_set_var('doom_disabled_plugins', disabled_plugins) + end use { 'norcalli/nvim-colorizer.lua', - disable = (disabled_web and true or has_value(g.doom_disabled_plugins, 'nvim-colorizer')) + disable = (disabled_web and true or disabled_colorizer) } -- HTPP Client support -- Depends on bayne/dot-http to work! + disabled_restclient = has_value(g.doom_disabled_plugins, 'restclient') + if disabled_web and (not disabled_restclient) then + table.insert(disabled_plugins, 'restclient') + nvim_set_var('doom_disabled_plugins', disabled_plugins) + end use { 'bayne/vim-dot-http', - disable = (disabled_web and true or has_value(g.doom_disabled_plugins, 'vim-dot-http')) + disable = (disabled_web and true or disabled_restclient) } -- Emmet plugin + disabled_emmet = has_value(g.doom_disabled_plugins, 'emmet') + if disabled_web and (not disabled_emmet) then + table.insert(disabled_plugins, 'emmet') + nvim_set_var('doom_disabled_plugins', disabled_plugins) + end use { 'mattn/emmet-vim', - disable = (disabled_web and true or has_value(g.doom_disabled_plugins, 'emmet-vim')) + disable = (disabled_web and true or disabled_emmet) } end)