Last active
November 9, 2023 03:21
-
-
Save nevermoe/86a97967096832c2336e61465c7d3517 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible " 关闭 vi 兼容模式 | |
syntax on " 自动语法高亮 | |
colorscheme desert " 设定配色方案 | |
set number " 显示行号 | |
" set cursorline " 突出显示当前行 | |
set ruler " 打开状态栏标尺 | |
set shiftwidth=2 " 设定 << 和 >> 命令移动时的宽度为 2 | |
set softtabstop=2 " 使得按退格键时可以一次删掉 2 个空格 | |
set tabstop=2 " 设定 tab 长度为 2 | |
set expandtab | |
set nobackup " 覆盖文件时不备份 | |
""set autochdir " 自动切换当前目录为当前文件所在的目录 | |
filetype plugin indent on " 开启插件 | |
set backupcopy=yes " 设置备份时的行为为覆盖 | |
set ignorecase smartcase " 搜索时忽略大小写,但在有一个或以上大写字母时仍保持对大小写敏感 | |
set nowrapscan " 禁止在搜索到文件两端时重新搜索 | |
set incsearch " 输入搜索内容时就显示搜索结果 | |
set hlsearch " 搜索时高亮显示被找到的文本 | |
set magic " 设置魔术 | |
set noundofile " don't use un~ files | |
set hidden " 允许在有未保存的修改时切换缓冲区,此时的修改由 vim 负责保存 | |
set wildmenu "命令状态按tab显示文件列表 | |
set smartindent " 开启新行时使用智能自动缩进 | |
set autoindent " 自动对齐,将当前行的对齐方式应用到下一行 | |
set backspace=indent,eol,start "不设定在插入状态无法用退格键和 Delete 键删除回车符 | |
set cmdheight=1 " 设定命令行的行数为 1 | |
set laststatus=2 " 显示状态栏 (默认值为 1, 无法显示状态栏) | |
set noerrorbells " 不让vim发出讨厌的滴滴声 | |
set splitright " 新切分的窗口放在右边 | |
set statusline=\ %<%F[%1*%M%*%n%R%H]%=\ %y\ %0(%{&fileformat}\ %{&encoding}\ %c:%l/%L%)\ | |
set guifont=Courier_New:h16 | |
set iminsert=0 imsearch=0 " 关闭Vim的自动切换IME输入法(插入模式和检索模式) | |
set fileencodings=ucs-bom,iso-2022-jp,utf-8,cp932,euc-jp,default,latin | |
"set clipboard+=unnamed | |
set re=0 | |
"autocomplete brackets and so on | |
" inoremap " ""<Esc>i | |
" inoremap ' ''<Esc>i | |
inoremap ( ()<Esc>i | |
inoremap [ []<Esc>i | |
inoremap {<CR> {<CR>}<Esc>O | |
" autocmd Syntax html,vim inoremap < <lt>><Esc>i| 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 | |
"" global variable | |
let Tlist_Ctags_Cmd = '/usr/local/bin/ctags' | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
"some key mappings | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
"在窗口间快速切换 | |
nnoremap <C-h> <C-w>h | |
nnoremap <C-j> <C-w>j | |
nnoremap <C-k> <C-w>k | |
nnoremap <C-l> <C-w>l | |
"Fast buffer switch | |
nnoremap <S-l> :bn<CR> | |
nnoremap <S-h> :bp<CR> | |
"Shut buffer | |
nnoremap <C-c><C-c> :q<CR> | |
"Compile | |
nnoremap <F5> :make<CR> | |
"打开文件时,总是跳到退出之前的光标处 | |
autocmd BufReadPost * | |
\ if line("'\"") > 0 && line("'\"") <= line("$") | | |
\ exe "normal! g`\"" | | |
\ endif | |
"**************************************************************** | |
"NERDTree settings | |
"**************************************************************** | |
let NERDTreeIgnore=['\.\w*[^chp]$', '\..[^p]p$', '\.[^c]pp$'] "设置要显示的后缀名 | |
map <F3> :NERDTreeToggle<CR> | |
"**************************************************************** | |
"taglist settings | |
"***********************************************************" | |
let Tlist_Use_Right_Window = 1 " 在右侧窗口中显示taglist窗口 | |
let Tlist_File_Fold_Auto_Close=1 " 自动折叠当前非编辑文件的方法列表 | |
let Tlist_Auto_Open = 0 | |
let Tlist_Show_One_File=1 | |
let Tlist_Exit_OnlyWindow=1 | |
let Tlist_File_Fold_Auto_Close=1 "taglist 只显示当前文件 tag,其它文件的tag折叠。 | |
let Tlist_Auto_Update = 1 | |
let Tlist_Hightlight_Tag_On_BufEnter = 1 | |
let Tlist_Enable_Fold_Column = 0 | |
let Tlist_Process_File_Always = 1 | |
let Tlist_Display_Prototype = 0 | |
let Tlist_Compact_Format = 1 | |
" nnoremap <silent> <F8> :TlistToggle<CR> | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" gtags setting | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
nmap <C-g>f :Gtags -f %<CR> | |
nmap <C-g>g :Gtags -g <C-R>=expand("<cword>")<CR><CR> | |
nmap <C-g>r :Gtags -r <C-R>=expand("<cword>")<CR><CR> | |
nmap <C-g>j :Gtags <C-R>=expand("<cword>")<CR><CR> | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" cscope setting | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" set cscopequickfix=s-,c-,d-,i-,t-,e- | |
let cwd = getcwd() | |
if has("cscope") | |
set csto=0 | |
set cscopetag | |
set cst | |
set nocsverb | |
" add any database in current directory | |
if filereadable("cscope.out") | |
"cs add cscope.out ~/Documents/File/graphics/poly_drawer/ | |
cs add cscope.out . | |
endif | |
set csverb | |
endif | |
nmap <C-m>s :cs find s <C-R>=expand("<cword>")<CR><CR> | |
nmap <C-m>g :cs find g <C-R>=expand("<cword>")<CR><CR> | |
nmap <C-m>c :cs find c <C-R>=expand("<cword>")<CR><CR> | |
nmap <C-m>t :cs find t <C-R>=expand("<cword>")<CR><CR> | |
nmap <C-m>e :cs find e <C-R>=expand("<cword>")<CR><CR> | |
nmap <C-m>f :cs find f <C-R>=expand("<cfile>")<CR><CR> | |
nmap <C-m>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR> | |
" nmap <C-m>d :cs find d <C-R>=expand("<cword>")<CR><CR> | |
""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
"YouCompleMe settings | |
""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
let g:ycm_min_num_of_chars_for_completion = 1 | |
let g:ycm_global_ycm_extra_conf = './.ycm_extra_conf.py' | |
nnoremap <C-m>d :YcmCompleter GoToDeclaration<CR> | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
"vundle settings | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
set nocompatible " be iMproved, required | |
filetype off " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" alternatively, pass a path where Vundle should install plugins | |
"call vundle#begin('~/some/path/here') | |
" let Vundle manage Vundle, required | |
Plugin 'VundleVim/Vundle.vim' | |
" My Bundles here: | |
" | |
Plugin 'hashivim/vim-terraform' | |
" original repos on github | |
"Plugin 'tpope/vim-fugitive' | |
"Plugin 'Lokaltog/vim-easymotion' | |
"" vim-scripts repos | |
"Plugin 'L9' | |
"Plugin 'FuzzyFinder' | |
"""Plugin 'https://github.com/Valloric/YouCompleteMe.git' | |
"Plugin 'https://github.com/fholgado/minibufexpl.vim' | |
"Plugin 'https://github.com/vim-scripts/taglist.vim' | |
"Plugin 'https://github.com/scrooloose/nerdtree' | |
"Plugin 'https://github.com/vim-scripts/gtags.vim' | |
""Plugin 'https://github.com/vim-scripts/visual_studio.vim' | |
Plugin 'https://github.com/preservim/tagbar.git' | |
nnoremap <silent> <F8> :TagbarToggle<CR> | |
" All of your Plugins must be added before the following line | |
call vundle#end() " required | |
filetype plugin indent on " required | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment