Ai
1 Star 0 Fork 1

独孤小败/Vim

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
_vimrc 7.55 KB
一键复制 编辑 原始数据 按行查看 历史
独孤小败 提交于 2013-08-05 11:08 +08:00 . 解决ctags跳转显示Press Enter问题
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Maintainer:
" V
" http://weibo.com/unsuccessful
"
" Version:
" 1.0 - 2013-02-16 21:31:44
"
" Sections:
" -> Base
" -> Encoding
" -> General
" -> Encoding
" -> UI
" -> User
" -> Helper functions
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Base
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
" Enable filetype plugins
filetype on
filetype plugin on
filetype indent on
" syntax
syntax on
syntax enable " Enable syntax highlighting
"""""""""""""""""""""""""""""""
" => Encoding
"""""""""""""""""""""""""""""""
" 设置编码
set encoding=utf-8 " or 'enc'
set fileencoding=utf-8 " or 'fenc'
set fileencodings=utf-8,gbk,ucs-bom,cp936,latin-1 " or 'fencs'
" Use Unix as the standard file type
set ffs=unix,dos,mac
"设置菜单语言
set langmenu=en_US.utf-8
" 解决菜单乱码
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
" 解决consle输出乱码
language messages en_US.utf-8
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => General
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Set to auto read when a file is changed from the outside
set autoread
" 1 tab == 4 spaces
set shiftwidth=4
set tabstop=4
" user spaces instead of tabs
" 在输入 tab 后, vim 用恰当的空格来填充这个 tab
set expandtab
set nocompatible " 设置不兼容
set number
" Make no *.bak
set nobackup
" keep backup while we are editing
set writebackup
" 启动的时候不显示那个援助索马里儿童的提示
set shortmess=atI
" Custom Commands
command! DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
\ | wincmd p | diffthis
"Fix findstr for Win32
if has("win32")
set grepprg=findstr\ /R\ /S\ /N
endif
" do not highlight searches
set nohlsearch
let Tlist_Show_One_file=1 " 不同时显示多个的tag,只显示当前文件的
let Tlist_Exit_OnlyWindow=1 " 如果taglist窗口是最后一个窗口,则退出vim
" Make autoindent happen
set autoindent
" Show actual currsor position
set ruler
set showcmd
" set showmatch
set showmode
" Linebreak on 500 characters
set lbr
set tw=500
set ai "Auto indent
set si "Smart indent
set wrap "Wrap lines
" 搜索时忽略大小写,但在有一个或以上大写字母时仍保持对大小写敏感
set ignorecase smartcase
"""""""""""""""""""""""""""""""
" => NERDTree
"""""""""""""""""""""""""""""""
let NERDChristmasTree=1
let NERDTreeAutoCenter=1
let NERDTreeBookmarksFile=$VIM.'\temp\NerdBookmarks.txt'
let NERDTreeShowBookmarks=1
let NERDTreeMouseMode=2
let NERDTreeShowFiles=1
" let NERDTreeShowHidden=1
" let NERDTreeShowLineNumbers=1
" let NERDTreeWinPos='left'
let NERDTreeWinSize=31
" command Dir NERDTreeToggle
map <C-n> :NERDTreeToggle<CR>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => UI
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Themes setting
" let g:molokai_original = 1
colorscheme molokai
" colorscheme zellner
" colorscheme peachpuff
" colorscheme chocolateliquor
" 字体 && 字号
set guifont=Courier\ New:h9
" set guifont=Source_Code_Pro:h9:cANSI
" 设置中文字体
" set gfw=仿宋:h10:cGB2312
" Set extra options when running in GUI mode
if has("gui_running")
set t_Co=256
"au GUIEnter * simalt ~x " 窗口启动时自动最大化
winpos 50 50 " 设置出现位置
" set lines=40 columns=160 " 设置高度跟宽度
set lines=30 columns=100 " 设置高度跟宽度
"set guioptions-=m " 隐藏菜单栏
set guioptions-=T " 隐藏工具栏
" set guioptions-=L " 隐藏左侧滚动条
" set guioptions-=r " 隐藏右侧滚动条
" set guioptions-=b " 隐藏底部滚动条
" set showtabline=0 " 隐藏Tab栏
" set guitablabel=%M\ %t
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => User
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Google Go
" set rtp+=$GOROOT/misc/vim
" autocmd BufNewFile,BufReadPost *.go set filetype=go
" autocmd FileType go set omnifunc=gocomplete#Complete
" autocmd BufWritePost,FileWritePost *.go execute 'Lint' | cwindow
let s:tlist_def_go_settings = 'go;f:func;v:var;t:type'
" autocmd BufNewFile,BufRead *.di setfiletype d
let tlist_d_settings='d;c:classes;d:macro definitions;e:enumerators'
nnoremap <silent> <F2> :TlistToggle<CR>
" Windows like mappings
if has("win32")
" Ctrl+A = Select All
map <C-a> <Esc>ggVG
endif
" 高亮当前行
" set cursorline
" 高亮当前列
" set cursorcolum
"""""""""""""""""""""""""""""""
" => Zencoding
"""""""""""""""""""""""""""""""
let g:user_zen_settings = {
\ 'indentation' : ' ',
\ 'perl' : {
\ 'aliases' : {
\ 'req' : 'require '
\ },
\ 'snippets' : {
\ 'use' : "use strict\nuse warnings\n\n",
\ 'warn' : "warn \"|\";",
\ }
\ }
\}
let g:user_zen_expandabbr_key = '<c-o>'
let g:use_zen_complete_tag = 1
" let g:user_zen_mode='n' "only enable normal mode functions.
" let g:user_zen_mode='inv' "enable all functions, which is equal to
" let g:user_zen_mode='a' "enable all function in all mode.
"""""""""""""""""""""""""""""""
" => TabBar
"""""""""""""""""""""""""""""""
map <C-H> <C-W>h
map <C-J> <C-W>j
map <C-K> <C-W>k
map <C-L> <C-W>l
" 设置 TabBar 高度
" let g:Tb_MaxSize = 3
"
"默认情况下,只有用户新建了标签页才会在窗口上方显示标签栏,这是由选项
"set showtabline=1决定的。如果我们希望总是显示标签栏,那么可以用
"set showtabline=2命令来设置。如果我们希望完全不显示标签栏,
"那么可以使用set showtabline=0来设置。
" set showtabline=2
"""""""""""""""""""""""""""""""
" => ctags
"""""""""""""""""""""""""""""""
" 注意第一个命令里的分号是必不可少的。这个命令让vim首先在当前目录里寻找tags文件,
" 如果没有找到tags文件,或者没有找到对应的目标,就到父目录中查找,一直向上递归。
" 因为tags文件中记录的路径总是相对于tags文件所在的路径,
" 所以要使用第二个设置项来改变vim的当前目录。
set tags=tags;
set autochdir
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Helper functions
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 比较文件差别
set diffexpr=MyDiff()
function MyDiff()
let opt = '-a --binary '
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
let arg1 = v:fname_in
if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
let arg2 = v:fname_new
if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
let arg3 = v:fname_out
if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
let eq = ''
if $VIMRUNTIME =~ ' '
if &sh =~ '\<cmd'
let cmd = '""' . $VIMRUNTIME . '\diff"'
let eq = '"'
else
let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
endif
else
let cmd = $VIMRUNTIME . '\diff'
endif
silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq
endfunction
" 引号 && 括号自动匹配
" inoremap ( ()<left>
" inoremap [ []<left>
" inoremap { {}<left>
" :inoremap ) <c-r>=ClosePair(')')<CR>
" :inoremap } <c-r>=ClosePair('}')<CR>
" :inoremap ] <c-r>=ClosePair(']')<CR>
" function ClosePair(char)
" if getline('.')[col('.') - 1] == a:char
" return "\<right>"
" else
" return a:char
" endif
" endf
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
VimL
1
https://gitee.com/unsuccessful/vim.git
git@gitee.com:unsuccessful/vim.git
unsuccessful
vim
Vim
master

搜索帮助