Skip to content

Instantly share code, notes, and snippets.

@leimingyu
Last active August 25, 2022 03:19
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 leimingyu/6fa2ba1853189ce9d7ee6439617d8eec to your computer and use it in GitHub Desktop.
Save leimingyu/6fa2ba1853189ce9d7ee6439617d8eec to your computer and use it in GitHub Desktop.
vimrc configuration
" use vim features
set nocompatible
"enable language-dependent indenting.
filetype plugin indent on
"confirm for saving file and readonly files
set confirm
set autowrite
"encode
set fenc=utf-8
set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2313,cp936
"syntax highlight
if has("syntax")
syntax on
endif
"use ron as the color scheme (optional)
colorscheme ron
if has('gui_running')
" Set a custom font you have installed on your computer.
" Syntax: set guifont=<font_name>\ <font_weight>\ <size>
set guifont=Monospace\ Regular\ 15
endif
" no swapfile for buffer (optional)
"set noswapfile
" no backup before overwriting a file (optional)
"set nobackup
" show the cursor position
set ruler
" show the matching bracket
set showmatch
set matchtime=3
" format options (https://www.cs.swarthmore.edu/help/vim/reformatting.html)
set formatoptions=tqn21
" a comment character will not be automatically inserted in the next line under any situation.
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
"disable case sensitivity when searching
set ignorecase
"With both ignorecase and smartcase turned on, a search is case-insensitive in ALL lower case.
set smartcase
"disable restart scan
"set nowrapscan
"highlight the searched one
set hlsearch
"highlight all matches while searching
set incsearch
"share the clipboard with the os
set clipboard^=unnamed,unnamedplus
" number of columns that a tab counts for
set tabstop=4
" make space fee like tab
"set sts=4
" autoindent
set autoindent
" for c-like file
set cindent
" columns to use in insert mode
"set softtabstop=4
" space when using >> or <<
set shiftwidth=4
" use space instead of tab
"set expandtab
" highlighted column width
if exists('+colorcolumn')
set colorcolumn=80
else
au BufWinEnter * let w:m2=matchadd('ErrorMsg', '\%>80v.\+', -1)
endif
" turn off error beep/flash
autocmd GUIEnter * set vb t_vb= " for your GUI
" automatic refresh files
set autoread
autocmd VimEnter * set vb t_vb=
set novisualbell " turn off visual bell
set visualbell t_vb= " turn off error beep/flash
set ls=2 " always show status line and commandline
set showcmd "display incomplete commands
set ttyfast " smoother changes
" coloring for different extensions
au BufNewFile,BufRead *.vb set syntax=vb
au BufNewFile,BufRead *.ll set syntax=lex
au BufNewFile,BufRead *.yy set syntax=yacc
au BufNewFile,BufRead *.cu set filetype=cpp
au BufNewFile,BufRead *.cl set filetype=cpp
" quit recording
cnoremap <c-q> <c-f>i<c-o>q
" python-mode
set nofoldenable
" adjust the move stride
"noremap <Up> 2k
"noremap <Down> 2j
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment