-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.vim.minimal
145 lines (118 loc) · 3.16 KB
/
init.vim.minimal
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
138
139
140
141
142
143
144
145
set nocompatible
filetype plugin indent on
syntax on
" use case-smart searching
set ignorecase
set smartcase
" set line numbers (and relative)
set number
set relativenumber
" eliminate delay from pressing ESC
set ttimeoutlen=0
set timeoutlen=0
" all items matching search are highlighted
set incsearch
set hlsearch
" clear highlighted items with space
nnoremap <silent> <Space> :nohlsearch<Bar>:echo<CR>
" cmdline history
set history=1000
" allow backspace in insert mode
set backspace=indent,eol,start
" buffers can exist in the background
set hidden
" set window title
set title
" highline the line the cursor is on
set cursorline
" intelligent indentation
set autoindent
set smartindent
" show existing tab with 2 spaces width
set tabstop=4
" when indenting with '>'
set shiftwidth=4
" on pressing tab, insert 4 spaces
set expandtab
call plug#begin('~/.config/nvim/plugged')
" colorscheme
Plug 'morhetz/gruvbox'
" commenting
Plug 'scrooloose/nerdcommenter'
" auto pairs
Plug 'jiangmiao/auto-pairs'
" surroundings
Plug 'tpope/vim-surround'
" fuzzy search
Plug 'ctrlpvim/ctrlp.vim'
" display changes in git:
Plug 'airblade/vim-gitgutter'
" lighweight powerline
Plug 'itchyny/lightline.vim'
" icons
Plug 'ryanoasis/vim-devicons'
" show indents
Plug 'Yggdroot/indentLine'
call plug#end()
" auto install plugins
autocmd VimEnter *
\ if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
\| PlugInstall --sync | q
\| endif
" enable syntax highlighting
if !exists("g:syntax_on")
syntax enable
endif
" tab based completion
inoremap <expr><Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
" colorscheme & settings
set termguicolors
set t_8f=^[[38;2;%lu;%lu;%lum
set t_8b=^[[48;2;%lu;%lu;%lum
colorscheme gruvbox
set background=dark
let g:gruvbox_contrast_dark = 'hard'
" use system clipboard
set clipboard^=unnamed,unnamedplus
" enable mouse support
set mouse=a
" Automatically resize splits when resizing window
autocmd VimResized * wincmd =
" Keep 10 lines below and above the cursor
set scrolloff=10
" Navigate in insert mode to start/end of line
inoremap <C-a> <C-o>0
inoremap <C-e> <C-o>$
" lightline settings
let g:lightline = {
\ 'colorscheme': 'gruvbox',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ], ['relativepath'] ]
\ },
\ 'tabline': {
\ 'left': [ ['buffers'] ],
\ 'right': [ ['bufnum'] ]
\ },
\ 'component_expand': {
\ 'buffers': 'lightline#bufferline#buffers'
\ },
\ 'component_type': {
\ 'buffers': 'tabsel'
\ },
\ 'component_function': {
\ 'fugitive': 'LightlineFugitive',
\ 'filename': 'LightlineFilename',
\ },
\ 'separator': { 'left': '', 'right': '' },
\ 'subseparator': { 'left': '', 'right': '' }
\ }
" Cycle through buffers with tab
:nnoremap <Tab> :bnext<CR>
:nnoremap <S-Tab> :bprevious<CR>
" Close buffer without closing split using Bd
command Bd bp|bd #
" Use ripgrep for cltrp
let g:ctrlp_user_command = 'rg %s --files --color=never --glob ""'
let g:ctrlp_use_caching = 0
" Enable spell checking for text files
autocmd FileType text,markdown,html,tex set spell