Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- " ===========================================================================
- " General settings
- " ===========================================================================
- set nu
- set ic
- set ai
- set ruler
- set bs=2
- set shiftwidth=4
- set softtabstop=4
- set smarttab
- set laststatus=2
- set showmatch
- set expandtab
- set visualbell
- set incsearch
- set hlsearch
- set nocompatible
- syntax on
- filetype on
- filetype plugin on
- filetype indent on
- filetype plugin indent on
- syntax sync fromstart
- let mapleader = ","
- map <silent> <leader>x :x<cr>
- map <silent> <leader>q :q<cr>
- "set wildmode=full,list
- "set wildmode=list:full
- set wildmode=longest,list
- set wildignore+=*.o,*.a,*.so,*.obj,*.exe,*.lib,*.ncb,*.opt,*.plg,.svn,.git
- " on/off in corbasic
- vmap n :s/\%VOFF /ON /i<cr>
- vmap f :s/\%VON /OFF /i<cr>
- " indent
- nmap <tab> V>
- nmap <s-tab> V<
- xmap <tab> >gv
- xmap <s-tab> <gv
- " folding
- au FileType c FoldMatching #ifdef\ DEBUG #endif 0
- " vimrc
- if has("gui_running")
- autocmd! bufwritepost .vimrc source ~/.gvimrc
- else
- autocmd! bufwritepost .vimrc source ~/.vimrc
- endif
- " move to next/previous the same indent
- nn <M-,> k:call search ("^". matchstr (getline (line (".")+ 1), '\(\s*\)') ."\\S", 'b')<CR>^
- nn <M-.> :call search ("^". matchstr (getline (line (".")), '\(\s*\)') ."\\S")<CR>^
- " grep
- command! GT :execute 'vimgrep '.expand('<cword>').' '.expand('%') | :copen | :cc
- command! GTA :execute 'vimgrep '.expand('<cword>').' '.expand('%:p:h').'/*' | :copen | :cc
- command! GA :execute 'vimgrep '.expand('<cword>').' '.'*' | :copen | :cc
- " ===========================================================================
- " Toogle quickfix window
- " ===========================================================================
- "
- com! -bang -nargs=? QFix cal QFixToggle(<bang>0)
- fu! QFixToggle(forced)
- if exists("g:qfix_win") && a:forced == 0
- cclose
- unlet g:qfix_win
- else
- copen 10
- let g:qfix_win = bufnr("$")
- en
- endf
- nn <leader>qf :QFix<cr>
- " ===========================================================================
- " GUI related
- " ===========================================================================
- colo metacosm
- hi Search term=reverse cterm=bold ctermbg=12 gui=bold guifg=white guibg=red
- set guioptions-=T "no toolbar
- set guioptions+=l "left scroll bar
- set guioptions-=e "no gui mode tab
- set guioptions+=c "use console dialogs
- set guioptions+=M "menu.vim isn't soured
- " ===========================================================================
- " Userful commands
- " ===========================================================================
- " :h pattern
- " :TOhtml
- " :set ff=unix
- " <C-W>s => horizontal split
- " <C-W>[+|-] => resize h-split
- " <C-W>v => vertical split
- " <C-W>[<|>] => resize h-split
- " <C-W>o => close all except current one
- " <C-W>n => new file in split window
- " <C-W><C-W> => next window
- " copen => open quickfix window
- " cclose => close quickfix window
- " :so % to extract it => extract vim ball
- " ===========================================================================
- " Plugins
- " ===========================================================================
- " --------------------------
- " shellinsidevim.vim
- " --------------------------
- map <CR> :Shell
- let g:ShowOutputWindowWhenVimLaunched=0
- " --------------------------
- " mru.vim
- " --------------------------
- map <silent> <leader>m :MRU<cr>
- let MRU_Max_Entries = 20
- " --------------------------
- " vimbuddy.vim
- " --------------------------
- " can't use with search complete together
- " set statusline=%{VimBuddy()}\ %F%m%r%h%w\ [%{&ff}]\ [%Y]
- " --------------------------
- " ZoomWin
- " --------------------------
- " <C-W> z => toggle single window <=> multiple windows
- map <silent> <leader>z :ZoomWin<cr>
- " --------------------------
- " SearchComplete
- " --------------------------
- " search something then presss tab
- " --------------------------
- " yankring
- " --------------------------
- " :YRShow
- " h yankring.txt
- map <silent> <leader>y :YRShow<cr>
- let g:yankring_history_file = '.vim/.yankring_history'
- " --------------------------
- " timestamp.vim
- " --------------------------
- " add
- " Created: uc(timestamp)
- " Modifed: uc(timestamp)
- " in the file then save it
- let g:timestamp_regexp = '\v\C%(<%(Last%([cC]hanged?|modified)|Modified|MODIFIED)\s*: )@<=.*$|TIMESTAMP'
- "let g:timestamp_rep = '%w %d/%m/%Y %H:%M:%S #u@#h:#f'
- map <silent> <leader>ts :r ~/.vim/plugin/timestamp.template<cr>
- " --------------------------
- " GetLastestVimScripts
- " --------------------------
- " modified GetLastestVimScripts.dat and then
- " :GetLastestVimScripts
- " --------------------------
- " minibufexpl.vim
- " --------------------------
- " <C-Tab>
- let g:miniBufExplMapWindowNavVim = 1
- let g:miniBufExplMapWindowNavArrows = 1
- let g:miniBufExplMapCTabSwitchBufs = 1
- let g:miniBufExplModSelTarget = 1
- " --------------------------
- " tabbar
- " --------------------------
- " <C-Tab>
- " <A-#>: minibufexpl.vim doesn't have!
- map <silent> <leader>b :TbToggle<cr>
- " --------------------------
- " bufexplorer
- " --------------------------
- " ,be => open BufExplorer
- " ,bs => open in split window
- " ,bv => open in vertical split window
- " --------------------------
- " DrawIt!
- " --------------------------
- " ,di to start
- " ,ds to stop
- " :h drawit
- " --------------------------
- " utl
- " --------------------------
- " :h utl-start
- " --------------------------
- " NERD tree
- " --------------------------
- map <silent> <leader>n :NERDTreeToggle<cr>
- " --------------------------
- " NERD Commenter
- " --------------------------
- " ,c<space> => NERDComToggleComment
- " --------------------------
- " taglist
- " --------------------------
- map <silent> <leader>t :TlistToggle<cr>
- let tlist_corbasic_settings = 'corbasic;o:io;T:topcells;t:template_blocks;c:corbasic;p:python_modules;f:functions;F:files;g:groups;G:globals;i:includes'
- let Tlist_WinWidth = 27
- " --------------------------
- " calendar
- " --------------------------
- let g:calendar_diary = '~/.vim/diary'
- map <silent> <leader>c :Calendar<cr>
- map <silent> <leader>ch :CalendarH<cr>
- " --------------------------
- " project
- " --------------------------
- " :h project
- " \c create new project
- " \C create new project, recursively
- map <silent> <Leader>p <Plug>ToggleProject
- let g:proj_window_width = 30
- let g:proj_window_increment = 50
- " --------------------------
- " fuzzyfinder
- " --------------------------
- " :h fuzzyfinder
- nnoremap <Leader>ff :FuzzyFinderFile! <CR>
- nnoremap <Leader>fd :FuzzyFinderDir! <CR>
- nnoremap <Leader>fb :FuzzyFinderBuffer! <CR>
- nnoremap <Leader>fm :FuzzyFinderMruFile! <CR>
- nnoremap <Leader>ft :FuzzyFinderTag! <CR>
- " --------------------------
- " MultipleSearch
- " --------------------------
- " :Search <pattern>
- map <silent> <Leader>sr :SearchReset<cr>
- " --------------------------
- " Align
- " --------------------------
- " :h align.txt
- " ,tsp => align by space
- " --------------------------
- " DiffDir
- " --------------------------
- " :DiffDir dir-a dir-b
- " --------------------------
- " grep.vim
- " --------------------------
- " :Grep
- " --------------------------
- " vimcommander.vim
- " --------------------------
- map <silent> <Leader>vc :cal VimCommanderToggle()<cr>
- " --------------------------
- " perl-support.vim
- " --------------------------
- let g:Perl_PerlcriticSeverity = 1
- map <leader>pc :call Perl_Perlcritic()<cr>:redraw<cr>
- " --------------------------
- " snippetsEmu
- " --------------------------
- let g:snip_start_tag = "«"
- let g:snip_end_tag = "»"
- " --------------------------
- " snippetsEmu
- " --------------------------
- let g:Lua_AuthorName = 'Yen-Liang Chen'
- let g:Lua_Email = 'ylchenzr@tsmc.com'
- let g:Lua_Company = 'TSMC'
- "source /ban/ylchenzr/.vim/.vimrc.copyright
- " ===========================================================================
- " Best Vim Tips
- " ===========================================================================
- " --------------------------
- " Exploring
- " --------------------------
- " :Ex : file explorer note capital Ex
- " \be : builtin buffer explorer
- " :ls : list of buffers(eg following)
- " :cd .. : move to parent directory
- " --------------------------
- " Great
- " --------------------------
- " guu : lowercase line
- " gUU : uppercase line
- " ~ : invert case (upper->lower; lower->upper) of current character
- " gf : open file name under cursor (SUPER)
- " ga : display hex, ascii value of character under cursor
- " ggg?G : rot13 whole file
- " xp : swap next two characters around
- " CTRL-A,CTRL-X : increment, decrement next number on same line as the cursor
- " CTRL-R=5*5 : insert 25 into text
- " = : (re)indent the text on the current line or on the area selected (SUPER)
- " --------------------------
- " Recording (BEST TIP of ALL)
- " --------------------------
- " qq : record keystrokes to register q
- " your commands
- " q : quit recording
- " @q : execute commands again
- " @@ : repeat
- " # editing a register/recording
- " "qp
- " <you can now see register contents, edit as required>
- " "add
- " @a
- " :%normal @q #execute the macro recorded in register q on all lines of the current file.
- " #or, with a visually selected set of lines:
- " :normal @q
- " --------------------------
- " Global command
- " --------------------------
- " :g/^\s*$/d : delete all blank lines
- " :g!/^dd/d : delete lines not containing string
- " :v/^dd/d : delete lines not containing string
- " :g/fred/,/joe/d : not line based
- " :v/./.,/./-1join : compress empty lines
- " :'a,'b g/^Error/ . w >> errors.txt
- " :g/cmap\|form/p : ORing
Add Comment
Please, Sign In to add comment