-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
116 lines (89 loc) · 2.8 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
" Default file encoding
set encoding=utf8
" Automatic vim-plug install
let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'
if empty(glob(data_dir . '/autoload/plug.vim'))
silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
set signcolumn="yes"
let &t_SI = "\<esc>[5 q" " I beam cursor for insert mode
let &t_EI = "\<esc>[2 q" " block cursor for normal mode - Change to 1 for blinking cursor
let &t_SR = "\<esc>[3 q" " underscore cursor for replace
" Setup plugins
call plug#begin()
Plug 'morhetz/gruvbox'
Plug 'airblade/vim-gitgutter'
Plug 'preservim/nerdtree'
Plug 'mg979/vim-visual-multi', {'branch': 'master'}
Plug 'vim-airline/vim-airline'
Plug 'yggdroot/indentline'
Plug 'sheerun/vim-polyglot'
Plug 'junegunn/fzf'
Plug 'ervandew/supertab'
Plug 'jiangmiao/auto-pairs'
Plug 'preservim/nerdcommenter'
call plug#end()
" Add supeior vim arline to open buffers
let g:airline#extensions#tabline#enabled = 1
syntax on
set background=dark
let g:gruvbox_italic=1
let g:gruvbox_invert_selection=0
colorscheme gruvbox
" Show line numbers
set number
set relativenumber
set cursorline
let g:netrw_liststyle = 3
let g:netrw_bufsettings = 'noma nomod nu nobl nowrap ro'
set showcmd
set showmatch
set ignorecase
set smartcase
set hidden
set mouse=a
set confirm
set autoread
set ruler
filetype plugin indent on
filetype plugin on
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set autoindent
set smartindent
" Save file as sudo with 'w!!'
cmap w!! w !sudo tee > /dev/null %
" Make 'set: list' show hidden charecters
set listchars=tab:→\ ,eol:↲,nbsp:␣,trail:•,extends:⟩,precedes:⟨,space:.
set clipboard=unnamedplus
set foldmethod=indent
" command! -nargs=0 Sw w !sudo tee % > /dev/null
set nofoldenable
" Centralize cursor when vertical navigating
nnoremap <C-d> <C-d>zz
nnoremap <C-u> <C-u>zz
"Remove trailing whitespaces on save
autocmd BufWritePre * :%s/\s\+$//e
" NERDTree config
" Start NERDTree and put the cursor back in the other window.
" autocmd VimEnter * NERDTree | wincmd p
" Close the tab if NERDTree is the only window remaining in it.
autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
" Add Ctrl P to fzf
nnoremap <silent> <C-p> :FZF<CR>
" Close current buffer
nnoremap <silent> <C-w> :bp<bar>sp<bar>bn<bar>bd<CR>
" Select indent last selected lines
" nnoremap > gv>
nnoremap Q <nop>
" Move lines when visual with C-j and C-v
vnoremap <C-j> :m '>+1<CR>gv=gv
vnoremap <C-k> :m '<-2<CR>gv=gv
" C-o create empity line
nnoremap <C-o> o<ESC>
" C-/ comment lines
nmap <C-_> <Plug>NERDCommenterToggle
vmap <C-_> <Plug>NERDCommenterToggle<CR>gv