Advertisement
Guest User

Untitled

a guest
Feb 21st, 2020
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.24 KB | None | 0 0
  1. call plug#begin('~/.vim/plugged')
  2. "autosave feature
  3. "Plug 'vim-scripts/vim-auto-save' "(no need now...)
  4. "pretty nice status bar
  5. Plug 'vim-airline/vim-airline'
  6. "themes for status bar higher
  7. Plug 'vim-airline/vim-airline-themes'
  8. "plugin for git diff (shows -, + or ~ on the fields)
  9. Plug 'airblade/vim-gitgutter'
  10. "Plugin for git commands and nice interface (do i need it?)
  11. "Plug 'tpope/vim-fugitive'
  12. "plugin for autoformat (default formatters can see on the Internet)
  13. "just type :Autoformat (works with tabs and spaces after function name)
  14. Plug 'Chiel92/vim-autoformat'
  15. "plugin for markdown preview
  16. if !has('nvim')
  17. Plug 'iamcco/markdown-preview.vim'
  18. endif
  19. if has('nvim')
  20. Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() } }
  21. endif
  22. "plugin for syntax highlighting
  23. Plug 'sheerun/vim-polyglot'
  24. "show git changes on the fields (for nerd tree)
  25. Plug 'Xuyuanp/nerdtree-git-plugin'
  26. "multifile project
  27. Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
  28. "colourful names (?)
  29. Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
  30. "icons for nerdtree
  31. Plug 'ryanoasis/vim-devicons'
  32. "automatically adds second `(` and etc.
  33. Plug 'jiangmiao/auto-pairs'
  34. "plugin for autocomplete
  35. Plug 'neoclide/coc.nvim', {'branch' : 'release'}
  36. "autocomplete python
  37. "Plug 'davidhalter/jedi-vim' (works good, but very heavy plug....)
  38. "finder of the file in the project (ctrl + p and the name of the file)
  39. Plug 'kien/ctrlp.vim'
  40. "Just hit "\cm" (i = individual, m - minimal, check repo for info)
  41. "to leave a comment (also works in visual mode)
  42. Plug 'scrooloose/nerdcommenter'
  43. "here is plugin with many different themes (can find on github)
  44. Plug 'rafi/awesome-vim-colorschemes'
  45. call plug#end()
  46.  
  47. set cursorline
  48. set number
  49. set relativenumber
  50. " change mode if I'm not focused on the win (realativenumber -> number)
  51. :augroup numbertoggle
  52. : autocmd!
  53. : autocmd BufEnter,FocusGained,InsertLeave * set relativenumber
  54. : autocmd BufLeave,FocusLost,InsertEnter * set norelativenumber
  55. :augroup END
  56. set expandtab
  57. set encoding=UTF-8
  58. set tabstop=4
  59. set shiftwidth=4
  60.  
  61. syntax on
  62.  
  63. "theme for tabs and panel
  64. let g:airline_theme='luna'
  65. let g:airline#extensions#tabline#enabled = 1
  66.  
  67. "theme for whole vim
  68. colorscheme gruvbox
  69. set background=dark
  70. "resetting background must be after theme configuration
  71. highlight Normal ctermbg=NONE guibg=NONE
  72. set is
  73. set hls
  74. "need this to show tabs if they exists
  75. set list
  76. set listchars=tab:>-
  77. set langmap=ёйцукенгшщзхъфывапролджэячсмитьбюЁЙЦУКЕHГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ;`qwertyuiop[]asdfghjkl\\;'zxcvbnm\\,.~QWERTYUIOP{}ASDFGHJKL:\\"ZXCVBNM<>
  78.  
  79. map <C-n> :NERDTreeToggle<CR>
  80.  
  81. "mappings for tabs in vim
  82. if !has('nvim')
  83. map w :tabclose<CR>
  84. map m :tabnew<CR>
  85. map i :tabn<CR>
  86. map u :tabp<CR>
  87. endif
  88.  
  89. "mappings for windows in vim
  90. if !has('nvim')
  91. map q <C-w>q
  92. map v <C-w>n
  93. map n <C-w>v
  94. map k <C-w>k
  95. map h <C-w>h
  96. map l <C-w>l
  97. map j <C-w>j
  98. map e <C-w>=
  99. map . <C-w><
  100. map , <C-w>>
  101. map - <C-w>-
  102. map = <C-w>+
  103. endif
  104.  
  105. "mappings for tabs in vim
  106. if has('nvim')
  107. map <M-w> :tabclose<CR>
  108. map <M-m> :tabnew<CR>
  109. map <M-i> :tabn<CR>
  110. map <M-u> :tabp<CR>
  111. endif
  112.  
  113. "mappings for windows in vim
  114. if has('nvim')
  115. map <M-q> q
  116. map <M-v> n
  117. map <M-n> v
  118. map <M-k> k
  119. map <M-h> h
  120. map <M-l> l
  121. map <M-j> j
  122. map <M-e> =
  123. map <M-.> <
  124. map <M-,> >
  125. map <M--> -
  126. map <M-=> +
  127. endif
  128. "
  129. "keybindings for tabs-work
  130. "map <C-t>n :tabnew<CR>
  131. "map <C-t>q :tabclose<CR>
  132. "map <C-t>k :tabr<CR>
  133. "map <C-t>j :tabl<CR>
  134. "map <C-t>h :tabp<CR>
  135. "map <C-t>l :tabn<CR>
  136.  
  137. nnoremap <C-j> :m .+1<CR>
  138. nnoremap <C-k> :m .-2<CR>
  139. vnoremap <C-j> :m '>+1<CR>gv=gv
  140. vnoremap <C-k> :m '<-2<CR>gv=gv
  141.  
  142. "CONFIGURATION FOR COC
  143.  
  144. let g:coc_global_extensions = ['coc-ccls', 'coc-json', 'coc-python', 'coc-highlight']
  145. "coc.preferences.jumpCommand": "drop"
  146.  
  147. " if hidden is not set, TextEdit might fail.
  148. set hidden
  149.  
  150. " Some servers have issues with backup files, see #649
  151. set nobackup
  152. set nowritebackup
  153.  
  154. " Better display for messages
  155. set cmdheight=2
  156.  
  157. " You will have bad experience for diagnostic messages when it's default 4000.
  158. set updatetime=300
  159.  
  160. " don't give |ins-completion-menu| messages.
  161. set shortmess+=c
  162.  
  163. " always show signcolumns
  164. set signcolumn=yes
  165.  
  166. " Use tab for trigger completion with characters ahead and navigate.
  167. " Use command ':verbose imap <tab>' to make sure tab is not mapped by other plugin.
  168. inoremap <silent><expr> <TAB>
  169. \ pumvisible() ? "\<C-n>" :
  170. \ <SID>check_back_space() ? "\<TAB>" :
  171. \ coc#refresh()
  172. inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
  173.  
  174. function! s:check_back_space() abort
  175. let col = col('.') - 1
  176. return !col || getline('.')[col - 1] =~# '\s'
  177. endfunction
  178.  
  179. " Use <c-space> to trigger completion.
  180. inoremap <silent><expr> <c-space> coc#refresh()
  181.  
  182. " Use <cr> to confirm completion, `<C-g>u` means break undo chain at current position.
  183. " Coc only does snippet and additional edit on confirm.
  184. inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
  185. " Or use `complete_info` if your vim support it, like:
  186. " inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
  187.  
  188. " Use `[g` and `]g` to navigate diagnostics
  189. nmap <silent> [g <Plug>(coc-diagnostic-prev)
  190. nmap <silent> ]g <Plug>(coc-diagnostic-next)
  191.  
  192. " Remap keys for gotos
  193. nmap <silent> gd <Plug>(coc-definition)
  194. nmap <silent> gy <Plug>(coc-type-definition)
  195. nmap <silent> gi <Plug>(coc-implementation)
  196. nmap <silent> gr <Plug>(coc-references)
  197.  
  198. " Use K to show documentation in preview window
  199. nnoremap <silent> K :call <SID>show_documentation()<CR>
  200.  
  201. function! s:show_documentation()
  202. if (index(['vim','help'], &filetype) >= 0)
  203. execute 'h '.expand('<cword>')
  204. else
  205. call CocAction('doHover')
  206. endif
  207. endfunction
  208.  
  209. " Highlight symbol under cursor on CursorHold
  210. autocmd CursorHold * silent call CocActionAsync('highlight')
  211.  
  212. " Remap for rename current word
  213. nmap <leader>rn <Plug>(coc-rename)
  214.  
  215. " Remap for format selected region
  216. xmap <leader>f <Plug>(coc-format-selected)
  217. nmap <leader>f <Plug>(coc-format-selected)
  218.  
  219. augroup mygroup
  220. autocmd!
  221. " Setup formatexpr specified filetype(s).
  222. autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
  223. " Update signature help on jump placeholder
  224. autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
  225. augroup end
  226.  
  227. " Remap for do codeAction of selected region, ex: `<leader>aap` for current paragraph
  228. xmap <leader>a <Plug>(coc-codeaction-selected)
  229. nmap <leader>a <Plug>(coc-codeaction-selected)
  230.  
  231. " Remap for do codeAction of current line
  232. nmap <leader>ac <Plug>(coc-codeaction)
  233. " Fix autofix problem of current line
  234. nmap <leader>qf <Plug>(coc-fix-current)
  235.  
  236. " Create mappings for function text object, requires document symbols feature of languageserver.
  237. xmap if <Plug>(coc-funcobj-i)
  238. xmap af <Plug>(coc-funcobj-a)
  239. omap if <Plug>(coc-funcobj-i)
  240. omap af <Plug>(coc-funcobj-a)
  241.  
  242. " Use <TAB> for select selections ranges, needs server support, like: coc-tsserver, coc-python
  243. nmap <silent> <TAB> <Plug>(coc-range-select)
  244. xmap <silent> <TAB> <Plug>(coc-range-select)
  245.  
  246. " Use `:Format` to format current buffer
  247. command! -nargs=0 Format :call CocAction('format')
  248.  
  249. " Use `:Fold` to fold current buffer
  250. command! -nargs=? Fold :call CocAction('fold', <f-args>)
  251.  
  252. " use `:OR` for organize import of current buffer
  253. command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport')
  254.  
  255. " Add status line support, for integration with other plugin, checkout `:h coc-status`
  256. "set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
  257.  
  258. " Using CocList
  259. " Show all diagnostics
  260. nnoremap <silent> <space>a :<C-u>CocList diagnostics<cr>
  261. " Manage extensions
  262. nnoremap <silent> <space>e :<C-u>CocList extensions<cr>
  263. " Show commands
  264. nnoremap <silent> <space>c :<C-u>CocList commands<cr>
  265. " Find symbol of current document
  266. nnoremap <silent> <space>o :<C-u>CocList outline<cr>
  267. " Search workspace symbols
  268. nnoremap <silent> <space>s :<C-u>CocList -I symbols<cr>
  269. " Do default action for next item.
  270. nnoremap <silent> <space>j :<C-u>CocNext<CR>
  271. " Do default action for previous item.
  272. nnoremap <silent> <space>k :<C-u>CocPrev<CR>
  273. " Resume latest coc list
  274. nnoremap <silent> <space>p :<C-u>CocListResume<CR>
  275.  
  276. if has('nvim')
  277. " set to 1, nvim will open the preview window after entering the markdown buffer
  278. " default: 0
  279. let g:mkdp_auto_start = 0
  280.  
  281. " set to 1, the nvim will auto close current preview window when change
  282. " from markdown buffer to another buffer
  283. " default: 1
  284. let g:mkdp_auto_close = 0
  285.  
  286. " set to 1, the vim will refresh markdown when save the buffer or
  287. " leave from insert mode, default 0 is auto refresh markdown as you edit or
  288. " move the cursor
  289. " default: 0
  290. let g:mkdp_refresh_slow = 0
  291.  
  292. " set to 1, the MarkdownPreview command can be use for all files,
  293. " by default it can be use in markdown file
  294. " default: 0
  295. let g:mkdp_command_for_global = 0
  296.  
  297. " set to 1, preview server available to others in your network
  298. " by default, the server listens on localhost (127.0.0.1)
  299. " default: 0
  300. let g:mkdp_open_to_the_world = 0
  301.  
  302. " use custom IP to open preview page
  303. " useful when you work in remote vim and preview on local browser
  304. " more detail see: https://github.com/iamcco/markdown-preview.nvim/pull/9
  305. " default empty
  306. let g:mkdp_open_ip = ''
  307.  
  308. " specify browser to open preview page
  309. " default: ''
  310. let g:mkdp_browser = ''
  311.  
  312. " set to 1, echo preview page url in command line when open preview page
  313. " default is 0
  314. let g:mkdp_echo_preview_url = 0
  315.  
  316. " a custom vim function name to open preview page
  317. " this function will receive url as param
  318. " default is empty
  319. let g:mkdp_browserfunc = ''
  320.  
  321. " options for markdown render
  322. " mkit: markdown-it options for render
  323. " katex: katex options for math
  324. " uml: markdown-it-plantuml options
  325. " maid: mermaid options
  326. " disable_sync_scroll: if disable sync scroll, default 0
  327. " sync_scroll_type: 'middle', 'top' or 'relative', default value is 'middle'
  328. " middle: mean the cursor position alway show at the middle of the preview page
  329. " top: mean the vim top viewport alway show at the top of the preview page
  330. " relative: mean the cursor position alway show at the relative positon of the preview page
  331. " hide_yaml_meta: if hide yaml metadata, default is 1
  332. " sequence_diagrams: js-sequence-diagrams options
  333. let g:mkdp_preview_options = {
  334. \ 'mkit': {},
  335. \ 'katex': {},
  336. \ 'uml': {},
  337. \ 'maid': {},
  338. \ 'disable_sync_scroll': 0,
  339. \ 'sync_scroll_type': 'middle',
  340. \ 'hide_yaml_meta': 1,
  341. \ 'sequence_diagrams': {}
  342. \ }
  343.  
  344. " use a custom markdown style must be absolute path
  345. let g:mkdp_markdown_css = ''
  346.  
  347. " use a custom highlight style must absolute path
  348. let g:mkdp_highlight_css = ''
  349.  
  350. " use a custom port to start server or random for empty
  351. let g:mkdp_port = ''
  352.  
  353. " preview page title
  354. " ${name} will be replace with the file name
  355. let g:mkdp_page_title = '「${name}」'
  356. endif
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370. {
  371. "languageserver": {
  372. "ccls": {
  373. "command": "/home/justar/freespace/third_party/ccls/Release/ccls",
  374. "filetypes": ["c", "cpp", "objc", "objcpp"],
  375. "rootPatterns": [
  376. ".ccls",
  377. "compile_commands.json",
  378. ".vim/",
  379. ".git/",
  380. ".hg/"
  381. ],
  382. "initializationOptions": {
  383. "cache": {
  384. "directory": "/tmp/ccls"
  385. }
  386. },
  387. "clang": {
  388. "resourceDir": "/Library/Developer/CommandLineTools/usr/lib/clang/11.0.0",
  389. "extraArgs": [
  390. "-isystem",
  391. "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1",
  392. "-I",
  393. "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/"
  394. ]
  395. }
  396. }
  397. }
  398. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement