[misc] clean up vimrc
This commit is contained in:
parent
14a01e960b
commit
5083ac0447
|
@ -25,6 +25,7 @@ end
|
|||
source-file-if-exists /usr/share/autojump/autojump.fish
|
||||
source-file-if-exists /usr/local/share/autojump/autojump.fish
|
||||
append-path-if-exists ~/.local/bin
|
||||
append-path-if-exists ~/Programs/bin
|
||||
append-path-if-exists ~/.yarn/bin
|
||||
source-file-if-exists ~/.cargo/env
|
||||
append-path-if-exists /usr/local/bin
|
||||
|
|
102
tex.vimrc
Normal file
102
tex.vimrc
Normal file
|
@ -0,0 +1,102 @@
|
|||
function! MathAndLiquid()
|
||||
"" Define certain regions
|
||||
" Block math. Look for "$$[anything]$$"
|
||||
syn region math start=/\$\$/ end=/\$\$/
|
||||
" inline math. Look for "$[not $][anything]$"
|
||||
syn match math_block '\$[^$].\{-}\$'
|
||||
|
||||
" Liquid single line. Look for "{%[anything]%}"
|
||||
syn match liquid '{%.*%}'
|
||||
" Liquid multiline. Look for "{%[anything]%}[anything]{%[anything]%}"
|
||||
syn region highlight_block start='{% highlight .*%}' end='{%.*%}'
|
||||
" Fenced code blocks, used in GitHub Flavored Markdown (GFM)
|
||||
syn region highlight_block start='```' end='```'
|
||||
|
||||
"" Actually highlight those regions.
|
||||
hi link math Statement
|
||||
hi link liquid Statement
|
||||
hi link highlight_block Function
|
||||
hi link math_block Function
|
||||
endfunction
|
||||
|
||||
" Call everytime we open a Markdown file
|
||||
"autocmd BufRead,BufNewFile,BufEnter *.md,*.markdown call MathAndLiquid()
|
||||
|
||||
" \vm 2 4\<Tab>
|
||||
" \begin{vmatrix}
|
||||
" <++> & <++> & <++> & <++> \\
|
||||
" <++> & <++> & <++> & <++ > \\
|
||||
" \end{vmatrix}<++>
|
||||
"
|
||||
function! Tex()
|
||||
let mark = '\'
|
||||
let sepr = ' '
|
||||
let tags = {'vm': 'vmatrix', 'bm': 'bmatrix', 'mt': 'matrix', 'cs': 'cases', 'ad': 'aligned', 'al': 'align', 'ar': 'array'}
|
||||
let text = getline('.')
|
||||
let end = col('.')
|
||||
let start = strridx(text, mark, end)
|
||||
if start > -1
|
||||
let params = strpart(text, start+1, end - start - 1)
|
||||
let params = split(params, sepr)
|
||||
let abbr = params[0]
|
||||
if strlen(abbr) == 0 || !has_key(tags, abbr)
|
||||
return
|
||||
endif
|
||||
let rc = params[1]
|
||||
if !(rc>0)
|
||||
return
|
||||
endif
|
||||
if len(params)>2
|
||||
let cc = params[2]
|
||||
if !(cc>0)
|
||||
return
|
||||
endif
|
||||
else
|
||||
let cc = 1
|
||||
end
|
||||
|
||||
let prefix = repeat(' ', start)
|
||||
|
||||
let thecols = []
|
||||
let i = 0
|
||||
while i < cc
|
||||
call add(thecols, '<++>')
|
||||
let i += 1
|
||||
endwhile
|
||||
let columnsText = prefix . ' '. join(thecols, ' & ') . ' \\'
|
||||
|
||||
let lines = []
|
||||
let i = 0
|
||||
while i < rc
|
||||
call add(lines, columnsText)
|
||||
let i += 1
|
||||
endwhile
|
||||
call add(lines, prefix . '\end{' . tags[abbr] . '}<++>')
|
||||
|
||||
let leftPart = strpart(text, 0, start)
|
||||
let rightPart = strpart(text, end)
|
||||
if strlen(rightPart) > 0
|
||||
call add(lines, prefix . rightPart)
|
||||
endif
|
||||
call setline(line('.'), leftPart . '\begin{' . tags[abbr] . '}')
|
||||
call append(line('.'), lines)
|
||||
"call append(line('.'), lines)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" autocmd FileType markdown
|
||||
inoremap <Bslash><Tab> <Esc>:call Tex()<Esc>a
|
||||
" Navigating with guides
|
||||
inoremap <leader><Tab> <Esc>/<++><Enter>"_c4l
|
||||
vnoremap <leader><Tab> <Esc>/<++><Enter>"_c4l
|
||||
map <leader><Tab> <Esc>/<++><Enter>"_c4l
|
||||
nmap <C-_> <Plug>NERDCommenterToggle
|
||||
vmap <C-_> <Plug>NERDCommenterToggle<CR>gv
|
||||
|
||||
" Markdown setup
|
||||
autocmd FileType markdown inoremap \cs<Tab> \begin{cases}\end{cases}<++><Esc>F\i
|
||||
autocmd FileType markdown inoremap \fr<Tab> \frac{<++>}{<++>}<++><Esc>F\i
|
||||
autocmd FileType markdown inoremap `<Tab> `$$`<++><Esc>F$i
|
||||
autocmd FileType markdown inoremap $<Tab> $$<Enter>$$<Enter><++><Esc>kO
|
||||
autocmd FileType markdown inoremap \{ \{\}<++><Esc>F{a
|
||||
autocmd FileType markdown vnoremap <leader>b c__<C-r>"__<Esc>
|
456
vimrc
456
vimrc
|
@ -37,50 +37,44 @@ else
|
|||
source $VIMRUNTIME/delmenu.vim
|
||||
source $VIMRUNTIME/menu.vim
|
||||
endif
|
||||
Plug 'terryma/vim-multiple-cursors'
|
||||
Plug 'jiangmiao/auto-pairs'
|
||||
"Plug 'scrooloose/syntastic'
|
||||
"Plug 'w0rp/ale'
|
||||
Plug 'scrooloose/nerdtree'
|
||||
Plug 'alvan/vim-closetag'
|
||||
"Plug 'AndrewRadev/tagalong.vim'
|
||||
Plug 'tpope/vim-repeat'
|
||||
Plug 'tpope/vim-fugitive' " git 功能
|
||||
Plug 'tpope/vim-surround'
|
||||
"Plug 'vim-airline/vim-airline'
|
||||
"Plug 'vim-airline/vim-airline-themes'
|
||||
Plug 'scrooloose/nerdcommenter'
|
||||
Plug 'editorconfig/editorconfig-vim'
|
||||
|
||||
" searching and formatting
|
||||
Plug 'mhinz/vim-grepper', { 'on': ['Grepper', '<plug>(GrepperOperator)'] }
|
||||
Plug 'ctrlpvim/ctrlp.vim'
|
||||
Plug 'godlygeek/tabular' " align text by specified pattern :Tabularize /<pattern>
|
||||
Plug 'editorconfig/editorconfig-vim'
|
||||
Plug 'tpope/vim-surround'
|
||||
Plug 'tpope/vim-repeat'
|
||||
Plug 'alvan/vim-closetag'
|
||||
Plug 'jiangmiao/auto-pairs'
|
||||
|
||||
" ide like
|
||||
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
||||
Plug 'mgedmin/coverage-highlight.vim'
|
||||
"Plug 'klesh/vim-fakeclip'
|
||||
Plug 'scrooloose/nerdcommenter'
|
||||
Plug 'tpope/vim-fugitive' " git 功能
|
||||
Plug 'scrooloose/nerdtree'
|
||||
|
||||
" color themes
|
||||
Plug 'morhetz/gruvbox'
|
||||
|
||||
" syntax
|
||||
Plug 'peitalin/vim-jsx-typescript'
|
||||
Plug 'pangloss/vim-javascript'
|
||||
Plug 'lunaru/vim-less'
|
||||
Plug 'posva/vim-vue'
|
||||
Plug 'othree/html5.vim'
|
||||
Plug 'mtscout6/syntastic-local-eslint.vim'
|
||||
Plug 'pangloss/vim-javascript'
|
||||
Plug 'klesh/vim-fakeclip'
|
||||
Plug 'dag/vim-fish'
|
||||
Plug 'digitaltoad/vim-pug'
|
||||
"Plug 'ludovicchabant/vim-gutentags'
|
||||
Plug 'godlygeek/tabular'
|
||||
Plug 'plasticboy/vim-markdown'
|
||||
Plug 'triglav/vim-visual-increment'
|
||||
Plug 'jvirtanen/vim-octave'
|
||||
Plug 'vim-python/python-syntax'
|
||||
Plug 'mgedmin/coverage-highlight.vim'
|
||||
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
||||
Plug 'neoclide/coc-python', {'do': 'yarn install --frozen-lockfile'}
|
||||
Plug 'neoclide/coc-tsserver', {'do': 'yarn install --frozen-lockfile'}
|
||||
Plug 'morhetz/gruvbox'
|
||||
Plug 'peitalin/vim-jsx-typescript'
|
||||
Plug 'plasticboy/vim-markdown'
|
||||
"Plug 'digitaltoad/vim-pug'
|
||||
|
||||
" statusline
|
||||
Plug 'liuchengxu/eleline.vim'
|
||||
call plug#end()
|
||||
|
||||
" coc configuration, may need to run `yarn` in ~/.vim/coc-python folder
|
||||
" $ pip install --user python-language-server jedi rope
|
||||
|
||||
|
||||
|
||||
" Remap keys for gotos
|
||||
" ==== coc configuration ====
|
||||
nmap <silent> gd <Plug>(coc-definition)
|
||||
nmap <silent> gy <Plug>(coc-type-definition)
|
||||
nmap <silent> gi <Plug>(coc-implementation)
|
||||
|
@ -89,9 +83,6 @@ nmap <silent> gr <Plug>(coc-references)
|
|||
" Highlight symbol under cursor on CursorHold
|
||||
autocmd CursorHold * silent call CocActionAsync('highlight')
|
||||
|
||||
" Use K to show documentation in preview window
|
||||
nnoremap <silent> K :call <SID>show_documentation()<CR>
|
||||
|
||||
" Remap for rename current word
|
||||
nmap <leader>rn <Plug>(coc-rename)
|
||||
|
||||
|
@ -99,305 +90,45 @@ nmap <leader>rn <Plug>(coc-rename)
|
|||
xmap <leader>f <Plug>(coc-format-selected)
|
||||
nmap <leader>f <Plug>(coc-format-selected)
|
||||
|
||||
" Use K to show documentation in preview window
|
||||
function! s:show_documentation()
|
||||
" s:f makes function f local, use <SID>f() to call it, ! replaces existing
|
||||
" function quitely
|
||||
if (index(['vim','help'], &filetype) >= 0)
|
||||
execute 'h '.expand('<cword>')
|
||||
else
|
||||
call CocAction('doHover')
|
||||
endif
|
||||
endfunction
|
||||
nnoremap <silent> K :call <SID>show_documentation()<CR>
|
||||
|
||||
|
||||
" markdown
|
||||
" ==== markdown configuration ====
|
||||
let g:vim_markdown_folding_disabled = 1
|
||||
let g:vim_markdown_math = 1
|
||||
|
||||
" nerdtree
|
||||
|
||||
" ==== nerdtree configuration ====
|
||||
let NERDTreeDirArrowExpandable = "+"
|
||||
let NERDTreeDirArrowCollapsible = "-"
|
||||
let NERDTreeIgnore = ['\.pyc$', '__pycache__']
|
||||
|
||||
" python
|
||||
|
||||
" ==== python configuration ====
|
||||
let g:python_highlight_all = 1
|
||||
|
||||
" airline
|
||||
let g:airline_theme='bubblegum'
|
||||
let g:airline_left_sep = ''
|
||||
let g:airline_right_sep = ''
|
||||
"let g:airline_left_sep = ' '
|
||||
"let g:airline_right_sep = ' '
|
||||
let g:airline_symbols#crypt = '🔒'
|
||||
let g:airline_symbols#linenr = '¶'
|
||||
let g:airline_symbols#maxlinenr = '☰'
|
||||
let g:airline_symbols#branch = ''
|
||||
"let g:airline_symbols#paste = 'ρ'
|
||||
let g:airline_symbols#paste = 'Þ'
|
||||
"let g:airline_symbols#paste = '∥'
|
||||
"let g:airline_symbols#spell = 'Ꞩ'
|
||||
"let g:airline_symbols#notexists = '∄'
|
||||
"let g:airline_symbols#whitespace = 'Ξ'
|
||||
"
|
||||
"let g:airline_theme='luna'
|
||||
|
||||
" CtrlP
|
||||
" ==== ctrlp configuration ====
|
||||
let g:ctrlp_user_command = ['.git', 'git ls-files -co --exclude-standard']
|
||||
"let g:ctrlp_map = '<Space><Space>'
|
||||
" NERDTree
|
||||
let NERDTreeIgnore = ['\.pyc$', '__pycache__']
|
||||
" syntastic
|
||||
" let g:syntastic_javascript_checkers = ['eslint']
|
||||
"let g:ale_python_pylint_change_directory = 0
|
||||
let g:ale_linters = {
|
||||
\ 'python': ['flake8']
|
||||
\}
|
||||
|
||||
|
||||
|
||||
" vue-vim
|
||||
" 解决跳到尾部时语法高亮不正常的问题
|
||||
" ==== vue configuration ====
|
||||
" syntax highlighting not working correctly occasionally for vue
|
||||
autocmd FileType vue syntax sync fromstart
|
||||
" 利用现有的插件对语法进行高亮
|
||||
"autocmd BufRead,BufNewFile *.vue setlocal filetype=vue.html5.javascript.less
|
||||
autocmd BufRead,BufNewFile *.vue setlocal filetype=vue
|
||||
|
||||
" vim
|
||||
set ts=4
|
||||
set sw=4
|
||||
set listchars=eol:$,tab:->,extends:>,precedes:<,space:.,
|
||||
set list
|
||||
set nu
|
||||
set expandtab
|
||||
set hidden
|
||||
set autoindent
|
||||
set confirm
|
||||
set noundofile
|
||||
set nobackup
|
||||
set ruler " 开启游标右下角行、列显示
|
||||
set noswapfile " 关闭临时文件
|
||||
set hlsearch
|
||||
set lazyredraw
|
||||
set noshowmatch
|
||||
set laststatus=2
|
||||
let html_no_rendering=1
|
||||
set fillchars=vert:\ ,fold:-
|
||||
"highlight VertSplit guibg=Orange guifg=Black ctermbg=None ctermfg=033
|
||||
hi StatusLine cterm=NONE
|
||||
|
||||
" keybindings
|
||||
" 从系统剪贴板复制/粘贴
|
||||
"inoremap <C-p> <ESC>"+pa
|
||||
"nnoremap <C-p> "+p
|
||||
"vnoremap <C-p> "+p
|
||||
"vnoremap <C-y> "+y
|
||||
vmap <C-y> <Plug>(fakeclip-y)
|
||||
inoremap <C-S-s> <ESC>:<C-u>:w<CR>a
|
||||
nnoremap <C-S-s> :<C-u>:w<CR>
|
||||
|
||||
"nnoremap <Space><Space> :CtrlP<CR>
|
||||
nnoremap <Space>n :NERDTreeToggle<CR>
|
||||
nnoremap <Space>g :Grepper -tool git<CR>
|
||||
|
||||
nnoremap <Esc><Esc> :noh<return><esc>
|
||||
nnoremap <Space>o :only<CR>
|
||||
nnoremap <Space>w <C-w><C-w>
|
||||
nnoremap <Space>q :<C-u>qall<CR>
|
||||
vnoremap <Space>p "_dP
|
||||
nnoremap <Space>e :<C-u>%s/\s\+$//g<CR>
|
||||
nnoremap <Space>s :<C-u>syntax sync fromstart<CR>
|
||||
nnoremap <Space>c :<C-u>:set cursorcolumn!<CR>
|
||||
|
||||
nnoremap <Space>h <C-w>h
|
||||
nnoremap <Space>j <C-w>j
|
||||
nnoremap <Space>k <C-w>k
|
||||
nnoremap <Space>l <C-w>l
|
||||
nnoremap <Space>m :vertical resize +5<CR>
|
||||
nnoremap <Space>, :vertical resize -5<CR>
|
||||
nnoremap <Space>. :resize +5<CR>
|
||||
nnoremap <Space>/ :resize -5<CR>
|
||||
nnoremap <Space>d :vs<CR>
|
||||
nnoremap <Space>[ :lprev<CR>
|
||||
nnoremap <Space>] :lnext<CR>
|
||||
|
||||
vnoremap <silent> <leader>m c<c-r>=trim(@") . '=' . trim(system('math ' . shellescape(@")))<cr><esc>
|
||||
|
||||
" 行尾空格高亮
|
||||
highlight ExtraWhitespace ctermbg=red guibg=red
|
||||
au ColorScheme * highlight ExtraWhitespace ctermbg=red guibg=red
|
||||
au Syntax * match ExtraWhitespace /\s\+$/
|
||||
|
||||
" iterm2 插入模式时backspace不works
|
||||
set backspace=indent,eol,start
|
||||
|
||||
function! ReadClipboardWsl()
|
||||
let text = system('powershell.exe -Command Get-Clipboard')
|
||||
let text = substitute(text, "\r\n", '', 'g')
|
||||
return text
|
||||
endfunction
|
||||
|
||||
function! TabNewFromClipboard()
|
||||
exec ':tabnew ' . ReadClipboardWsl()
|
||||
endfunction
|
||||
|
||||
function! Jsonpp()
|
||||
"exec ':%!python -m json.tool'
|
||||
exec ':%!json_pp'
|
||||
endfunction
|
||||
|
||||
function! DecodeHtml()
|
||||
exec ':%s/<pre>/```\r/g'
|
||||
exec ':%s/<\/pre>/\r```/g'
|
||||
exec ':%s/</</g'
|
||||
exec ':%s/>/>/g'
|
||||
exec ':%s/&/\&/g'
|
||||
endfunction
|
||||
|
||||
cnoremap <C-a> <Home>
|
||||
cnoremap <C-e> <End>
|
||||
cnoremap <C-f> <Right>
|
||||
cnoremap <C-b> <Left>
|
||||
cnoremap <C-d> <Delete>
|
||||
cnoremap <C-n> <Down>
|
||||
cnoremap <C-p> <Up>
|
||||
|
||||
inoremap <C-a> <Home>
|
||||
inoremap <C-e> <End>
|
||||
inoremap <C-f> <Right>
|
||||
inoremap <C-b> <Left>
|
||||
inoremap <C-d> <Delete>
|
||||
inoremap <C-n> <Down>
|
||||
inoremap <C-p> <Up>
|
||||
|
||||
noremap <C-a> <Home>
|
||||
noremap <C-e> <End>
|
||||
noremap <C-f> <Right>
|
||||
noremap <C-b> <Left>
|
||||
noremap <C-n> <Down>
|
||||
noremap <C-p> <Up>
|
||||
|
||||
function! MathAndLiquid()
|
||||
"" Define certain regions
|
||||
" Block math. Look for "$$[anything]$$"
|
||||
syn region math start=/\$\$/ end=/\$\$/
|
||||
" inline math. Look for "$[not $][anything]$"
|
||||
syn match math_block '\$[^$].\{-}\$'
|
||||
|
||||
" Liquid single line. Look for "{%[anything]%}"
|
||||
syn match liquid '{%.*%}'
|
||||
" Liquid multiline. Look for "{%[anything]%}[anything]{%[anything]%}"
|
||||
syn region highlight_block start='{% highlight .*%}' end='{%.*%}'
|
||||
" Fenced code blocks, used in GitHub Flavored Markdown (GFM)
|
||||
syn region highlight_block start='```' end='```'
|
||||
|
||||
"" Actually highlight those regions.
|
||||
hi link math Statement
|
||||
hi link liquid Statement
|
||||
hi link highlight_block Function
|
||||
hi link math_block Function
|
||||
endfunction
|
||||
|
||||
" Call everytime we open a Markdown file
|
||||
"autocmd BufRead,BufNewFile,BufEnter *.md,*.markdown call MathAndLiquid()
|
||||
|
||||
" \vm 2 4\<Tab>
|
||||
" \begin{vmatrix}
|
||||
" <++> & <++> & <++> & <++> \\
|
||||
" <++> & <++> & <++> & <++ > \\
|
||||
" \end{vmatrix}<++>
|
||||
"
|
||||
function! Tex()
|
||||
let mark = '\'
|
||||
let sepr = ' '
|
||||
let tags = {'vm': 'vmatrix', 'bm': 'bmatrix', 'mt': 'matrix', 'cs': 'cases', 'ad': 'aligned', 'al': 'align', 'ar': 'array'}
|
||||
let text = getline('.')
|
||||
let end = col('.')
|
||||
let start = strridx(text, mark, end)
|
||||
if start > -1
|
||||
let params = strpart(text, start+1, end - start - 1)
|
||||
let params = split(params, sepr)
|
||||
let abbr = params[0]
|
||||
if strlen(abbr) == 0 || !has_key(tags, abbr)
|
||||
return
|
||||
endif
|
||||
let rc = params[1]
|
||||
if !(rc>0)
|
||||
return
|
||||
endif
|
||||
if len(params)>2
|
||||
let cc = params[2]
|
||||
if !(cc>0)
|
||||
return
|
||||
endif
|
||||
else
|
||||
let cc = 1
|
||||
end
|
||||
|
||||
let prefix = repeat(' ', start)
|
||||
|
||||
let thecols = []
|
||||
let i = 0
|
||||
while i < cc
|
||||
call add(thecols, '<++>')
|
||||
let i += 1
|
||||
endwhile
|
||||
let columnsText = prefix . ' '. join(thecols, ' & ') . ' \\'
|
||||
|
||||
let lines = []
|
||||
let i = 0
|
||||
while i < rc
|
||||
call add(lines, columnsText)
|
||||
let i += 1
|
||||
endwhile
|
||||
call add(lines, prefix . '\end{' . tags[abbr] . '}<++>')
|
||||
|
||||
let leftPart = strpart(text, 0, start)
|
||||
let rightPart = strpart(text, end)
|
||||
if strlen(rightPart) > 0
|
||||
call add(lines, prefix . rightPart)
|
||||
endif
|
||||
call setline(line('.'), leftPart . '\begin{' . tags[abbr] . '}')
|
||||
call append(line('.'), lines)
|
||||
"call append(line('.'), lines)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" autocmd FileType markdown
|
||||
inoremap <Bslash><Tab> <Esc>:call Tex()<Esc>a
|
||||
" Navigating with guides
|
||||
inoremap <Space><Tab> <Esc>/<++><Enter>"_c4l
|
||||
vnoremap <Space><Tab> <Esc>/<++><Enter>"_c4l
|
||||
map <Space><Tab> <Esc>/<++><Enter>"_c4l
|
||||
nmap <C-_> <Plug>NERDCommenterToggle
|
||||
vmap <C-_> <Plug>NERDCommenterToggle<CR>gv
|
||||
|
||||
" Markdown setup
|
||||
autocmd FileType markdown inoremap \cs<Tab> \begin{cases}\end{cases}<++><Esc>F\i
|
||||
autocmd FileType markdown inoremap \fr<Tab> \frac{<++>}{<++>}<++><Esc>F\i
|
||||
autocmd FileType markdown inoremap `<Tab> `$$`<++><Esc>F$i
|
||||
autocmd FileType markdown inoremap $<Tab> $$<Enter>$$<Enter><++><Esc>kO
|
||||
autocmd FileType markdown inoremap \{ \{\}<++><Esc>F{a
|
||||
autocmd FileType markdown vnoremap <Space>b c__<C-r>"__<Esc>
|
||||
autocmd FileType json nnoremap <Space>f %!json_pp<Cr>
|
||||
|
||||
function! HTML5()
|
||||
let html = []
|
||||
call setline(1, '<!DOCTYPE html>')
|
||||
call add(html, '<html>')
|
||||
call add(html, ' <head>')
|
||||
call add(html, ' <meta charset="UTF-8">')
|
||||
call add(html, ' <title><++></title>')
|
||||
call add(html, ' </head>')
|
||||
call add(html, ' <body>')
|
||||
call add(html, ' <++>')
|
||||
call add(html, ' </body>')
|
||||
call add(html, '</html>')
|
||||
call append(1, html)
|
||||
endfunction
|
||||
|
||||
color gruvbox
|
||||
set background=dark
|
||||
highlight Normal ctermbg=None
|
||||
|
||||
" closetag
|
||||
" dict
|
||||
" ==== closetag configuration ====
|
||||
" Disables auto-close if not in a "valid" region (based on filetype)
|
||||
let g:closetag_regions = {
|
||||
\ 'typescript.tsx': 'jsxRegion,tsxRegion',
|
||||
|
@ -405,9 +136,10 @@ let g:closetag_regions = {
|
|||
\ }
|
||||
let g:closetag_shortcut = '>'
|
||||
let g:closetag_filenames = "*.html,*.xhtml,*.phtml,*.js,*.vue,*.tsx"
|
||||
"
|
||||
"let g:tagalong_additional_filetypes = ['typescript.tsx']
|
||||
|
||||
|
||||
" ==== nerdcommenter configuration ====
|
||||
" fixing vue commenting problem
|
||||
fu! NERDCommenter_before()
|
||||
if &ft == 'vue'
|
||||
let b:isvue = 1
|
||||
|
@ -427,13 +159,93 @@ fu! NERDCommenter_after()
|
|||
let b:isvue = 0
|
||||
endif
|
||||
endfu
|
||||
"
|
||||
|
||||
"fu! NERDCommenter_before()
|
||||
"setf javascript
|
||||
"endfu
|
||||
|
||||
|
||||
"fu! NERDCommenter_after()
|
||||
"setf vue
|
||||
"endfu
|
||||
" ==== general configuration ====
|
||||
set ts=4
|
||||
set sw=4
|
||||
set listchars=eol:$,tab:->,extends:>,precedes:<,space:.,
|
||||
set list
|
||||
set nu
|
||||
set expandtab
|
||||
set hidden
|
||||
set autoindent
|
||||
set confirm
|
||||
set noundofile
|
||||
set nobackup
|
||||
set ruler " 开启游标右下角行、列显示
|
||||
set noswapfile " 关闭临时文件
|
||||
set hlsearch
|
||||
set lazyredraw
|
||||
set noshowmatch
|
||||
set laststatus=2
|
||||
let html_no_rendering=1
|
||||
set fillchars=vert:\ ,fold:-
|
||||
set showcmd
|
||||
hi StatusLine cterm=NONE
|
||||
|
||||
" 行尾空格高亮
|
||||
highlight ExtraWhitespace ctermbg=red guibg=red
|
||||
au ColorScheme * highlight ExtraWhitespace ctermbg=red guibg=red
|
||||
au Syntax * match ExtraWhitespace /\s\+$/
|
||||
|
||||
" theme
|
||||
try
|
||||
color gruvbox
|
||||
catch
|
||||
color delek
|
||||
endtry
|
||||
set background=dark
|
||||
highlight Normal ctermbg=None
|
||||
|
||||
" ==== keybinding configuration ====
|
||||
"vmap <C-y> <Plug>(fakeclip-y)
|
||||
inoremap <C-S-s> <ESC>:<C-u>:w<CR>a
|
||||
nnoremap <C-S-s> :<C-u>:w<CR>
|
||||
|
||||
vnoremap <leader>p "_dP
|
||||
nnoremap <leader><Esc> :noh<return><esc>
|
||||
nnoremap <leader>n :NERDTreeToggle<CR>
|
||||
nnoremap <leader>g :Grepper -tool git<CR>
|
||||
nnoremap <leader>o :only<CR>
|
||||
nnoremap <leader>q :<C-u>qall<CR>
|
||||
nnoremap <leader>e :<C-u>%s/\s\+$//g<CR>
|
||||
nnoremap <leader>s :<C-u>syntax sync fromstart<CR>
|
||||
nnoremap <leader>c :<C-u>:set cursorcolumn!<CR>
|
||||
autocmd FileType json nnoremap <leader>f %!json_pp<Cr>
|
||||
|
||||
"nnoremap <leader>m :vertical resize +5<CR>
|
||||
"nnoremap <leader>, :vertical resize -5<CR>
|
||||
"nnoremap <leader>. :resize +5<CR>
|
||||
"nnoremap <leader>/ :resize -5<CR>
|
||||
"nnoremap <leader>d :vs<CR>
|
||||
"nnoremap <leader>[ :lprev<CR>
|
||||
"nnoremap <leader>] :lnext<CR>
|
||||
"vnoremap <silent> <leader>m c<c-r>=trim(@") . '=' . trim(system('math ' . shellescape(@")))<cr><esc>
|
||||
|
||||
" iterm2 插入模式时backspace不works
|
||||
set backspace=indent,eol,start
|
||||
|
||||
|
||||
function! DecodeHtml()
|
||||
exec ':%s/<pre>/```\r/g'
|
||||
exec ':%s/<\/pre>/\r```/g'
|
||||
exec ':%s/</</g'
|
||||
exec ':%s/>/>/g'
|
||||
exec ':%s/&/\&/g'
|
||||
endfunction
|
||||
|
||||
function! HTML5()
|
||||
let html = []
|
||||
call setline(1, '<!DOCTYPE html>')
|
||||
call add(html, '<html>')
|
||||
call add(html, ' <head>')
|
||||
call add(html, ' <meta charset="UTF-8">')
|
||||
call add(html, ' <title><++></title>')
|
||||
call add(html, ' </head>')
|
||||
call add(html, ' <body>')
|
||||
call add(html, ' <++>')
|
||||
call add(html, ' </body>')
|
||||
call add(html, '</html>')
|
||||
call append(1, html)
|
||||
endfunction
|
||||
|
|
Loading…
Reference in New Issue
Block a user