From 7406739b4a2586b2b2ef1055659bbbb7e3e6119a Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Tue, 25 Jan 2022 19:59:40 -0700 Subject: [PATCH] fix changes for vim-plug installation --- dot_config/nvim/cmp_init.vim | 59 +++++++++---------- dot_config/nvim/coc_init.vim | 10 +++- dot_config/nvim/coq_init.vim | 22 +++---- dot_config/nvim/init.vim | 4 +- dot_config/nvim/templates/general.vim | 64 ++++++++++----------- dot_config/nvim/templates/general_plugs.vim | 30 ++++++++++ dot_config/nvim/templates/treesitter.vim | 23 -------- 7 files changed, 110 insertions(+), 102 deletions(-) create mode 100644 dot_config/nvim/templates/general_plugs.vim delete mode 100644 dot_config/nvim/templates/treesitter.vim diff --git a/dot_config/nvim/cmp_init.vim b/dot_config/nvim/cmp_init.vim index d7af672..e7215aa 100644 --- a/dot_config/nvim/cmp_init.vim +++ b/dot_config/nvim/cmp_init.vim @@ -1,38 +1,39 @@ + +call plug#begin() + source $HOME/.config/nvim/templates/general_plugs.vim + " LSP resources + Plug 'neovim/nvim-lspconfig' + Plug 'williamboman/nvim-lsp-installer' + Plug 'hrsh7th/cmp-nvim-lsp' + Plug 'hrsh7th/cmp-buffer' + Plug 'hrsh7th/cmp-path' + Plug 'hrsh7th/cmp-cmdline' + Plug 'hrsh7th/nvim-cmp' + + " For vsnip users. + Plug 'hrsh7th/cmp-vsnip' + Plug 'hrsh7th/vim-vsnip' + + " For luasnip users. + " Plug 'L3MON4D3/LuaSnip' + " Plug 'saadparwaiz1/cmp_luasnip' + + " For ultisnips users. + " Plug 'SirVer/ultisnips' + " Plug 'quangnguyen30192/cmp-nvim-ultisnips' + + " For snippy users. + " Plug 'dcampos/nvim-snippy' + " Plug 'dcampos/cmp-snippy' + +call plug#end() + source $HOME/.config/nvim/templates/general.vim -source $HOME/.config/nvim/templates/treesitter.vim source $HOME/.config/nvim/templates/lsp_keymap.vim " Theme colorscheme OceanicNext -call plug#begin() -" LSP resources -Plug 'neovim/nvim-lspconfig' -Plug 'williamboman/nvim-lsp-installer' -Plug 'hrsh7th/cmp-nvim-lsp' -Plug 'hrsh7th/cmp-buffer' -Plug 'hrsh7th/cmp-path' -Plug 'hrsh7th/cmp-cmdline' -Plug 'hrsh7th/nvim-cmp' - -" For vsnip users. -Plug 'hrsh7th/cmp-vsnip' -Plug 'hrsh7th/vim-vsnip' - -" For luasnip users. -" Plug 'L3MON4D3/LuaSnip' -" Plug 'saadparwaiz1/cmp_luasnip' - -" For ultisnips users. -" Plug 'SirVer/ultisnips' -" Plug 'quangnguyen30192/cmp-nvim-ultisnips' - -" For snippy users. -" Plug 'dcampos/nvim-snippy' -" Plug 'dcampos/cmp-snippy' - -call plug#end() - lua <' to make sure tab is not mapped by diff --git a/dot_config/nvim/coq_init.vim b/dot_config/nvim/coq_init.vim index 144e418..506e93d 100644 --- a/dot_config/nvim/coq_init.vim +++ b/dot_config/nvim/coq_init.vim @@ -1,21 +1,21 @@ +call plug#begin() + source $HOME/.config/nvim/templates/general_plugs.vim + " LSP resources + Plug 'neovim/nvim-lspconfig' + Plug 'williamboman/nvim-lsp-installer' + Plug 'ms-jpq/coq_nvim', {'branch': 'coq'} + Plug 'ms-jpq/coq.artifacts', {'branch': 'artifacts'} +call plug#end() + source $HOME/.config/nvim/templates/general.vim -source $HOME/.config/nvim/templates/treesitter.vim source $HOME/.config/nvim/templates/lsp_keymap.vim +set omnifunc=v:lua.vim.lsp.omnifunc + " Theme set background=dark colorscheme onedark -call plug#begin() -" LSP resources -Plug 'neovim/nvim-lspconfig' -Plug 'williamboman/nvim-lsp-installer' -Plug 'ms-jpq/coq_nvim', {'branch': 'coq'} -Plug 'ms-jpq/coq.artifacts', {'branch': 'artifacts'} -call plug#end() - -set omnifunc=v:lua.vim.lsp.omnifunc - lua << EOF vim.g.coq_settings = { auto_start = 'shut-up', diff --git a/dot_config/nvim/init.vim b/dot_config/nvim/init.vim index f23505a..70e9780 100644 --- a/dot_config/nvim/init.vim +++ b/dot_config/nvim/init.vim @@ -1,4 +1,6 @@ -source $HOME/.config/nvim/templates/general.vim +call plug#begin() + source $HOME/.config/nvim/templates/general.vim +call plug#end() "Theme colorscheme gruvbox diff --git a/dot_config/nvim/templates/general.vim b/dot_config/nvim/templates/general.vim index e3b32a4..b4287ca 100644 --- a/dot_config/nvim/templates/general.vim +++ b/dot_config/nvim/templates/general.vim @@ -11,41 +11,15 @@ set completeopt=menu,menuone,noselect " Set leader to comma let mapleader="," -call plug#begin() -" Color Schemes -Plug 'rafi/awesome-vim-colorschemes' -Plug 'mhartington/oceanic-next' -Plug 'morhetz/gruvbox' -Plug 'joshdick/onedark.vim' - -" Navigation -Plug 'tpope/vim-commentary' -Plug 'tpope/vim-surround' - -" Commands -Plug 'vim-test/vim-test' -Plug 'skywind3000/asyncrun.vim' -Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } -Plug 'junegunn/fzf.vim' - -" Extra Appearance Features -Plug 'airblade/vim-gitgutter' -Plug 'tpope/vim-fugitive' -Plug 'mhinz/vim-signify' -Plug 'vim-airline/vim-airline' -Plug 'vim-airline/vim-airline-themes' - -" File Navigation -Plug 'ms-jpq/chadtree', {'branch': 'chad', 'do': 'python3 -m chadtree deps'} -" Vista Sidebar -Plug 'liuchengxu/vista.vim' -" Syntax Highlighting -Plug 'sheerun/vim-polyglot' - -call plug#end() - " Set to open tree -nnoremap CHADopen +nnoremap NERDTreeToggle +" Start NERDTree when Vim is started without file arguments. +autocmd StdinReadPre * let s:std_in=1 +autocmd VimEnter * if argc() == 0 && !exists('s:std_in') | NERDTree | endif +" Close the tab if NERDTree is the only window remaining in it. +autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif +" Exit Vim if NERDTree is the only window remaining in the only tab. +autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif " Set to open Vista Sidebar nnoremap ; Vista!! @@ -151,5 +125,25 @@ endif " Set termdebug let g:termdebug_wide=1 +lua << EOF +require'nvim-treesitter.configs'.setup { + ensure_installed = { "zig", "python", "c", "bash", "json" }, -- one of "all", "maintained" (parsers with maintainers), or a list of languages + sync_install = false, -- install languages synchronously (only applied to `ensure_installed`) + ignore_install = { "javascript" }, -- List of parsers to ignore installing + highlight = { + enable = true, -- false will disable the whole extension + -- disable = { "c", "rust" }, -- list of language that will be disabled + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = false, + }, +} -nnoremap "+p +EOF + +" Specific Local config +if filereadable($HOME . "/.config/nvim/templates/general.vim.local") + source ~/.config/nvim/templates/general.vim.local +endif diff --git a/dot_config/nvim/templates/general_plugs.vim b/dot_config/nvim/templates/general_plugs.vim new file mode 100644 index 0000000..03a5dba --- /dev/null +++ b/dot_config/nvim/templates/general_plugs.vim @@ -0,0 +1,30 @@ +" Color Schemes +Plug 'rafi/awesome-vim-colorschemes' +Plug 'mhartington/oceanic-next' +Plug 'morhetz/gruvbox' +Plug 'joshdick/onedark.vim' + +" Navigation +Plug 'tpope/vim-commentary' +Plug 'tpope/vim-surround' + +" Commands +Plug 'vim-test/vim-test' +Plug 'skywind3000/asyncrun.vim' +Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } +Plug 'junegunn/fzf.vim' + +" Extra Appearance Features +Plug 'airblade/vim-gitgutter' +Plug 'tpope/vim-fugitive' +Plug 'mhinz/vim-signify' +Plug 'vim-airline/vim-airline' +Plug 'vim-airline/vim-airline-themes' + +" File Navigation +Plug 'preservim/nerdtree' +" Vista Sidebar +Plug 'liuchengxu/vista.vim' +" Syntax Highlighting +Plug 'sheerun/vim-polyglot' +Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} " We recommend updating the parsers on update diff --git a/dot_config/nvim/templates/treesitter.vim b/dot_config/nvim/templates/treesitter.vim deleted file mode 100644 index da297b3..0000000 --- a/dot_config/nvim/templates/treesitter.vim +++ /dev/null @@ -1,23 +0,0 @@ -call plug#begin() -" Highlighting -Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} " We recommend updating the parsers on update -call plug#end() - -lua << EOF - -require'nvim-treesitter.configs'.setup { - ensure_installed = { "zig", "python", "c", "bash", "json" }, -- one of "all", "maintained" (parsers with maintainers), or a list of languages - sync_install = false, -- install languages synchronously (only applied to `ensure_installed`) - ignore_install = { "javascript" }, -- List of parsers to ignore installing - highlight = { - enable = true, -- false will disable the whole extension - -- disable = { "c", "rust" }, -- list of language that will be disabled - -- Setting this to true will run `:h syntax` and tree-sitter at the same time. - -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). - -- Using this option may slow down your editor, and you may see some duplicate highlights. - -- Instead of true it can also be a list of languages - additional_vim_regex_highlighting = false, - }, -} - -EOF