diff --git a/nvim/init.vim b/nvim/init.vim index 1d52894..2a549bb 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -1,5 +1,7 @@ let s:my_config_dir = expand(':p:h') +let g:vim_ide = get(g:, 'vim_ide', 0) + for s:name in ['plugins', 'editing', 'interface', 'colorscheme', 'files', 'completion', 'terminal', 'git'] execute 'source' fnameescape(s:my_config_dir.'/lib/'.s:name.'.vim') endfor diff --git a/nvim/lib/completion.vim b/nvim/lib/completion.vim index bfaeedf..8b1b668 100644 --- a/nvim/lib/completion.vim +++ b/nvim/lib/completion.vim @@ -5,6 +5,13 @@ imap pumvisible() ? "\" : "\" " }}} +if !g:vim_ide + function IsCocEnabled() + return 0 + endfunction + finish +endif + " coc.nvim {{{ " list of filetypes (that are added in language-specific scripts) for which " coc mappings are enabled diff --git a/nvim/lib/files.vim b/nvim/lib/files.vim index 63d5bbf..25cc782 100644 --- a/nvim/lib/files.vim +++ b/nvim/lib/files.vim @@ -123,7 +123,7 @@ nnoremap &buftype is# '' ? ":write\" : "\" " auto-format with Coc.nvim {{{ let g:coc_format_on_save_ignore = [] function s:FormatOnSave() - if index(g:coc_format_on_save_ignore, &filetype) < 0 && IsCocEnabled() + if IsCocEnabled() && index(g:coc_format_on_save_ignore, &filetype) < 0 silent CocFormat endif endfunction diff --git a/nvim/lib/languages/c.vim b/nvim/lib/languages/c.vim index 50d02bc..1652882 100644 --- a/nvim/lib/languages/c.vim +++ b/nvim/lib/languages/c.vim @@ -1,3 +1,5 @@ +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/lib/languages/css.vim index ed36b79..12bbfe5 100644 --- a/nvim/lib/languages/css.vim +++ b/nvim/lib/languages/css.vim @@ -1,2 +1,4 @@ +if !g:vim_ide | finish | endif + call coc#add_extension('coc-css') let g:coc_filetypes += ['css'] diff --git a/nvim/lib/languages/haskell.vim b/nvim/lib/languages/haskell.vim index 6d11c2b..5fbfe33 100644 --- a/nvim/lib/languages/haskell.vim +++ b/nvim/lib/languages/haskell.vim @@ -1,3 +1,9 @@ +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', { @@ -6,7 +12,3 @@ call coc#config('languageserver.haskell', { \ 'rootPatterns': ['.stack.yaml', 'cabal.config', 'package.yaml'], \ 'initializationOptions': {}, \ }) - -let g:haskell_conceal = 0 -let g:haskell_conceal_enumerations = 0 -let g:haskell_multiline_strings = 1 diff --git a/nvim/lib/languages/html.vim b/nvim/lib/languages/html.vim index 612be25..c6bbf8b 100644 --- a/nvim/lib/languages/html.vim +++ b/nvim/lib/languages/html.vim @@ -1,2 +1,4 @@ +if !g:vim_ide | finish | endif + call coc#add_extension('coc-html', 'coc-emmet') let g:coc_filetypes += ['html'] diff --git a/nvim/lib/languages/javascript.vim b/nvim/lib/languages/javascript.vim index 7b9497e..d44f7d8 100644 --- a/nvim/lib/languages/javascript.vim +++ b/nvim/lib/languages/javascript.vim @@ -1,3 +1,9 @@ +augroup vimrc-javascript + autocmd FileType javascript setlocal matchpairs-=<:> +augroup END + +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/lib/languages/json.vim index a9d8047..1221f66 100644 --- a/nvim/lib/languages/json.vim +++ b/nvim/lib/languages/json.vim @@ -1,7 +1,9 @@ -call coc#add_extension('coc-json') -let g:coc_filetypes += ['json'] - augroup vimrc-languages-json autocmd! autocmd FileType json syntax match Comment +\/\/.\+$+ augroup END + +if !g:vim_ide | finish | endif + +call coc#add_extension('coc-json') +let g:coc_filetypes += ['json'] diff --git a/nvim/lib/languages/markdown.vim b/nvim/lib/languages/markdown.vim index a27e1f9..83878f6 100644 --- a/nvim/lib/languages/markdown.vim +++ b/nvim/lib/languages/markdown.vim @@ -1,5 +1,3 @@ -let g:coc_filetypes += ['markdown'] - let g:vim_markdown_conceal = 0 let g:vim_markdown_conceal_code_blocks = 0 @@ -7,3 +5,7 @@ augroup vimrc-languages-markdown autocmd! autocmd FileType markdown call pencil#init() augroup END + +if !g:vim_ide | finish | endif + +let g:coc_filetypes += ['markdown'] diff --git a/nvim/lib/languages/python.vim b/nvim/lib/languages/python.vim index 4727edd..059f625 100644 --- a/nvim/lib/languages/python.vim +++ b/nvim/lib/languages/python.vim @@ -1,3 +1,12 @@ +augroup vimrc-language-python + autocmd! + autocmd FileType python Indent 4 +augroup END + +let g:python_highlight_all = 1 + +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']) @@ -10,10 +19,3 @@ call coc#config('python', { \ 'flake8Args': ['--ignore', 'E501'], \ }, \ }) - -augroup vimrc-language-python - autocmd! - autocmd FileType python Indent 4 -augroup END - -let g:python_highlight_all = 1 diff --git a/nvim/lib/languages/rust.vim b/nvim/lib/languages/rust.vim index fda8d42..8fd67c4 100644 --- a/nvim/lib/languages/rust.vim +++ b/nvim/lib/languages/rust.vim @@ -1,9 +1,11 @@ -call coc#add_extension('coc-rls') -let g:coc_filetypes += ['rust'] -call coc#config('rust', { 'clippy_preference': 'on' }) - let g:rust_recommended_style = 0 augroup vimrc-rust autocmd FileType rust setlocal matchpairs-=<:> augroup END + +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/text.vim b/nvim/lib/languages/text.vim index 6329b94..416f56b 100644 --- a/nvim/lib/languages/text.vim +++ b/nvim/lib/languages/text.vim @@ -2,3 +2,5 @@ augroup vimrc-languages-text autocmd! autocmd FileType text call pencil#init() augroup END + +if !g:vim_ide | finish | endif diff --git a/nvim/lib/languages/yaml.vim b/nvim/lib/languages/yaml.vim index 3c48b35..657a70a 100644 --- a/nvim/lib/languages/yaml.vim +++ b/nvim/lib/languages/yaml.vim @@ -1 +1,3 @@ +if !g:vim_ide | finish | endif + let g:coc_filetypes += ['yaml'] diff --git a/nvim/lib/plugins.vim b/nvim/lib/plugins.vim index f18ec8f..e0538a4 100644 --- a/nvim/lib/plugins.vim +++ b/nvim/lib/plugins.vim @@ -14,7 +14,9 @@ Plug 'junegunn/vim-plug' " Files {{{ Plug 'tpope/vim-eunuch' - Plug 'francoiscabrol/ranger.vim' + if g:vim_ide + Plug 'francoiscabrol/ranger.vim' + endif " }}} " Editing {{{ @@ -27,7 +29,7 @@ Plug 'junegunn/vim-plug' Plug 'Yggdroot/indentLine' Plug 'henrik/vim-indexed-search' Plug 'andymass/vim-matchup' - Plug 'tommcdo/vim-exchange' + " Plug 'tommcdo/vim-exchange' Plug 'inkarkat/vim-ingo-library' " required by LineJuggler Plug 'inkarkat/vim-LineJuggler', { 'branch': 'stable' } Plug 'reedes/vim-pencil' @@ -38,7 +40,6 @@ Plug 'junegunn/vim-plug' Plug 'kana/vim-textobj-entire' Plug 'kana/vim-textobj-line' Plug 'kana/vim-textobj-indent' - " Plug 'kana/vim-textobj-fold' " }}} " UI {{{ @@ -46,10 +47,11 @@ Plug 'junegunn/vim-plug' Plug 'gerw/vim-HiLinkTrace' Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes' - Plug 'wincent/terminus' Plug 'tpope/vim-obsession' Plug 'romainl/vim-qf' - Plug 'dyng/ctrlsf.vim' + if g:vim_ide + Plug 'dyng/ctrlsf.vim' + endif " }}} " Git {{{ @@ -65,8 +67,10 @@ Plug 'junegunn/vim-plug' " Programming {{{ Plug 'sheerun/vim-polyglot' - Plug 'neoclide/coc.nvim', { 'do': 'yarn install' } - Plug 'dag/vim2hs' + if g:vim_ide + Plug 'neoclide/coc.nvim', { 'do': 'yarn install' } + Plug 'dag/vim2hs' + endif " }}} call plug#end()