Skip to content

Instantly share code, notes, and snippets.

@anthonywong
Created September 14, 2016 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anthonywong/89b4ef5ca1e7a7da52555436ca35501e to your computer and use it in GitHub Desktop.
Save anthonywong/89b4ef5ca1e7a7da52555436ca35501e to your computer and use it in GitHub Desktop.
" Vim
"
" To use it, copy it to
" for Unix and OS/2: ~/.vimrc
" for Amiga: s:.vimrc
" for MS-DOS and Win32: $VIM\_vimrc
"set fe=taiwan
"set gfs=-adobe-courier-bold-r-normal--14-140-75-75-m-90-iso8859-1,-eten-fixed-medium-r-normal--16-150-75-75-c-160-big5-0
set nocompatible " Use Vim defaults (much better!)
set bs=2 " allow backspacing over everything in insert mode
"set ai " always set autoindenting on
set tw=70 " always limit the width of text to 70
set viminfo='20,\"50 " read/write a .viminfo file, don't store more
" than 50 lines of registers
set ruler
set et
set ts=4
set sw=4
set showmatch
set smartindent
set linebreak
set background=dark
set incsearch
set hlsearch
set smartcase
set switchbuf=usetab
set guifont=Monospace\ 14
" if &term =~ "xterm"
" if has("terminfo")
" set t_Co=256
" set t_AB=[%?%p1%{8}%<%t%p1%{40}%+%e%p1%{92}%+%;%dm
" set t_AF=[%?%p1%{8}%<%t%p1%{30}%+%e%p1%{82}%+%;%dm
" " set t_Sf=[3%p1%dm
" " set t_Sb=[4%p1%dm
" else
" set t_Co=256
" set t_Sf=[3%dm
" set t_Sb=[4%dm
" endif
" endif
if &t_Co > 1
syntax on
syn sync minlines=500
endif
" Don't use Ex mode, use Q for formatting
map Q gq
":nnoremap gr :grep <cword> *<CR>
":nnoremap gr :grep <cword> %:p:h/*<CR>
":nnoremap gR :grep '\b<cword>\b' *<CR>
":nnoremap gR :grep '\b<cword>\b' %:p:h/*<CR>
nnoremap gw :execute "vimgrep /" . expand("<cword>") . "/j **" <Bar> cw<CR>
augroup cprog
" Remove all cprog autocommands
au!
" When starting to edit a file:
" For *.c and *.h files set formatting of comments and set C-indenting on.
" For other files switch it off.
" Don't change the order, it's important that the line with * comes first.
autocmd BufRead * set formatoptions=tcql nocindent comments&
autocmd BufRead *.c,*.h set formatoptions=croql cindent comments=sr:/*,mb:*,el:*/,://
set makeprg=make\ %<
" set errorformat=%f:%l:\ %m
augroup END
hi PreProc term=underline cterm=bold ctermfg=1 guifg=#ff80ff
" set runtimepath+=/home/anthony/.vim/bundle/vim-ibus/
" function! <SID>AC_IBusToggle()
" if exists("b:ibustoggle") "上次从输入法状态离开
" unlet b:ibustoggle
" call ibus#enable()
" elseif ibus#is_enabled() " 离开前处于输入法状态
" let b:ibustoggle = ibus#is_enabled()
" call ibus#disable()
" endif
" endfunction
"
" autocmd InsertLeave,InsertEnter *
" \ call <SID>AC_IBusToggle()
""" -------- Vundle begins --------
filetype off " required by Vundle
" 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'
Plugin 'scrooloose/nerdtree'
Plugin 'easymotion/vim-easymotion'
Plugin 'CCTree'
Plugin 'vim-airline/vim-airline'
Plugin 'tpope/vim-fugitive'
Plugin 'vim-signature'
Plugin 'ervandew/supertab'
Plugin 'ctrlp.vim'
Plugin 'vim-misc'
Plugin 'xolox/vim-easytags'
Plugin 'majutsushi/tagbar'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
""" -------- Vundle ends --------
" For cctree plugin
autocmd VimEnter * if filereadable('cscope.out') | exec "CCTreeLoadDB cscope.out" | endif
"autocmd VimEnter * NERDTree " Start NERDTree (or not) when vim is launched
map <C-n> :NERDTreeToggle<CR>
set runtimepath^=~/.vim/bundle/ctrlp.vim
nmap <F8> :TagbarToggle<CR>
let g:airline_powerline_fonts = 1 " use beautiful icon for status line
set laststatus=2
let g:airline#extensions#tabline#enabled = 1
"let g:airline_theme=wombat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment