-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
155 lines (118 loc) · 3.84 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
syntax on
colorscheme desert256
set cursorline
set scrolloff=5
set tabstop=4 shiftwidth=4
set incsearch hlsearch
set autoindent
set number
set wildmenu
"set wildmode=longest:full
set ttymouse=xterm2
set mouse=a
"set t_RV=
set wrap!
set hidden
set ruler
set showcmd
set ignorecase
set smartcase
"let g:loaded_matchparen=1 "disable highlighting matching brackets
"easy buffer access
"set wildcharm=<C-Z>
"nnoremap <F4> :buffer <C-Z>
nnoremap <F2> :set number! invpaste paste?<CR>a
"set pastetoggle=<F2>
map! <F2> <ESC>:set nonumber invpaste paste?<CR>a
"imap <F2> :set number
"set pastetoggle=<F2>
set showmode
nnoremap <F3> :ConqueTermTab bash <CR>
"nnoremap <F5> :b#<C
"map! <F5> <ESC>:b#<CR>
map! <F3> <ESC> :ConqueTermTab bash <CR>
"map! <F4> <ESC> :buffer <C-Z>
"map! <C-F4> <ESC> :ConqueTermVSplit bash <CR>
"nnoremap <S-F3> :ConqueTermVSplit bash <CR>
map! <F4> <ESC>:tabp<CR>a
map! <F5> <ESC>:tabn<CR>a
map! <F6> <ESC>:tabclose<CR>
nnoremap <F4> :tabp<CR>a
nnoremap <F5> :tabn<CR>a
nnoremap <F6> :tabclose<CR>
map! <F7> <ESC>:set spell!<CR>a
nnoremap <F7> :set spell!<CR>
set laststatus=2
"set statusline=%{GitBranch()}
"set statusline=%<%f\ %m%r%=%-9.(%y%)\ %10.10(#c%b#0x%B%)#\ %-12.(%l,%c%V%)\ %P
set statusline=%<%f\ %m%r%=%-9.(%y%)\ %10.10(#c%b#0x%B%)#\ %-12.(%l,%c%V%)\ %P
set mouse=a
"set ttytype=xterm
nnoremap <ESC><ESC> :q<CR>
":map <M-Esc>[62~ <ScrollWheelUp>
":map! <M-Esc>[62~ <ScrollWheelUp>
":map <M-Esc>[63~ <ScrollWheelDown>
":map! <M-Esc>[63~ <ScrollWheelDown>
":map <M-Esc>[64~ <S-ScrollWheelUp>
":map! <M-Esc>[64~ <S-ScrollWheelUp>
":map <M-Esc>[65~ <S-ScrollWheelDown>
":map! <M-Esc>[65~ <S-ScrollWheelDown>
"open file at last position
:au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
" ex command for toggling hex mode - define mapping if desired
command -bar Hexmode call ToggleHex()
" helper function to toggle hex mode
function ToggleHex()
" hex mode should be considered a read-only operation
" save values for modified and read-only for restoration later,
" and clear the read-only flag for now
let l:modified=&mod
let l:oldreadonly=&readonly
let &readonly=0
let l:oldmodifiable=&modifiable
let &modifiable=1
if !exists("b:editHex") || !b:editHex
" save old options
let b:oldft=&ft
let b:oldbin=&bin
" set new options
setlocal binary " make sure it overrides any textwidth, etc.
let &ft="xxd"
" set status
let b:editHex=1
" switch to hex editor
%!xxd
else
" restore old options
let &ft=b:oldft
if !b:oldbin
setlocal nobinary
endif
" set status
let b:editHex=0
" return to normal editing
%!xxd -r
endif
" restore values for modified and read only state
let &mod=l:modified
let &readonly=l:oldreadonly
let &modifiable=l:oldmodifiable
endfunction
set nocp
filetype plugin on
function! s:DiffWithSaved()
let filetype=&ft
diffthis
vnew | r # | normal! 1Gdd
diffthis
exe "setlocal bt=nofile bh=wipe nobl noswf ro ft=" . filetype
endfunction
com! DiffSaved call s:DiffWithSaved()
command! -range=% -nargs=0 Space2Tab execute '<line1>,<line2>s#^\( \{'.&ts.'\}\)\+#\=repeat("\t", len(submatch(0))/' . &ts . ')'
"cursor at the beginning of a tab in normal mode
set list lcs=tab:\ \
highlight ExtraWhitespace ctermbg=red guibg=red
highlight ExtraWhitespace2 ctermbg=red guibg=red
match ExtraWhitespace2 /\s\+$\| \+\ze\t/
match ExtraWhitespace /^\t*\zs \+/
set viminfo='200,s100,h