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
146
147
148
149
150
151
|
set encoding=utf8
scriptencoding utf8
lang en_US.UTF-8
" use space as <leader> key
let mapleader=" "
set nu
set relativenumber
" syntax highlighting
syntax on
filetype plugin indent on
set backspace=indent,eol,start
" indentation
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
set smartindent
set autoindent
" copy paste clipboard
set clipboard=unnamed
" highlight current line
set cursorline
" searching
set incsearch
set ignorecase
set smartcase
set nohlsearch
" display title of current file in terminal title bar
set title
" allow hidden buffers
set hidden
" dont wrap long lines
set nowrap
" disable swaps and backups
set noswapfile
set nobackup
set nowritebackup
" start scrolling when 8 lines left
set scrolloff=8
" show sign column
set signcolumn=yes
" show the colorcolumn
set colorcolumn=80
" :sp and :vsp should split below and to the right
set splitbelow
set splitright
" avoid delays when typing
set updatetime=50
" enable mouse support
set mouse=a
" shows a more advanced command-line completion menu
set wildmenu
" Modifies the auto-complete menu. See :h completeopt
set completeopt="noinsert,menuone,noselect"
" show whitespace characters
set list lcs=tab:>\ ,trail:~,precedes:<,space:\ ,nbsp:×
" set correct filetype for terraform files
autocmd BufRead,BufNewFile *.tf,*.tfvars set filetype=terraform
" ---------------------------------
" --- KEYBINDINGS
" --------------------------------
" open file explorer
nnoremap <leader>pv :Ex<CR>
" copy the whole file and stay where you are
nnoremap <leader>yy ggVGy<C-o>
" move visual line(s) up and down
vnoremap J :m '>+1<CR>gv=gv
vnoremap K :m '<-2<CR>gv=gv
" move line up/down
nnoremap <S-Up> :m-2<CR>
nnoremap <S-Down> :m+1<CR>
" keeps search in the middle (n=next, N=previous)
nnoremap n nzzzv
nnoremap N Nzzzv
" keeps half page up/down in the middle
nnoremap <C-d> <C-d>zz
nnoremap <C-u> <C-u>zz
" delete highlighted word/line into void and keeps the pasted value
" in default registry so you can paste many times
xnoremap <leader>p "_dp
" delete to void
nnoremap <leader>d "_d
vnoremap <leader>d "_d
" fzf
nnoremap <C-f> :GFiles<CR>
nnoremap <leader>ff :Files<CR>
nnoremap <leader>fg :Ag<CR>
nnoremap <leader>ffg :Rg
nnoremap <leader>b :Buffers
" reload file if changes from outside
autocmd FocusGained,BufEnter * :checktime
" avoid human error
cabbr W w
cabbr Wq wq
cabbr Q q
cabbr E e
" ----------------------
" --- PLUGINS
" ----------------------
call plug#begin()
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'jremmen/vim-ripgrep'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-surround'
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
call plug#end()
" ----------------------
" --- THEME
" ----------------------
set background=dark
colorscheme habamax
|