-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvimrc
More file actions
178 lines (143 loc) · 3.91 KB
/
vimrc
File metadata and controls
178 lines (143 loc) · 3.91 KB
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
" Directory to store swap files on
set dir=~/tmp
" Show line numbers
set number
" Default tab settings: width 2, expand to spaces
set tabstop=2
set expandtab
set sw=2
" Map 'go to marked line' to 'go to marked char'
nmap ' `
" Add autoclosing of { when pressing enter
inoremap {<Enter> {<Enter>}<Esc>O
" Find matching anything (useful for html tags)
runtime! macros/matchit.vim
" Activate filetype plugin
filetype plugin on
" Activate indentation by filetypes
filetype indent on
augroup filetypedefinitions
autocmd BufRead,BufNewFile *.txt setfiletype text
autocmd BufRead,BufNewFile *.haml setfiletype haml
autocmd BufRead,BufNewFile *.sass setfiletype sass
augroup END
augroup textfiles
" Make it easier to work with plaintext files
autocmd FileType text nmap j gj
autocmd FileType text nmap k gk
autocmd FileType text set linebreak
augroup END
autocmd FileType ruby,eruby,yaml,html set sw=2
autocmd FileType php set sw=2
autocmd FileType haml set syntax=haml
autocmd FileType haml set ai
autocmd FileType sass set ai
autocmd FileType plaintex inoremap á \'a
autocmd FileType plaintex inoremap é \'e
autocmd FileType plaintex inoremap í \'i
autocmd FileType plaintex inoremap ó \'o
autocmd FileType plaintex inoremap ú \'u
autocmd FileType plaintex inoremap ñ \~n
" show tabs as blank-padded arrows, trailing spaces as middle-dots
set list
set listchars=tab:→\ ,trail:·
" Set color scheme for console
set t_Co=256
if !has("gui_running")
let g:solarized_termcolors= 256 " 16
let g:solarized_termtrans = 1 " 0
let g:solarized_degrade = 0 "1
let g:solarized_bold = 1 " 0
let g:solarized_underline = 1 " 0
let g:solarized_italic = 1 " 0
let g:solarized_contrast = "normal" " “high” or “low”
let g:solarized_visibility= "high" " “normal” or “low”
colorscheme solarized
set background=dark
endif
" TAB completion
function! InsertTabWrapper(direction)
let col = col('.') - 1
if !col || getline('.')[col - 1] !~ '\k'
return "\<tab>"
elseif "backward" == a:direction
return "\<c-p>"
else
return "\<c-n>"
endif
endfunction
inoremap <tab> <c-r>=InsertTabWrapper ("forward")<cr>
inoremap <s-tab> <c-r>=InsertTabWrapper ("backward")<cr>
" File finder
function! EnterGoToFileWrapper()
if exists("b:isFileList") && b:isFileList
return "\<Esc>:edit! <cfile>\<cr>"
else
return "\<Esc>\<Enter>"
endif
endfunction
nnoremap <enter> i<c-r>=EnterGoToFileWrapper()<cr>
map <C-F> <ESC>:split<CR>:new<CR>:let b:isFileList=1<CR>:read ! find \| grep
"highlight OverLength ctermbg=darkred ctermfg=white guibg=#FFD9D9
"match OverLength /\%81v.*/
syn on
function! MoveToPrevTab()
"there is only one window
if tabpagenr('$') == 1 && winnr('$') == 1
return
endif
"preparing new window
let l:tab_nr = tabpagenr('$')
let l:cur_buf = bufnr('%')
if tabpagenr() != 1
close!
if l:tab_nr == tabpagenr('$')
tabprev
endif
sp
else
close!
exe "0tabnew"
endif
"opening current buffer in new window
exe "b".l:cur_buf
endfunc
function! MoveToNextTab()
"there is only one window
if tabpagenr('$') == 1 && winnr('$') == 1
return
endif
"preparing new window
let l:tab_nr = tabpagenr('$')
let l:cur_buf = bufnr('%')
if tabpagenr() < tab_nr
close!
if l:tab_nr == tabpagenr('$')
tabnext
endif
sp
else
close!
tabnew
endif
"opening current buffer in new window
exe "b".l:cur_buf
endfunc
nnoremap <C-W>> :call MoveToNextTab()<CR>
nnoremap <C-W>< :call MoveToPrevTab()<CR>
set wildmenu
set wildmode=longest:full
set ruler
set visualbell
set winminheight=0
set ignorecase
set smartcase
set clipboard^=unnamedplus
let g:ycm_confirm_extra_conf = 0
" set statusline+=%#warningmsg#
" set statusline+=%{SyntasticStatuslineFlag()}
" set statusline+=%*
" let g:syntastic_always_populate_loc_list = 1
" let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
" let g:syntastic_check_on_wq = 0