forked from wklken/k-vim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc.local
154 lines (121 loc) · 4.36 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
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
" ----------------------------------------------------------------------
" customized setting
"-----------------------------------------------------------------------
" vim-plug unplug
function! s:deregister(repo)
let repo = substitute(a:repo, '[\/]\+$', '', '')
let name = fnamemodify(repo, ':t:s?\.git$??')
call remove(g:plugs, name)
call remove(g:plugs_order, index(g:plugs_order, name))
endfunction
command! -nargs=1 -bar UnPlug call s:deregister(<args>)
" let file_ext = &filetype
let file_ext = expand('%:e')
if filereadable(expand("~/.vimrc.main"))
if file_ext == 'ts'
let g:bundle_groups=['nodejs', 'angular', 'html', 'css', 'typescript', 'vue', 'web']
elseif file_ext == 'vue'
let g:bundle_groups=['nodejs', 'javascript', 'html', 'css', 'typescript', 'vue', 'web']
elseif file_ext == 'jsx'
let g:bundle_groups=['nodejs', 'javascript', 'html', 'css', 'typescript', 'react', 'web']
elseif file_ext == 'js' || file_ext == 'jsx' || file_ext == 'html'|| file_ext =='css' || file_ext=='scss' || file_ext=='less'
let g:bundle_groups=['javascript', 'typescript', 'nodejs', 'react', 'vue', 'angular', 'web', 'html', 'css']
elseif file_ext == 'py'
let g:bundle_groups=['python', 'tmux', 'web', 'flask', 'css', 'javascript', 'typescript', 'react']
" let g:bundle_groups=['python', 'tmux', 'web', 'jinja', 'django']
elseif file_ext == 'ruby'
let g:bundle_groups=['ruby', 'tmux']
elseif file_ext == 'java'
let g:bundle_groups=['java']
elseif file_ext == 'go'
let g:bundle_groups=['golang', 'tmux', 'web', 'css', 'javascript', 'typescript', 'react']
elseif file_ext == 'exs' || file_ext == 'ex'
let g:bundle_groups=['iex', 'tmux', 'web']
else
let g:bundle_groups=['web', 'nodejs', 'python', 'javascript', 'angularjs', 'angular', 'iex', 'markdown', 'html', 'css', 'tmux', 'beta', 'golang', 'ruby', 'typescript', 'csharp', 'django', 'vue', 'react', 'java']
endif
source ~/.vimrc.main
" set NerdTreeIgnore
let g:NERDTreeIgnore+=['\~$', 'node_modules', 'bower_components']
endif
" map space to leader
" map <space> ,
nmap <leader>d :bprevious<CR>:bdelete #<CR>
" 选中并高亮最后一次插入的内容
nnoremap gv `[v`]
if has("gui_running")
" set guifont=Meslo\ LG\ M\ DZ\ Regular\ for\ Powerline:h13
" set guifont=MesloLGSDZ\ Nerd\ Font:h13
set guifont=Hack\ Nerd\ Font\ Mono:h13
if has("gui_gtk2") "GTK2
set guifont=Monaco\ 12,Monospace\ 13
endif
set guioptions-=T
set guioptions+=e
set guioptions-=r
set guioptions-=L
set guitablabel=%M\ %t
set showtabline=1
set linespace=2
set lines=50 columns =180
set noimd
set background=dark
set t_Co=256
set guicursor=a:hor10-Cursor
colorscheme PaperColor
else
set t_Co=256
set background=dark
" colorscheme PaperColor
colorscheme gruvbox
endif
" 切换窗口
map <leader>ww <C-W>w
" 横向分割窗口
map <leader>ws <C-W>s
" 竖向分割窗口
map <leader>wv <C-W>v
" 关闭窗口
map <leader>wc <C-W>c
" 设置leader等待时间
" set timeoutlen=4000
" nnoremap <leader>. ;
" inoremap <C-e> <C-o>$
" 插入模式下新增上一行新增下一行
inoremap <leader>o <ESC>o
inoremap <leader>O <ESC>O
" imap \nn <C-O>o
" 0和^互换
noremap 0 ^
noremap ^ 0
" 设置' 为 ;重复查找上次 f 命令所查找的字符
nnoremap ' ;
" move the current line below
nnoremap <c-down> ddp
" move the current line above
" nnoremap <c-s-j> ddkP
noremap <c-up> :call feedkeys( line('.')==1 ? '' : 'ddkP' )<CR>
" insert mode uppercase the current word
" <esc> : go to normal mode
" v : visual mode
" iw : select the current word
" U : uppercase selection
" i : back to insert mode
inoremap <c-u> <esc>viwUi
" quickly move current line, likely n[e or n]e
nnoremap [e :<c-u>execute 'move -1-'. v:count1<cr>
nnoremap ]e :<c-u>execute 'move +'. v:count1<cr>
" Replaces the current word (and all occurrences).
nnoremap <Leader>rc :%s/\<<C-r><C-w>\>/
vnoremap <Leader>rc y:%s/<C-r>"/
" Changes the current word (and all occurrences).
nnoremap <Leader>cw :%s/\<<C-r><C-w>\>/<C-r><C-w>
vnoremap <Leader>cw y:%s/<C-r>"/<C-r>"
" Replace tabs with spaces.
nnoremap <Leader>rts :%s/ / /g<CR>
noremap <leader><leader>p "*p
" Allow saving of files as sudo when I forgot to start vim using sudo.
cmap w!! w !sudo tee > /dev/null %
if filereadable(expand("~/.vimrc.config.local"))
source ~/.vimrc.config.local
endif