aboutsummaryrefslogtreecommitdiffstats
path: root/.config
diff options
context:
space:
mode:
authorla-ninpre <leobrekalini@gmail.com>2020-11-04 14:03:25 +0300
committerla-ninpre <leobrekalini@gmail.com>2020-11-04 14:03:25 +0300
commit5e93953a2ac9a64e91ca43899f23728f402eeb34 (patch)
treeb2054c519739e2f1c2ca57758a08d41aa3a4f7f1 /.config
parent34bebed4068b1ee29f2386fb79e73373de0d5fc5 (diff)
downloaddotfiles-5e93953a2ac9a64e91ca43899f23728f402eeb34.tar.gz
dotfiles-5e93953a2ac9a64e91ca43899f23728f402eeb34.zip
add comments to init.vim
Diffstat (limited to '.config')
-rw-r--r--.config/nvim/init.vim65
1 files changed, 63 insertions, 2 deletions
diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim
index b6dede9..8e0c7f0 100644
--- a/.config/nvim/init.vim
+++ b/.config/nvim/init.vim
@@ -1,27 +1,62 @@
+" la-ninpre init.vim "
+
+" use space as leader key
let mapleader=" "
+
+" enter new era :D
set nocompatible
set encoding=utf-8
+
+" enable 24-bit colors
set termguicolors
+
+" enable hybrid numbers
set nu rnu
+
+" mouse is bad, but sometimes is useful
set mouse=a
+
+" this is for better file searching
set path+=**
set wildmenu
+
+" more intuitive splits
set splitbelow splitright
-set nohlsearch
-set incsearch
+
+" don't highlight everything when search and move cursor to the searched word
+set nohlsearch incsearch
+
+" expand tabs to spaces
set tabstop=4 softtabstop=4
set shiftwidth=4
set expandtab
+
+" use autoindents
set smartindent
+
+" replace default behaviour with undotree plugin
set noswapfile nobackup
set undodir=~/.local/share/nvim/undodir
set undofile
+
+" actually, i don't remember what is this...
set hidden
+
+" fix update time
set updatetime=50
+
+" remind yourself about 80 column rule
set colorcolumn=81
+
+" disable coloured column when editing plain text files and git commit msgs
autocmd BufRead,BufNewFile *.md,*.txt,*/.git/COMMIT_EDITMSG set cc=
+" enable insert mode when entering git commit message
autocmd VimEnter */.git/COMMIT_EDITMSG startinsert
+
+" this could be used to show unprintable characters
set listchars=tab:>-,eol:$,space:•,trail:~
+
+" vim plug plugins
call plug#begin('~/.local/share/nvim/plugged')
Plug 'morhetz/gruvbox'
Plug 'junegunn/goyo.vim'
@@ -34,6 +69,8 @@ Plug 'tpope/vim-surround'
Plug 'mbbill/undotree'
call plug#end()
filetype plugin indent on
+
+" colorscheme tweaks
let g:gruvbox_contrast_dark = 'hard'
if exists('+termguicolors')
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
@@ -42,20 +79,44 @@ endif
let g:gruvbox_invert_selection='0'
colorscheme gruvbox
set background=dark
+
+"
+" mappings
+"
+
+" easier navigation in splits
map <C-H> <C-W><C-H>
map <C-L> <C-W><C-L>
map <C-J> <C-W><C-J>
map <C-K> <C-W><C-K>
+
+" show or hide undo tree
nnoremap <leader>u :UndotreeToggle<CR>
+
+" open file with fzf
nnoremap <leader>o :Files<CR>
+
+" easy source init.vim
nnoremap <leader><CR> :so ~/.config/nvim/init.vim<CR>
+" easy open init.vim
nnoremap <leader>vc :e ~/.config/nvim/init.vim<CR>
+
+" show or hide unprintable characters
nnoremap <leader>sl :set list<CR>
nnoremap <leader>sn :set nolist<CR>
nnoremap <leader>go :Goyo<CR>
+
+" actually magick!
+" this moves higlighted block up or down
vnoremap J :m '>+1<CR>gv=gv
vnoremap K :m '<-2<CR>gv=gv
+
+" alias for capturing group in command mode (for use with regexps)
cmap ;( \(\)<Left><Left>
+
+" highlight yanked text
+" i consider this as transition from visually selecting stuff and yanking it
+" to just yank text object without selecting it
augroup highlight_yank
autocmd!
autocmd TextYankPost * silent! lua require'vim.highlight'.on_yank({timeout = 40})