From 1aca31103361b456c33e99fa46e54e7a7821fa71 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Mon, 6 Mar 2023 00:26:13 +0800 Subject: Remove old vimrc --- vimrc.bak | 300 -------------------------------------------------------------- 1 file changed, 300 deletions(-) delete mode 100644 vimrc.bak diff --git a/vimrc.bak b/vimrc.bak deleted file mode 100644 index e15d412..0000000 --- a/vimrc.bak +++ /dev/null @@ -1,300 +0,0 @@ -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => Custom Config -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -set cursorline -set number -set relativenumber -set showcmd -set nowrap -set nostartofline -set sidescroll=1 -set sidescrolloff=999 -set shell=/bin/bash -set shiftwidth=2 -autocmd FileType vimwiki set shiftwidth=4 -" set clipboard=unnamedplus - -" general -function! Bye() - if len(filter(range(1, bufnr('$')), 'buflisted(v:val)')) == 1 - :quit - else - :bdelete - endif -endfunction -nnoremap :call Bye() -nnoremap :q! -nnoremap , :.terminal ++noclose -vnoremap , :terminal -nnoremap Y viW:!tee >(xsel -ib) -vnoremap Y :!tee >(xsel -ib) -nnoremap < :%terminal ++noclose -nnoremap W :set wrap! -nnoremap T :vertical terminal -nnoremap R :read ! -nnoremap P :r !xsel -ob -nnoremap nn :NERDTree -set autoread -set nofoldenable " disable folding - -" move -" nnoremap } -" nnoremap { -inoremap -cnoremap -cnoremap -nmap H 0 -nnoremap L $ -nnoremap 60l -nnoremap 60h -nnoremap / ms/ - -" disable syntax -nnoremap s - \ : if exists("syntax_on") - \ syntax off - \ else - \ syntax enable - \ endif -" show current syntax -nnoremap S :echo join(reverse(map(synstack(line('.'), col('.')), 'synIDattr(v:val,"name")')),' ') - -" Operator pending -onoremap p i( -onoremap ap a( -" next parenthesis -onoremap fp :normal! f(vi( -onoremap b i{ -onoremap fb :normal! f{vi{ -onoremap ab a{ -" block -onoremap B /return - -" Search -vnoremap // y/\V=escape(@",'/\')'") - -" S&R -nnoremap ; :%s:::g -vnoremap ; :s:::g -cnoremap \\ \(\) - -" Fix paste bug triggered by inoremaps -set t_BE= - -" surround with charactor -vnoremap ' ``>la' -vnoremap q ``>la" -vnoremap ( ``>la) -vnoremap { ``>la} -vnoremap [ ``>la]gvlol -inoremap [ []h -vnoremap ` ``>la` -vnoremap , ``>la> -vnoremap ``>la -vnoremap 8 ``>la* -vnoremap z ``>la」 -vnoremap ~ ``>la~ - -" abbrev -iabbrev @@ typebrook@gmail.com - - -" vim_markdown -let g:vim_markdown_folding_disabled = 1 -let g:vim_markdown_conceal = 0 -vnoremap ``>la]()i - -" XML fold -let g:xml_syntax_folding=1 -autocmd FileType xml setlocal foldmethod=syntax - -" JSON fold -let g:json_syntax_folding=1 -autocmd FileType json setlocal foldmethod=syntax - -" Apply new SniptMat Parser -let g:snipMate = { 'snippet_version' : 1 } - -" Set width of mutt as 72 -au BufRead /tmp/mutt-* set tw=72 - -" Redirection with buffer -" Usage: -" :Redir hi ............. show the full output of command ':hi' in a scratch window -" :Redir !ls -al ........ show the full output of command ':!ls -al' in a scratch window -function! Redir(cmd) - for win in range(1, winnr('$')) - if getwinvar(win, 'scratch') - execute win . 'windo close' - endif - endfor - if a:cmd =~ '^!' - let output = system(matchstr(a:cmd, '^!\zs.*')) - else - redir => output - execute a:cmd - redir END - endif - vnew - let w:scratch = 1 - setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile - call setline(1, split(output, "\n")) -endfunction - -command! -nargs=1 -complete=command Redir silent call Redir() - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => Settings for Vimwiki -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - -nnoremap tt :VimwikiTable -nnoremap wg :VimwikiGoto -nnoremap wT :VimwikiSearchTags -nnoremap i I- l -nnoremap I :s/^[ ]*- \(\[.\] \)*// -nmap D dd:VimwikiMakeDiaryNoteGp:w!:Bclose -vnoremap D d:VimwikiMakeDiaryNoteGp:w! -let g:vimwiki_list = [{ - \ 'path': '~/log/', - \ 'syntax': 'markdown', - \ 'ext': '.md', - \ }] - -" Git push quietly whenever leaving vim with VimWiki files -augroup vimwikiPush - autocmd! - autocmd VimLeave ~/log/* :!(cd ~/log && git add * && git commit -am Update && git push origin >/dev/null 2>&1 &) -augroup END - -" Configuration fro vim-instant-markdown -let g:instant_markdown_autostart = 0 -nnoremap md :InstantMarkdownPreview - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => Settings for Blog -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - -" Generate static pages -augroup blogRebuild - autocmd! - autocmd BufWritePost ~/blog/*.md :!cd ~/blog && hugo >/dev/null -augroup END - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => Settings for Slides -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - -" Generate static pages -augroup slideRebuild - autocmd BufWritePost ~/public/**/slide/*.md :!(cd %:p:h && ~/helper/bin/markdown/reveal %:t >/dev/null &) -augroup END - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => Redirect the output of a Vim or external command into a scratch buffer -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Copy from : https://gist.github.com/romainl/eae0a260ab9c135390c30cd370c20cd7 -" -" Usage: -" :Redir hi ............. show the full output of command ':hi' in a scratch window -" :Redir !ls -al ........ show the full output of command ':!ls -al' in a scratch window - -function! Redir(cmd) - for win in range(1, winnr('$')) - if getwinvar(win, 'scratch') - execute win . 'windo close' - endif - endfor - if a:cmd =~ '^!' - let output = system(matchstr(a:cmd, '^!\zs.*')) - else - redir => output - execute a:cmd - redir END - endif - vnew - let w:scratch = 1 - setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile - call setline(1, split(output, "\n")) -endfunction - -command! -nargs=1 -complete=command Redir silent call Redir() -nnoremap r :Redir - - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => Make Alt key works on Gnome terminal -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Solution is here: https://stackoverflow.com/questions/6778961 - -let c='a' -while c <= 'z' - exec "set =\e".c - exec "imap \e".c." " - let c = nr2char(1+char2nr(c)) -endw -set timeout ttimeoutlen=50 - - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => vim-racer -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -set hidden -let g:racer_cmd = "~/.cargo/bin/racer" -let g:racer_experimental_completer = 1 - -autocmd FileType rust nmap gd (rust-def) -autocmd FileType rust nmap gs (rust-def-split) -autocmd FileType rust nmap gx (rust-def-vertical) -autocmd FileType rust nmap gd (rust-doc) - - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => vim-plug -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" run :PlugInstall to install plugins - -call plug#begin('~/.vim/plugged') - -" Add indent line - -Plug 'Yggdroot/indentLine' -Plug 'mileszs/ack.vim' -Plug 'tpope/vim-surround' -"Plug 'lifepillar/pgsql.vim' -Plug 'vimwiki/vimwiki' -"Plug 'iberianpig/tig-explorer.vim' -Plug 'rust-lang/rust.vim' -"Plug 'racer-rust/vim-racer' -"Plug 'suan/vim-instant-markdown', {'for': 'markdown'} -Plug 'junegunn/fzf.vim' -Plug 'michal-h21/vim-zettel' -Plug 'rlue/vim-barbaric' -Plug 'nathangrigg/vim-beancount' -Plug 'preservim/nerdtree' - -" Initialize plugin system -call plug#end() - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => lf -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Use lf as file selector -function! LF() - let temp = tempname() - exec 'silent !lf -selection-path=' . shellescape(temp) - if !filereadable(temp) - redraw! - return - endif - let names = readfile(temp) - if empty(names) - redraw! - return - endif - exec 'edit ' . fnameescape(names[0]) - for name in names[1:] - exec 'argadd ' . fnameescape(name) - endfor - redraw! -endfunction -command! -bar LF call LF() -- cgit v1.2.3-70-g09d2