Moved plugins config to separate dir

This commit is contained in:
Jef Roosens 2021-02-01 09:48:09 +01:00
parent 136afdf82d
commit 36acc07310
9 changed files with 1 additions and 0 deletions

38
init/plugins/coc.vim Normal file
View file

@ -0,0 +1,38 @@
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction
inoremap <silent><expr> <Tab>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<Tab>" :
\ coc#refresh()
" Navigating through results list
" Tab to select next result
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
" Shift+Tab to select previous
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
" Use enter to confirm completion
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
" Select first option if no option is selected on enter
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm() : "\<C-g>u\<CR>"
" Project refactoring keybinding
nnoremap <silent> <leader>pwr :CocSearch <C-R>=expand("<cword>")<CR><CR>
" Go to definition
nmap gd <Plug>(coc-definition)
nmap gb <C-o>
nmap gi <Plug>(coc-implementation)
nmap gr <Plug>(coc-references)
" Jump between diagnostic positions
nmap <silent> <leader>dk <Plug>(coc-diagnostic-prev)
nmap <silent> <leader>dK <Plug>(coc-diagnostic-prev-error)
nmap <silent> <leader>dj <Plug>(coc-diagnostic-next)
nmap <silent> <leader>dJ <Plug>(coc-diagnostic-next-error)
" Show full diagnostics list
nmap <silent> <leader>dd :CocDiagnostics<CR>

28
init/plugins/ctrlp.vim Normal file
View file

@ -0,0 +1,28 @@
" Remap CtrlP shortcut
let g:ctrlp_map = '<leader>t'
" Enable caching
" I think this'll make it run just a bit faster
let g:ctrlp_use_caching = 1
" Don't clear the cache on exit, so it won't re-index every time we open the
" project
let g:ctrlp_clear_cache_on_exit = 0
" Cache inside the project's .vim directory to keep things tidy
let g:ctrlp_cache_dir = './.vim/cache/ctrlp'
" You can define different listing commands for different version controls
" systems etc.
" I currently only have experience with Git, but I've written the config like
" this to allow for easy expansion if needed.
let g:ctrlp_user_command = {
\ 'types': {
\ 1: ['.git', 'git --git-dir=%s/.git ls-files -oc --exclude-standard']
\ },
\ 'fallback': 'find %s -type f'
\ }
" Limit max number of files
" This prevents me from indexing my entire HOME by accident
let g:ctrlp_max_files = 10000
" Also limit recursion depth
let g:ctrlp_max_depth = 40

View file

@ -0,0 +1,12 @@
" Key bindings for quicker Git work
" Status
nnoremap <silent> <leader>gg :Git<CR>
" Commit
nnoremap <silent> <leader>gc :Gcommit<CR>
" Push
nnoremap <silent> <leader>gp :Gpush<CR>
" Show diffs
nnoremap <silent> <leader>gd :Gvdiffsplit!<CR>
" Easily resolve merges
nnoremap <silent> <leader>gh :diffget //2<CR>
nnoremap <silent> <leader>gl :diffget //3<CR>

View file

@ -0,0 +1,2 @@
" Disable key mappings
let g:gitgutter_map_keys = 0

View file

@ -0,0 +1,2 @@
" Set name of tags file; should put it inside .vim directory
let g:gutentags_ctags_tagfile='.vim/tags'

View file

@ -0,0 +1,2 @@
" Make each indent level have a specific character
let g:indentLine_char_list = ['|', '¦', '┆', '┊']

46
init/plugins/nerdtree.vim Normal file
View file

@ -0,0 +1,46 @@
" Listing of paths to ignore. I think I could use something similar to CtrlP
" here as well, but I want NERDTree to also show some non-version
" controlled files
" Vim
" Other IDEs
" Python
" Java
" Git
" Stack & Haskell
" CMake
" Non-text files
let NERDTreeIgnore = [
\ '^\.vim$[[dir]]',
\ '^\.vscode$[[dir]]', '.*\.code-workspace$[[file]]', '^\.idea$[[dir]]',
\ '^__pycache__$[[dir]]', '^\.pytest_cache$[[dir]]', '^venv$[[dir]]', '\.egg-info$[[dir]]', '^dist$[[dir]]',
\ '^build$[[dir]]', '^\.eggs$[[dir]]',
\ '^out$[[dir]]',
\ '^\.git$[[dir]]',
\ '^\.stack-work$[[dir]]', '\.lock$',
\ '^CMakeFiles$[[dir]]', '^CMakeCache.txt$[[file]]',
\ '.pdf$[[file]]']
" Show files starting with .
let NERDTreeShowHidden = 1
" Hide 'Press ? for help'
let NERDTreeMinimalUI = 1
let NERDTreeDirArrows = 1
" Close NERDTree after opening a file
let NERDTreeQuitOnOpen = 1
" Explicitely tell NERDTree to never change my current working directory
let NERDTreeChDirMode = 0
" Sort naturally, e.g. z10.txt comes after z1.txt
let NERDTreeNaturalSort = 1
" Show files, not only directories
let NERDTreeShowFiles = 1
" Don't show line numbers
let NERDTreeShowLineNumbers = 0
" Show NERDTree on the left side
let NERDTreeWinPos = 'left'
" Use the minimal menu system
let NERDTreeMinimalMenu = 1
" Always delete the buffer when you rename the file
let NERDTreeAutoDeleteBuffer = 1
" Open NERDTree on the current file
nnoremap <silent> tt :NERDTreeFind<CR>

25
init/plugins/tagbar.vim Normal file
View file

@ -0,0 +1,25 @@
" Navigating between tags
" Go to next top-level tag
let g:tagbar_map_nexttag = 'J'
" Same, but previous
let g:tagbar_map_prevtag = 'K'
" Show prototype of current tag
let g:tagbar_map_showproto = 'u'
" Use order from source file
let g:tagbar_sort = 0
" Don't show help tip at the top
let g:tagbar_compact = 1
" Auto-open folds while following cursor
let g:tagbar_autoshowtag = 1
" Don't show status line
let g:no_status_line = 1
" Close tagbar when a tag is selected
let g:tagbar_autoclose = 1
" Open tagbar when opening certain language types
" autocmd BufNewFile,BufReadPre *.py,*.java,*.rs,*.cpp,*.c,*.r TagbarOpen
" Explicitly close tagbar for these types
" autocmd BufNewFile,BufReadPre *.txt,*.rst TagbarClose
nnoremap <silent> tr :TagbarToggle<CR>