-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
100 lines (82 loc) · 2.99 KB
/
.vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
" Plug managed Vim plugins
" https://github.com/junegunn/vim-plug
call plug#begin('~/.vim/plugged')
Plug 'tpope/vim-sensible'
Plug 'airblade/vim-gitgutter'
Plug 'pearofducks/ansible-vim'
Plug 'ntpeters/vim-better-whitespace'
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
Plug 'pangloss/vim-javascript'
Plug 'tpope/vim-bundler'
Plug 'vim-ruby/vim-ruby'
Plug 'tpope/vim-rails'
Plug 'tpope/vim-surround'
Plug 'scrooloose/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug '/usr/local/opt/fzf'
Plug 'junegunn/fzf.vim'
Plug 'farmergreg/vim-lastplace'
call plug#end()
" Git Gutter config
" Always show the sign column for Git Gutter
set signcolumn=yes
" vim-better-whitespace config
let g:better_whitespace_enabled=1
let g:strip_whitespace_on_save=1
" pearofducks/ansible-vim
let g:ansible_unindent_after_newline = 1
" Offset scroll by 10 lines
set scrolloff=10
" Force a fast tty connection
set ttyfast
" Show line number and relative numbers
set number
set relativenumber
" Configure whitespace characters
set listchars=eol:¬,tab:>·,trail:~,extends:>,precedes:<,space:␣
" Apparently I'm supposed to be using ctags
set tags=tags
" Yank into the system clipboard
set clipboard=unnamed
" No need to be compatible with vi
set nocompatible
" Delete comment character when joining commented lines
set formatoptions+=j
" Enable backup files and store them in ~/.vim/backup
set backup
set writebackup
set backupdir=~/.vim/backup
" Enable swap files and store them in ~/.vim/swap
set directory=~/.vim/swap
" Show 80 character column if we can
if exists('+colorcolumn')
set colorcolumn=81
endif
" Use F1 to toggle line numbers
nmap <F1> :set number! relativenumber! relativenumber?<cr>
imap <F1> <C-O>:set number! relativenumber! relativenumber?<cr>
" Use Ctrl+z to use fzf for search
nnoremap <silent> <C-z> :FZF<CR>
" Change Leader to space for increased sanity
let mapleader = "\<Space>"
" Toggle paste with F2
nnoremap <F2> :set invpaste paste?<cr>
set pastetoggle=<F2>
" NERDTree Config
" open/close nerdtree window with -
map - :NERDTreeToggle<CR>
" ] inside any open file in vim will jump to the nerdtree and highlight where that file is -> very useful when you have multiple files open at once
map ] :NERDTreeFind<CR>
" Open nerdtree if vim was opened without file
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" Close vim if only NerdTree is left
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" FileType configs
" Get the 2-space YAML as the default when hit carriage return after the colon
autocmd FileType yaml setlocal expandtab shiftwidth=2 tabstop=2
" Get the 2-space Ruby as the default when hit carriage return after the colon
autocmd FileType ruby setlocal expandtab shiftwidth=2 tabstop=2
autocmd FileType eruby setlocal expandtab shiftwidth=2 tabstop=2
" Get the 4-space Python as the default when hit carriage return after the colon
autocmd FileType python setlocal expandtab shiftwidth=4 tabstop=4