Another copy of my dotfiles. Because I don't completely trust GitHub.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

200 lines
6.1 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. " XDG Base Directory Specification
  2. set runtimepath^=$XDG_CONFIG_HOME/vim
  3. set runtimepath+=$XDG_DATA_HOME/vim
  4. set runtimepath+=$XDG_CONFIG_HOME/vim/after
  5. set packpath^=$XDG_DATA_HOME/vim,$XDG_CONFIG_HOME/vim
  6. set packpath+=$XDG_CONFIG_HOME/vim/after,$XDG_DATA_HOME/vim/after
  7. let g:netrw_home = $XDG_DATA_HOME."/vim"
  8. call mkdir($XDG_DATA_HOME."/vim/spell", 'p')
  9. set viewdir=$XDG_DATA_HOME/vim/view | call mkdir(&viewdir, 'p')
  10. set backupdir=$XDG_CACHE_HOME/vim/backup | call mkdir(&backupdir, 'p')
  11. set directory=$XDG_CACHE_HOME/vim/swap | call mkdir(&directory, 'p')
  12. set undodir=$XDG_CACHE_HOME/vim/undo | call mkdir(&undodir, 'p')
  13. let s:MRU_File = $XDG_CACHE_HOME."/vim/mru"
  14. if !has('nvim') | set viminfofile=$XDG_CACHE_HOME/vim/viminfo | endif
  15. source ~/.config/vim/plugin/plugins.vim
  16. " Set leader
  17. let mapleader = ","
  18. noh
  19. " Leader Mappings
  20. map <Leader>w :update<CR>
  21. map <Leader>q :qall<CR>
  22. map <Leader>gs :Gstatus<CR>
  23. " Recently edited files
  24. map <Leader>h :History<CR>
  25. " CtrlP use FZF (faster!)
  26. nnoremap <C-p> :Files<CR>
  27. nnoremap <leader>b :Buffers<CR>
  28. noremap <leader>u :w<Home>silent <End> !urlview<CR>
  29. syntax on
  30. filetype plugin on
  31. autocmd Filetype scss if getfsize(@%) > 300 | setlocal syntax=OFF | endif
  32. augroup twig_ft
  33. au!
  34. autocmd BufNewFile,BufRead *.html.inky set syntax=eruby
  35. augroup END
  36. set autoread " Auto reload changed files
  37. set wildmenu " Tab autocomplete in command mode
  38. set backspace=indent,eol,start " http://vi.stackexchange.com/a/2163
  39. set laststatus=2 " Show status line on startup
  40. set splitright " Open new splits to the right
  41. set splitbelow " Open new splits to the bottom
  42. set lazyredraw " Reduce the redraw frequency
  43. set ttyfast " Send more characters in fast terminals
  44. set nowrap " Don't wrap long lines
  45. set listchars=extends:→ " Show arrow if line continues rightwards
  46. set listchars+=precedes:← " Show arrow if line continues leftwards
  47. set nobackup nowritebackup noswapfile " Turn off backup files
  48. set noerrorbells novisualbell " Turn off visual and audible bells
  49. set expandtab shiftwidth=2 tabstop=2 " Two spaces for tabs everywhere
  50. set history=500
  51. set hidden " Save buffers automatically
  52. set ignorecase smartcase " Search queries intelligently set case
  53. set incsearch " Show search results as you type
  54. set timeoutlen=1000 ttimeoutlen=0 " Remove timeout when hitting escape
  55. set showcmd " Show size of visual selection
  56. set cmdheight=2
  57. set t_Co=256
  58. set clipboard=unnamedplus
  59. set shortmess+=c
  60. set updatetime=300
  61. if has("patch-8.1.1564")
  62. " Recently vim can merge signcolumn and number column into one
  63. set signcolumn=number
  64. else
  65. set signcolumn=yes
  66. endif
  67. " Persistent undo
  68. set undodir=~/.local/share/vim/undo/
  69. set undofile
  70. set undolevels=1000
  71. set undoreload=10000
  72. " Ignored files/directories from autocomplete (and CtrlP)
  73. set wildignore+=*/tmp/*
  74. set wildignore+=*.so
  75. set wildignore+=*.zip
  76. set wildignore+=*/vendor/bundle/*
  77. set wildignore+=*/node_modules/
  78. "-------------------------------------------------------------------------------
  79. " Interface
  80. "-------------------------------------------------------------------------------
  81. set number " Enable line numbers
  82. set scrolloff=5 " Leave 5 lines of buffer when scrolling
  83. set sidescrolloff=10 " Leave 10 characters of horizontal buffer when scrolling
  84. "-------------------------------------------------------------------------------
  85. " Colors & Formatting
  86. "-------------------------------------------------------------------------------
  87. let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
  88. let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
  89. if (has("termguicolors"))
  90. set termguicolors
  91. endif
  92. let g:material_theme_style='ocean-community'
  93. let g:material_style='ocean'
  94. set background=dark
  95. try
  96. colorscheme material
  97. catch /^Vim\%((\a\+)\)\=:E185/
  98. colorscheme default
  99. endtry
  100. " Showcase comments in italics
  101. highlight Comment cterm=italic gui=italic
  102. " Easy tab navigation
  103. nnoremap <C-Left> :tabprevious<CR>
  104. nnoremap <C-Right> :tabnext<CR>
  105. " Golang specific settings
  106. let g:go_highlight_build_constraints = 1
  107. let g:go_highlight_extra_types = 1
  108. let g:go_highlight_fields = 1
  109. let g:go_highlight_functions = 1
  110. let g:go_highlight_methods = 1
  111. let g:go_highlight_operators = 1
  112. let g:go_highlight_structs = 1
  113. let g:go_highlight_types = 1
  114. let g:go_auto_type_info = 1
  115. let g:go_fmt_command = "goimports"
  116. " Find/replace
  117. vnoremap <C-r> "hy:%s/<C-r>h//g<left><left><left>
  118. " Disable highlight
  119. nnoremap <leader>e :noh<CR>
  120. " let g:auto_save = 1 " enable AutoSave on Vim startup
  121. " let g:auto_save_in_insert_mode = 0 " do not save in insert mode
  122. " Get off my lawn - helpful when learning Vim :)
  123. nnoremap <C-c> :echoe "Use Esc"<CR>
  124. nnoremap <Left> :echoe "Use h"<CR>
  125. nnoremap <Right> :echoe "Use l"<CR>
  126. nnoremap <Up> :echoe "Use k"<CR>
  127. nnoremap <Down> :echoe "Use j"<CR>
  128. nnoremap <silent> <Leader>+ :exe "resize " . (winheight(0) * 3/2)<CR>
  129. nnoremap <silent> <Leader>- :exe "resize " . (winheight(0) * 2/3)<CR>
  130. let g:Tlist_WinWidth = 40
  131. " Syntastic max file size for python
  132. let g:syntastic_python_pylint_post_args="--max-line-length=120"
  133. "-------------------------------------------------------------------------------
  134. " Neovim-specific configurations
  135. "-------------------------------------------------------------------------------
  136. if has('nvim')
  137. let $NVIM_TUI_ENABLE_TRUE_COLOR=1
  138. set termguicolors
  139. " Fix vim-tmux-navigator <C-h> https://git.io/viGRU
  140. nmap <BS> <C-W>h
  141. " Fix vim-tmux-navigator <C-h> https://git.io/vS5QH
  142. nmap <BS> :<C-u>TmuxNavigateLeft<CR>
  143. endif
  144. " Don't clear clipboard on exit
  145. autocmd VimLeave * call system("xsel -ib", getreg('+'))
  146. " Useful for GDB debugging
  147. packadd termdebug
  148. " Use skeleton files
  149. if has("autocmd")
  150. augroup templates
  151. autocmd BufNewFile *.* silent! execute '0r ~/.local/share/vim/templates/skeleton.'.expand("<afile>:e")
  152. autocmd BufNewFile * %substitute#\[:VIM_EVAL:\]\(.\{-\}\)\[:END_EVAL:\]#\=eval(submatch(1))#ge
  153. augroup END
  154. autocmd BufWinLeave *.tex !texclear %:p
  155. endif