Advertisement
Guest User

Untitled

a guest
Aug 20th, 2018
978
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 10.21 KB | None | 0 0
  1. "=======================
  2. "====== FILE TYPES =====
  3. "=======================
  4. au BufNewFile,BufRead *.yaml set filetype=yaml
  5. au BufNewFile,BufRead *.yml set filetype=yaml
  6. au BufNewFile,BufRead *.rs set filetype=rust
  7. autocmd BufNewFile,BufReadPost *.wast,*.wat setlocal filetype=wast
  8. "=============================
  9. "====== EDITOR SETTINGS ======
  10. "=============================
  11. set nocompatible "use things vi can't
  12. filetype indent plugin on "required, makes everything nicer
  13. set synmaxcol=319 "to help keep things from slowing down with long horizontal lines
  14. set hidden "stash unwritten files in buffer
  15. set noswapfile "no swap files because they suck
  16. set wildmenu "tabcomplete for some commands
  17. set showcmd "count highlighted
  18. set hlsearch "hightlight search results
  19. set ignorecase "ignore case when searching
  20. set smartcase "but don't ignore case if I use an uppercase letter
  21. set backspace=indent,eol,start "backspace over indents eol and sol
  22. set nostartofline  "make some movements more intuitive regarding SoL
  23. set confirm "don't quietly fail because of unsaved file, ask first
  24. set cmdheight=2 "Number of lines to use for command line
  25. set autoread "update file when it is changed but not deleted in the filesystem
  26. set notimeout ttimeout ttimeoutlen=200 "timeout for key bindings
  27. "use F7 for formatting
  28. map <F7> mzgg=G`z`
  29. set nobackup "save on clutterish backup files
  30. set tabstop=2 "indent using a tab size of 2 spaces
  31. set softtabstop=2 "^^^
  32. set autoindent "^^^
  33. set shiftwidth=2 "^^^
  34. set noet "use tabs for indentation becasue tabs > spaces
  35. autocmd FileType * set noexpandtab "force noexpandtab for all file types
  36. colorscheme badwolf "set the colour scheme to badwolf
  37. set t_Co=256 "Make vim think we have all the colours!
  38. set cursorline "Be very obvious about what line you are on
  39. set nowrap "Don't wrap long lines
  40. set incsearch "incremental search for performance in larger files
  41. set wrapscan "wrap around the file when searching
  42. set list listchars=tab:\|\ "show tabs as |
  43. set list "load the list changes
  44. let mapleader=" " "set the mapleader character to space (%20)
  45. let g:indentLine_color_term = 239 "set the space indent colour
  46. set cc=150 "horizonal rule at the 150th character
  47.  
  48. "====================================
  49. "====== EDITOR STATUS DISPLAYS ======
  50. "====================================
  51.  
  52. set ruler "Display cursor position on last line of screen or in status line
  53. set number "show line number
  54. set relativenumber "for any line I'm not on show the line number relative to the cursour
  55. set laststatus=2 "always show status line
  56. set novisualbell "don't be annoying when I fuck up
  57. set title "Change the title of the terminal
  58. set history=1000 "Cap to a decent history size for cmd history
  59. hi NonText ctermbg=none
  60. hi Normal guibg=NONE ctermbg=NONE
  61.  
  62. "=============================
  63. "====== SYNTAX SETTINGS ======
  64. "============================
  65.  
  66. syntax on "syntax highlighting
  67. syntax sync minlines=256 "Life saving for large files and slow machines
  68. set synmaxcol=2048 "same as minlines but for how far out to hightlight lines
  69. set autoindent "keep code pretty and indented
  70. set smartindent "be even better about keeping code pretty
  71.  
  72. "=========================================
  73. "====== MODIFY TERMINAL ENVIRONMENT ======
  74. "=========================================
  75.  
  76. if &term =~ '256color'
  77.   " disable Background Color Erase (BCE) so that color schemes
  78.   " render properly when inside 256-color tmux and GNU screen.
  79.   " see also http://snk.tuxfamily.org/log/vim-256color-bce.html
  80.   set t_ut=
  81. endif
  82.  
  83. "=================================
  84. "====== CUSTOM KEY BINDINGS ======
  85. "=================================
  86.  
  87. "--------------------------
  88. "----disable arrow keys----
  89. "--------------------------
  90. noremap  <up> <nop>
  91. inoremap <up> <nop>
  92.  
  93. noremap <down> <nop>
  94. inoremap <down> <nop>
  95.  
  96. noremap <left> <nop>
  97. noremap <right> <nop>
  98.  
  99. inoremap <left> <nop>
  100. inoremap <right> <nop>
  101. " B A start
  102. " Joke shamelessly stolen from this blog post https://tylercipriani.com/blog/2017/06/14/literate-vimrc
  103.  
  104. "------------------------------------
  105. "---- screen splitting shortcuts ----
  106. "------------------------------------
  107. nmap <Leader><bar> :vsplit<CR>
  108.  
  109. "=============================
  110.  
  111. "=============================
  112. "====== PLUGIN SETTINGS ======
  113. "=============================
  114.  
  115. "------------------------
  116. "====Rainbow Brackets==== colours brackets by nesting level
  117. "------------------------
  118.  
  119. let g:rainbow_active = 1 "enable rainbow brackets
  120. let g:paredit_mode = 1 "work with paredit plugin
  121. au VimEnter * RainbowParenthesesToggle "toggle it on when starting vim and vimrc has been loaded
  122. au Syntax * RainbowParenthesesLoadRound "load colours for round brackets for any syntax
  123. au Syntax * RainbowParenthesesLoadSquare "load colours for square brackets for any syntax
  124. au Syntax * RainbowParenthesesLoadBraces "load colours for braces for any syntax
  125. "because the template files have weird bracketing and make this plugin kill
  126. "vims speed
  127. autocmd FileType yaml let g:rainbow_active = 0
  128. autocmd FileType yaml let g:paredit_mode = 0
  129. autocmd FileType yaml au VimEnter * RainbowParenthesesToggle
  130. autocmd FileType yaml au Syntax * RainbowParenthesesLoadSquare "load colours for square brackets for any syntax
  131. autocmd FileType yaml au Syntax * RainbowParenthesesLoadBraces "load colours for braces for any syntax
  132.  
  133. "------------------------
  134. "====airline settings==== "Lightweight status line enchancements
  135. "------------------------
  136.  
  137. let g:airline_theme='badwolf' "Match the colour scheme
  138. let g:airline_exclude_preview = 1 "Don't show preview in a preview window
  139. let g:bufferline_echo = 0  "Don't echo the bufferline
  140. let g:airline#extensions#bufferline#enabled = 0 "Disable settings for use with bufferline
  141. let g:airline#extensions#branch#enabled = 1 "Enable git integration with vim fugitive
  142. let g:airline_detect_spell = 0 "Don't show if in spell mode or not
  143. let g:airline_powerline_fonts = 1 "Use the power line fonts (may need to patch fonts)
  144.  
  145. "---------------------------
  146. "===Vim Clojure Highlight=== "A plugin to further highlight clj code
  147. "---------------------------
  148. autocmd BufRead *.clj try | silent! Require | catch /^Fireplace/ | endtry
  149.  
  150. "------------------
  151. "======TagBar======
  152. "------------------
  153. "open / close the tag bar for navigation
  154. "Use this binding if you prefer the defautl behaviour of CTRL-T
  155. "nmap <Leader><t> :TagbarToggle<CR>
  156. nmap <C-T> :TagbarToggle<CR>
  157. "show line number and relative line number in tagbar window
  158. let g:tagbar_show_linenumbers = 3
  159.  
  160. "-----------------
  161. "======Snipe======
  162. "-----------------
  163. "More accurate forward / backward jumping with f/F
  164. map f <Plug>(snipe-f)
  165. map F <plug>(snipe-F)
  166.  
  167. "------------------------
  168. "=====LanguageClient=====
  169. "------------------------
  170. let g:LanguageClient_serverCommands = {
  171.     \ 'rust': ['rustup', 'run', 'nightly', 'rls'],
  172.     \ 'javascript': ['javascript-typescript-stdio'],
  173.     \ 'javascript.jsx': ['javascript-typescript-stdio'],
  174.         \ 'go': ['go-langserver'],
  175.         \ 'golang': ['go-langserver']
  176.     \ }
  177.  
  178. "---------------
  179. "=====CtrlP=====
  180. "---------------
  181. let g:ctrlp_working_path_mode = 'ra'
  182.  
  183. "--------------------------
  184. "=====Vim-Docker-Tools=====
  185. "--------------------------
  186. let g:dockertools_docker_host = 'unix:///var/run/docker.sock'
  187. let g:dockertools_user_key_mapping = {'ui-filter' : 'W'}
  188.  
  189.  
  190. "============================
  191. "=====Language Functions=====
  192. "============================
  193.  
  194. "------------------------
  195. "=====Edit With Tabs=====
  196. "------------------------
  197. "For passed in filetype
  198. "Open file type and conver tabs to spaces
  199. "Before saving convert tabs back to spaces
  200. "After saving convert spaces back to tabs
  201.  
  202. function! EditWithTabs(ft)
  203.     execute "au BufRead " . a:ft . " %retab!"
  204.     execute "au BufWritePre " . a:ft . " set expandtab"
  205.     execute "au BufWritePre " . a:ft . " %retab!"
  206.     execute "au BufWritePost " . a:ft . " set noexpandtab"
  207.     execute "au BufWritePost " . a:ft . " %retab!"
  208. endfunction
  209.  
  210. "===========================
  211. "=====Language Settings=====
  212. "===========================
  213.  
  214.  
  215. "----------------
  216. "=====Python=====
  217. "----------------
  218. call EditWithTabs("*.py")
  219.  
  220. autocmd FileType python AutoFormatBuffer yapf
  221. autocmd FileType python match ErrorMsg '\%>120v.\+'
  222. autocmd FileType python match ErrorMsg '\%>120v.\+'
  223. autocmd FileType python noremap <silent> K :call LanguageClient_textDocument_hover()<CR>
  224. autocmd FileType python noremap <silent> gd :call LanguageClient_textDocument_definition()<CR>
  225. autocmd FileType python noremap <silent> <F2> :call LanguageClient_textDocument_rename()<CR>
  226. autocmd FileType python noremap <silent> <C-A-f> :call LanguageClient_textDocument_formatting()<CR>
  227. autocmd! FileType python packadd LanguageClient-neovim
  228.  
  229. "--------------
  230. "=====Yaml=====
  231. "--------------
  232. call EditWithTabs('*.yaml')
  233. call EditWithTabs('*.yml')
  234.  
  235. "------------
  236. "=====Go=====
  237. "------------
  238. autocmd! FileType go packadd gopack
  239. autocmd FileType go AutoFormatBuffer gofmt
  240. autocmd FileType go noremap <silent> K :call LanguageClient_textDocument_hover()<CR>
  241. autocmd FileType go noremap <silent> gd :call LanguageClient_textDocument_definition()<CR>
  242. autocmd FileType go noremap <silent> <F2> :call LanguageClient_textDocument_rename()<CR>
  243. autocmd FileType go noremap <silent> <C-A-f> :call LanguageClient_textDocument_formatting()<CR>
  244. autocmd FileType go let g:tagbar_type_go = {
  245.     \ 'ctagstype' : 'go',
  246.     \ 'kinds'     : [
  247.         \ 'p:package',
  248.         \ 'i:imports:1',
  249.         \ 'c:constants',
  250.         \ 'v:variables',
  251.         \ 't:types',
  252.         \ 'n:interfaces',
  253.         \ 'w:fields',
  254.         \ 'e:embedded',
  255.         \ 'm:methods',
  256.         \ 'r:constructor',
  257.         \ 'f:functions'
  258.     \ ],
  259.     \ 'sro' : '.',
  260.     \ 'kind2scope' : {
  261.         \ 't' : 'ctype',
  262.         \ 'n' : 'ntype'
  263.     \ },
  264.     \ 'scope2kind' : {
  265.         \ 'ctype' : 't',
  266.         \ 'ntype' : 'n'
  267.     \ },
  268.     \ 'ctagsbin'  : 'gotags',
  269.     \ 'ctagsargs' : '-sort -silent'
  270. \ }
  271.  
  272.  
  273. "===============
  274. "==== RUST =====
  275. "===============
  276. autocmd FileType rust packadd rustpack
  277.  
  278. "================
  279. "===== WASM =====
  280. "================
  281. autocmd FileType wast packadd wasmpack
  282.  
  283. "-----------------
  284. "=====Clojure=====
  285. "-----------------
  286. autocmd FileType clojure packadd clojure
  287.  
  288. "=====================
  289. "===== Help Tags =====
  290. "=====================
  291.  
  292. silent! helptags ALL
  293.  
  294. "=====================================
  295. "===== END OF VIMRC REQUIREMENTS =====
  296. "=====================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement