diff options
Diffstat (limited to '.vimrc')
-rw-r--r-- | .vimrc | 148 |
1 files changed, 148 insertions, 0 deletions
@@ -0,0 +1,148 @@ +set encoding=utf-8 +scriptencoding utf-8 +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=120 + +" :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 + +" ??? +set completeopt="menu,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 |