Advertisement
Guest User

Untitled

a guest
Jan 17th, 2020
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.59 KB | None | 0 0
  1.  
  2.  
  3. filetype off
  4. set autochdir "working directory is always directory of current file
  5. filetype plugin on "netrw file browser
  6. filetype plugin indent on
  7. "set mouse=a
  8.  
  9. "vim-plug
  10. call plug#begin()
  11. Plug 'junegunn/limelight.vim'
  12. Plug 'neoclide/coc.nvim', {'branch': 'release'}
  13. Plug 'sheerun/vim-polyglot'
  14.  
  15. call plug#end()
  16.  
  17. "mapping setup
  18. let mapleader="," "leader is comma
  19.  
  20. "echodoc config
  21. "set cmdheight=2
  22. let g:echodoc#enable_at_startup = 1
  23. "let g:echodoc#type = 'virtual'
  24.  
  25. "limelight config
  26. let g:limelight_conceal_ctermfg = 1
  27. nnoremap <leader>l :Limelight!! 0.85<CR>
  28.  
  29. "python-syntax config
  30. let g:python_highlight_all = 1
  31.  
  32. "start python language server
  33. if executable('pyls')
  34. " pip install python-language-server
  35. au User lsp_setup call lsp#register_server({
  36. \ 'name': 'pyls',
  37. \ 'cmd': {server_info->['pyls']},
  38. \ 'whitelist': ['python'],
  39. \ 'workspace_config': {'pyls': {'plugins': {'pydocstyle': {'enabled': v:true}}}}
  40. \ })
  41. endif
  42.  
  43. "coc config
  44. inoremap <expr><tab> pumvisible() ? "\<c-n>" : "\<tab>"
  45. inoremap <expr><S-tab> pumvisible() ? "\<c-p>" : "\<tab>"
  46. set hidden
  47. set nobackup
  48. set nowritebackup
  49. set updatetime=300
  50. set shortmess+=c
  51. set signcolumn=yes
  52.  
  53. "tab mapping
  54. inoremap <silent><expr> <TAB>
  55. \ pumvisible() ? "\<C-n>" :
  56. \ <SID>check_back_space() ? "\<TAB>" :
  57. \ coc#refresh()
  58. inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
  59.  
  60. function! s:check_back_space() abort
  61. let col = col('.') - 1
  62. return !col || getline('.')[col - 1] =~# '\s'
  63. endfunction
  64. "enter confirms completion
  65. inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
  66.  
  67. "goto's
  68. nmap <silent> gd <Plug>(coc-definition)
  69. nmap <silent> gy <Plug>(coc-type-definition)
  70. nmap <silent> gi <Plug>(coc-implementation)
  71. nmap <silent> gr <Plug>(coc-references)
  72.  
  73. "documentation bound to ,d
  74. nnoremap <leader>d :call <SID>show_documentation()<CR>
  75. function! s:show_documentation()
  76. if (index(['vim','help'], &filetype) >= 0)
  77. execute 'h '.expand('<cword>')
  78. else
  79. call CocAction('doHover')
  80. endif
  81. endfunction
  82.  
  83. "rename bound to ,r
  84. nmap <leader>r <Plug>(coc-rename)
  85.  
  86. "mapping
  87. "map jk to ESC to save time
  88. inoremap jk <esc>
  89.  
  90. "map ,f to open netrw in a vertical split
  91. nnoremap <leader>f :Vexplore<CR>
  92. "map ,F to open netrw
  93. nnoremap <leader>F :Explore<CR>
  94.  
  95. "map ,t to make new tab and explore
  96. nnoremap <leader>t :tab split<CR>:Explore<CR>
  97. "map ,T to make new tab with same file
  98. nnoremap <leader>T :tab split<CR>
  99. "map ,w to close tab
  100. nnoremap <leader>w :tabclose<CR>
  101. "map J to previous tab
  102. nnoremap J :tabp<CR>
  103. "map K to next tab
  104. nnoremap K :tabn<CR>
  105.  
  106. nnoremap <leader>V :e ~/.config/nvim/init.vim<CR>
  107.  
  108. "clear search highlight after search and fix paste insert mode
  109. nnoremap <leader><space> :nohlsearch<CR>:set nopaste<CR>
  110.  
  111. "map j and k to move visually on wrapped lines
  112. nnoremap j gj
  113. nnoremap k gk
  114.  
  115. "map <C-k> and <C-j> to cycle windows
  116. nnoremap <C-k> <C-w><C-W>
  117. nnoremap <C-j> <C-w><S-w>
  118.  
  119. "tab settings
  120. set autoindent "maintain indentation from previous line
  121. set expandtab "replace tabs with spaces
  122. set tabstop=4 "amount of spaces in a tab character
  123. set softtabstop=4 "amount of spaces inserted when tabbing
  124. set shiftwidth=4 "changes >> and <<, automatic indentation
  125. set linebreak "word wrapping
  126.  
  127. "visual
  128. "if empty($TMUX) && empty($STY)
  129. " " See https://gist.github.com/XVilka/8346728.
  130. " if $COLORTERM =~# 'truecolor' || $COLORTERM =~# '24bit'
  131. " if has('termguicolors')
  132. " " See :help xterm-true-color
  133. " if $TERM =~# '^screen'
  134. " let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
  135. " let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
  136. " endif
  137. " set termguicolors
  138. " endif
  139. " endif
  140. "endif
  141.  
  142. "scheme
  143. set termguicolors
  144. "set background=dark
  145. "colorscheme modest
  146. colorscheme fadedwolf
  147.  
  148. syntax enable "explanatory
  149. set relativenumber "line numbers aren't absolute
  150. set nu rnu "hybrid line numbers
  151. set showcmd "show command being typed
  152. set cursorline "highlight line being edited
  153. set wildmenu "visual autocomplete for commands
  154. set lazyredraw "optimization, especially for macros
  155. set showmatch "highlight matching [{()}]
  156.  
  157. "folding
  158. set foldmethod=syntax
  159.  
  160. "searching
  161. set path+=** "search downward with depth of 30 from working dir, **n changes the amount of layers
  162. set incsearch "search as you enter characters
  163. set hlsearch "highlight matches
  164.  
  165. "netrw
  166. let g:netrw_liststyle = 3 "change default directory view
  167. let g:netrw_banner = 0 "banner off on startup, I to view
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement