mirror of
https://github.com/keanuplayz/dotfiles.git
synced 2024-08-15 02:33:12 +00:00
[nvim] add IDE mode switch
This commit is contained in:
parent
edf166391b
commit
3de164b9d1
15 changed files with 67 additions and 28 deletions
|
@ -1,5 +1,7 @@
|
|||
let s:my_config_dir = expand('<sfile>: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
|
||||
|
|
|
@ -5,6 +5,13 @@
|
|||
imap <silent><expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
|
||||
" }}}
|
||||
|
||||
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
|
||||
|
|
|
@ -123,7 +123,7 @@ nnoremap <silent><expr> <CR> &buftype is# '' ? ":write\<CR>" : "\<CR>"
|
|||
" 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
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
if !g:vim_ide | finish | endif
|
||||
|
||||
let s:filetypes = ['c', 'cpp', 'objc', 'objcpp']
|
||||
let g:coc_filetypes += s:filetypes
|
||||
|
||||
|
|
|
@ -1,2 +1,4 @@
|
|||
if !g:vim_ide | finish | endif
|
||||
|
||||
call coc#add_extension('coc-css')
|
||||
let g:coc_filetypes += ['css']
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,2 +1,4 @@
|
|||
if !g:vim_ide | finish | endif
|
||||
|
||||
call coc#add_extension('coc-html', 'coc-emmet')
|
||||
let g:coc_filetypes += ['html']
|
||||
|
|
|
@ -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', {
|
||||
|
|
|
@ -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']
|
||||
|
|
|
@ -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']
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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' })
|
||||
|
|
|
@ -2,3 +2,5 @@ augroup vimrc-languages-text
|
|||
autocmd!
|
||||
autocmd FileType text call pencil#init()
|
||||
augroup END
|
||||
|
||||
if !g:vim_ide | finish | endif
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
if !g:vim_ide | finish | endif
|
||||
|
||||
let g:coc_filetypes += ['yaml']
|
||||
|
|
|
@ -14,7 +14,9 @@ Plug 'junegunn/vim-plug'
|
|||
|
||||
" Files {{{
|
||||
Plug 'tpope/vim-eunuch'
|
||||
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'
|
||||
if g:vim_ide
|
||||
Plug 'dyng/ctrlsf.vim'
|
||||
endif
|
||||
" }}}
|
||||
|
||||
" Git {{{
|
||||
|
@ -65,8 +67,10 @@ Plug 'junegunn/vim-plug'
|
|||
|
||||
" Programming {{{
|
||||
Plug 'sheerun/vim-polyglot'
|
||||
if g:vim_ide
|
||||
Plug 'neoclide/coc.nvim', { 'do': 'yarn install' }
|
||||
Plug 'dag/vim2hs'
|
||||
endif
|
||||
" }}}
|
||||
|
||||
call plug#end()
|
||||
|
|
Loading…
Reference in a new issue