vim安装与配置
1、vim安装
ubuntu下sudo apt-get install vim
centos下sudo yum install vim
mac os下brew install macvim
安装完后,这么配置
安装Vundle管理插件
$ git clone http://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
接着修改 .vimrc 加上下面這段就可以了
除了可以直接裝上 vim-scripts 上面的外掛之外, 也可以直接裝 github 上的 repo。 只需要修改 .vimrc 加上你要裝的 plugin, 像是 …
修改或创建一个.vimrc文件,内容如下:
" 配置vundle安装
set nocompatible " be iMproved
filetype off " required!
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'
" My Bundles here:
"
" original repos on github
Bundle 'davidhalter/jedi-vim'
Bundle 'scrooloose/nerdtree'
Bundle 'kien/ctrlp.vim'
Bundle 'sjbach/lusty'
Bundle 'tpope/vim-fugitive'
Bundle 'vim-scripts/Syntastic'
" vim-scripts repos
Bundle 'L9'
" non github repos
" Bundle 'git://git.wincent.com/command-t.git'
"
" 一些基本配置
"
filetype plugin indent on " required!
let mapleader = ','
let g:mapleader = ','
" Ignore case when searching
set ignorecase
" When searching try to be smart about cases
set smartcase
" Highlight search results
set hlsearch
" Makes search act like search in modern browsers
set incsearch
" Use spaces instead of tabs
set expandtab
" Be smart when using tabs ;)
set smarttab
" 1 tab == 4 spaces
set shiftwidth=4
set tabstop=4
"Always show current position
set ruler
"
"" Height of the command bar
set cmdheight=2
set nobackup
set noswapfile
set nowb
" 状态栏配置
set laststatus =2 "always has status line
set statusline=%F%m%r%h%w\ [TYPE=%Y]\ [POS=%04l,%04v]\ [%p%%]
set statusline+=%=\ %{fugitive#statusline()}
set statusline+=%{SyntasticStatuslineFlag()}
"
"插件相关配置
"
" NERDTree=====
map <F2> :NERDTreeToggle<CR>
"nmap :NERDTreeToggle
"let NERDTreeWinSize=22
"let NERDTreeIgnore=['\.pyc', '\.swp']
"switch window
" LustyBufferExplorer=====
nnoremap lb :LustyBufExplorer
set hidden
"
" Brief help
" :BundleList - list configured bundles
" :BundleInstall(!) - install(update) bundles
" :BundleSearch(!) foo - search(or refresh cache first) for foo
" :BundleClean(!) - confirm(or auto-approve) removal of unused bundles
"
" see :h vundle for more details or wiki for FAQ
" NOTE: comments after Bundle command are not allowed..
-------------------------------------
在命令方式下运行
以上内容是搜google来的
-------------------------------------
在命令方式下运行
:BundleInstall
-------------------------------------
1.插入注释:
用v进入virtual模式
用上下键选中需要注释的行数
按Control+v进入列模式
按大些“I”进入插入模式,输入注释符“#”,然后立刻按下ESC(两下)
2.删除注释
先按Control+v进入列模式
按光标键选中需要删除的注释符
按x键删除
键入 Ctrl+V
键入 “>” (即shift + .)
然后如果还想再缩进 , 按 “. ” 就可以重复前面的操作了
如果想要反缩进也很简单, 把 “>” 改为 “<” 就可以了。