Last active
August 30, 2022 15:22
-
-
Save kran/2886745 to your computer and use it in GitHub Desktop.
.vimrc(need much more cleans)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aug default | |
au! | |
au BufReadPost *.html setl filetype=html | |
" au BufEnter * colo default | |
au FileType javascript,xml,css,html setl sw=2 sts=2 et | |
au FileType php setl iskeyword+=$ | |
au TabLeave * let g:lasttab = tabpagenr() | |
au QuickFixCmdPost [^l]* nested cwindow | |
au QuickFixCmdPost l* nested lwindow | |
aug END | |
if empty(glob('~/.vim/autoload/plug.vim')) | |
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs | |
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim | |
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC | |
endif | |
"{{{ | |
let g:EasyMotion_keys = 'abcdezgyhilmnopqrstuvwxjkf' | |
let delimitMate_expand_cr = 2 | |
let delimitMate_expand_space = 0 | |
let g:lasttab = 1 | |
let g:SuperTabNoCompleteAfter = ['^', '\s', ','] | |
let g:matchup_matchparen_offscreen = {'method': 'popup'} | |
let g:rainbow_active = 1 | |
"}}} | |
call plug#begin('~/.vim/plugged') | |
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } | |
Plug 'junegunn/fzf.vim' | |
Plug 'tpope/vim-commentary' | |
Plug 'junegunn/vim-easy-align' | |
Plug 'ackyshake/VimCompletesMe' | |
Plug 'scrooloose/nerdtree' | |
Plug 'easymotion/vim-easymotion' | |
Plug 'Raimondi/delimitMate' | |
Plug 'chrisbra/NrrwRgn' | |
Plug 'junegunn/vim-easy-align' | |
Plug 'tpope/vim-surround' | |
Plug 'jason0x43/vim-js-indent' | |
Plug 'kran/poorman-spacevim' | |
Plug 'andymass/vim-matchup' | |
Plug 'ziglang/zig.vim' | |
" Plug 'luochen1990/rainbow' | |
" Plug 'morhetz/gruvbox' | |
" Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' } | |
call plug#end() | |
"{{{ | |
filetype plugin indent on | |
syntax on | |
set bg=light | |
colo default | |
set clipboard=unnamed | |
set t_Co=256 | |
set directory=/tmp | |
set undodir=/tmp | |
set nu | |
set concealcursor=nc | |
set guioptions=eg | |
set ruler! wrap | |
set wildmenu | |
set splitright | |
set cmdheight=1 | |
set nocompatible | |
set completeopt-=preview | |
set novisualbell ttyfast | |
set shell=bash | |
set showmatch | |
set textwidth=0 | |
set cindent autoindent | |
set tabstop=4 shiftwidth=4 smarttab expandtab | |
set ambiwidth=double | |
set timeoutlen=800 | |
set synmaxcol=300 | |
set linebreak | |
set formatoptions+=mB | |
set scrolloff=2 scrolljump=5 | |
set backspace=indent,eol,start | |
set whichwrap=b,s,<,>,[,] | |
set mouse=a mousemodel=popup | |
set keymodel= | |
set selection=inclusive | |
set ignorecase wildignorecase nohlsearch incsearch | |
set nojoinspaces | |
set autowriteall | |
set undofile undolevels=100 undoreload=100 | |
set encoding=utf-8 | |
set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1 | |
set laststatus=2 | |
set statusline=%#identifier#[%f]%*%#warningmsg#%{(&fenc!='utf-8'&&&fenc!='')?'['.&fenc.']':''}%* | |
\%h%y%#identifier#%r%*%#identifier#%m%* | |
\%*%#error#%{&paste?'[paste]':''}%* | |
\%=%1.40{getcwd()}\ \|\ %c,%l/%L\ %P | |
"}}} | |
"{{{ | |
func! HomeOfLine() | |
call feedkeys("\<Home>", 'n') | |
if(match(getline('.'), '^[ \t]\ze.*') == 0) | |
call feedkeys("\<S-Right>") | |
endif | |
return "" | |
endfunc | |
nnoremap <C-j> <C-W>j | |
nnoremap <C-k> <C-W>k | |
nnoremap <C-h> <C-W>h | |
nnoremap <C-l> <C-W>l | |
imap <C-d> <del> | |
ino <expr> <C-a> HomeOfLine() | |
imap <C-e> <END> | |
imap <C-b> <LEFT> | |
imap <C-j> <DOWN> | |
imap <C-k> <UP> | |
imap <C-f> <RIGHT> | |
imap <C-l> <S-RIGHT> | |
vnoremap <C-C> "+y | |
imap <C-v> <ESC>"+pa | |
nmap <C-y> <C-^> | |
imap <C-y> <C-^> | |
nmap <c-p> :GFiles<cr> | |
imap <c-p> <c-o>:GFiles<cr> | |
xmap <CR> <Plug>(EasyAlign) | |
map T :tabnew<cr> | |
nmap J :tabnext<cr> | |
nmap K :tabprev<cr> | |
nnoremap <silent> <c-t> :exe "tabn ".g:lasttab<cr> | |
vnoremap <silent> <c-t> :exe "tabn ".g:lasttab<cr> | |
noremap <silent> <expr> j (v:count == 0 ? 'gj' : 'j') | |
noremap <silent> <expr> k (v:count == 0 ? 'gk' : 'k') | |
vnoremap < <gv | |
vnoremap > >gv | |
noremap Y y$ | |
"}}} | |
"{{{ | |
let g:poorman_spacevim_cmds = #{ | |
\f: #{name: '文件', children: #{ | |
\m: #{name: "历史文件", cmd: #{_: "History"}}, | |
\w: #{name: "保存", cmd: #{_: "w"}}, | |
\v: #{name: "vimrc", cmd: #{_: "e ~/.vimrc"}}, | |
\a: #{name: "保存全部", cmd: #{_: "wa"}}, | |
\}}, | |
\g: #{name: 'git', children: #{ | |
\c: #{name: "commits", cmd: #{_: "Commits"}}, | |
\b: #{name: "buffer commits", cmd: #{_: "BCommits"}}, | |
\}}, | |
\0: #{name: "上次标签", cmd: #{_: "tablast"}}, | |
\1: #{name: "标签1", cmd: #{_: "normal 1gt"}}, | |
\2: #{name: "标签2", cmd: #{_: "normal 2gt"}}, | |
\3: #{name: "标签3", cmd: #{_: "normal 3gt"}}, | |
\4: #{name: "标签4", cmd: #{_: "normal 4gt"}}, | |
\n: #{name: "切换行号", cmd: #{_: "set nu!"}}, | |
\p: #{name: "粘贴模式", cmd: #{_: "set paste!"}}, | |
\d: #{name: "目录浏览器", cmd: #{_: "NERDTreeToggle"}}, | |
\a: #{name: "目录文件", cmd: #{_: "Files"}}, | |
\w: #{name: "字符定位", cmd: #{_: "call EasyMotion#WB(0,2)"}}, | |
\c: #{name: "切换到当前目录", cmd: #{_: "lcd %:p:h"}}, | |
\e: #{name: "buffers", cmd: #{_: "Buffers"}}, | |
\s: #{name: "彩虹括号", cmd: #{_: "RainbowToggle"}}, | |
\l: #{name: "当前文件行", cmd: #{_: "BLines"}}, | |
\m: #{name: "marks", cmd: #{_: "Marks"}}, | |
\q: #{name: "search", cmd: #{_: "Rg"}}, | |
\r: #{name: "执行🛵", cmd: #{vim: "so %", php: "!php %", go: "!go run %", lua: "!lua %", zig: "!zig run %"}}, | |
\} | |
nmap <silent> <space> :call PoorMan#Trigger()<cr> | |
nmap <silent> <c-n> :call PoorMan#Trigger()<cr> | |
imap <silent> <c-n> <c-o>:call PoorMan#Trigger()<cr> | |
"}}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment