Skip to content

Instantly share code, notes, and snippets.

@adong
Created December 8, 2018 04:55
Show Gist options
  • Save adong/89676a779de701349442ca1fe70d206b to your computer and use it in GitHub Desktop.
Save adong/89676a779de701349442ca1fe70d206b to your computer and use it in GitHub Desktop.
" ==============================================================================
" Author: Alan Dong
" Version: 0.3.5
" Last Modified Date: 8/17/2018
" Description: My Vim Configuration file for Server
" ==============================================================================
" set shell for bash as default
set shell=/bin/bash
" leader
let mapleader = ','
let g:mapleader = ','
" syntax
syntax on
" manually load syntax highlighter
":set syn=syntax-type
"i.e. :set syn=python
" history : how many lines of history VIM has to remember
set history=10000
" filetype
filetype on
" Enable filetype plugins
filetype plugin on
filetype indent on
" base
set nocompatible " don't bother with vi compatibility
set autoread " reload files when changed on disk, i.e. via `git checkout`
set shortmess=atI
set magic " For regular expressions turn magic on
set title " change the terminal's title
set nobackup " do not keep a backup file
set novisualbell " turn off visual bell
set noerrorbells " don't beep
set visualbell t_vb= " turn off error beep/flash
set t_vb=
set tm=500
" always show report messages
set report=0
" show location
set cursorcolumn
set cursorline
" movement
set scrolloff=7 " keep 3 lines when scrolling
nnoremap k gk
nnoremap gk k
nnoremap j gj
nnoremap gj j
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
cnoremap <C-j> <t_kd>
cnoremap <C-k> <t_ku>
" show
set ruler " show the current row and column
set number " show line numbers
set nowrap
set showcmd " display incomplete commands
set showmode " display current modes
set showmatch " jump to matches when entering parentheses
set matchtime=2 " tenths of a second to show the matching parenthesis
" search
set hlsearch " highlight searches
set incsearch " do incremental searching, search as you type
set smartcase " no ignorecase if Uppercase char present
"set ignorecase " ignore case when searching"
" cancel highlight search
noremap <silent><leader>/ :nohls<CR>
noremap <leade<leader>>hl :set hlsearch! hlsearch?<CR>
" tab
set expandtab " expand tabs to spaces
set smarttab
set shiftround
" indent
set autoindent
set smartindent
set shiftwidth=2
set tabstop=2
set softtabstop=2 " insert mode tab and backspace use 2 spaces
vnoremap < <gv
vnoremap > >gv
" NOT SUPPORT
" set foldenable
" set foldmethod=indent
" set foldlevel=99
" encoding
set encoding=utf-8
set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1
set termencoding=utf-8
set ffs=unix,dos,mac
set formatoptions+=m
" spell check
set spell
set spelllang=en_us
set formatoptions+=B
" select & complete
set selection=inclusive
set selectmode=mouse,key
set completeopt=longest,menu
set wildmenu " show a navigable menu for tab completion"
set wildmode=longest,list,full
set wildignore=*.o,*~,*.pyc,*.class
" no ex mode
nnoremap Q <nop>
" remap vim
command! WQ wq
command! Wq wq
command! W w
command! Q q
command! Q1 q!
" Q map to q, to quit vim
command! -bar -bang Q quit<bang>
" update vim on the fly
nmap <leader>v :tabedit $MYVIMRC<CR>
nmap <leader>V :tabedit $MYVIMRC<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment