This repository has been archived by the owner on Jun 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
117 lines (99 loc) · 2.7 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
"vimrc (user setting)
"Common Settings
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
function! BuildYCM(info)
" info is a dictionary with 3 fields
" - name: name of the plugin
" - status: 'installed', 'updated', or 'unchanged'
" - force: set on PlugInstall! or PlugUpdate!
if a:info.status == 'installed' || a:info.force
!./install.py
endif
endfunction
call plug#begin('~/.vim/plugged')
"Plug 'Valloric/YouCompleteMe', { 'do': function('BuildYCM') }
Plug 'preservim/nerdtree'
Plug 'itchyny/lightline.vim'
Plug 'ervandew/supertab'
Plug 'tomasr/molokai'
call plug#end()
"settings
set nocompatible
set nowrap
set mouse=a
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set noswapfile
set nobackup
set number
set autoindent
set modeline
set fileencoding=utf8
set hlsearch
set incsearch
set cursorline
set t_Co=256
set laststatus=2
filetype plugin indent on
syntax on
set clipboard=unnamedplus
"Auto close scratch preview
autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
"Shorcut key mapping
"
"
"Ctrl + a -> Select All Text
map <C-a> <esc>ggVG<CR>
"F2 to write/update file
nnoremap <F2> :update <CR>
"Ctrl + Space -> popup autocomplete
inoremap <expr> <C-Space> pumvisible() \|\| &omnifunc == '' ?
\ "\<lt>C-n>" :
\ "\<lt>C-x>\<lt>C-o><c-r>=pumvisible() ?" .
\ "\"\\<lt>c-n>\\<lt>c-p>\\<lt>c-n>\" :" .
\ "\" \\<lt>bs>\\<lt>C-n>\"\<CR>"
imap <C-@> <C-Space>
"Switch tab bar
noremap <C-Right> gt
noremap <C-Left> gT
"UNDO and REDO
nnoremap <C-z> u
nnoremap <C-y> <C-r>
"Close VIM no save
map <silent> <C-w> :q! <CR>
"Toggle Show/Hide NERDTree Explorer
map <silent> <C-n> :NERDTreeToggle % <CR>
"Toggle Show/Hide Taglist
map <silent> <C-l> :TlistToggle <CR>
"Visual mode -> quickly Tabs indent multiple line
vnoremap <Tab> >gv
vnoremap <S-Tab> <gv
"Misc - Config
autocmd vimenter * if !argc() | NERDTree | endif
let g:NERDTreeShowHidden=1
let Tlist_Auto_Update=1
let g:jedi#show_call_signatures = "0"
autocmd Filetype java setlocal omnifunc=javacomplete#Complete
"Supertab
let g:SuperTabDefaultCompletionType = "<C-X><C-O>"
"Vim Theme
let g:rehash256 = 1
colors molokai
let g:lightline = {
\ 'colorscheme': 'wombat',
\ 'active' : {
\ 'left' : [ [ 'mode' ], [ 'filename' ], [ 'mod' ] ]
\ },
\ 'component': {
\ 'filename': '"%{expand("%:p:t")}"',
\ 'mod' : '%{&readonly?"[readonly]":&modified?"+":""}'
\ }
\ }
"-------- END CONFIG ----------