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.

141 lines
4.6 KiB

4 years ago
4 years ago
4 years ago
4 years ago
  1. "
  2. " Vim settings for @mscoutermarsh
  3. "
  4. " Settings in this file may depend on plugins, so let's install them first.
  5. " Not to be confused with the contents of ~/.vim/plugin/* which are
  6. " configuration options for each plugin and automatically loaded by Vim.
  7. source ~/.vim/plugin/plugins.vim
  8. " Set leader
  9. let mapleader = ","
  10. " Leader Mappings
  11. map <Leader>w :update<CR>
  12. map <Leader>q :qall<CR>
  13. map <Leader>gs :Gstatus<CR>
  14. " Recently edited files
  15. map <Leader>h :History<CR>
  16. " CtrlP use FZF (faster!)
  17. nnoremap <C-p> :Files<Cr>
  18. syntax on
  19. filetype plugin on
  20. autocmd Filetype scss if getfsize(@%) > 300 | setlocal syntax=OFF | endif
  21. augroup twig_ft
  22. au!
  23. autocmd BufNewFile,BufRead *.html.inky set syntax=eruby
  24. augroup END
  25. set autoread " Auto reload changed files
  26. set wildmenu " Tab autocomplete in command mode
  27. set backspace=indent,eol,start " http://vi.stackexchange.com/a/2163
  28. set laststatus=2 " Show status line on startup
  29. set splitright " Open new splits to the right
  30. set splitbelow " Open new splits to the bottom
  31. set lazyredraw " Reduce the redraw frequency
  32. set ttyfast " Send more characters in fast terminals
  33. set nowrap " Don't wrap long lines
  34. set listchars=extends:→ " Show arrow if line continues rightwards
  35. set listchars+=precedes:← " Show arrow if line continues leftwards
  36. set nobackup nowritebackup noswapfile " Turn off backup files
  37. set noerrorbells novisualbell " Turn off visual and audible bells
  38. set expandtab shiftwidth=2 tabstop=2 " Two spaces for tabs everywhere
  39. set history=500
  40. set hlsearch " Highlight search results
  41. set ignorecase smartcase " Search queries intelligently set case
  42. set incsearch " Show search results as you type
  43. set timeoutlen=1000 ttimeoutlen=0 " Remove timeout when hitting escape
  44. set showcmd " Show size of visual selection
  45. set termguicolors
  46. " Persistent undo
  47. set undodir=~/.vim/undo/
  48. set undofile
  49. set undolevels=1000
  50. set undoreload=10000
  51. " Ignored files/directories from autocomplete (and CtrlP)
  52. set wildignore+=*/tmp/*
  53. set wildignore+=*.so
  54. set wildignore+=*.zip
  55. set wildignore+=*/vendor/bundle/*
  56. set wildignore+=*/node_modules/
  57. "-------------------------------------------------------------------------------
  58. " Interface
  59. "-------------------------------------------------------------------------------
  60. set number " Enable line numbers
  61. set scrolloff=5 " Leave 5 lines of buffer when scrolling
  62. set sidescrolloff=10 " Leave 10 characters of horizontal buffer when scrolling
  63. "-------------------------------------------------------------------------------
  64. " Colors & Formatting
  65. "-------------------------------------------------------------------------------
  66. let g:material_style='oceanic'
  67. set background=dark
  68. colorscheme vim-material
  69. let g:airline_theme='material'
  70. " Showcase comments in italics
  71. highlight Comment cterm=italic gui=italic
  72. " Open most recently used files on start
  73. " autocmd VimEnter * Mru .
  74. " Easy tab navigation
  75. nnoremap <C-Left> :tabprevious<CR>
  76. nnoremap <C-Right> :tabnext<CR>
  77. " Golang specific settings
  78. let g:go_highlight_build_constraints = 1
  79. let g:go_highlight_extra_types = 1
  80. let g:go_highlight_fields = 1
  81. let g:go_highlight_functions = 1
  82. let g:go_highlight_methods = 1
  83. let g:go_highlight_operators = 1
  84. let g:go_highlight_structs = 1
  85. let g:go_highlight_types = 1
  86. let g:go_auto_type_info = 1
  87. let g:go_fmt_command = "goimports"
  88. " Find/replace
  89. vnoremap <C-r> "hy:%s/<C-r>h//g<left><left><left>
  90. nnoremap <leader>e :noh<CR>
  91. " let g:auto_save = 1 " enable AutoSave on Vim startup
  92. " let g:auto_save_in_insert_mode = 0 " do not save in insert mode
  93. " Get off my lawn - helpful when learning Vim :)
  94. nnoremap <C-c> :echoe "Use Esc"<CR>
  95. nnoremap <Left> :echoe "Use h"<CR>
  96. nnoremap <Right> :echoe "Use l"<CR>
  97. nnoremap <Up> :echoe "Use k"<CR>
  98. nnoremap <Down> :echoe "Use j"<CR>
  99. nnoremap <silent> <Leader>+ :exe "resize " . (winheight(0) * 3/2)<CR>
  100. nnoremap <silent> <Leader>- :exe "resize " . (winheight(0) * 2/3)<CR>
  101. let g:Tlist_WinWidth = 40
  102. "
  103. "-------------------------------------------------------------------------------
  104. " Neovim-specific configurations
  105. "-------------------------------------------------------------------------------
  106. if has('nvim')
  107. let $NVIM_TUI_ENABLE_TRUE_COLOR=1
  108. set termguicolors
  109. " Fix vim-tmux-navigator <C-h> https://git.io/viGRU
  110. nmap <BS> <C-W>h
  111. " Fix vim-tmux-navigator <C-h> https://git.io/vS5QH
  112. nmap <BS> :<C-u>TmuxNavigateLeft<CR>
  113. endif