-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
137 lines (112 loc) · 3.24 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
125
126
127
128
129
130
131
132
133
134
135
136
137
set nocompatible
filetype on
filetype off
" 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 'bling/vim-airline'
Plugin 'lervag/vimtex'
Plugin 'ervandew/supertab'
Plugin 'davidhalter/jedi-vim'
Plugin 'valloric/youcompleteme'
" Track the engine.
Plugin 'SirVer/ultisnips'
" Snippets are separated from the engine. Add this if you want them:
Plugin 'honza/vim-snippets'
call vundle#end() " required
syntax on
colorscheme idle
" set smartindent
set showmatch
set foldcolumn=1
set shiftwidth=3
set tabstop=3
filetype plugin on
filetype indent on
set autoread
set mouse=a
set magic
set number
set relativenumber
set wildmenu
set title
set pastetoggle=<F2>
cmap w!! w !sudo tee % >/dev/null
set incsearch
set hlsearch
set ignorecase
set smartcase
set autoread
let &titleold=getcwd()
set scrolloff=3
set gdefault
:augroup numbertoggle
: autocmd!
: autocmd BufEnter,FocusGained,InsertLeave * set relativenumber
: autocmd BufLeave,FocusLost,InsertEnter * set norelativenumber
:augroup END
command! W w
command! Wq wq
command! Q q
" movement by screen line instead of file line (for text wrap)
nnoremap j gj
nnoremap <down> gj
nnoremap k gk
nnoremap <up> gk
" Move between splits
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" Split opening position
set splitbelow
set splitright
let g:vimtex_view_method = 'zathura'
" Enable Folding
set foldmethod=indent
set foldlevel=99
" Fold with <space>
nnoremap <space> za
"nerdTree
"Open when only vim
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
"Nerd when open a directory
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif
"Shortcut to nerd
map <C-o> :NERDTreeToggle<CR>
"Close vim if only nerd left
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" Airline
let g:airline#extensions#tabline#enabled = 1
" move among buffers with CTRL
map <C-n> :bnext<CR>
map <C-b> :bprev<CR>
" YCM
let g:ycm_python_binary_path = 'usr/bin/python3'
" supertab
let g:SuperTabDefaultCompletionTypeDiscovery = [
\ "&completefunc:<c-x><c-u>",
\ "&omnifunc:<c-x><c-o>",
\ ]
let g:SuperTabLongestHighlight = 1
" make YCM compatible with UltiSnips (using supertab)
let g:ycm_key_list_select_completion = ['<C-n>', '<Down>']
let g:ycm_key_list_previous_completion = ['<C-p>', '<Up>']
let g:SuperTabDefaultCompletionType = '<C-n>'
" Jedi
autocmd FileType python setlocal completeopt-=preview
autocmd FileType python set omnifunc=pythoncomplete#Complete
" UltiSnips
" Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
let g:UltiSnipsExpandTrigger="<S-tab>"
let g:UltiSnipsJumpForwardTrigger="<S-tab>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
" Python
au BufNewFile,BufRead *.py :setlocal tabstop=4 softtabstop=4 shiftwidth=4 expandtab fileformat=unix