-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc.local
88 lines (75 loc) · 2.09 KB
/
vimrc.local
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
"colorscheme desert
colorscheme darkZ
"colorscheme earthburn
set splitright
set nospell
"buffer nav
map <S-H> :bp<CR>
map <S-L> :bn<CR>
"make * to be highlighting the current word
let g:highlighting = 0
function! Highlighting()
if g:highlighting == 1 && @/ =~ '^\\<'.expand('<cword>').'\\>$'
let g:highlighting = 0
return ":silent nohlsearch\<CR>"
endif
let @/ = '\<'.expand('<cword>').'\>'
let g:highlighting = 1
return ":silent set hlsearch\<CR>"
endfunction
nnoremap <silent> <expr> * Highlighting()
"multi_cursour_mode enable when press quit-key
"disable due to confict with ctrl-p
"let g:multi_cursor_exit_from_visual_mode = 0
"let g:multi_cursor_exit_from_insert_mode = 0
nmap <silent> <S-S> :! scp % 172.18.11.50:/root/workdir<CR>
" toggle location list and quickfix list
function! GetBufferList()
redir =>buflist
silent! ls
redir END
return buflist
endfunction
function! ToggleList(bufname, pfx)
let buflist = GetBufferList()
for bufnum in map(filter(split(buflist, '\n'), 'v:val =~ "'.a:bufname.'"'), 'str2nr(matchstr(v:val, "\\d\\+"))')
if bufwinnr(bufnum) != -1
exec(a:pfx.'close')
return
endif
endfor
if a:pfx == 'l' && len(getloclist(0)) == 0
echohl ErrorMsg
echo "Location List is Empty."
return
endif
let winnr = winnr()
exec(a:pfx.'open')
if winnr() != winnr
wincmd p
endif
endfunction
nmap <silent> <leader>l :call ToggleList("Location List", 'l')<CR>
nmap <silent> <leader>c :call ToggleList("Quickfix List", 'c')<CR>
"delete all other buffers
command! BcloseOthers call <SID>BufCloseOthers()
function! <SID>BufCloseOthers()
let l:currentBufNum = bufnr("%")
let l:alternateBufNum = bufnr("#")
for i in range(1,bufnr("$"))
if buflisted(i)
if i!=l:currentBufNum
execute("bdelete ".i)
endif
endif
endfor
endfunction
map <leader>bdo :BcloseOthers<cr>
"no easy6 window
let g:spf13_no_easyWindows = 1
map <C-J> <C-W>j
map <C-K> <C-W>k
map <C-L> <C-W>l
map <C-H> <C-W>h
"no autochdir, it will mess up the cscope FIXME:seems no interferon
"let g:spf13_no_autochdir = 1