-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
101 lines (78 loc) · 1.96 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
" [[ Keymaps ]]
" Remap to <Esc>
inoremap <C-c> <Esc>
" Set leader
let mapleader=" "
" Paste the most recent yank
noremap <Leader>p "0p
" Load the system clipboard register
noremap <Leader>= "+
" Buffer navigation
nnoremap <Leader>sb :ls<CR>:b<Space>
" Yank to end of line
nnoremap Y y$
" [[ Options ]]
" Display line numbers
set number
set relativenumber
" Change line numbers depending on the mode
autocmd InsertEnter * set norelativenumber
autocmd InsertLeave * set relativenumber
" Disable line wrapping
set nowrap
" Search settings
set nohlsearch
set ignorecase
set smartcase
" Indentation settings
set tabstop=4
set shiftwidth=0 " follow tabstop
set softtabstop=-1 " follow shiftwidth
set list
set listchars=tab:\ \ ,trail:·,nbsp:␣
" Automatically focus new splits
set splitright
set splitbelow
" Keep cursor above/below N lines
set scrolloff=12
" Enable mouse usage
set mouse=a
" Disable error sounds
set noerrorbells
set novisualbell
" Save undo history
if has('persistent_undo')
if !isdirectory($HOME . '/.vim/undo')
call mkdir($HOME . '/.vim/undo', 'p')
endif
set undodir=$HOME/.vim/undo
set undofile
endif
" Set terminal colors
if exists('+termguicolors')
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
set termguicolors
endif
" [[ Plugins ]]
" Install vim-plug if not found
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
endif
" Run PlugInstall if there are missing plugins
autocmd VimEnter * if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
\| PlugInstall --sync | source $MYVIMRC
\| endif
" Load plugins
call plug#begin()
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-sensible'
Plug 'tpope/vim-sleuth'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-vinegar'
Plug 'sonph/onehalf', { 'rtp': 'vim' }
call plug#end()
" Set colorscheme
colorscheme onehalfdark