2017年7月21日 星期五
2016年11月3日 星期四
2016年9月21日 星期三
[vim] Backup current vim environment
Backup vim environment
:mksession ~/mysession.vim
Restore old vim environment
:source ~/mysession.vim
or open vim with the -S option:
$ vim -S ~/mysession.vim
Reference:
:mksession ~/mysession.vim
Restore old vim environment
:source ~/mysession.vim
or open vim with the -S option:
$ vim -S ~/mysession.vim
Reference:
2016年7月21日 星期四
[VIM] How to use CCTree
Load database~
>
:CCTreeLoadDB
<
(Please note that it might take a while depending on the
database size)
Exploring source-code~
CCTree-explore-source
Get reverse call tree for symbol <C-\><
>
:CCTreeTraceReverse <symbolname>
<
Get forward call tree for symbol <C-\>>
>
:CCTreeTraceForward <symbolname>
<
Increase depth of tree and update <C-\>=
>
:CCTreeRecurseDepthPlus
<
Decrease depth of tree and update <C-\>-
>
:CCTreeRecurseDepthMinus
<
Reference:
[VIM] How to add submodule package into .vim
Install instruction :
To install a new plugin as a git submoudle, type the following commands.
Ex:
Because CCTree have plugin under it folder, so vim can load it.
To install a new plugin as a git submoudle, type the following commands.
cd ~/.vim
git submodule add [GIT-REPOSITORY-URL] bundle/[PLUGIN-NAME]
Ex:
Because CCTree have plugin under it folder, so vim can load it.
git submodule add git@github.com:hari-rangarajan/CCTree.git bundle/CCTree
2016年4月18日 星期一
[Vim][DirDiff][vimdiff] How to use DirDiff to compare to different folder
1. Go into vim editor
2. Type “:DirDiff ”, then start to compare the code of different folder.
Reference:
2. Type “:DirDiff ”, then start to compare the code of different folder.
Reference:
2016年3月29日 星期二
2015年12月24日 星期四
[Vim] Scrolling synchronously
scroll simultaneously
:set scb
scroll no simultaneously
:set scb!
Reference:
:set scb
scroll no simultaneously
:set scb!
Reference:
2015年12月8日 星期二
[Vim] Powerline
Install python tool
sudo pacman -Sy python-pip
Install powerline package
sudo pip install git+git://github.com/Lokaltog/powerline
For System
Update font
sudo pacman -Sy python-pip
Install powerline package
sudo pip install git+git://github.com/Lokaltog/powerline
For System
if [ -f /usr/lib/python3.5/site-packages/powerline/bindings/bash/powerline.sh ]; then
source /usr/lib/python3.5/site-packages/powerline/bindings/bash/powerline.sh
fi
For vimset rtp+=/usr/lib/python3.5/site-packages/powerline/bindings/vim/
" Always show statusline
set laststatus=2
" Use 256 colours (Use this setting only if your terminal supports 256 colours)
set t_Co=256
Update font
wget https://github.com/Lokaltog/powerline/raw/develop/font/PowerlineSymbols.otf https://github.com/Lokaltog/powerline/raw/develop/font/10-powerline-symbols.conf
sudo mv PowerlineSymbols.otf /usr/share/fonts/
sudo fc-cache -vf
sudo mv 10-powerline-symbols.conf /etc/fonts/conf.d/
Reference:2015年9月11日 星期五
[VIM] vim 7.4 install
Download from vim webpage
wget ftp://ftp.vim.org/pub/vim/unix/vim-7.4.tar.bz2
Enable cscope
./configure --enable-cscope
make
make install
Type following command will know the status of cscope.
vim --version
wget ftp://ftp.vim.org/pub/vim/unix/vim-7.4.tar.bz2
Enable cscope
./configure --enable-cscope
make
make install
Type following command will know the status of cscope.
vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jul 8 2016 10:05:38)
Compiled by freeman@localhost
Normal version with GTK2 GUI. Features included (+) or not (-):
-arabic +file_in_path -mouse_sgr +tag_binary
+autocmd +find_in_path -mouse_sysmouse +tag_old_static
+balloon_eval +float -mouse_urxvt -tag_any_white
+browse +folding +mouse_xterm -tcl
+builtin_terms -footer +multi_byte +terminfo
+byte_offset +fork() +multi_lang +termresponse
+cindent +gettext -mzscheme +textobjects
+clientserver -hangul_input +netbeans_intg +title
+clipboard +iconv +path_extra +toolbar
+cmdline_compl +insert_expand -perl +user_commands
+cmdline_hist +jumplist +persistent_undo +vertsplit
+cmdline_info -keymap +postscript +virtualedit
+comments -langmap +printer +visual
-conceal +libcall -profile +visualextra
+cryptv +linebreak -python +viminfo
-cscope +lispindent -python3 +vreplace
+cursorbind +listcmds +quickfix +wildignore
+cursorshape +localmap +reltime +wildmenu
+dialog_con_gui -lua -rightleft +windows
+diff +menu -ruby +writebackup
+digraphs +mksession +scrollbind +X11
+dnd +modify_fname +signs -xfontset
-ebcdic +mouse +smartindent +xim
-emacs_tags +mouseshape -sniff +xsmp_interact
+eval -mouse_dec +startuptime +xterm_clipboard
+ex_extra +mouse_gpm +statusline -xterm_save
+extra_search -mouse_jsbterm -sun_workshop
-farsi -mouse_netterm +syntax
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
system gvimrc file: "$VIM/gvimrc"
user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
system menu file: "$VIMRUNTIME/menu.vim"
fall-back for $VIM: "/usr/local/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -pthread -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libdrm -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/freetype2 -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -L/usr/local/lib -Wl,--as-needed -o vim -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE -lm -lncurses -lelf -lnsl -lacl -lattr -lgpm -ldl 2015年7月21日 星期二
2015年7月15日 星期三
[vim][Cscope] cscope the command is not available
:version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jul 15 2015 11:22:43)
Compiled by root@localhost.localdomain
Normal version without GUI. Features included (+) or not (-):-cscope <– This is mean no support cscope
Download vim 7.4Configurate as following
./configure –enable-cscope
Reference:
2015年3月23日 星期一
[vim] How to remove and add submodule
# Download package from github
git clone git@github.com:happy/vimrc.gitcd vimrc
# Clean all file which under bundle/snipmate-snippets
git submodule deinit -f bundle/snipmate-snippetsCleared directory ‘bundle/snipmate-snippets’
# remove snipmate from submodule
git rm bundle/snipmate-snippetsrm ‘bundle/snipmate-snippets’
# git add submodule under bundle/snipmate-snippets
git submodule add https://github.com/spf13/snipmate-snippets.git bundle/snipmate-snippets# git update submodule
git submodule update --init (update all submodule)git submodule update --init
Reference:
[vim] Set the vim environment from github
MANUALLY INSTALL
- Check out from github
git clone https://github.com/Jumbo88888/vimrc.git ~/.vim cd ~/.vim git submodule update --init - Install ~/.vimrc and ~/.gvimrc
./install-vimrc.sh
Reference:
[vim] How to use ack.vim
### Ack
You have to install [ack](http://betterthangrep.com/), of course.
Install on Debian / Ubuntu with:
sudo apt-get install ack-grep
## Usage ##
:Ack [options] {pattern} [{directory}]
Reference:- Readme of ack.vim
2015年3月19日 星期四
[vim] E73: tag stack empty
Error Place :
Fix :
Reference :
" jump out of the tag stack (undo Ctrl-])
map <C-t> <ESC>:po<CR>
Fix :
" [[ jump out of the tag stack (undo Ctrl-])
map [[ :po<CR>
Reference :
2015年3月12日 星期四
[vim] NERD Commenter
Edit ~/.vimrc or ~/.vim/vimrc
Usage
Reference:
" set leader to ,
let mapleader=","
let g:mapleader=","
Usage
[count]\cc |NERDComComment|
Comment out the current line or text selected in visual mode.
,cc = Comment out the current line or text selected in visual mode.
[count]\cu |NERDComUncommentLine|
Uncomments the selected line(s).
,cu = Uncomments the selected line(s).
Reference:
2015年3月10日 星期二
[Vim] Vim script for default setting
Seting load configuration path
Create a file was called happy.vim
Edit ~/.vimrc or ~/.vim/vimrc
Manual :
source happy.vim
/etc/vimrc -->
/usr/share/vim/vim74 -->
~/.vim/vimrc
Create a file was called happy.vim
" Highlight the syntax syntax on" Show line number set nu " all the enhancements and improvements of Vi Improved are turned on set nocompatible "Number of spaces that a in the file counts for set tabstop=4 " Number of spaces that a counts set softtabstop=4 set shiftwidth=4" when search will highlight the word set hlsearch " Undo file even quit vim set undofile set undodir=/tmp " Copy to system clipboard set clipboard+=unnamed " List the function name nmap <silent> <F5> :TlistToggle<CR><C-W><C-W> " syntastic {{{ let g:syntastic_error_symbol='✗' let g:syntastic_warning_symbol='⚠' let g:syntastic_enable_highlighting = 1 let g:syntastic_stl_format = '[%E{Err: %fe #%e}%B{, }%W{Warn: %fw #%w}]' " }}} " Search string map <C-a><C-a> :CtrlSF
" Setting up Vundle - the vim plugin bundler let iCanHazVundle=1 let vundle_readme=expand('~/.vim/bundle/vundle/README.md') if !filereadable(vundle_readme) echo "Installing Vundle.." echo "" silent !mkdir -p ~/.vim/bundle silent !git clone https://github.com/gmarik/vundle ~/.vim/bundle/vundle let iCanHazVundle=0 endif set rtp+=~/.vim/bundle/vundle/ call vundle#rc() "Add your bundles here Bundle 'tpope/vim-fugitive' Bundle 'Lokaltog/vim-easymotion' Bundle 'rstacruz/sparkup', {'rtp': 'vim/'} Bundle 'tpope/vim-rails.git' " vim-scripts repos Bundle 'L9' Bundle 'FuzzyFinder' " non-GitHub repos Bundle 'git://git.wincent.com/command-t.git' " Git repos on your local machine (i.e. when working on your own plugin) Bundle 'file:///Users/gmarik/path/to/plugin' " ... Bundle 'ervandew/supertab' Bundle 'vim-scripts/taglist.vim' Bundle 'mileszs/ack.vim' Bundle 'kien/ctrlp.vim' Bundle 'scrooloose/syntastic' Bundle 'scrooloose/nerdtree' Bundle 'rstacruz/sparkup' Bundle 'dyng/ctrlsf.vim' Bundle 'vim-scripts/DirDiff.vim' Bundle 'charz/multi-cscope-db' "Bundle 'Valloric/YouCompleteMe' "...All your other bundles... if iCanHazVundle == 0 echo "Installing Bundles, please ignore key map error messages" echo "" :BundleInstall endif " Setting up Vundle - the vim plugin bundler end
Edit ~/.vimrc or ~/.vim/vimrc
Manual :
source happy.vim
[Vim] How to copy string to system clipboard by using vim
Edit ~/.vimrc or ~/.vim/vimrc
set clipboard+=unnamed
Usage:
“+y = Copy
“+p = Paste
Reference:
Copy to system clipboard instead of vim buffer
set clipboard+=unnamed
Usage:
“+y = Copy
“+p = Paste
Reference:
Copy to system clipboard instead of vim buffer
[ctrlsf][vim] Search String by using ctrlsf
1. Install package “ack”
sudo pacman -S ack
- Edit ~/.vimrc or ~/.vim/vimrc
map:CtrlSF
:CtrlSF <search string which you want>
Reference:
每日vim插件–代码搜索ack.vim/ag/ctlsf.vim
vim每日插件之CtrlSF
訂閱:
文章 (Atom)