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.

204 lines
6.4 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 ~/.local/share/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. " Use tab for trigger completion with characters ahead and navigate.
  62. " Use command ':verbose imap <tab>' to make sure tab is not mapped by other plugin.
  63. inoremap <silent><expr> <TAB>
  64. \ pumvisible() ? "\<C-n>" :
  65. \ <SID>check_back_space() ? "\<TAB>" :
  66. \ coc#refresh()
  67. inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
  68. " Persistent undo
  69. set undodir=~/.local/share/vim/undo/
  70. set undofile
  71. set undolevels=1000
  72. set undoreload=10000
  73. " Ignored files/directories from autocomplete (and CtrlP)
  74. set wildignore+=*/tmp/*
  75. set wildignore+=*.so
  76. set wildignore+=*.zip
  77. set wildignore+=*/vendor/bundle/*
  78. set wildignore+=*/node_modules/
  79. "-------------------------------------------------------------------------------
  80. " Interface
  81. "-------------------------------------------------------------------------------
  82. set number " Enable line numbers
  83. set scrolloff=5 " Leave 5 lines of buffer when scrolling
  84. set sidescrolloff=10 " Leave 10 characters of horizontal buffer when scrolling
  85. "-------------------------------------------------------------------------------
  86. " Colors & Formatting
  87. "-------------------------------------------------------------------------------
  88. let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
  89. let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
  90. if (has("termguicolors"))
  91. set termguicolors
  92. endif
  93. let g:material_theme_style='ocean-community'
  94. let g:material_style='ocean'
  95. set background=dark
  96. try
  97. colorscheme material
  98. catch /^Vim\%((\a\+)\)\=:E185/
  99. colorscheme default
  100. endtry
  101. " Showcase comments in italics
  102. highlight Comment cterm=italic gui=italic
  103. " Easy tab navigation
  104. nnoremap <C-Left> :tabprevious<CR>
  105. nnoremap <C-Right> :tabnext<CR>
  106. " Golang specific settings
  107. let g:go_highlight_build_constraints = 1
  108. let g:go_highlight_extra_types = 1
  109. let g:go_highlight_fields = 1
  110. let g:go_highlight_functions = 1
  111. let g:go_highlight_methods = 1
  112. let g:go_highlight_operators = 1
  113. let g:go_highlight_structs = 1
  114. let g:go_highlight_types = 1
  115. let g:go_auto_type_info = 1
  116. let g:go_fmt_command = "goimports"
  117. " Find/replace
  118. vnoremap <C-r> "hy:%s/<C-r>h//g<left><left><left>
  119. " Disable highlight
  120. nnoremap <leader>e :noh<CR>
  121. " let g:auto_save = 1 " enable AutoSave on Vim startup
  122. " let g:auto_save_in_insert_mode = 0 " do not save in insert mode
  123. " Get off my lawn - helpful when learning Vim :)
  124. nnoremap <C-c> :echoe "Use Esc"<CR>
  125. nnoremap <Left> :echoe "Use h"<CR>
  126. nnoremap <Right> :echoe "Use l"<CR>
  127. nnoremap <Up> :echoe "Use k"<CR>
  128. nnoremap <Down> :echoe "Use j"<CR>
  129. nnoremap <silent> <Leader>+ :exe "resize " . (winheight(0) * 3/2)<CR>
  130. nnoremap <silent> <Leader>- :exe "resize " . (winheight(0) * 2/3)<CR>
  131. let g:Tlist_WinWidth = 40
  132. " Syntastic max file size for python
  133. let g:syntastic_python_pylint_post_args="--max-line-length=120"
  134. "-------------------------------------------------------------------------------
  135. " Neovim-specific configurations
  136. "-------------------------------------------------------------------------------
  137. if has('nvim')
  138. let $NVIM_TUI_ENABLE_TRUE_COLOR=1
  139. set termguicolors
  140. " Fix vim-tmux-navigator <C-h> https://git.io/viGRU
  141. nmap <BS> <C-W>h
  142. " Fix vim-tmux-navigator <C-h> https://git.io/vS5QH
  143. nmap <BS> :<C-u>TmuxNavigateLeft<CR>
  144. endif
  145. " Don't clear clipboard on exit
  146. autocmd VimLeave * call system("xsel -ib", getreg('+'))
  147. " Useful for GDB debugging
  148. packadd termdebug
  149. " Use skeleton files
  150. if has("autocmd")
  151. augroup templates
  152. autocmd BufNewFile main.* silent! execute '0r ~/.local/share/vim/templates/skeleton-main.'.expand("<afile>:e")
  153. autocmd BufNewFile *.* silent! execute '0r ~/.local/share/vim/templates/skeleton.'.expand("<afile>:e")
  154. autocmd BufNewFile * %substitute#\[:VIM_EVAL:\]\(.\{-\}\)\[:END_EVAL:\]#\=eval(submatch(1))#ge
  155. augroup END
  156. autocmd BufWinLeave *.tex !texclear %:p
  157. endif