Skip to content

Commit 34c3fee

Browse files
committed
add .vimrc
1 parent c23e4fb commit 34c3fee

File tree

1 file changed

+215
-0
lines changed

1 file changed

+215
-0
lines changed

Diff for: dot_files/.vimrc

+215
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
set nocompatible
2+
set nobackup
3+
set noswapfile
4+
5+
set t_Co=256
6+
7+
filetype off
8+
filetype plugin indent on
9+
10+
let mapleader=";"
11+
nmap <leader>w <C-W>
12+
set pastetoggle=<leader>pp
13+
14+
set incsearch
15+
set ignorecase
16+
set backspace=indent,eol,start
17+
18+
set wrap
19+
set wildmenu
20+
set wildmode=list:full
21+
set completeopt=longest,menu
22+
set wildignore+=*.a,*.o
23+
set wildignore+=*.bmp,*.gif,*.ico,*.jpg,*.png
24+
set wildignore+=.DS_Store,.git,.hg,.svn
25+
set wildignore+=*~,*.swp,*.tmp
26+
27+
set mouse=a
28+
autocmd BufEnter * let &titlestring = ' ' . expand("%:t")
29+
set title
30+
31+
set laststatus=2
32+
set ruler
33+
set number
34+
35+
set hlsearch
36+
37+
syntax enable
38+
syntax on
39+
40+
filetype indent on
41+
set expandtab
42+
43+
" 默认缩进4
44+
set ai
45+
set sw=4
46+
set ts=4
47+
set sts=4
48+
49+
set mousemodel=popup
50+
51+
map j gj
52+
map k gk
53+
54+
" insert data, time
55+
nmap <Leader>it a<C-R>=strftime("%H:%M")<CR><Esc>
56+
nmap <Leader>id a<C-R>=strftime("%Y-%m-%d")<CR><Esc>
57+
nmap <Leader>t i<C-R>=strftime("%Y-%m-%d %H:%M")<CR><Esc>
58+
let g:plug_url_format = '[email protected]:%s.git'
59+
call plug#begin('~/.vim/plugged')
60+
"Plug 'Shougo/neocomplete.vim'
61+
Plug 'Shougo/neocomplcache.vim'
62+
Plug 'davidhalter/jedi-vim'
63+
Plug 'SirVer/ultisnips'
64+
Plug 'honza/vim-snippets'
65+
Plug 'Yggdroot/indentLine'
66+
Plug 'itchyny/lightline.vim'
67+
Plug 'junegunn/vim-easy-align'
68+
Plug 'scrooloose/nerdcommenter'
69+
Plug 'jiangmiao/auto-pairs'
70+
Plug 'scrooloose/nerdtree'
71+
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
72+
Plug 'junegunn/fzf.vim'
73+
Plug 'NLKNguyen/papercolor-theme'
74+
Plug 'scrooloose/syntastic'
75+
Plug 'mbbill/undotree'
76+
call plug#end()
77+
78+
" indentLine
79+
let g:indentLine_color_term = 9
80+
81+
nmap <Leader>lf :NERDTreeToggle<CR>
82+
" easytags
83+
let g:easytags_events = ['BufWritePost']
84+
let g:easytags_file = '~/.vim/tags'
85+
nmap <Leader>lt :TagbarToggle<CR>
86+
87+
colo PaperColor
88+
set bg=dark
89+
90+
let g:UltiSnipsExpandTrigger="<leader><tab>"
91+
let g:UltiSnipsJumpForwardTrigger="<leader><tab>"
92+
let g:UltiSnipsJumpBackwardTrigger="<leader><s-tab>"
93+
94+
95+
" fzf
96+
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.pyc,*.pickle " MacOSX/Linux
97+
nmap <leader>ff :FZF<CR>
98+
nmap <leader>fb :Buffers<CR>
99+
nmap <leader>ft :BTags<CR>
100+
nmap <leader>fl :BLines<CR>
101+
nmap <leader>fh :History<CR>
102+
103+
104+
" vim-ag-anying.vim ag anything
105+
" Maintainer: Chun Yang <http://github.com/Chun-Yang>
106+
" Version: 1.0
107+
" 使用fzf.vim的Ag命令替代ag.vim
108+
109+
" http://stackoverflow.com/questions/399078/what-special-characters-must-be-escaped-in-regular-expressions
110+
let g:vim_action_ag_escape_chars = get(g:, 'vim_action_ag_escape_chars', '#%.^$*+?()[{\\|')
111+
112+
function! s:Ag(mode) abort
113+
" preserver @@ register
114+
let reg_save = @@
115+
116+
" copy selected text to @@ register
117+
if a:mode ==# 'v' || a:mode ==# ''
118+
silent exe "normal! `<v`>y"
119+
elseif a:mode ==# 'char'
120+
silent exe "normal! `[v`]y"
121+
else
122+
return
123+
endif
124+
125+
" escape special chars,
126+
" % is file name in vim we need to escape that first
127+
" # is secial in ag
128+
let escaped_for_ag = escape(@@, '%#')
129+
let escaped_for_ag = escape(escaped_for_ag, g:vim_action_ag_escape_chars)
130+
131+
" execute Ag command
132+
" '!' is used to NOT jump to the first match
133+
exe ":Ag ".escaped_for_ag
134+
135+
" recover @@ register
136+
let @@ = reg_save
137+
endfunction
138+
139+
vnoremap <silent> <Plug>AgActionVisual :<C-U>call <SID>Ag(visualmode())<CR>
140+
vmap <leader><space> <Plug>AgActionVisual
141+
142+
" syntastic
143+
144+
let g:syntastic_always_populate_loc_list = 0
145+
let g:syntastic_auto_loc_list = 0
146+
let g:syntastic_check_on_open = 1
147+
let g:syntastic_check_on_wq = 0
148+
149+
if has("persistent_undo")
150+
set undodir=~/.undodir/
151+
set undofile
152+
endif
153+
nmap <leader>lu :UndotreeToggle<cr>
154+
155+
" Disable AutoComplPop.
156+
let g:acp_enableAtStartup = 0
157+
" Use neocomplete.
158+
let g:neocomplete#enable_at_startup = 1
159+
" Use smartcase.
160+
let g:neocomplete#enable_smart_case = 1
161+
" Set minimum syntax keyword length.
162+
let g:neocomplete#sources#syntax#min_keyword_length = 1
163+
let g:neocomplete#lock_buffer_name_pattern = '\*ku\*'
164+
165+
" Define dictionary.
166+
let g:neocomplete#sources#dictionary#dictionaries = {
167+
\ 'default' : ''
168+
\ }
169+
170+
" Define keyword.
171+
if !exists('g:neocomplete#keyword_patterns')
172+
let g:neocomplete#keyword_patterns = {}
173+
endif
174+
let g:neocomplete#keyword_patterns['default'] = '\h\w*'
175+
176+
" Plugin key-mappings.
177+
inoremap <expr><C-g> neocomplete#undo_completion()
178+
inoremap <expr><C-l> neocomplete#complete_common_string()
179+
180+
" Recommended key-mappings.
181+
" <CR>: close popup and save indent.
182+
inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>
183+
function! s:my_cr_function()
184+
return (pumvisible() ? "\<C-y>" : "" ) . "\<CR>"
185+
" For no inserting <CR> key.
186+
"return pumvisible() ? "\<C-y>" : "\<CR>"
187+
endfunction
188+
" <TAB>: completion.
189+
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
190+
" <C-h>, <BS>: close popup and delete backword char.
191+
inoremap <expr><C-h> neocomplete#smart_close_popup()."\<C-h>"
192+
inoremap <expr><BS> neocomplete#smart_close_popup()."\<C-h>"
193+
" Close popup by <Space>.
194+
"inoremap <expr><Space> pumvisible() ? "\<C-y>" : "\<Space>"
195+
196+
" Enable omni completion.
197+
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
198+
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
199+
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
200+
autocmd FileType python setlocal omnifunc=jedi#completions
201+
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
202+
203+
" Enable heavy omni completion.
204+
if !exists('g:neocomplete#sources#omni#input_patterns')
205+
let g:neocomplete#sources#omni#input_patterns = {}
206+
endif
207+
208+
" jedivim
209+
let g:jedi#goto_command = "<leader>jg"
210+
let g:jedi#goto_assignments_command = "<leader>ja"
211+
let g:jedi#goto_definitions_command = "<leader>jd"
212+
let g:jedi#documentation_command = "<leader>jK"
213+
let g:jedi#usages_command = "<leader>ju"
214+
let g:jedi#completions_command = ""
215+
let g:jedi#rename_command = "<leader>jr"

0 commit comments

Comments
 (0)