diff --git a/nvim/lib/languages/c.vim b/nvim/coc-languages/c.vim similarity index 94% rename from nvim/lib/languages/c.vim rename to nvim/coc-languages/c.vim index 1652882..50d02bc 100644 --- a/nvim/lib/languages/c.vim +++ b/nvim/coc-languages/c.vim @@ -1,5 +1,3 @@ -if !g:vim_ide | finish | endif - let s:filetypes = ['c', 'cpp', 'objc', 'objcpp'] let g:coc_filetypes += s:filetypes diff --git a/nvim/lib/languages/css.vim b/nvim/coc-languages/css.vim similarity index 71% rename from nvim/lib/languages/css.vim rename to nvim/coc-languages/css.vim index 3ae68ad..0b322e5 100644 --- a/nvim/lib/languages/css.vim +++ b/nvim/coc-languages/css.vim @@ -1,4 +1,2 @@ -if !g:vim_ide | finish | endif - call coc#add_extension('coc-css') let g:coc_filetypes += ['css', 'scss', 'less'] diff --git a/nvim/lib/languages/haskell.vim b/nvim/coc-languages/haskell.vim similarity index 68% rename from nvim/lib/languages/haskell.vim rename to nvim/coc-languages/haskell.vim index 5fbfe33..fdafd7f 100644 --- a/nvim/lib/languages/haskell.vim +++ b/nvim/coc-languages/haskell.vim @@ -1,9 +1,3 @@ -let g:haskell_conceal = 0 -let g:haskell_conceal_enumerations = 0 -let g:haskell_multiline_strings = 1 - -if !g:vim_ide | finish | endif - let s:filetypes = ['haskell', 'lhaskell', 'chaskell'] let g:coc_filetypes += s:filetypes call coc#config('languageserver.haskell', { diff --git a/nvim/lib/languages/html.vim b/nvim/coc-languages/html.vim similarity index 87% rename from nvim/lib/languages/html.vim rename to nvim/coc-languages/html.vim index 24c1ca6..5880168 100644 --- a/nvim/lib/languages/html.vim +++ b/nvim/coc-languages/html.vim @@ -1,5 +1,3 @@ -if !g:vim_ide | finish | endif - call coc#add_extension('coc-html', 'coc-emmet') let s:emmet_filetype_mapping = { 'jinja': 'html' } let g:coc_filetypes += ['html'] + keys(s:emmet_filetype_mapping) diff --git a/nvim/lib/languages/javascript.vim b/nvim/coc-languages/javascript.vim similarity index 93% rename from nvim/lib/languages/javascript.vim rename to nvim/coc-languages/javascript.vim index 34b3c23..ceed679 100644 --- a/nvim/lib/languages/javascript.vim +++ b/nvim/coc-languages/javascript.vim @@ -1,5 +1,3 @@ -if !g:vim_ide | finish | endif - call coc#add_extension('coc-tsserver', 'coc-eslint', 'coc-prettier') let g:coc_filetypes += ['javascript', 'javascript.jsx', 'typescript', 'typescript.jsx'] call coc#config('eslint', { diff --git a/nvim/lib/languages/json.vim b/nvim/coc-languages/json.vim similarity index 70% rename from nvim/lib/languages/json.vim rename to nvim/coc-languages/json.vim index e80b1f4..277ca25 100644 --- a/nvim/lib/languages/json.vim +++ b/nvim/coc-languages/json.vim @@ -1,4 +1,2 @@ -if !g:vim_ide | finish | endif - call coc#add_extension('coc-json') let g:coc_filetypes += ['json', 'json5'] diff --git a/nvim/lib/languages/markdown.vim b/nvim/coc-languages/markdown.vim similarity index 52% rename from nvim/lib/languages/markdown.vim rename to nvim/coc-languages/markdown.vim index fa42486..7234c40 100644 --- a/nvim/lib/languages/markdown.vim +++ b/nvim/coc-languages/markdown.vim @@ -1,3 +1 @@ -if !g:vim_ide | finish | endif - let g:coc_filetypes += ['markdown'] diff --git a/nvim/lib/languages/python.vim b/nvim/coc-languages/python.vim similarity index 92% rename from nvim/lib/languages/python.vim rename to nvim/coc-languages/python.vim index aac9de9..371e1d9 100644 --- a/nvim/lib/languages/python.vim +++ b/nvim/coc-languages/python.vim @@ -1,5 +1,3 @@ -if !g:vim_ide | finish | endif - call coc#add_extension('coc-python') let g:coc_filetypes += ['python'] call coc#config('pyls.plugins.pycodestyle.ignore', ['E501']) diff --git a/nvim/lib/languages/rust.vim b/nvim/coc-languages/rust.vim similarity index 64% rename from nvim/lib/languages/rust.vim rename to nvim/coc-languages/rust.vim index 5f938b4..b83c6e5 100644 --- a/nvim/lib/languages/rust.vim +++ b/nvim/coc-languages/rust.vim @@ -1,7 +1,3 @@ -let g:rust_recommended_style = 0 - -if !g:vim_ide | finish | endif - call coc#add_extension('coc-rls') let g:coc_filetypes += ['rust'] call coc#config('rust', { 'clippy_preference': 'on' }) diff --git a/nvim/lib/languages/yaml.vim b/nvim/coc-languages/yaml.vim similarity index 50% rename from nvim/lib/languages/yaml.vim rename to nvim/coc-languages/yaml.vim index 657a70a..3c48b35 100644 --- a/nvim/lib/languages/yaml.vim +++ b/nvim/coc-languages/yaml.vim @@ -1,3 +1 @@ -if !g:vim_ide | finish | endif - let g:coc_filetypes += ['yaml'] diff --git a/nvim/init.vim b/nvim/init.vim index 69f2a5d..1c9bf26 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -4,12 +4,92 @@ let g:vim_ide = get(g:, 'vim_ide', 0) let &runtimepath = g:nvim_dotfiles_dir.','.&runtimepath.','.g:nvim_dotfiles_dir.'/after' -for s:name in ['plugins', 'editing', 'interface', 'files', 'completion', 'terminal', 'git'] - execute 'source' fnameescape(g:nvim_dotfiles_dir.'/lib/'.s:name.'.vim') -endfor + +let s:vim_config_dir = expand('~/.config/nvim') +let s:vim_plug_script = s:vim_config_dir . '/autoload/plug.vim' +let s:vim_plug_home = s:vim_config_dir . '/plugged' + +let s:just_installed_vim_plug = 0 +if !filereadable(s:vim_plug_script) + execute '!curl -fL https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim --create-dirs -o' shellescape(s:vim_plug_script) + autocmd VimEnter * PlugInstall --sync +endif + +call plug#begin(s:vim_config_dir . '/plugged') + +Plug 'junegunn/vim-plug' + +" Files {{{ + Plug 'tpope/vim-eunuch' + if g:vim_ide + Plug 'francoiscabrol/ranger.vim' + endif +" }}} + +" Editing {{{ + Plug 'easymotion/vim-easymotion' + Plug 'junegunn/vim-easy-align' + Plug 'Raimondi/delimitMate' + Plug 'tpope/vim-repeat' + Plug 'tpope/vim-commentary' + Plug 'tpope/vim-surround' + Plug 'Yggdroot/indentLine' + Plug 'henrik/vim-indexed-search' + Plug 'andymass/vim-matchup' + " Plug 'tommcdo/vim-exchange' + Plug 'inkarkat/vim-ingo-library' " required by LineJuggler + Plug 'inkarkat/vim-LineJuggler', { 'branch': 'stable' } + Plug 'reedes/vim-pencil' +" }}} + +" Text objects {{{ + Plug 'kana/vim-textobj-user' + Plug 'kana/vim-textobj-entire' + Plug 'kana/vim-textobj-line' + Plug 'kana/vim-textobj-indent' +" }}} + +" UI {{{ + Plug 'moll/vim-bbye' + Plug 'gerw/vim-HiLinkTrace' + Plug 'vim-airline/vim-airline' + Plug 'tpope/vim-obsession' + Plug 'romainl/vim-qf' + if g:vim_ide + Plug 'dyng/ctrlsf.vim' + endif +" }}} + +" Git {{{ + Plug 'tpope/vim-fugitive' + Plug 'tpope/vim-rhubarb' + Plug 'airblade/vim-gitgutter' +" }}} + +" FZF {{{ + Plug 'junegunn/fzf', { 'do': './install --bin' } + Plug 'junegunn/fzf.vim' +" }}} + +" Programming {{{ + Plug 'sheerun/vim-polyglot' + if g:vim_ide + Plug 'neoclide/coc.nvim', { 'do': 'yarn install' } + Plug 'dag/vim2hs' + endif +" }}} + +call plug#end() + +" Automatically install/clean plugins (because I'm a programmer) {{{ + augroup vimrc-plugins + autocmd! + autocmd VimEnter * + \ if len(filter(values(g:plugs), '!isdirectory(v:val.dir)')) + \| PlugInstall --sync | q + \| endif + augroup END +" }}} + colorscheme dotfiles - -for s:path in globpath(g:nvim_dotfiles_dir.'/lib/languages', '*', 0, 1) - execute 'source' fnameescape(s:path) -endfor diff --git a/nvim/lib/plugins.vim b/nvim/lib/plugins.vim deleted file mode 100644 index c79336e..0000000 --- a/nvim/lib/plugins.vim +++ /dev/null @@ -1,85 +0,0 @@ -let s:vim_config_dir = expand('~/.config/nvim') -let s:vim_plug_script = s:vim_config_dir . '/autoload/plug.vim' -let s:vim_plug_home = s:vim_config_dir . '/plugged' - -let s:just_installed_vim_plug = 0 -if !filereadable(s:vim_plug_script) - exe '!curl -fL https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim --create-dirs -o' shellescape(s:vim_plug_script) - autocmd VimEnter * PlugInstall --sync -endif - -call plug#begin(s:vim_config_dir . '/plugged') - -Plug 'junegunn/vim-plug' - -" Files {{{ - Plug 'tpope/vim-eunuch' - if g:vim_ide - Plug 'francoiscabrol/ranger.vim' - endif -" }}} - -" Editing {{{ - Plug 'easymotion/vim-easymotion' - Plug 'junegunn/vim-easy-align' - Plug 'Raimondi/delimitMate' - Plug 'tpope/vim-repeat' - Plug 'tpope/vim-commentary' - Plug 'tpope/vim-surround' - Plug 'Yggdroot/indentLine' - Plug 'henrik/vim-indexed-search' - Plug 'andymass/vim-matchup' - " Plug 'tommcdo/vim-exchange' - Plug 'inkarkat/vim-ingo-library' " required by LineJuggler - Plug 'inkarkat/vim-LineJuggler', { 'branch': 'stable' } - Plug 'reedes/vim-pencil' -" }}} - -" Text objects {{{ - Plug 'kana/vim-textobj-user' - Plug 'kana/vim-textobj-entire' - Plug 'kana/vim-textobj-line' - Plug 'kana/vim-textobj-indent' -" }}} - -" UI {{{ - Plug 'moll/vim-bbye' - Plug 'gerw/vim-HiLinkTrace' - Plug 'vim-airline/vim-airline' - Plug 'tpope/vim-obsession' - Plug 'romainl/vim-qf' - if g:vim_ide - Plug 'dyng/ctrlsf.vim' - endif -" }}} - -" Git {{{ - Plug 'tpope/vim-fugitive' - Plug 'tpope/vim-rhubarb' - Plug 'airblade/vim-gitgutter' -" }}} - -" FZF {{{ - Plug 'junegunn/fzf', { 'do': './install --bin' } - Plug 'junegunn/fzf.vim' -" }}} - -" Programming {{{ - Plug 'sheerun/vim-polyglot' - if g:vim_ide - Plug 'neoclide/coc.nvim', { 'do': 'yarn install' } - Plug 'dag/vim2hs' - endif -" }}} - -call plug#end() - -" " Automatically install/clean plugins (because I'm a programmer) {{{ - augroup vimrc-plugins - autocmd! - autocmd VimEnter * - \ if len(filter(values(g:plugs), '!isdirectory(v:val.dir)')) - \| PlugInstall --sync | q - \| endif - augroup END -" " }}} diff --git a/nvim/lib/completion.vim b/nvim/plugin/completion.vim similarity index 91% rename from nvim/lib/completion.vim rename to nvim/plugin/completion.vim index 900ae31..1656f9a 100644 --- a/nvim/lib/completion.vim +++ b/nvim/plugin/completion.vim @@ -1,7 +1,7 @@ " pop-up (completion) menu mappings {{{ - imap pumvisible() ? "\" : "\delimitMateCR" - imap pumvisible() ? "\" : "\" - imap pumvisible() ? "\" : "\" + imap pumvisible() ? "\" : "\delimitMateCR" + imap pumvisible() ? "\" : "\" + imap pumvisible() ? "\" : "\" imap pumvisible() ? "\" : "\" " }}} @@ -81,4 +81,7 @@ endif \ 'errorSign': 'XX', \ 'warningSign': '!!', \ }) + + runtime! coc-languages/*.vim + " }}} diff --git a/nvim/lib/editing.vim b/nvim/plugin/editing.vim similarity index 95% rename from nvim/lib/editing.vim rename to nvim/plugin/editing.vim index 8ca20ac..369f3f8 100644 --- a/nvim/lib/editing.vim +++ b/nvim/plugin/editing.vim @@ -164,3 +164,13 @@ set commentstring=//%s xmap ga (LiveEasyAlign) nmap ga (LiveEasyAlign) " }}} + +" language-specific settings {{{ + + let g:rust_recommended_style = 0 + + let g:haskell_conceal = 0 + let g:haskell_conceal_enumerations = 0 + let g:haskell_multiline_strings = 1 + +" }}} diff --git a/nvim/lib/files.vim b/nvim/plugin/files.vim similarity index 100% rename from nvim/lib/files.vim rename to nvim/plugin/files.vim diff --git a/nvim/lib/git.vim b/nvim/plugin/git.vim similarity index 100% rename from nvim/lib/git.vim rename to nvim/plugin/git.vim diff --git a/nvim/lib/interface.vim b/nvim/plugin/interface.vim similarity index 100% rename from nvim/lib/interface.vim rename to nvim/plugin/interface.vim diff --git a/nvim/lib/terminal.vim b/nvim/plugin/terminal.vim similarity index 100% rename from nvim/lib/terminal.vim rename to nvim/plugin/terminal.vim