Advertisement
bitwise_gamgee

Untitled

Jun 27th, 2023
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 6.42 KB | None | 0 0
  1. " Basic Configuration
  2. " ------------------
  3.  
  4. syntax on
  5. set backspace=indent,eol,start
  6.  
  7. " Turn on filetype plugin
  8. filetype plugin on
  9.  
  10. " Enable italics
  11. set t_ZH=^[[3m
  12. set t_ZR=^[[23m
  13.  
  14. " Hide command line when not being used (Nvim only)
  15. " set cmdheight=0
  16.  
  17. " Tab Settings
  18. " ------------
  19.  
  20. set tabstop=2       " Tabs are 2 spaces
  21. set shiftwidth=2    " Using > indents 2 spaces
  22. set autoindent      " Indent where possible
  23. set nowrap          " Remove wrapping for coding files
  24. set nonumber        " Disable line numbers
  25.  
  26. " Auto Commands
  27. " -------------
  28.  
  29. " Markdown specific settings
  30. autocmd FileType markdown setlocal wrap
  31. autocmd FileType markdown setlocal nonumber
  32.  
  33. " Key Bindings
  34. " ------------
  35.  
  36. " Window resizing
  37. noremap <silent> <M-Left> :vertical resize -10<CR>
  38. noremap <silent> <M-Right> :vertical resize +10<CR>
  39. noremap <silent> <M-Up> :resize -10<CR>
  40. noremap <silent> <M-Down> :resize +10<CR>
  41.  
  42. " Close current buffer
  43. noremap <leader>x <cmd>bp\|bd#<cr>
  44.  
  45. " Mac specific fixes for function keys
  46. nmap <F1> :NERDTreeToggle<CR>
  47. nmap <Leader><F1> :NERDTreeFind<CR>
  48. nmap <F8> :TagbarToggle<CR>
  49. nmap <F7> :UndotreeToggle<CR>
  50.  
  51. " Easier shift-hjkl movement
  52. nnoremap <C-J> <C-W>j
  53. nnoremap <C-K> <C-W>k
  54. nnoremap <C-L> <C-W>l
  55. nnoremap <C-H> <C-W>h
  56.  
  57. " Plugins
  58. " -------
  59.  
  60. call plug#begin()
  61.  
  62. " Theme plugins
  63. Plug 'sonph/onehalf', { 'rtp': 'vim' }
  64. Plug 'kaicataldo/material.vim', { 'branch': 'main' }
  65. Plug 'sainnhe/everforest'
  66. Plug 'rakr/vim-one'
  67. Plug 'NLKNguyen/papercolor-theme'
  68. Plug 'markvincze/panda-vim'
  69. Plug 'jacoborus/tender.vim'
  70. Plug 'mhartington/oceanic-next'
  71. Plug 'kyoz/purify', { 'rtp': 'vim' }
  72. Plug 'altercation/vim-colors-solarized'
  73. Plug 'reedes/vim-colors-pencil'
  74. Plug 'mswift42/vim-themes'
  75. Plug 'Brettm12345/moonlight.vim'
  76. Plug 'ghifarit53/tokyonight-vim'
  77. Plug 'cormacrelf/vim-colors-github'
  78. Plug 'tssm/c64-vim-color-scheme'
  79.  
  80. " Dev icons
  81. Plug 'ryanoasis/vim-devicons'
  82.  
  83. " Helper plugins
  84. Plug 'godlygeek/tabular'        " Align text
  85. Plug 'tpope/vim-eunuch'          " VIM helpers (delete, rename, move)
  86. Plug 'ctrlpvim/ctrlp.vim'        " Open anything plugin
  87. Plug 'mileszs/ack.vim'           " Grep replace tool
  88. Plug 'vim-test/vim-test'         " Runs PHPUnit tests
  89. Plug 'majutsushi/tagbar'         " Shows tab and tags collections
  90. Plug 'universal-ctags/ctags'     " Builds ctags automatically
  91. Plug 'preservim/nerdtree'        " File explorer
  92. Plug 'jistr/vim-nerdtree-tabs'   " NERDTree tabs
  93. Plug 'tpope/vim-fugitive'        " Git support (diff)
  94. Plug 'vim-vdebug/vdebug'         " Debugger for Vim
  95. Plug 'reedes/vim-pencil'         " Soft wrapping
  96. Plug 'craigemery/vim-autotag'    " Automatically builds ctags
  97. Plug 'junegunn/goyo.vim'         " Distraction-free writing
  98. Plug 'itchyny/lightline.vim'     " Status bar for Vim
  99.  
  100. call plug#end()
  101.  
  102. " Plugin Configuration
  103. " --------------------
  104.  
  105. " COC Configuration
  106. " -----------------
  107.  
  108. " Some servers have issues with backup files, see #649
  109. set nobackup
  110. set nowritebackup
  111.  
  112. " Disable COC for markdown files
  113. function! s:disable_coc_for_type()
  114.   let l:filesuffix_blacklist = ['markdown', 'md', 'mkd']
  115.   if index(l:filesuffix_blacklist, expand('%:e')) != -1
  116.     let b:coc_enabled = 0
  117.   endif
  118. endfunction
  119. autocmd BufRead,BufNewFile * call s:disable_coc_for_type()
  120.  
  121. " Always show the signcolumn
  122. set signcolumn=yes
  123.  
  124. " Reduce updatetime for better responsiveness
  125. set updatetime=300
  126.  
  127. " Keybindings for COC
  128. inoremap <silent><expr> <TAB> coc#pum#visible() ? coc#pum#next(1) : CheckBackspace() ? "\<Tab>" : coc#refresh()
  129. inoremap <silent><expr> <S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
  130. inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm() : "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
  131. inoremap <silent><expr> <c-space> coc#refresh()
  132. nnoremap <silent> K :call <SID>show_documentation()<CR>
  133.  
  134. " GoTo code navigation
  135. nmap <silent> gd <Plug>(coc-definition)
  136. nmap <silent> gy <Plug>(coc-type-definition)
  137. nmap <silent> gi <Plug>(coc-implementation)
  138. nmap <silent> gr <Plug>(coc-references)
  139.  
  140. " Symbol renaming
  141. nmap <leader>rn <Plug>(coc-rename)
  142.  
  143. " Formatting selected code
  144. xmap <leader>f <Plug>(coc-format-selected)
  145. nmap <leader>f <Plug>(coc-format-selected)
  146.  
  147. " Applying code actions to the selected code block
  148. xmap <leader>a <Plug>(coc-codeaction-selected)
  149. nmap <leader>a <Plug>(coc-codeaction-selected)
  150.  
  151. " Apply code actions at cursor position
  152. nmap <leader>ac <Plug>(coc-codeaction-cursor)
  153.  
  154. " Apply code actions to entire buffer
  155. nmap <leader>as <Plug>(coc-codeaction-source)
  156.  
  157. " Apply the most preferred quickfix action to fix diagnostic on the current line
  158. nmap <leader>qf <Plug>(coc-fix-current)
  159.  
  160. " Remap keys for refactor code actions
  161. nmap <silent> <leader>re <Plug>(coc-codeaction-refactor)
  162. xmap <silent> <leader>r <Plug>(coc-codeaction-refactor-selected)
  163. nmap <silent> <leader>r <Plug>(coc-codeaction-refactor-selected)
  164.  
  165. " Run Code Lens action on the current line
  166. nmap <leader>cl <Plug>(coc-codelens-action)
  167.  
  168. " Pencil (Wrap) Settings
  169. " ----------------------
  170.  
  171. let g:pencil#wrapModeDefault = 'soft'   " Default is 'hard'
  172.  
  173. augroup pencil
  174.   autocmd!
  175.   autocmd FileType markdown,mkd,md call pencil#init()
  176.   autocmd FileType text call pencil#init()
  177. augroup END
  178.  
  179. " Lightline Settings
  180. " ------------------
  181.  
  182. call lightline#init()
  183.  
  184. " Goyo Settings
  185. " -------------
  186.  
  187. function! s:auto_goyo()
  188.   if &ft == 'markdown'
  189.     Goyo 80
  190.   elseif exists('#goyo')
  191.     let bufnr = bufnr('%')
  192.     Goyo!
  193.     execute 'b '.bufnr
  194.   endif
  195. endfunction
  196.  
  197. augroup goyo_markdown
  198.   autocmd!
  199.   autocmd BufEnter * call s:auto_goyo()
  200. augroup END
  201.  
  202. " Color Scheme
  203. " ------------
  204.  
  205. colorscheme deus
  206. set background=dark
  207.  
  208. " Post Scheme Formatting
  209. " ----------------------
  210.  
  211. " Clear certain highlighting settings
  212. highlight clear SignColumn
  213. highlight clear FoldColumn
  214.  
  215. hi Folded ctermfg=100 guifg=NONE guibg=NONE ctermbg=NONE
  216.  
  217. hi TabLineFill term=bold cterm=bold ctermbg=0
  218. hi TabLine ctermfg=NONE ctermbg=NONE
  219. hi TabLineSel ctermfg=NONE ctermbg=NONE
  220. hi SpecialKey guifg=NONE ctermfg=NONE guibg=NONE
  221.  
  222. hi Normal guibg=NONE ctermbg=NONE
  223. hi CursorColumn cterm=NONE ctermbg=NONE ctermfg=NONE
  224. hi CursorLine cterm=NONE ctermbg=NONE ctermfg=NONE
  225. hi LineNr guibg=NONE ctermbg=NONE
  226. hi CursorLineNr guibg=NONE ctermbg=NONE
  227. hi EndOfBuffer guibg=NONE ctermbg=NONE guifg=#343d46 ctermfg=NONE
  228.  
  229. " Set comments to italic style
  230. highlight Comment cterm=italic gui=italic
  231.  
  232. " Miscellaneous Settings
  233. " ----------------------
  234.  
  235. set noshowmode
  236. set noshowcmd
  237.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement