-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
190 lines (165 loc) · 5.4 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
""""""" PATHOGEN """"""""
execute pathogen#infect()
execute pathogen#helptags()
"YouCompleteMe
"ag.vim
"ctrlp.vim
"gundo.vim nerdtree
"syntastic
"ultisnips
"vim-airline
"vim-fugitive
"vim-json
"vim-ruby
"vim-snippets
"jedi-vim
"""""""" COLOR SCHEME """"""""
""let g:solarized_termcolors=256
colorscheme solarized
set t_Co=256
syntax enable
set background=dark
"""""""" GLOBAL """"""""
set nocompatible " old vi compatibility
set nobackup " don't save a working copy
set ruler " show the cursor position all the time
set completeopt=menuone " auto-complete ctrl-x ctrl-p
set history=100 " keep last commands
"set clipboard=unnamed " +p paste OS clipboard
"set modeline " load configs as a comment from files (insecure)
"set smartindent
"set autoindent
set tabstop=2
"set softtabstop=2
set expandtab
set shiftwidth=2
set nrformats-=octal
set cursorline
set shortmess+=I " Disable welcome message
set encoding=utf-8 " Set default encoding
set hidden " Hide buffers on switching instead of abandoning them
set autoread " Autoload hidden buffers on change
" j and k go by actual line on the screen and not the entire wrapped line
nnoremap j gj
nnoremap k gk
" Make backspace work
set backspace=indent,eol,start
filetype plugin on " load plugins
highlight SpecialKey term=standout ctermbg=red guibg=red
set listchars=tab:▸\ ,eol:¬,trail:~,extends:>,precedes:<,nbsp:_
" Maintain viminfo file
set viminfo='10,\"100,:20,%,n~/.vimstash/viminfo
set backupdir=~/.vimstash/backups
set directory=~/.vimstash/swaps
if exists("&undodir")
set undofile
set undodir=~/.vimstash/undo
endif
augroup vimrc
autocmd!
augroup END
" Restore last edit location when opening a file
autocmd vimrc BufReadPost * if line("'\"") > 0 && line ("'\"") <= line("$") | exe "normal g'\"" | endif
""""""""" SEARCH """"""""
set ignorecase " Ignore case when searching
set smartcase " Unless the search term has capital letters
"set gdefault " Global search and replace by default; use s/a/b/g to override
set incsearch " Start searching as soon as text is typed
"set showmatch " Jump back to matching bracket briefly when closing one is inserted.
set hlsearch " Highlight search results. Can be annoying, so
"""""""" KEY SHORTCUTS """"""""
" Stop accidentally triggering help
inoremap <F1> <ESC>
nnoremap <F1> <ESC>
vnoremap <F1> <ESC>
let mapleader = ","
" leader+space will clear it.
nnoremap <leader><space> :noh<cr>
" Meh, using leader key is much faster!
noremap <F2> :set fileformat=unix<CR>
noremap <F3> :set list!<CR>
noremap <F4> :GundoToggle<CR>
noremap <F5> :set paste!<CR>
noremap <F6> :let g:syntastic_quiet_messages = {}<CR>
" HEX editor
noremap <F7> :%!xxd<CR>
noremap <F8> :%!xxd -r<CR>
noremap <F9> :w !sudo tee %<CR>
nnoremap <leader>u :GundoToggle<CR>
nnoremap <leader>p :set paste!<CR>
nnoremap <leader>t :NERDTreeToggle<CR>
nnoremap <leader>l :set list!<CR>
nnoremap <leader>n :set relativenumber! number!<CR>
nnoremap <leader>g :GitGutterSignsToggle<CR>
nnoremap <leader>c :NeoComplCacheEnable<CR>
nnoremap <leader>y :let g:ycm_auto_trigger=0<CR>
nnoremap <leader>Y :let g:ycm_auto_trigger=1<CR>
nnoremap <leader>s :w !sudo tee %<CR>
" hardmode
"noremap <Up> <NOP>
"noremap <Down> <NOP>
"noremap <Left> <NOP>
"noremap <Right> <NOP>
"""""""" FILETYPE SPECIFICS """"""""
"""""""" PYTHON
au FileType python setlocal expandtab tabstop=4 shiftwidth=4 colorcolumn=80
"""""""" RUBY
au FileType ruby setlocal expandtab tabstop=2 shiftwidth=2 colorcolumn=120
au BufRead,BufNewFile Vagrantfile set filetype=ruby
"""""""" PERL
"au FileType perl setlocal tabstop=8 expandtab shiftwidth=8 softtabstop=8
"""""""" BASH
au FileType sh setlocal tabstop=2 expandtab shiftwidth=2 softtabstop=2
"""""""" C
au Filetype c setlocal shiftwidth=8 tabstop=8 noexpandtab colorcolumn=80
"""""""" YAML
"au BufNewFile,BufRead *.yaml,*.yml setf yaml
"""""""" JSON
"setfiletype json
let g:vim_json_syntax_conceal = 0
"""""""" PLUGIN SPECIFICS """"""""
"""""""" SYNTASTIC
let g:syntastic_check_on_open = 0
let g:syntastic_check_on_wq = 0
let g:syntastic_error_symbol = 'x'
let g:syntastic_warning_symbol = '!'
let g:syntastic_style_error_symbol = '>>'
let g:syntastic_style_warning_symbol = '>'
let g:syntastic_auto_loc_list = 1
let g:syntastic_enable_signs = 1
"let g:syntastic_quiet_messages = {'level': 'warnings'}
let g:syntastic_python_flake8_args='--ignore=F403'
let g:syntastic_python_flake8_args = "--max-line-length=120"
let g:syntastic_python_checkers = ['flake8', 'pylint']
let g:syntastic_c_checkers = ['checkpatch', 'gcc', 'make']
"let g:syntastic_disabled_filetypes = ['html']
"let g:syntastic_json_checker = "jsonlint"
"let g:syntastic_ruby_checkers = ['rubocop']
"""""""" CTRLP
let g:ctrlp_working_path_mode='a'
" Setup some default ignores
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/](\.(git|hg|svn)|\_site)$',
\ 'file': '\v\.(exe|so|dll|class|png|jpg|jpeg)$',
\}
" Open as tab
let g:ctrlp_prompt_mappings = {
\ 'AcceptSelection("e")': ['<c-t>'],
\ 'AcceptSelection("b")': ['<cr>', '<2-LeftMouse>'],
\}
"""""""" NERDTree
"""""""" AIRLINE
set laststatus=2
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
let g:airline_detect_paste=1
"let g:airline#extensions#tabline#fnamemod = ':t'
" Workaround for leaving insert mode delay with statusline active
if ! has('gui_running')
set ttimeoutlen=10
augroup FastEscape
autocmd!
au InsertEnter * set timeoutlen=0
au InsertLeave * set timeoutlen=1000
augroup END
endif