Advertisement
Guest User

Untitled

a guest
Jul 26th, 2020
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 5.70 KB | None | 0 0
  1. syntax on
  2.  
  3. set guicursor=
  4. set noshowmatch
  5. set relativenumber
  6. set nohlsearch
  7. set hidden
  8. set noerrorbells
  9. set tabstop=4 softtabstop=4
  10. set shiftwidth=4
  11. set expandtab
  12. set smartindent
  13. set nu
  14. set nowrap
  15. set smartcase
  16. set noswapfile
  17. set nobackup
  18. set undodir=~/.config/nvim/undodir
  19. set undofile
  20. set incsearch
  21. set termguicolors
  22. set scrolloff=8
  23. set noshowmode
  24.  
  25. " Give more space for displaying messages.
  26. set cmdheight=2
  27.  
  28. " Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
  29. " delays and poor user experience.
  30. set updatetime=50
  31.  
  32. " Don't pass messages to |ins-completion-menu|.
  33. set shortmess+=c
  34.  
  35. set colorcolumn=80
  36. highlight ColorColumn ctermbg=0 guibg=lightgrey
  37.  
  38. call plug#begin('~/.config/nvim/plugged')
  39.  
  40. Plug 'neoclide/coc.nvim', {'branch': 'release'}
  41. Plug 'tweekmonster/gofmt.vim'
  42. Plug 'tpope/vim-fugitive'
  43. Plug 'mbbill/undotree'
  44. Plug 'sheerun/vim-polyglot'
  45. Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
  46. Plug 'junegunn/fzf.vim'
  47. Plug 'vuciv/vim-bujo'
  48. Plug 'tpope/vim-dispatch'
  49. Plug 'tell-k/vim-autopep8'
  50. Plug 'mattn/emmet-vim'
  51. Plug 'pangloss/vim-javascript'
  52. Plug 'tpope/vim-commentary'
  53. Plug 'preservim/nerdtree'
  54.  
  55. "  I AM SO SORRY FOR DOING COLOR SCHEMES IN MY VIMRC, BUT I HAVE
  56. "  TOOOOOOOOOOOOO
  57. Plug 'gruvbox-community/gruvbox'
  58. Plug 'sainnhe/gruvbox-material'
  59. Plug 'phanviet/vim-monokai-pro'
  60. Plug 'vim-airline/vim-airline'
  61. " Plug 'itchyny/lightline.vim'
  62. Plug 'flazz/vim-colorschemes'
  63.  
  64. call plug#end()
  65.  
  66. let g:gruvbox_contrast_dark = 'hard'
  67. if exists('+termguicolors')
  68.     let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
  69.     let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
  70. endif
  71. let g:gruvbox_invert_selection='0'
  72.  
  73. " --- vim go (polyglot) settings.
  74. let g:go_highlight_build_constraints = 1
  75. let g:go_highlight_extra_types = 1
  76. let g:go_highlight_fields = 1
  77. let g:go_highlight_functions = 1
  78. let g:go_highlight_methods = 1
  79. let g:go_highlight_operators = 1
  80. let g:go_highlight_structs = 1
  81. let g:go_highlight_types = 1
  82. let g:go_highlight_function_parameters = 1
  83. let g:go_highlight_function_calls = 1
  84. let g:go_highlight_generate_tags = 1
  85. let g:go_highlight_format_strings = 1
  86. let g:go_highlight_variable_declarations = 1
  87. let g:go_auto_sameids = 1
  88.  
  89. " Disbale vim-autopep8 diff window
  90. let g:autopep8_disable_show_diff=1
  91.  
  92. colorscheme gruvbox
  93. set background=dark
  94.  
  95. if executable('rg')
  96.     let g:rg_derive_root='true'
  97. endif
  98.  
  99. let loaded_matchparen = 1
  100. let mapleader = " "
  101.  
  102. let g:netrw_browse_split = 2
  103. let g:netrw_banner = 0
  104. let g:netrw_winsize = 25
  105.  
  106. nnoremap <leader>prw :CocSearch <C-R>=expand("<cword>")<CR><CR>
  107. nnoremap <leader>pw :Rg <C-R>=expand("<cword>")<CR><CR>
  108. nnoremap <leader>phw :h <C-R>=expand("<cword>")<CR><CR>
  109. nnoremap <leader>h :wincmd h<CR>
  110. nnoremap <leader>j :wincmd j<CR>
  111. nnoremap <leader>k :wincmd k<CR>
  112. nnoremap <leader>l :wincmd l<CR>
  113. nnoremap <leader>u :UndotreeShow<CR>
  114. nnoremap <leader>pv :wincmd v<bar> :Ex <bar> :vertical resize 30<CR>
  115. nnoremap <Leader>ps :Rg<SPACE>
  116. nnoremap <C-p> :GFiles<CR>
  117. nnoremap <Leader>pf :Files<CR>
  118. nnoremap <Leader><CR> :so ~/.config/nvim/init.vim<CR>
  119. nnoremap <Leader>+ :vertical resize +5<CR>
  120. nnoremap <Leader>- :vertical resize -5<CR>
  121. nnoremap <Leader>rp :resize 100<CR>
  122. nnoremap <Leader>ee oif err != nil {<CR>log.Fatalf("%+v\n", err)<CR>}<CR><esc>kkI<esc>
  123. vnoremap J :m '>+1<CR>gv=gv
  124. vnoremap K :m '<-2<CR>gv=gv
  125.  
  126. noremap <leader>/ :Commentary<cr>
  127.  
  128. noremap <C-n> :NERDTreeToggle<CR>
  129.  
  130. " vim TODO
  131. nmap <Leader>tu <Plug>BujoChecknormal
  132. nmap <Leader>th <Plug>BujoAddnormal
  133. let g:bujo#todo_file_path = $HOME . "/.cache/bujo"
  134.  
  135. " Vim with me
  136. nnoremap <leader>vwm :colorscheme gruvbox<bar>:set background=dark<CR>
  137. nmap <leader>vtm :highlight Pmenu ctermbg=gray guibg=gray
  138.  
  139. vnoremap X "_d
  140. inoremap <C-c> <esc>
  141.  
  142. function! s:check_back_space() abort
  143.     let col = col('.') - 1
  144.     return !col || getline('.')[col - 1]  =~# '\s'
  145. endfunction
  146.  
  147. command! -nargs=0 Prettier :CocCommand prettier.formatFile
  148. inoremap <silent><expr> <C-space> coc#refresh()
  149.  
  150. " GoTo code navigation.
  151. nmap <leader>gd <Plug>(coc-definition)
  152. nmap <leader>gy <Plug>(coc-type-definition)
  153. nmap <leader>gi <Plug>(coc-implementation)
  154. nmap <leader>gr <Plug>(coc-references)
  155. nmap <leader>rr <Plug>(coc-rename)
  156. nmap <leader>g[ <Plug>(coc-diagnostic-prev)
  157. nmap <leader>g] <Plug>(coc-diagnostic-next)
  158. nmap <silent> <leader>gp <Plug>(coc-diagnostic-prev-error)
  159. nmap <silent> <leader>gn <Plug>(coc-diagnostic-next-error)
  160. nnoremap <leader>cr :CocRestart
  161.  
  162. " Sweet Sweet FuGITive
  163. nmap <leader>gh :diffget //3<CR>
  164. nmap <leader>gu :diffget //2<CR>
  165. nmap <leader>gs :G<CR>
  166.  
  167. " Lightline
  168. " let g:lightline = {
  169. "       \ 'colorscheme': 'wombat',
  170. "       \ 'active': {
  171. "       \   'left': [ [ 'mode', 'paste' ],
  172. "       \             [ 'gitbranch', 'readonly', 'filename', 'modified' ] ]
  173. "       \ },
  174. "       \ 'component_function': {
  175. "       \   'gitbranch': 'FugitiveHead'
  176. "       \ },
  177. "       \ }
  178.  
  179. fun! TrimWhitespace()
  180.     let l:save = winsaveview()
  181.     keeppatterns %s/\s\+$//e
  182.     call winrestview(l:save)
  183. endfun
  184.  
  185. augroup highlight_yank
  186.     autocmd!
  187.     autocmd TextYankPost * silent! lua require'vim.highlight'.on_yank("IncSearch", 50)
  188. augroup END
  189.  
  190. autocmd BufWritePre * :call TrimWhitespace()
  191.  
  192. "python with virtualenv support
  193. let g:python3_host_prog = "/usr/bin/python"
  194.  
  195. py << EOF
  196. import os
  197. import sys
  198. if 'VIRTUAL_ENV' in os.environ:
  199.     project_base_dir = os.environ['VIRTUAL_ENV']
  200.     activate_this = os.path.join(project_base_dir, 'bin/activate_this.py')
  201.     execfile(activate_this, dict(__file__=activate_this))
  202. EOF
  203.  
  204. " Auto Formatting
  205. nnoremap <C-f> :Prettier<CR>
  206.  
  207. " Indentation for Python
  208. au BufNewFile,BufRead *.py
  209.     \set autoindent
  210.     \set fileformat=unix
  211.  
  212. " Indentation for JS
  213. au BufNewFile,BufRead *.js
  214.     \set shiftwidth=2
  215.  
  216.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement