Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.12 KB | None | 0 0
  1. " Vim Configuration
  2. "==============================================================================
  3. " Neovim: ~/.local/share/nvim/plugged
  4. call plug#begin()
  5. "==========================================================================="
  6. "==========================================================================="
  7. "=============================["General:"]=================================="
  8. "==========================================================================="
  9. "||
  10. "Vimrc:
  11. Plug 'iliubang/vimrc'
  12. "||
  13. "Tables:
  14. Plug 'dhruvasagar/vim-table-mode'
  15. "||
  16. "ImageMagick:
  17. Plug 'tpope/vim-afterimage'
  18. "||
  19. "CapsLock:
  20. "Plug 'tpope/vim-capslock'
  21. "||
  22. "Status:
  23. Plug 'tpope/vim-flagship'
  24. Plug 'tpope/vim-airline'
  25. "||
  26. "Dotfiles:
  27. Plug 'tpope/vim-dotenv'
  28. "||
  29. "JSON:
  30. Plug 'tpope/vim-jdaddy'
  31. "||
  32. "Characters:(UNICODE/UTF-8):
  33. Plug 'tpope/vim-characterize'
  34. "||
  35. "Movement:
  36. Plug 'tpope/vim-endwise'
  37. Plug 'tpope/vim-repeat'
  38. "||
  39. "Alignment:
  40. Plug 'junegunn/vim-easy-align'
  41. "||
  42. "TextObjects:
  43. Plug 'tpope/vim-sensible'
  44. Plug 'tpope/vim-surround'
  45. "||
  46. "Theme:
  47. Plug 'tyrannicaltoucan/vim-deep-space'
  48. Plug 'tpope/vim-vividchalk'
  49. "||
  50. "Snippets:
  51. Plug 'honza/vim-snippets'
  52. "||
  53. "Filemanager:
  54. Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
  55. Plug 'tpope/vim-apathy'
  56. "// EXAMPLE:
  57. "|| gf, <C-W>f, <C-W>gf: jump to the included file under the cursor.
  58. "|| :find, :sfind, :tabfind: jump to the specified included file.
  59. Plug 'tpope/vim-eunuch'
  60. "// EXAMPLE:
  61. "|| Vim sugar for the UNIX shell commands that need it the most. Features include:
  62. "|| :Delete: Delete a buffer and the file on disk simultaneously.
  63. "|| :Unlink: Like :Delete, but keeps the now empty buffer.
  64. "|| :Move: Rename a buffer and the file on disk simultaneously.
  65. "|| :Rename: Like :Move, but relative to the current file's containing directory.
  66. "|| :Chmod: Change the permissions of the current file.
  67. "|| :Mkdir: Create a directory, defaulting to the parent of the current file.
  68. "|| :Cfind: Run find and load the results into the quickfix list.
  69. "|| :Clocate: Run locate and load the results into the quickfix list.
  70. "|| :Lfind/:Llocate: Like above, but use the location list.
  71. "|| :Wall: Write every open window. Handy for kicking off tools like guard.
  72. "|| :SudoWrite: Write a privileged file with sudo.
  73. "|| :SudoEdit: Edit a privileged file with sudo.
  74. "||
  75. "||
  76. "Database:
  77. Plug 'tpope/vim-dadbod'
  78. "// EXAMPLE: :DB postgresql:///foobar
  79. "|| :DB redis:
  80. "||
  81. "Fuzzy:
  82. Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
  83. "||
  84. "Tmux:
  85. Plug 'tpope/vim-tbone'
  86. "||
  87. "Commenting:
  88. "||
  89. "||
  90. "Session:
  91. Plug 'tpope/vim-obsession'
  92. "||
  93. "Git:
  94. Plug 'NoahOrberg/gilbert.nvim'
  95. Plug 'tpope/vim-git'
  96. Plug 'tpope/vim-fugitive'
  97. Plug 'tpope/vim-rhubarb'
  98. "// EXAMPLE:
  99. "|| Enables :Gbrowse from fugitive.vim to open GitHub URLs.
  100. "|| Sets up :Git to use hub if installed rather than git.
  101. "||
  102. "Paste:
  103. Plug 'dunstontc/snip'
  104. Plug 'maxbrunsfeld/vim-yankstack'
  105. "// EXAMPLE: For example, if you wanted to define some mappings based on your 'leader' key, you could do this:
  106. "|| nmap <leader>p <Plug>yankstack_substitute_older_paste
  107. "|| nmap <leader>P <Plug>yankstack_substitute_newer_paste
  108. "||
  109. Plug 'svermeulen/vim-yoink'
  110. "// EXAMPLE:
  111. "|| Note that by default Yoink will not affect the way Vim behaves in any
  112. "|| way. You have to add one or more of the following maps or enable one
  113. "|| of the optional settings to produce an effect.
  114. "||
  115. "|| For example, if you want to add a key to swap the most recent paste
  116. "|| around in the yank history:
  117. "||
  118. "|| nmap <c-n> <plug>(YoinkPostPasteSwapBack)
  119. "|| nmap <c-p> <plug>(YoinkPostPasteSwapForward)
  120. "||
  121. "|| nmap p <plug>(YoinkPaste_p)
  122. "|| nmap P <plug>(YoinkPaste_P)
  123. "||
  124. "|| :Yanks - Display the current yank history
  125. "|| :ClearYanks - Delete history. This will reduce the history down to
  126. "|| 1 entry taken from the default register.
  127. "||
  128. "Search:
  129. Plug 'svermeulen/vim-subversive'
  130. "||
  131. "||
  132. "[]"End:"General:[]========================================================="
  133.  
  134.  
  135. "==========================================================================="
  136. "==========================================================================="
  137. "===============["Specific Programming Language Plugins:"]=================="
  138. "==========================================================================="
  139. "||
  140. "HAML:
  141. Plug 'tpope/vim-haml'
  142. "||
  143. "Markdown:
  144. Plug 'junegunn/goyo.vim', { 'for': 'markdown' }
  145. Plug '/tpope/vim-markdown'
  146. "||
  147. "[]"End:"Markdown:"[]========================================================"
  148.  
  149. "============================================================================"
  150. "||
  151. "C:
  152. "||
  153. "[]"End:"C:"[]=============================================================="
  154.  
  155.  
  156. "============================================================================"
  157. "||
  158. "Rust:
  159. Plug 'alx741/vim-rustfmt'
  160. Plug 'ebfe/vim-racer'
  161. Plug 'timonv/vim-cargo'
  162. Plug 'rust-lang/rust.vim'
  163. "||
  164. "[]"End:"Rust:"[]=============================================================="
  165.  
  166. "==========================================================================="
  167. "||
  168. "CPP:
  169. Plug 'octol/vim-cpp-enhanced-highlight', { 'for': 'cpp' }
  170. "||
  171. "[]"End:"CPP:"[]============================================================"
  172.  
  173. "==========================================================================="
  174. "Go:Golang:golang:
  175. "||
  176. Plug 'ajswis/vim-colorful-go'
  177. Plug 'webhat/gocovim'
  178. Plug 'netdigger/vim-config'
  179. Plug 'jasontbradshaw/pigeon.vim'
  180. Plug 'b0o/quicktemplate.vim'
  181. Plug 'pilere/vim_go_runtime'
  182. Plug 'enriqueChen/vimrc4go'
  183. Plug 'tenfyzhong/golint-fixer.vim'
  184. Plug 'heavenshell/vim-golinter'
  185. Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
  186. Plug 'sebdah/vim-delve'
  187. Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' }
  188. Plug 'rhysd/unite-go-import.vim'
  189. Plug 'AdnanHodzic/vim-hue'
  190. "||
  191. "+=["Go:]["Autocomplete:]
  192. Plug 'prabirshrestha/asyncomplete-file.vim'
  193. Plug 'prabirshrestha/async.vim'
  194. Plug 'prabirshrestha/asyncomplete.vim'
  195. Plug 'prabirshrestha/asyncomplete-buffer.vim'
  196. Plug 'prabirshrestha/asyncomplete-gocode.vim'
  197. "||
  198. "[]"End:"Go:"[]==========================================================="
  199.  
  200. "==========================================================================="
  201. "Ruby:
  202. "||
  203. Plug 'tpope/vim-rvm'
  204. Plug 'tpope/vim-hashrocket'
  205. Plug 'tpope/vim-bundler'
  206. "+===["Ruby:]["Rails:]
  207. "||
  208. Plug 'tpope/vim-cucumber'
  209. Plug 'tpope/vim-rails'
  210. Plug 'tpope/vim-rake'
  211. "||
  212. "[]"End:"Ruby:"[]==========================================================="
  213.  
  214. call plug#end()
  215.  
  216.  
  217. "============================================================================="
  218. "||
  219. " Convert tabs to spaces, use 2 spaces for tabs
  220. set expandtab
  221. set tabstop=2
  222. set shiftwidth=2
  223.  
  224. "||
  225. " Jump to the last position when reopening a file
  226. if has("autocmd")
  227. au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
  228. endif
  229.  
  230. "||
  231. " Nerdtree Settings - Key Assignment
  232. nnoremap <C-a> :tabprevious<CR>
  233. nnoremap <C-d> :tabnext<CR>
  234. nnoremap <C-s> :tabnew<CR>:NERDTree<CR>
  235.  
  236. " Theme
  237. set background=dark
  238. set termguicolors
  239. colorscheme deep-space
  240.  
  241. function! g:FuckThatMatchParen ()
  242. if exists(":NoMatchParen")
  243. :NoMatchParen
  244. endif
  245. endfunction
  246.  
  247. augroup plugin_initialize
  248. autocmd!
  249. autocmd VimEnter * call FuckThatMatchParen()
  250. augroup END
  251.  
  252. " Aliasing
  253. command Q q
  254. command Qw wq
  255. command W w
  256. command Wq wq
  257. "cmap q qa
  258.  
  259.  
  260.  
  261. imap <c-space> <Plug>(asyncomplete_force_refresh)
  262. set completeopt-=preview
  263.  
  264. let g:asyncomplete_smart_completion = 1
  265. let g:asyncomplete_auto_popup = 1
  266. let g:asyncomplete_remove_duplicates = 1
  267.  
  268. autocmd! CompleteDone * if pumvisible() == 0 | pclose | endif
  269.  
  270.  
  271. call asyncomplete#register_source(asyncomplete#sources#gocode#get_source_options({
  272. \ 'name': 'gocode',
  273. \ 'whitelist': ['go'],
  274. \ 'completor': function('asyncomplete#sources#gocode#completor'),
  275. \ 'config': {
  276. \ 'gocode_path': expand('~/Development/bin/gocode')
  277. \ },
  278. \ }))
  279.  
  280. au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#file#get_source_options({
  281. \ 'name': 'file',
  282. \ 'whitelist': ['*'],
  283. \ 'priority': 10,
  284. \ 'completor': function('asyncomplete#sources#file#completor')
  285. \ }))
  286.  
  287. call asyncomplete#register_source(asyncomplete#sources#buffer#get_source_options({
  288. \ 'name': 'buffer',
  289. \ 'whitelist': ['*'],
  290. \ 'blacklist': ['go'],
  291. \ 'completor': function('asyncomplete#sources#buffer#completor'),
  292. \ }))
  293.  
  294.  
  295. " Use `tab` key to select completions. Default is arrow keys.
  296. "inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
  297. "inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
  298.  
  299. " Use tab to trigger auto completion. Default suggests completions as you type.
  300. "let g:completor_auto_trigger = 0
  301.  
  302. let g:completor_gocode_binary = '/usr/bin/gocode'
  303. set relativenumber
  304.  
  305.  
  306. set textwidth=80
  307. au BufRead,BufNewFile *.md setlocal textwidth=80
  308.  
  309. " Return to previous line if file previously opened
  310. if has("autocmd")
  311. au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
  312. \| exe "normal! g'\"" | endif
  313. endif
  314.  
  315. set undofile
  316. set undodir=~/.config/nvim/undo/
  317. set backupdir=~/.config/nvim/backup/
  318. set directory=~/.config/nvim/tmp
  319.  
  320.  
  321. tnoremap <Esc> <C-\><C-n>
  322.  
  323. "10sp also works
  324. "split | Explore | resize 50
  325. "
  326. nmap <leader>p <Plug>yankstack_substitute_older_paste
  327. nmap <leader>P <Plug>yankstack_substitute_newer_paste
  328. let g:yankstack_yank_keys = ['y', 'd']
  329.  
  330. let g:markdown_fenced_languages = ['html', 'python', 'bash=sh']
  331.  
  332. let g:markdown_minlines = 999
  333.  
  334.  
  335. function! s:isAtStartOfLine(mapping)
  336. let text_before_cursor = getline('.')[0 : col('.')-1]
  337. let mapping_pattern = '\V' . escape(a:mapping, '\')
  338. let comment_pattern = '\V' . escape(substitute(&l:commentstring, '%s.*$', '', ''), '\')
  339. return (text_before_cursor =~? '^' . ('\v(' . comment_pattern . '\v)?') . '\s*\v' . mapping_pattern . '\v$')
  340. endfunction
  341.  
  342. inoreabbrev <expr> <bar><bar>
  343. \ <SID>isAtStartOfLine('\|\|') ?
  344. \ '<c-o>:TableModeEnable<cr><bar><space><bar><left><left>' : '<bar><bar>'
  345. inoreabbrev <expr> __
  346. \ <SID>isAtStartOfLine('__') ?
  347. \ '<c-o>:silent! TableModeDisable<cr>' : '__'
  348.  
  349. let g:table_mode_corner_corner='+'
  350. let g:table_mode_header_fillchar='='
  351.  
  352.  
  353.  
  354.  
  355. " write file whenever you try to GoBuild
  356. set autowrite
  357.  
  358. "allow copy/paste from sys clipboard
  359. set clipboard=unnamed
  360.  
  361.  
  362.  
  363.  
  364. " run :GoBuild or :GoTestCompile based on the go file
  365. function! s:build_go_files()
  366. let l:file = expand('%')
  367. if l:file =~# '^\f\+_test\.go$'
  368. call go#cmd#Test(0, 1)
  369. elseif l:file =~# '^\f\+\.go$'
  370. call go#cmd#Build(0)
  371. endif
  372. endfunction
  373.  
  374. autocmd FileType go nmap <leader>b :<C-u>call <SID>build_go_files()<CR>
  375. autocmd FileType go nmap <Leader>i <Plug>(go-info)
  376. autocmd BufNewFile,BufRead *.go setlocal noexpandtab tabstop=4 shiftwidth=4
  377.  
  378. let g:go_auto_type_info = 1
  379. let g:go_auto_sameids = 1
  380. let g:go_highlight_types = 1
  381. let g:go_highlight_fields = 1
  382. let g:go_highlight_functions = 1
  383. let g:go_highlight_methods = 1
  384. let g:go_highlight_operators = 1
  385. let g:go_highlight_extra_types = 1
  386.  
  387. set updatetime=100
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement