博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
all about vim
阅读量:5265 次
发布时间:2019-06-14

本文共 4231 字,大约阅读时间需要 14 分钟。

传说是“史上最强.vimrc”:

 

我自己曾经的.vimrc

if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"

   set fileencodings=utf-8,latin1
endif
set nocompatible " Use Vim defaults (much better!)
set bs=indent,eol,start " allow backspacing over everything in insert mode
set viminfo='20,\"50 " read/write a .viminfo file, don't store more
                        " than 50 lines of registers
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time
set smartindent " Judging former line's indent, smart select indent, for C-like language
set cindent " 传说是 C-like, 谁用谁知道
" 设定默认解码
set encoding=utf-8
" set fileencodings=utf-8, chinese,latin-1
" Environment {
" Setup Bundle Support {
" The next two lines ensure that the ~/.vim/bundle/ system works
runtime! autoload/pathogen.vim
silent! call pathogen#helptags()
silent! call pathogen#runtime_append_all_bundles()
" }
" }
" General {
set background=dark " Background become dark
filetype plugin indent on " Automatically detect file types.
syntax on " Highlight syntax
set mouse=a " automatically enable mouse usage(使用)
set virtualedit=onemore " allow for cursor beyond last character
" set spell " spell checking on. Amazing! I found this set is not as usefull as I think.
" Setting up the directoties {
set backup " I saw...Someone said: backups are nice...so I set:)
set backupdir=$HOME/.vimbackup// " but not when they clog .
set directory=$HOME/.vimswap// " Same for swap files
set viewdir=$HOME/.vimviews// " same for view files
" Creating directories if they don't exist
silent execute '!mkdir -p $HVOME/.vimbackup'
silent execute '!mkdir -p $HOME/.vimswap'
silent execute '!mkdir -p $HOME/.vimviews'
" set undofile " STFW, persistent undo. I do think this's not a good feature.
" set undodir=??? " Must, first, mkdir a directory, then replace ???
" set undolevels=1000 "maximum number of changes that can be undone
" }
" }
 
" Vim UI {
colorscheme evening
set showmode " display the current mode
set cursorline " highlight current line
hi cursorline guibg=#333333 " highlight bg color of current line
hi CursorColumn guibg=#333333 " highlight cursor
set backspace=indent,eol,start " backspace for dummys
set number " Show line number
set showmatch " 匹配模式,类似当输入一个"(" 时会匹配相应的")"
set incsearch " find as you type search
set ignorecase " case insensitive search
" }
" Formatting {
set autoindent " Auto-implement current line's indent to next line
autocmd FileType c,cpp,java,php,js,python,twig,xml,yml autocmd BufWritePre <buffer> :call setline(1,map(getline(1,"$"),'substitute(v:val,"\\s\\+$","","")'))
" }
" Only do this part when compiled with support for autocommands
if has("autocmd")
  augroup redhat
    " In text files, always limit the width of text to 78 characters
    autocmd BufRead *.txt set tw=78
    " When editing a file, always jump to the last cursor position
    autocmd BufReadPost *
    \ if line("'\"") > 0 && line ("'\"") <= line("$") |
    \ exe "normal! g'\"" |
    \ endif
  augroup END
endif
if has("cscope") && filereadable("/usr/bin/cscope")
   set csprg=/usr/bin/cscope
   set csto=0
   set cst
   set nocsverb
   " add any database in current directory
   if filereadable("cscope.out")
      cs add cscope.out
   " else add database pointed to by environment
   elseif $CSCOPE_DB != ""
      cs add $CSCOPE_DB
   endif
   set csverb
endif
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
  syntax on
  set hlsearch
endif
if &term=="xterm"
     set t_Co=8
     set t_Sb=[4%dm
     set t_Sf=[3%dm
endif
set tabstop=4 " Set tab is 4 * space
set shiftwidth=4 " 当行之间交错时,使用4个空格
set nocp " vim不再兼容模式下工作。不在模仿vi
set whichwrap=h,l " STFW
set cin " /opt/curricula/2_vim_study_summary
set sw=4 " STFW
set cino=:0g0t0(sus " STFW
set mousemodel=popup " 当右键单击窗口的时候,弹出快捷菜单。
" set paste " 设置粘贴时不自动使用格式:set nopaste 取消. :help autoindent 时发现,此选项与其冲突因此注释掉了

 

Vim,如果tab 和 space 混编会报错。

Please google:"vim tab用空格代替".

set expandtab     " 使用空格代替tab. 

set tabstop=4     " 空格数量是4。 
set shiftwidth=4  " 自动缩进的宽度。

 

 


 

MORE,

 

add: set list 

 

 

键盘 的  delay速度调到delay速度  调整到适合自己,键盘的speed直接调整到最大,非常的爽

这是比vim设定的一个更好的设定

真的

 

:help xxx, this is important.:wq

 

# vim ,这样就能编辑一个网页了

 

vimium,chrome插件,好用

 

ctrl+[可以代替Esc

 

现在唯一想做的,就是ctag,这个非常有用,我却不会。

转载于:https://www.cnblogs.com/kevin922/archive/2013/05/11/3072913.html

你可能感兴趣的文章
solr4.5部署
查看>>
学界 | Yann LeCun新作,中日韩文本分类到底要用哪种编码?
查看>>
<cerrno>
查看>>
httpServletRequest中的流只能读取一次的原因
查看>>
好玩的折纸效果
查看>>
面试知识点八:网络
查看>>
UVa 1220 (树的最大独立集) Party at Hali-Bula
查看>>
linux驱动程序之电源管理之linux的电源管理架构(3)
查看>>
DYCOM之Windows Phone 7.1网络通信
查看>>
.NET简谈事务、分布式事务处理
查看>>
C#串口通信
查看>>
java web 初尝遇到的坑
查看>>
leetcode 594. 最长和谐子序列(Longest Harmonious Subsequence)
查看>>
leetcode 944. 删列造序(Delete Columns to Make Sorted)
查看>>
来自SaberSama的HTML总结
查看>>
项目中的一些css问题总结
查看>>
Dockerfile
查看>>
陈老师作业
查看>>
cookie和session
查看>>
关于开启虚拟机磁盘利用率100%问题
查看>>