Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.75 KB | None | 0 0
  1. " don't worry about trying to stick to vi/ex conventions
  2. set nocompatible
  3.  
  4. " vim-plug config
  5. call plug#begin('~/.config/nvim/bundle')
  6. " Plug 'ctrlpvim/ctrlp.vim'
  7. Plug 'hashivim/vim-terraform'
  8. " Plug 'hashivim/vim-hashicorp-tools'
  9. " Plug 'vim-syntastic/syntastic'
  10. Plug 'w0rp/ale'
  11. Plug 'juliosueiras/vim-terraform-completion'
  12. " Plug 'hashivim/vim-vagrant'
  13. Plug 'justinmk/vim-sneak'
  14. Plug 'rizzatti/dash.vim'
  15. Plug 'mileszs/ack.vim'
  16. Plug 'sbdchd/neoformat'
  17. " comment plugins
  18. " Plug 'scrooloose/nerdcommenter'
  19. Plug 'tpope/vim-commentary'
  20. " Plug 'scrooloose/nerdtree'
  21. " buffer
  22. Plug 'jlanzarotta/bufexplorer'
  23. Plug 'Yggdroot/indentLine'
  24. Plug 'sheerun/vim-polyglot'
  25. Plug 'tpope/vim-endwise'
  26. Plug 'tpope/vim-fugitive'
  27. Plug 'tpope/vim-sensible'
  28. Plug 'tpope/vim-surround'
  29. Plug 'tpope/vim-unimpaired'
  30. Plug 'vim-airline/vim-airline'
  31. Plug 'vim-airline/vim-airline-themes'
  32. Plug 'vim-scripts/Align'
  33. Plug '/usr/local/opt/fzf'
  34. Plug 'ncm2/ncm2'
  35. Plug 'roxma/nvim-cm-tern', {'do': 'npm install'}
  36. Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
  37. Plug 'ekalinin/Dockerfile.vim'
  38. " text formatting
  39. Plug 'Chiel92/vim-autoformat'
  40. " colorschemes
  41. Plug 'mhartington/oceanic-next'
  42. Plug 'whatyouhide/vim-gotham'
  43. Plug 'joshdick/onedark.vim'
  44. Plug 'jacoborus/tender.vim'
  45. Plug 'ajh17/Spacegray.vim'
  46. Plug 'dylanaraps/wal.vim'
  47. Plug 'flazz/vim-colorschemes'
  48. Plug 'felixhummel/setcolors.vim'
  49. Plug 'nightsense/cosmic_latte'
  50. " ncm
  51. " Plug 'ncm2/ncm2-match-highlight'
  52. call plug#end()
  53.  
  54. " ncm config
  55. " let g:ncm2#match_highlight = 'sans-serif-bold'
  56. " let g:ncm2#match_highlight = 'sans-serif'
  57. " let g:ncm2#match_highlight = 'sans-serif-bold'
  58. " let g:ncm2#match_highlight = 'mono-space'
  59. " default
  60. " let g:ncm2#match_highlight = 'double-struck'
  61.  
  62.  
  63. " deoplete
  64. "call deoplete#enable()
  65. "let g:deoplete#enable_at_startup = 1
  66. "let g:python3_host_prog = '/usr/local/bin/python3'
  67. "filetype off
  68. let g:deoplete#omni_patterns = {}
  69. let g:deoplete#omni_patterns.terraform = '[^ *\t"{=$]\w*'
  70. let g:deoplete#enable_at_startup = 1
  71. call deoplete#initialize()
  72.  
  73. " no banner for netrw
  74. let g:netrw_banner = 0
  75.  
  76. " Jason's personal additions
  77. autocmd BufReadPost *
  78. \ if line("'\"") > 0 && line("'\"") <= line("$") |
  79. \ exe "normal g`\"" |
  80. \ endif
  81. " augroup END
  82. " set mapleader to comma for sanity
  83. :let mapleader = ","
  84. " map <Leader>n <plug>NERDTreeTabsToggle<CR>
  85.  
  86. " This is for the Syntastic plugin, we need to set it before it loads
  87. let g:syntastic_enable_signs = 1
  88. let g:syntastic_echo_current_error = 1
  89. let g:syntastic_enable_highlighting = 1
  90. set statusline+=%#warningmsg#
  91. set statusline+=%{SyntasticStatuslineFlag()}
  92. set statusline+=%*
  93. let g:syntastic_always_populate_loc_list = 1
  94. let g:syntastic_auto_loc_list = 1
  95. let g:syntastic_check_on_open = 0
  96. let g:syntastic_check_on_wq = 0
  97. let g:syntastic_mode = "passive"
  98. " (Optional) Enable terraform plan to be include in filter
  99. let g:syntastic_terraform_tffilter_plan = 0
  100.  
  101.  
  102.  
  103. " configure CtrlP
  104. let g:ctrlp_map = '<c-p>'
  105. " let g:ctrlp_map = '<Space>'
  106. let g:ctrlp_max_height = 45
  107. let g:ctrlp_match_window_reversed = 0
  108. let g:ctrlp_match_window_bottom = 1
  109. let g:ctrlp_switch_buffer = 2
  110. let g:ctrlp_working_path_mode = 'c'
  111. let g:ctrlp_mruf_include = '\.py$\|\.rb$|\.coffee|\.haml'
  112. let g:ctrlp_custom_ignore = '\.git$\|\.hg$\|\.svn$'
  113. let g:ctrlp_follow_symlinks = 1
  114. let g:ctrlp_extensions = ['tag', 'buffertag', 'quickfix', 'dir', 'rtscript']
  115. let g:ctrlp_user_command = {
  116. \ 'types': {
  117. \ 1: ['.git/', 'cd %s && git ls-files'],
  118. \ 2: ['.hg/', 'hg --cwd %s locate -I .'],
  119. \ },
  120. \ 'fallback': 'find %s -type f'
  121. \ }
  122. " slow vim exit?
  123. let g:ctrlp_clear_cache_on_exit = 0
  124.  
  125. " Configure vim-javascript
  126. let g:javascript_plugin_flow = 1
  127.  
  128. " Configure Vimwiki
  129. " let g:vimwiki_hl_headers = 1
  130. " let g:vimwiki_hl_cb_checked = 1
  131. " let g:vimwiki_user_mouse = 1
  132. " let g:vimwiki_folding = 1
  133. " let g:vimwiki_fold_lists = 1
  134. " let g:vimwiki_list_ignore_newline = 0
  135. " let wiki_1 = {}
  136. " let wiki_1.nested_syntaxes = {'python': 'python', 'ruby': 'ruby', 'rails': 'rails', 'yaml': 'yml'}
  137.  
  138. " configure IndentGuides plugin
  139. " let g:indent_guides_auto_colors = 0
  140. " let g:indent_guides_start_level = 3
  141. " let g:indent_guides_guide_size = 1
  142. " autocmd! VimEnter,Colorscheme * hi IndentGuidesOdd ctermbg=236 guibg=#303030 | hi IndentGuidesEven ctermbg=239 guibg=#505050
  143. " autocmd BufRead * IndentGuidesEnable
  144. "autocmd! VimEnter,Colorscheme * hi IndentGuidesEven ctermbg=123 guibg=#880055
  145.  
  146. " initialize pathogen and load all the plugins in .vim/bundle
  147. " runtime bundle/vim-pathogen/autoload/pathogen.vim
  148. " execute pathogen#infect('bundle/{}')
  149.  
  150. " airline settings
  151. let g:airline_powerline_fonts = 0
  152. let g:airline_solarized_bg='dark'
  153.  
  154. if !exists('g:airline_symbols')
  155. let g:airline_symbols = {}
  156. endif
  157. let g:airline_symbols.space = "\ua0"
  158. let g:airline#extensions#whitespace#checks = [ 'indent' ]
  159. let g:airline_left_sep=''
  160. let g:airline_right_sep=''
  161. let g:airline_section_x=''
  162. let g:airline_section_y=''
  163. let g:airline#extensions#tabline#enabled = 1
  164. let g:airline#extensions#tabline#fnamemod = ':t'
  165. let g:airline_theme='powerlineish'
  166. " let g:airline_theme='base16_greenscreen'
  167. " let g:airline#extensions#tabline#left_sep = ' '
  168. " let g:airline#extensions#tabline#left_alt_sep = '|'
  169.  
  170. colorscheme jkg2
  171.  
  172. if has('gui_running')
  173.  
  174. " for Gui versions of vim. see :help guioptions for more info
  175. "set guioptions=aAce
  176. set guioptions=egmrt
  177. " colorscheme ir_black
  178. " colorscheme flattened_dark
  179. " set guifont=Sauce\ Code\ Powerline\ Light:h13
  180. set guifont=Monaco:h14
  181.  
  182. " for MacVim
  183. "if has("macunix")
  184. "set transparency=0
  185. "end
  186. set transparency=0
  187.  
  188.  
  189. elseif version >= 700 && &term != 'cygwin'
  190.  
  191. " configure 256 color schemes for terminal using CSApprox or guicolorscheme
  192. set t_Co=256
  193. if has('gui')
  194. let g:CSApprox_attr_map = { 'bold' : 'bold', 'italic' : '', 'sp' : '' }
  195. " colorscheme pablo
  196. " colorscheme jkg1
  197. " colorscheme wal
  198. else
  199. " colorscheme pablo
  200. " colorscheme jkg1
  201. " colorscheme wal
  202. endif
  203.  
  204. endif
  205.  
  206. " Disable balloon popup since theres a plugin that makes it really annoying
  207. " set noballooneval
  208.  
  209. " Syntax hilight based on filetype, which is autmatically determined.
  210. " The filetype plugin needs to be reinitialized
  211. syntax on
  212. "filetype off
  213. filetype on
  214. filetype plugin on
  215. filetype indent on
  216.  
  217. " Enable syntax folding for blocks and comments.
  218. set foldmethod=syntax
  219. set foldminlines=3
  220. set foldlevel=100
  221.  
  222. " indentation configuration
  223. "set cindent
  224. "set smartindent
  225. set autoindent
  226.  
  227. " Convert tabs to spaces, use 2 spaces in place of tabs.
  228. set expandtab
  229. set tabstop=2
  230. set shiftwidth=2
  231.  
  232. " text search options
  233. set hlsearch
  234. set incsearch
  235. set ignorecase
  236. set smartcase
  237.  
  238. " hide buffers instead of closing them when you :q, keeping their undo history
  239. set hidden
  240.  
  241. " Open new windows on the bottom and right instead of the top and left.
  242. set splitbelow
  243. set splitright
  244.  
  245. " increase the default command line history
  246. set history=1000
  247.  
  248. " File name tab completion functions like bash, it gives you a list of
  249. " options instead of automatically filling in the first possible match.
  250. set wildmenu
  251. " It will however, with this option, complete up to the first character of
  252. " ambiguity.
  253. " set wildmode=list:longest
  254. set wildmode=longest:full,full
  255.  
  256. " Show line numbers
  257. set number
  258.  
  259. " Make clipbord work on OS X. This makes copy/paste operations trivial between
  260. " vim and other applications since they all use the same clipboard now.
  261. " set clipboard=unnamed
  262. " visual select automatically copies to X11's selection ("middle click") buffer
  263. " set go+=a
  264.  
  265. " scrolls the buffer before you reach the last line of the window
  266. set scrolloff=3
  267.  
  268. " Always show status line
  269. set ls=2
  270.  
  271. " default encoding
  272. set encoding=utf-8
  273.  
  274. " sets backspace key functions, allows it to backspace over end of line
  275. " characters, start of line, and indentation
  276. set backspace=indent,eol,start
  277. " movement keys will take you to the next or previous line
  278. " set whichwrap+=<,>,h,l
  279.  
  280. " enable mouse in console
  281. " set mousemodel=extend
  282. " set mouse=a
  283.  
  284. " disable mouse in console
  285. set mouse-=a
  286.  
  287. " improve autocomplete menu color
  288. highlight Pmenu ctermbg=238 gui=bold
  289.  
  290. " set the spellcheck language
  291. setlocal spell spelllang=en_us
  292. " disable spellcheck by default
  293. set nospell
  294.  
  295. " for exuberant CTags support
  296. set tags=./tags;/
  297.  
  298. " use a user-local vim-specific directory for backups rather than the global
  299. " tmp directory by default
  300. set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
  301. set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
  302.  
  303. " no backups for crontab
  304. autocmd filetype crontab setlocal nobackup nowritebackup
  305.  
  306. " treat question marks as part of a word in ruby
  307. autocmd BufRead *.rb,*.rake,*.rhtml,<ruby> set isk=?,@,48-57,_,192-255
  308.  
  309. " disable wordwrap when looking at CSVs
  310. autocmd BufRead *.csv,*.csv*,<csv> set nowrap
  311.  
  312. " setting active warehouse dsl files to ruby type
  313. autocmd BufRead,BufNewFile *.ebf,*.ctl set filetype=ruby
  314.  
  315. " setting rabl template files to ruby type
  316. autocmd BufRead,BufNewFile *.rabl set filetype=ruby
  317.  
  318. " setting erb to ruby
  319. autocmd BufRead,BufNewFile *.erb set filetype=ruby
  320.  
  321. " setting for groovy
  322. au BufNewFile,BufRead *.groovy setf groovy
  323. au BufNewFile,BufRead Jenkinsfile setf groovy
  324.  
  325. " turn off auto comments for newlines
  326. autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
  327.  
  328. " nowrap for json files
  329. autocmd FileType json set nowrap
  330.  
  331. " chef plugin
  332. " au BufNewFile,BufRead */*cookbooks/* call s:SetupChef()
  333. autocmd FileType ruby,eruby set filetype=ruby.eruby.chef
  334.  
  335. " remove whistespace at end of line before write
  336. func! StripTrailingWhitespace()
  337. normal mZ
  338. %s/\s\+$//e
  339. normal `Z
  340. endfunc
  341. " au BufWrite * if ! &bin | call StripTrailingWhitespace() | endif
  342.  
  343. " display the file name of the current file in the Terminal (xterm/item/&c) title
  344. if has('title')
  345. set title
  346. autocmd BufEnter * let &titlestring = "vim: " . expand("%:p:~")
  347. endif
  348.  
  349. " JSON formatting
  350. func! FormatJSON()
  351. :%!python -c "import json, sys, collections; print json.dumps(json.load(sys.stdin, object_pairs_hook=collections.OrderedDict), indent=2)"
  352. endfunc
  353. let g:vim_json_syntax_conceal = 0
  354.  
  355. " shortcuts
  356. " for rails.vim alternate between test and tested
  357. map <leader>t :A<CR>
  358. map <leader>ts :AS<CR>
  359. map <leader>tv :AV<CR>
  360. " for rails.vim swap to model/control/etc from associated file
  361. map <leader>rm :Rmodel<CR>
  362. map <leader>rc :Rcontroller<CR>
  363. map <leader>rh :Rhelper<CR>
  364. map <leader>ru :Runittest<CR>
  365. map <leader>rf :Rfunctionaltest<CR>
  366. map <leader>ro :Robserver<CR>
  367. map <leader>rv :Rview<CR>
  368. map <leader>rl :Rlocale<CR>
  369. " for CtrlP
  370. map <leader>ff :CtrlP<CR>
  371. map <leader>fb :CtrlPBuffer<CR>
  372. map <leader>ft :CtrlPTag<CR>
  373. map <leader>fq :CtrlPQuickfix<CR>
  374. map <leader>fd :CtrlPDir<CR>
  375. map <leader>fr :CtrlPRTS<CR>
  376. map <leader>fm :CtrlPMRU<CR>
  377. " for gundo
  378. map <leader>g :GundoToggle<CR>
  379. " runs diff against the current buffer and the file on disk
  380. map <leader>d :w !diff % -<CR>
  381. " When pressing <leader>cd switch to the directory of the open buffer
  382. map <leader>cd :cd %:p:h<CR>
  383. " search hilighting control, enables and disable intelligently and toggles
  384. nnoremap / :set hlsearch<CR>/
  385. nnoremap ? :set hlsearch<CR>?
  386. nnoremap n :set hlsearch<CR>n
  387. nnoremap N :set hlsearch<CR>N
  388. nnoremap <CR> :noh<CR><CR>
  389. nnoremap <leader>/ :set hlsearch!<CR>
  390.  
  391. " buffer maps
  392. map gn :bn<cr>
  393. map gp :bp<cr>
  394. map gd :bd<cr>
  395.  
  396. " tab navigation like firefox
  397. nmap <C-S-tab> :tabprevious<CR>
  398. nmap <C-tab> :tabnext<CR>
  399. map <C-S-tab> :tabprevious<CR>
  400. map <C-tab> :tabnext<CR>
  401. imap <C-S-tab> <ESC>:tabprevious<CR>i
  402. imap <C-tab> <ESC>:tabnext<CR>i
  403. nmap <C-t> :tabnew<CR>
  404. imap <C-t> <ESC>:tabnew<CR>
  405.  
  406. " Bash like keys for the command line
  407. cnoremap <C-A> <Home>
  408. cnoremap <C-E> <End>
  409. cnoremap <C-K> <C-U>
  410.  
  411. " cnoremap <C-P> <Up>
  412. " cnoremap <C-N> <Down>
  413.  
  414. " Easy way to move between windows
  415. map <C-j> <C-W>j
  416. map <C-k> <C-W>k
  417. map <C-h> <C-W>h
  418. map <C-l> <C-W>l
  419.  
  420. " make mouse scrolling work in vim!!!
  421. " map <M-Esc>[62~ <ScrollWheelUp>
  422. " map <M-Esc>[63~ <ScrollWheelDown>
  423. " map <M-Esc>[64~ <S-ScrollWheelUp>
  424. " map <M-Esc>[65~ <S-ScrollWheelDown>
  425. " map! <M-Esc>[62~ <ScrollWheelUp>
  426. " map! <M-Esc>[63~ <ScrollWheelDown>
  427. " map! <M-Esc>[64~ <S-ScrollWheelUp>
  428. " map! <M-Esc>[65~ <S-ScrollWheelDown>
  429.  
  430. " make keypad work in vim with iTerm on OS X!
  431. " map <Esc>Oq 1
  432. " map <Esc>Or 2
  433. " map <Esc>Os 3
  434. " map <Esc>Ot 4
  435. " map <Esc>Ou 5
  436. " map <Esc>Ov 6
  437. " map <Esc>Ow 7
  438. " map <Esc>Ox 8
  439. " map <Esc>Oy 9
  440. " map <Esc>Op 0
  441. " map <Esc>On .
  442. " map <Esc>OQ /
  443. " map <Esc>OR *
  444. " map <kPlus> +
  445. " map <Esc>OS -
  446. " map! <Esc>Oq 1
  447. " map! <Esc>Or 2
  448. " map! <Esc>Os 3
  449. " map! <Esc>Ot 4
  450. " map! <Esc>Ou 5
  451. " map! <Esc>Ov 6
  452. " map! <Esc>Ow 7
  453. " map! <Esc>Ox 8
  454. " map! <Esc>Oy 9
  455. " map! <Esc>Op 0
  456. " map! <Esc>On .
  457. " map! <Esc>OQ /
  458. " map! <Esc>OR *
  459. " map! <kPlus> +
  460. " map! <Esc>OS -
  461.  
  462. let g:nerdtree_tabs_open_on_console_startup=0
  463.  
  464. " tagbar
  465. nmap <F8> :TagbarToggle<CR>
  466.  
  467. " groovy for tagbar
  468. let g:tagbar_type_groovy = {
  469. \ 'ctagstype' : 'groovy',
  470. \ 'kinds' : [
  471. \ 'p:package:1',
  472. \ 'c:classes',
  473. \ 'i:interfaces',
  474. \ 't:traits',
  475. \ 'e:enums',
  476. \ 'm:methods',
  477. \ 'f:fields:1'
  478. \ ]
  479. \ }
  480.  
  481. " (Optional)Remove Info(Preview) window
  482. " set completeopt-=preview
  483.  
  484. " (Optional)Hide Info(Preview) window after completions
  485. autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
  486. autocmd InsertLeave * if pumvisible() == 0|pclose|endif
  487.  
  488. " vim-commentary
  489. " autocmd FileType terraform setlocal commentstring=#\ %s
  490.  
  491. " Clear last search highlighting
  492. " map <Space> :noh<cr>
  493. " nnoremap <cr> :noh<CR><CR>:<backspace>
  494. nnoremap <esc><esc> :noh<return>
  495.  
  496. " show ALE in vim-airline statusline
  497. let g:airline#extensions#ale#enabled = 1
  498.  
  499. " format JSON shortcut
  500. com! FormatJSON %!python -m json.tool
  501.  
  502. " disable ALE on startup
  503. let g:ale_enabled = 0
  504.  
  505. " indentline
  506. let g:indentLine_char = ' '
  507. let g:indentLine_bgcolor_term = 235
  508.  
  509. " unicode symbols
  510.  
  511. " terraform
  512. let g:terraform_align=1
  513. let g:terraform_fold_sections=1
  514. au FileType terraform setlocal foldlevel=0
  515. let g:terraform_remap_spacebar=1
  516. autocmd FileType terraform setlocal commentstring=#%s
  517.  
  518. " Dash
  519. :nmap <silent> <leader>d <Plug>DashSearch
  520.  
  521. " Neoformat
  522. let g:neoformat_terraform = {
  523. \ 'exe': 'terraform',
  524. \ 'args': ['fmt'],
  525. \ 'replace': 0,
  526. \ 'stdin': 0,
  527. \ 'valid_exit_codes': [0, 23],
  528. \ 'no_append': 1,
  529. \ }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement