-
Notifications
You must be signed in to change notification settings - Fork 11
/
.vimrc
184 lines (151 loc) · 3.79 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
set nocompatible
filetype off
set rtp+=~/.vim
filetype plugin indent on
"Plugings
"========
call plug#begin('~/.vim/plugged')
Plug 'Lokaltog/vim-easymotion'
Plug 'scrooloose/nerdtree'
Plug 'airblade/vim-gitgutter'
Plug 'christoomey/vim-tmux-navigator'
Plug 'editorconfig/editorconfig-vim'
Plug 'gcmt/breeze.vim'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'tomtom/tcomment_vim'
Plug 'tpope/vim-endwise'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-unimpaired'
Plug 'w0rp/ale'
Plug 'glacambre/firenvim', { 'do': { _ -> firenvim#install(0) } }
call plug#end()
"General Config
"==============
let mapleader=" "
set noerrorbells
set autoread
set tabstop=4 shiftwidth=4 expandtab
set showmode
set backspace=indent,eol,start
set showcmd
set autoindent
set cursorline
au BufWritePre * :%s/\s\+$//e "Strip trailing space on save
au FocusLost * :wa "save on focus lost
"Tabs
"====
au FileType python setl ts=4 sts=4 sw=4
au FileType json setl ts=2 sts=2 sw=2
au FileType scala setl ts=2 sts=2 sw=2
au FileType gitcommit setlocal tw=72 spell "spell git commit messages
au FileType md setl spell "spell git commit messages
au bufwritepost .vimrc source $MYVIMRC
nmap <leader>v :tabedit $MYVIMRC<CR>
set noswapfile " Don't use swapfile
set nobackup " Don't create annoying backup files
set splitright " Split vertical windows right to the current windows
set splitbelow " Split horizontal windows below to the current windows
set encoding=utf-8 " Set default encoding to UTF-8
set wildmenu
set rnu
set fillchars=vert:│,fold:- "nicer splits
highlight VertSplit cterm=none ctermbg=none ctermfg=247
"Escaping
"========
imap jk <Esc>
" Change current word - kill
noremap K ciw
"Show nice tabs
"===============
set listchars=tab:>-,trail:~,extends:>,precedes:<
set list
"Styling
"=======
set t_Co=256
colorscheme molokai
let g:molokai_original = 1
let g:rehash256 = 1
"Sets the proper font for GVIM.
"==============================
if has("gui_running")
set lines=45
set columns=84
set guioptions-=T "Strips the tabbar
if has("win32")
set guifont=Sauce_Code_Powerline:h11:cANSI
else
set guifont=Source\ Code\ Pro\ for\ Powerline
endif
endif
set number
syntax on
"Better Search
"=============
set ignorecase
set smartcase
set incsearch
set hlsearch
"Buffer Helpers
"===========
map <C-left> :bp<cr>
map <C-right> :bn<cr>
"Vmap for maintain Visual Mode after shifting > and <
"====================================================
vmap < <gv
vmap > >gv
"Tab Helpers
"===========
map <C-t><up> :tabr<cr>
map <C-t><down> :tabl<cr>
map <C-t><left> :tabp<cr>
map <C-t><right> :tabn<cr>
map <C-t>t :tabnew
"Quitting in style
"=================
cab W! w!
cab Q! q!
cab Wq wq
cab Wa wa
cab wQ wq
cab WQ wq
cab W w
cab Q q
:map Q <Nop> "Disabling ex mode
"Git
"===
noremap <Leader>ga :!git add .<CR>
noremap <Leader>gc :!git commit -m '<C-R>="'"<CR>
noremap <Leader>gp :!git push<CR>
noremap <Leader>gs :Gstatus<CR>
noremap <Leader>gb :Gblame<CR>
noremap <Leader>gd :Gvdiff<CR>
noremap <Leader>gr :Gremove<CR>
set ttimeoutlen=50
"JSHint
"======
let g:syntastic_javascript_checkers = ['jshint']
let g:syntastic_javascript_jshint_conf = '~/.jshintrc'
"Copy/Paste/Cut
"==============
noremap YY "+y<CR>
noremap P "+gP<CR>
noremap XX "+x<CR>
nnoremap <leader>j :%!jq .<CR>
"Tmux
"====
let g:tmux_navigator_save_on_switch = 1
"Tab Autocomplete
"================
function! Tab_Or_Complete()
if col('.')>1 && strpart( getline('.'), col('.')-2, 3 ) =~ '^\w'
return "\<C-N>"
else
return "\<Tab>"
endif
endfunction
inoremap <Tab> <C-R>=Tab_Or_Complete()<CR>
"CTRL P
"======
let g:ctrlp_custom_ignore = 'logs\|target/\|node_modules\|DS_Store\|git'