aboutsummaryrefslogtreecommitdiffstats
path: root/nvim
diff options
context:
space:
mode:
authorla-ninpre <leobrekalini@gmail.com>2021-07-12 16:27:52 +0300
committerla-ninpre <leobrekalini@gmail.com>2021-07-12 16:27:52 +0300
commite3bbee81de559c1b4dea7a83d46da3b4e00cc2a8 (patch)
tree697bca3add8a534bd6ed6a82308ef5869cc78393 /nvim
parent2d5fa70da78d05147a4055c51c983b93a4bc32dd (diff)
downloaddotfiles-e3bbee81de559c1b4dea7a83d46da3b4e00cc2a8.tar.gz
dotfiles-e3bbee81de559c1b4dea7a83d46da3b4e00cc2a8.zip
move to GNU stow approach on managing dotfiles
Diffstat (limited to 'nvim')
-rw-r--r--nvim/.config/nvim/after/ftplugin/python.vim26
-rw-r--r--nvim/.config/nvim/after/ftplugin/yaml.vim1
-rw-r--r--nvim/.config/nvim/ftdetect/pikchr.vim1
-rw-r--r--nvim/.config/nvim/init.vim156
-rw-r--r--nvim/.config/nvim/syntax/pikchr.vim93
5 files changed, 277 insertions, 0 deletions
diff --git a/nvim/.config/nvim/after/ftplugin/python.vim b/nvim/.config/nvim/after/ftplugin/python.vim
new file mode 100644
index 0000000..ef4d633
--- /dev/null
+++ b/nvim/.config/nvim/after/ftplugin/python.vim
@@ -0,0 +1,26 @@
+set shiftwidth=4 tabstop=4 softtabstop=4 expandtab autoindent smartindent
+
+setlocal path=.,**
+setlocal wildignore=*/__pycache__/*,*.pyc
+
+set include=^\\s*\\(from\\\|import\\)\\s*\\zs\\(\\S\\+\\s\\{-}\\)*\\ze\\($\\\|\ as\\)
+
+function! PyInclude(fname)
+ let parts = split(a:fname, ' import ')
+ let l = parts[0]
+ if len(parts) > 1
+ let r = parts[1]
+ let joined = join([l, r], '.')
+ let fp = substitute(joined, '\.', '/', 'g') . '.py'
+ let found = glob(fp, 1)
+ if len(found)
+ return substitute(joined, '\.', '/', 'g') . '.py'
+ endif
+ endif
+ return substitute(joined, '\.', '/', 'g') . '.py'
+endfunction
+
+setlocal includeexpr=PyInclude(v:fname)
+setlocal define=^\\s*\\<\\(def\\\|class\\)\\>
+
+nnoremap <leader>pp :!pycodestyle --first %<CR>
diff --git a/nvim/.config/nvim/after/ftplugin/yaml.vim b/nvim/.config/nvim/after/ftplugin/yaml.vim
new file mode 100644
index 0000000..42313c3
--- /dev/null
+++ b/nvim/.config/nvim/after/ftplugin/yaml.vim
@@ -0,0 +1 @@
+set shiftwidth=2 tabstop=2 softtabstop=2 expandtab
diff --git a/nvim/.config/nvim/ftdetect/pikchr.vim b/nvim/.config/nvim/ftdetect/pikchr.vim
new file mode 100644
index 0000000..ebd25b4
--- /dev/null
+++ b/nvim/.config/nvim/ftdetect/pikchr.vim
@@ -0,0 +1 @@
+autocmd BufRead,BufNewFile *.pikchr set filetype=pikchr
diff --git a/nvim/.config/nvim/init.vim b/nvim/.config/nvim/init.vim
new file mode 100644
index 0000000..52d7176
--- /dev/null
+++ b/nvim/.config/nvim/init.vim
@@ -0,0 +1,156 @@
+" la-ninpre init.vim "
+
+" misc: {{{
+
+" 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
+
+" search options
+set nohlsearch incsearch ignorecase smartcase showmatch
+
+" ruler
+set rulerformat=%35(%{strftime('%F\ %H:%M')}%=%l/%L%=%c%V%=%p%%\ %)
+
+" 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
+
+" this could be used to show unprintable characters
+set listchars=tab:>-,eol:$,space:•,trail:~
+
+" }}}
+" plugins: {{{
+
+" pluggins are installed with vim plug
+call plug#begin('~/.local/share/nvim/plugged')
+Plug '~/.local/share/nvim/plugged/gruvbox', {'branch': 'la-ninpre/la-ninpre'}
+Plug 'junegunn/goyo.vim'
+Plug 'junegunn/limelight.vim'
+Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
+Plug 'junegunn/fzf.vim'
+Plug 'mattn/emmet-vim'
+Plug 'ap/vim-css-color'
+Plug 'preservim/nerdcommenter'
+Plug 'tpope/vim-surround'
+Plug 'mbbill/undotree'
+Plug 'dense-analysis/ale'
+Plug 'cespare/vim-toml'
+Plug 'https://tildegit.org/sloum/gemini-vim-syntax'
+call plug#end()
+filetype plugin indent on
+
+" }}}
+" colorscheme: {{{
+" colorscheme tweaks
+if exists('+termguicolors')
+ let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
+ let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
+endif
+
+let g:gruvbox_contrast_dark='hard'
+let g:gruvbox_italic=1
+let g:gruvbox_transparent_bg=1
+let g:gruvbox_invert_selection='0'
+
+set background=dark
+colorscheme gruvbox
+
+" }}}
+" 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>
+
+" replace all occurencies of the word under the cursor
+nnoremap <leader>su :%s/\<<C-r><C-w>\>/
+
+" show or hide undo tree
+nnoremap <leader>u :UndotreeToggle<CR>
+
+" open helptags
+nnoremap <leader>h :Helptags<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>
+
+" goyo
+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>
+
+" }}}
+" autocommands: {{{
+
+" limelight on when goyo
+autocmd! User GoyoEnter Limelight
+autocmd! User GoyoLeave Limelight!
+
+" fix wrong nvim size when starting in alacritty
+autocmd VimEnter * :silent exec "!kill -s SIGWINCH $PPID"
+
+" enable insert mode when entering git commit message
+autocmd VimEnter */COMMIT_EDITMSG startinsert
+
+" highlight yanked text (needs nvim 0.5.x)
+augroup highlight_yank
+ autocmd!
+ autocmd TextYankPost * silent! lua require'vim.highlight'.on_yank({timeout = 40})
+augroup END
+
+" vim: ft=vim fdm=marker:
diff --git a/nvim/.config/nvim/syntax/pikchr.vim b/nvim/.config/nvim/syntax/pikchr.vim
new file mode 100644
index 0000000..52d4d59
--- /dev/null
+++ b/nvim/.config/nvim/syntax/pikchr.vim
@@ -0,0 +1,93 @@
+" Vim syntax file
+" Language: Pikchr
+" Mantainer: la-ninpre
+" Latest Revision: 14 Dec 2020
+
+" check if syntax highlighting is not in conflict
+if exists("b:current_syntax")
+ finish
+endif
+
+""" syntax block
+
+" keywords
+syntax keyword PikchrStatement print assert
+syntax keyword PikchrExprFunc abs cos dist int max min sin sqrt
+syntax keyword PikchrObject arc arrow box circle cylinder dot ellipse file line
+syntax keyword PikchrObject move oval spline text
+syntax keyword PikchrDirection right down left up nextgroup=PikchrNumber
+syntax keyword PikchrDirection n north ne e east se s south sw w west nw
+syntax keyword PikchrPlace of in vertex
+syntax keyword PikchrAttribute dashed dotted color fill behind cw ccw
+syntax keyword PikchrAttribute thick thin solid chop fit
+syntax keyword PikchrTextAttr above aligned below big small bold italic
+syntax keyword PikchrTextAttr center ljust rjust
+syntax keyword PikchrLocAttr at with
+syntax keyword PikchrEdgename n north ne nw e east s south se sw w west
+syntax keyword PikchrEdgename t top bot bottom c center start end left right
+syntax keyword PikchrEdgename nextgroup=PikchrPlace
+syntax keyword PikchrNumPropty diameter ht height rad radius thickness width wid
+syntax keyword PikchrNthObj last previous
+syntax keyword PikchrOperator + - * /
+
+" define stmt
+syntax match PikchrDefineStmt "^define\s\i\+" contains=PikchrCustomObject
+syntax keyword PikchrDefine define contained
+syntax match PikchrCustomObject "\i\+" contained
+
+" literals
+syntax match PikchrComment "\v(#.*$)|(/\*.*\*/)"
+syntax match PikchrString "\".*\""
+syntax match PikchrVariable "\v\i+\s?(\*|\+|-|/)?\="
+syntax match PikchrDollVar "\$\i\+"
+syntax match PikchrLabel "\u\w*"
+syntax match PikchrNumber "\v\.?\d+(\.\d+)?(\%|in|cm|px|pt|pc|mm)?"
+syntax match PikchrNumber "\v0x\x+"
+syntax match PikchrOrdinal "\v([^0]\d+(st|nd|rd|th))|first"
+
+" matches
+syntax match PikchrAttributeSup "\v<same(\sas)?>"
+syntax match PikchrAttributeSup "\v<invis(ible)?>"
+syntax match PikchrAttributeSup "\v\<-\>?|-\>"
+syntax match PikchrPosition "\v(((of\sthe\s)?\sway\s)?between)|and"
+syntax match PikchrDotEdgename "\v\.(n(e|w)?(orth)?|e(ast)?|s(e|w)?(outh)?|w(est)?)"
+syntax match PikchrDotEdgename "\v\.(bot(tom)?|t(op)?|right|left|start|end|c(enter)?)"
+syntax match PikchrDotPropty "\v\.(color|dashed|diameter|dotted|fill)"
+syntax match PikchrDotPropty "\v\.(ht|height|rad(ius)?|thickness|wid(th)?)"
+syntax match PikchrPathElem "\v<(from|then|go|to|(until\s)?even\swith|heading|close)>" nextgroup=PikchrDirection
+
+""" highlight block
+
+" keywords
+hi def link PikchrStatement Statement
+hi def link PikchrExprFunc Function
+hi def link PikchrObject Type
+hi def link PikchrDirection Function
+hi def link PikchrLocAttr Tag
+hi def link PikchrPlace Function
+hi def link PikchrTextAttr Identifier
+hi def link PikchrNumPropty Identifier
+hi def link PikchrEdgename Identifier
+hi def link PikchrNthObj Constant
+hi def link PikchrOperator Operator
+
+" define stmt
+hi def link PikchrDefine Define
+hi def link PikchrCustomObject Type
+
+" literals
+hi def link PikchrComment Comment
+hi def link PikchrString String
+hi def link PikchrVariable Identifier
+hi def link PikchrDollVar Identifier
+hi def link PikchrLabel Identifier
+hi def link PikchrNumber Number
+hi def link PikchrOrdinal Number
+
+" matches
+hi def link PikchrAttribute Tag
+hi def link PikchrAttributeSup Tag
+hi def link PikchrPosition Function
+hi def link PikchrDotEdgename Identifier
+hi def link PikchrDotPropty Identifier
+hi def link PikchrPathElem Statement