Lemur Pro nixos dotfiles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

201 lines
6.6 KiB

2 years ago
  1. map j gj
  2. map k gk
  3. set mouse+=a
  4. "let g:airline_theme ='base16_atelier_heath_light'
  5. set number
  6. set norelativenumber
  7. set wrap
  8. set linebreak
  9. " use indents of 4 spaces, and have them copied down lines:
  10. set shiftwidth=2
  11. set tabstop=2
  12. set softtabstop=2
  13. set expandtab
  14. set smarttab
  15. set autoindent
  16. set textwidth=80
  17. filetype indent off
  18. " enable filetype detection:
  19. filetype on
  20. autocmd FileType markdown,tex,text set nosmarttab noautoindent
  21. " for C-like programming, have automatic indentation:
  22. autocmd FileType c,cpp,slang set cindent
  23. " * Keystrokes -- Insert Mode
  24. autocmd Filetype python set shiftwidth=4 tabstop=4 softtabstop=4
  25. "Coc Stuff
  26. set encoding=utf-8
  27. " TextEdit might fail if hidden is not set.
  28. set hidden
  29. " Some servers have issues with backup files, see #649.
  30. set nobackup
  31. set nowritebackup
  32. " Give more space for displaying messages.
  33. set cmdheight=2
  34. " Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
  35. " delays and poor user experience.
  36. set updatetime=300
  37. " Don't pass messages to |ins-completion-menu|.
  38. set shortmess+=c
  39. " Always show the signcolumn, otherwise it would shift the text each time
  40. " diagnostics appear/become resolved.
  41. if has("nvim-0.5.0") || has("patch-8.1.1564")
  42. " Recently vim can merge signcolumn and number column into one
  43. set signcolumn=number
  44. else
  45. set signcolumn=yes
  46. endif
  47. " Use tab for trigger completion with characters ahead and navigate.
  48. " NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
  49. " other plugin before putting this into your config.
  50. inoremap <silent><expr> <TAB>
  51. \ pumvisible() ? "\<C-n>" :
  52. \ <SID>check_back_space() ? "\<TAB>" :
  53. \ coc#refresh()
  54. inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
  55. function! s:check_back_space() abort
  56. let col = col('.') - 1
  57. return !col || getline('.')[col - 1] =~# '\s'
  58. endfunction
  59. " Use <c-space> to trigger completion.
  60. if has('nvim')
  61. inoremap <silent><expr> <c-space> coc#refresh()
  62. else
  63. inoremap <silent><expr> <c-@> coc#refresh()
  64. endif
  65. " Make <CR> auto-select the first completion item and notify coc.nvim to
  66. " format on enter, <cr> could be remapped by other vim plugin
  67. inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
  68. \: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
  69. " Use `[g` and `]g` to navigate diagnostics
  70. " Use `:CocDiagnostics` to get all diagnostics of current buffer in location list.
  71. nmap <silent> [g <Plug>(coc-diagnostic-prev)
  72. nmap <silent> ]g <Plug>(coc-diagnostic-next)
  73. " GoTo code navigation.
  74. nmap <silent> gd <Plug>(coc-definition)
  75. nmap <silent> gy <Plug>(coc-type-definition)
  76. nmap <silent> gi <Plug>(coc-implementation)
  77. nmap <silent> gr <Plug>(coc-references)
  78. " Use K to show documentation in preview window.
  79. nnoremap <silent> K :call <SID>show_documentation()<CR>
  80. function! s:show_documentation()
  81. if (index(['vim','help'], &filetype) >= 0)
  82. execute 'h '.expand('<cword>')
  83. elseif (coc#rpc#ready())
  84. call CocActionAsync('doHover')
  85. else
  86. execute '!' . &keywordprg . " " . expand('<cword>')
  87. endif
  88. endfunction
  89. " Highlight the symbol and its references when holding the cursor.
  90. autocmd CursorHold * silent call CocActionAsync('highlight')
  91. " Symbol renaming.
  92. nmap <leader>rn <Plug>(coc-rename)
  93. " Formatting selected code.
  94. xmap <leader>f <Plug>(coc-format-selected)
  95. nmap <leader>f <Plug>(coc-format-selected)
  96. augroup mygroup
  97. autocmd!
  98. " Setup formatexpr specified filetype(s).
  99. autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
  100. " Update signature help on jump placeholder.
  101. autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
  102. augroup end
  103. " Applying codeAction to the selected region.
  104. " Example: `<leader>aap` for current paragraph
  105. xmap <leader>a <Plug>(coc-codeaction-selected)
  106. nmap <leader>a <Plug>(coc-codeaction-selected)
  107. " Remap keys for applying codeAction to the current buffer.
  108. nmap <leader>ac <Plug>(coc-codeaction)
  109. " Apply AutoFix to problem on the current line.
  110. nmap <leader>qf <Plug>(coc-fix-current)
  111. " Run the Code Lens action on the current line.
  112. nmap <leader>cl <Plug>(coc-codelens-action)
  113. " Map function and class text objects
  114. " NOTE: Requires 'textDocument.documentSymbol' support from the language server.
  115. xmap if <Plug>(coc-funcobj-i)
  116. omap if <Plug>(coc-funcobj-i)
  117. xmap af <Plug>(coc-funcobj-a)
  118. omap af <Plug>(coc-funcobj-a)
  119. xmap ic <Plug>(coc-classobj-i)
  120. omap ic <Plug>(coc-classobj-i)
  121. xmap ac <Plug>(coc-classobj-a)
  122. omap ac <Plug>(coc-classobj-a)
  123. " Remap <C-f> and <C-b> for scroll float windows/popups.
  124. if has('nvim-0.4.0') || has('patch-8.2.0750')
  125. nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
  126. nnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
  127. inoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>"
  128. inoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>"
  129. vnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
  130. vnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
  131. endif
  132. " Use CTRL-S for selections ranges.
  133. " Requires 'textDocument/selectionRange' support of language server.
  134. nmap <silent> <C-s> <Plug>(coc-range-select)
  135. xmap <silent> <C-s> <Plug>(coc-range-select)
  136. " Add `:Format` command to format current buffer.
  137. command! -nargs=0 Format :call CocActionAsync('format')
  138. " Add `:Fold` command to fold current buffer.
  139. command! -nargs=? Fold :call CocAction('fold', <f-args>)
  140. " Add `:OR` command for organize imports of the current buffer.
  141. command! -nargs=0 OR :call CocActionAsync('runCommand', 'editor.action.organizeImport')
  142. " Add (Neo)Vim's native statusline support.
  143. " NOTE: Please see `:h coc-status` for integrations with external plugins that
  144. " provide custom statusline: lightline.vim, vim-airline.
  145. set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
  146. " Mappings for CoCList
  147. " Show all diagnostics.
  148. nnoremap <silent><nowait> <space>a :<C-u>CocList diagnostics<cr>
  149. " Manage extensions.
  150. nnoremap <silent><nowait> <space>e :<C-u>CocList extensions<cr>
  151. " Show commands.
  152. nnoremap <silent><nowait> <space>c :<C-u>CocList commands<cr>
  153. " Find symbol of current document.
  154. nnoremap <silent><nowait> <space>o :<C-u>CocList outline<cr>
  155. " Search workspace symbols.
  156. nnoremap <silent><nowait> <space>s :<C-u>CocList -I symbols<cr>
  157. " Do default action for next item.
  158. nnoremap <silent><nowait> <space>j :<C-u>CocNext<CR>
  159. " Do default action for previous item.
  160. nnoremap <silent><nowait> <space>k :<C-u>CocPrev<CR>
  161. " Resume latest coc list.
  162. nnoremap <silent><nowait> <space>p :<C-u>CocListResume<CR>
  163. " END Coc