-
Notifications
You must be signed in to change notification settings - Fork 1
/
.vimrc
124 lines (109 loc) · 4.16 KB
/
.vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
"""""""""""""""""""""""""""""
" System
"""""""""""""""""""""""""""""
set nocompatible
""""""""""""""""""""""""""""""
" Interface
""""""""""""""""""""""""""""""
set nu " Show line number
set wrap " Wrap long lines
set showmatch " Show matching brackets when closing it
set matchtime=2 " Matching brackets highlight duration (200ms)
set showcmd " Show command status
set scrolloff=3 " Start to scroll when reaching lines before the edge
set ttymouse=xterm2 " Resolve mouse mode problem in tmux
set laststatus=2 " Show status line
set cursorline " Highlight current line
if has("syntax")
syntax on
endif
"""""""""""""""""""""""""""""
" Text Formatting
"""""""""""""""""""""""""""""
set shiftwidth=4
set tabstop=4 " A tab consumes 4 space
set expandtab " Tabs are spaces
set softtabstop=4 " Delete tabstop spaces when spaces are tab
set autoindent
set smartindent
set encoding=utf-8
filetype plugin indent on " Enable specific formatting rules support for certain filetypes
"""""""""""""""""""""""""""""
" Searching
"""""""""""""""""""""""""""""
set hlsearch " Highlight search results
set incsearch " Instantly search while typing
set ignorecase " Case-insensitive search
set smartcase " Switch to case-sensitive search when keywords contain uppercase
set wildmenu " Enable wildmenu while entering tab in command mode
set wildmode=list:longest,full " Allow full list and auto-completion in wildmenu
"""""""""""""""""""""""""""""
" vim-plug
"""""""""""""""""""""""""""""
set rtp+=~/.vim/bundle/Vundle.vim
call plug#begin()
Plug 'itchyny/lightline.vim'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle', 'tag': '6.10.9' }
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'tpope/vim-fugitive', { 'tag': 'v3.3' }
Plug 'majutsushi/tagbar', {'on':['TagbarToggle'], 'tag': 'v3.0.0' }
Plug 'nathanaelkane/vim-indent-guides', { 'tag': '1.6' }
Plug 'wlemuel/vim-tldr', { 'tag': 'v0.4' }
Plug 'junegunn/gv.vim'
Plug 'rakr/vim-one'
Plug 'sainnhe/sonokai'
Plug 'Raimondi/delimitMate'
call plug#end()
"""""""""""""""""""""""""""""
" Theme and specific settings
" for vim and gvim
"""""""""""""""""""""""""""""
set background=dark
" sonokai specific configurations
let g:sonokai_style = 'maia' " Style of sonokai color
let g:sonokai_enable_italic = 0 " Allow italic text (may not work on some terminals)
let g:sonokai_transparent_background = 0 " Use transparent background color
" with respect to the terminal instead of
" the original sonokai styled background
" One specific configurations
let g:one_allow_italics = 1
colorscheme sonokai " Default color scheme for both vim and gvim
if !has('gui_running')
set t_Co=256
else
"set guifont=Source\ Code\ Pro\ 10 " Recommended font
set guioptions-=r " Remove right-hand scroll bar
set guioptions-=L " Remove left-hand scroll bar
"set guioptions-=T " Remove toolbar
"set guioptions-=m " Remove menu bar
set guioptions+=a " Enable copy-on-select
endif
" Set true color if supported
"" tmux is usually buggy in true color so keep this setting out
if (has("termguicolors") && empty($TMUX))
set termguicolors
endif
" lightline specific settings
let g:lightline = { 'colorscheme': 'sonokai' }
set noshowmode
"""""""""""""""""""""""""""""
" Key remap
"""""""""""""""""""""""""""""
" Non-plugin related
nnoremap <C-h> <Esc>gT
nnoremap <C-l> <Esc>gt
nnoremap <F2> :mks! ~/.vim/sessions/session_
nnoremap <F3> :source ~/.vim/sessions/session_
nnoremap <F7> :!ctags -R .
vnoremap <C-c> "+y
vnoremap <C-x> "+d
nnoremap <C-p> "+p
inoremap <C-v> <C-r>+
let delimitMate_expand_cr = 1
augroup mydelimitMate
au!
au FileType markdown let b:delimitMate_nesting_quotes = ["`"]
au FileType tex let b:delimitMate_quotes = ""
au FileType tex let b:delimitMate_matchpairs = "(:),[:],{:},`:'"
au FileType python let b:delimitMate_nesting_quotes = ['"', "'"]
augroup END