-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathvimrc
165 lines (136 loc) · 3.33 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
" plugins
call plug#begin('~/.vim/plugged')
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'kien/ctrlp.vim'
Plug 'airblade/vim-gitgutter'
Plug 'ervandew/supertab'
Plug 'terryma/vim-multiple-cursors'
Plug 'matze/vim-move'
Plug 'scrooloose/nerdcommenter'
Plug 'Raimondi/delimitMate'
Plug 'scrooloose/syntastic'
Plug 'w0ng/vim-hybrid'
Plug 'othree/yajs.vim'
Plug 'moll/vim-node'
Plug 'altercation/vim-colors-solarized'
Plug 'tpope/vim-fugitive'
Plug 'editorconfig/editorconfig-vim'
"Plug 'nanotech/jellybeans.vim'
"Plug 'Lokaltog/vim-easymotion'
call plug#end()
" airline
set laststatus=2
set noshowmode
let g:airline_left_sep = ''
let g:airline_right_sep = ''
let g:airline#extensions#tabline#enabled = 1
let g:airline_theme='hybrid'
" gitgutter
set signcolumn=yes
set updatetime=750
" ctrlp
let g:ctrlp_custom_ignore = '\v[\/]\.(DS_Store|git|hg|svn)|node_modules$'
let g:ctrlp_show_hidden = 1
" move
let g:move_key_modifier = 'C'
" syntastic
"let g:syntastic_javascript_checkers = ['eslint']
" theme
syntax on
if !has("gui_running")
"let g:solarized_termtrans=1
let g:solarized_termcolors=256
endif
set background=dark
colorscheme hybrid
"hi LineNr ctermbg=NONE ctermfg=Black
"hi SignColumn ctermbg=NONE
" speed up
set ttyfast
set ttyscroll=3
" set lazyredraw
" config
let mapleader = ','
" buffers / files
nnoremap <Tab> :bnext<CR>
nnoremap <S-Tab> :bprevious<CR>
nnoremap <leader>q :bdelete<CR>
nnoremap <leader><leader> :w<CR>
" tabs / indent
set tabstop=2
set shiftwidth=2
set expandtab " spaces instead of tabs
set smartindent
set autoindent
set smarttab
" shift-tab to unindent
imap <S-Tab> <C-o><<
" no backups, swapfiles
set nobackup
set nowb
set noswapfile
" ruler, line numbers, cursorline
set ruler
set number
set textwidth=80
set colorcolumn=+0
set formatoptions-=t
" set cursorline " may slows things down dramatically
" hi clear CursorLine " don't highlight whole line as it's slow
" display command
"set showcmd
" allow opening buffers in background even if current is unsaved
set hidden
" disable folding
set nofoldenable
" search
set incsearch " find as you type
set smartcase
set nohlsearch
" keep lines when scrolling
set scrolloff=3
" if a file has been changed outside of vim and it has not been changed,
" automatically re-read it
set autoread
" macosx clipboard instead of vim's
set clipboard=unnamed
" delete to the left in insert mode with backspace
set backspace=indent,eol,start
" fix delete key in iTerm2
exe "set <Del>=\<Esc>[3;*~"
" remember last location in file
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal g'\"" | endif
endif
" toggle insert mode
nnoremap <C-Y> i
imap <C-Y> <Esc>
" invisibles
"hi NonText ctermfg=Grey
"hi SpecialKey ctermfg=Grey
" shortcut to rapidly toggle `set list`
nmap <leader>l :set list!<CR>
" use the same symbols as TextMate for tabstops and EOLs
set listchars=tab:▸\ ,eol:¬
" line numbers
nmap <leader>n :set number!<CR>
" line breaks
set showbreak=↳
" toggle showbreak
fun! ToggleShowBreak()
if &showbreak == ''
set showbreak=↳
else
set showbreak=
endif
endfun
nmap <leader>b :call ToggleShowBreak()<CR>
" strip trailing whitespace on save
fun! <SID>StripTrailingWhitespaces()
let l = line(".")
let c = col(".")
%s/\s\+$//e
call cursor(l, c)
endfun
autocmd BufWritePre * :call <SID>StripTrailingWhitespaces()