python可能4个空格缩进,ruby或者别的一些规定2个空格
下面是关于空格我的~/.vimrc.after,默认tab是4个空格(pythoner),如果写coffee的
话默认两个
set tabstop=4 " A four-space tab indent width is the prefered coding style
" for Python (and everything else!), although of course some
" disagree. This page generally assumes you want 4-space
" indents.
set shiftwidth=4 " This allows you to use the < and > keys from VIM's visual
" (marking) mode to block indent/unindent regions
set smarttab " Use the "shiftwidth" setting for inserting <TAB>s instead
" of the "tabstop" setting, when at the beginning of a
" line. This may be redundant for most people, but some
" poeple like to keep their tabstop=8 for compatability
" when loading files, but setting shiftwidth=4 for nicer
" coding style.
set expandtab " expandtab et Insert spaces instead of <TAB>
" character when the <TAB> key is pressed. This is also
" the prefered method of Python coding, since Python is
" especially sensitive to problems with indenting which can
" occur when people load files in different editors with
" different tab settings, and also cutting and pasting
" between applications (ie email/news for example) can
" result in problems. It is safer and more portable to
" use spaces for indenting.
set softtabstop=4 " softtabstop=4 sts People like using real tab
" character instead of spaces because it makes it easier
" when pressing BACKSPACE or DELETE, since if the indent
" is using spaces it will take 4 keystrokes to delete
" the indent. Using this setting, however, makes VIM see
" multiple space characters as tabstops, and so <BS> does
" the right thing and will delete four spaces (assuming
" 4 is your setting).
set autoindent " autoindent ai Very painful to live without this
" (especially with Python)! It means that when you press
" RETURN and a new line is created, the indent of the new
" line will match that of the previous line.
autocmd FileType coffee setlocal tabstop=2 shiftwidth=2 softtabstop=2
可视化
行级别 shift + v 列级别 ctrl + v
可视化是很重要的一个部分,还记得你在记事本里面用鼠标选中某些文字, 然后复制粘贴么?在vim里面只要ctrl + v 然后拉动 h l 等选中文字,y可以复制选中的文字,x可以删除选中的文字,大写I进行插入 按Esc之后会有惊喜(多行注释常用)
snippet le
logging.error(${0:msg})
# conflict with lambda=ld, therefor we change into Logger.debuG
snippet lg
import logging
snippet lw
logging.warning(${0:msg})
snippet lc
logging.critical(${0:msg})
snippet li
logging.info(${0:msg})
单词大小写转化
1.选中单词 ctrl + v w
转换大小写 gu(小写) gU(大写)
2. guw gUw
vim 编译coffeescript
vim的一个插件
https://github.com/kchmck/vim-coffee-script
安装
Install pathogen.vim into ~/.vim/autoload/
http://www.vim.org/scripts/script.php?script_id=2332
Enable pathogen in your vimrc. Here's a bare-minimum vimrc that enables all the features of vim-coffee-script:
call pathogen#infect()
syntax enable
filetype plugin indent on
:map <F3> :CoffeeCompile vert<CR> # 安F3编译 并且右边显示
Create the directory ~/.vim/bundle/:
mkdir ~/.vim/bundle
Clone the vim-coffee-script repo into ~/.vim/bundle/:
git clone https://github.com/kchmck/vim-coffee-script.git ~/.vim/bundle/vim-coffee-script/
~/.vimrc.after
set tabstop=4 " A four-space tab indent width is the prefered coding style
" for Python (and everything else!), although of course some
" disagree. This page generally assumes you want 4-space
" indents.
set shiftwidth=4 " This allows you to use the < and > keys from VIM's visual
" (marking) mode to block indent/unindent regions
set smarttab " Use the "shiftwidth" setting for inserting <TAB>s instead
" of the "tabstop" setting, when at the beginning of a
" line. This may be redundant for most people, but some
" poeple like to keep their tabstop=8 for compatability
" when loading files, but setting shiftwidth=4 for nicer
" coding style.
set expandtab " expandtab et Insert spaces instead of <TAB>
" character when the <TAB> key is pressed. This is also
" the prefered method of Python coding, since Python is
" especially sensitive to problems with indenting which can
" occur when people load files in different editors with
" different tab settings, and also cutting and pasting
" between applications (ie email/news for example) can
" result in problems. It is safer and more portable to
" use spaces for indenting.
set softtabstop=4 " softtabstop=4 sts People like using real tab
" character instead of spaces because it makes it easier
" when pressing BACKSPACE or DELETE, since if the indent
" is using spaces it will take 4 keystrokes to delete
" the indent. Using this setting, however, makes VIM see
" multiple space characters as tabstops, and so <BS> does
" the right thing and will delete four spaces (assuming
" 4 is your setting).
set autoindent " autoindent ai Very painful to live without this
" (especially with Python)! It means that when you press
" RETURN and a new line is created, the indent of the new
" line will match that of the previous line.
set textwidth=79
autocmd FileType coffee setlocal tabstop=2 shiftwidth=2 softtabstop=2
autocmd FileType styl setlocal tabstop=2 shiftwidth=2 softtabstop=2
autocmd FileType html setlocal tabstop=2 shiftwidth=2 softtabstop=2
autocmd FileType css setlocal tabstop=2 shiftwidth=2 softtabstop=2
set noswapfile
" :map <F1> :wa " zarkpy 的一个配置
" :! /usr/local/bin/launch-curr.py %:p " zarkpy 的一个配置
" :map <F2> :! /usr/local/bin/error-curr.py %:p " zarkpy 的一个配置
" :map <F3> :CoffeeCompile vert<CR> " coffee complie的一个插件
:map <C-t> :tabedit ./
:map <C-n> :tabnew ./
:map <C-h> :tabp<CR>
:map <C-i> :tabn<CR>
:map <C-c> :tabclose<CR>
:imap <C-l> <C-x><C-o>
call pathogen#infect()
syntax enable
filetype plugin indent on