diff --git a/.bashrc b/.bashrc index 3147a78..1ea8288 100644 --- a/.bashrc +++ b/.bashrc @@ -52,12 +52,12 @@ shopt -s autocd shopt -s globstar # ignoreboth is shorthand for ignorespace and ignoredups export HISTCONTROL=ignoredups:erasedups -PROMPT_COMMAND="history -n && history -a; $PROMPT_COMMAND" +PROMPT_COMMAND="history -a; $PROMPT_COMMAND" # If set, the history list is appended to the file named by the value of the # HISTFILE variable when the shell exits, rather than overwriting the file. (in # order to prevent the issue of lossig bash session history when multiple # instances are running) -# shopt -s histappend +shopt -s histappend export HISTSIZE=-1 # Stupid!!!! @@ -193,6 +193,8 @@ bind -x '"\ex2": vi-find "" .git' bind -x '"\ex3": vi-find ~/dot .git' bind -x '"\ex4": vi-find ~/note .git' bind -x '"\ex5": vi-grep' +# take in history from other shells +bind -x '"\C-h": history -n' bind -m vi-insert '"\C-f": "\ex1\e@"' bind -m vi-insert '"\ef": "\ex2\e@"' diff --git a/fontconfig/fonts.conf b/fontconfig/fonts.conf index c35267e..e69de29 100644 --- a/fontconfig/fonts.conf +++ b/fontconfig/fonts.conf @@ -1,103 +0,0 @@ - - - - - monospace - - Symbols Nerd Font - - - - - fa - - sans-serif - - Vazir - - - - - - - emoji - - - Noto Color Emoji - - - - - - sans - - - Noto Color Emoji - - - - - serif - - - Noto Color Emoji - - - - - sans-serif - - - Noto Color Emoji - - - - - monospace - - - Symbols Nerd Font - - - - - - - - Symbola - - - - - ~/.fonts - - - rgb - - - - - true - - - - - hintslight - - - - - true - - - - - - - - - - - - - diff --git a/i3/config b/i3/config index c51ba12..d642ce5 100644 --- a/i3/config +++ b/i3/config @@ -80,8 +80,8 @@ default_floating_border normal 1 smart_borders on #for_window [all] title_window_icon on -gaps outer 25 -gaps inner 10 +# gaps outer 25 +# gaps inner 10 # class border backgr. text indicator child_border client.focused #4c7899 #285577 #ffffff #2e9ef4 #285577 diff --git a/vim/colors/lightgruv.vim b/vim/colors/lightgruv.vim index a5946fa..4ba7417 100644 --- a/vim/colors/lightgruv.vim +++ b/vim/colors/lightgruv.vim @@ -8,7 +8,9 @@ endif set background=dark g:colors_name = "lightgruv" -var dark0 = '#2d2c2b' +# var dark0 = '#2d2c2b' +# var dark0 = '#202020' +var dark0 = '#282828' var dark1 = '#3c3836' var dark2 = '#504945' var dark3 = '#665c54' diff --git a/vim/plugin/parenmatch.vim b/vim/plugin/parenmatch.vim index 7e6f814..8842297 100644 --- a/vim/plugin/parenmatch.vim +++ b/vim/plugin/parenmatch.vim @@ -5,10 +5,12 @@ vim9script if exists('g:loaded_parenmatch') || v:version < 703 || !exists('*matchaddpos') finish endif -g:loaded_parenmatch = 1 +# g:loaded_parenmatch = 1 const TIMEOUT = 10 var paren = {} +var close_regex = '' +var open_regex = '' var matchpairs = '' def Setup() @@ -16,10 +18,14 @@ def Setup() return endif matchpairs = &l:matchpairs - for [open, closed] in map(split(&l:matchpairs, ','), 'split(v:val, ":")') - paren[open] = [ escape(open, '[]'), escape(closed, '[]'), 'nW', 'w$' ] - paren[closed] = [ escape(open, '[]'), escape(closed, '[]'), 'bnW', 'w0' ] + for [open, close] in map(split(&l:matchpairs, ','), 'split(v:val, ":")') + paren[open] = [ escape(open, '[]'), escape(close, '[]'), 'nW', 'w$' ] + paren[close] = [ escape(open, '[]'), escape(close, '[]'), 'bnW', 'w0' ] + close_regex ..= close .. '\|' + open_regex ..= open .. '\|' endfor + close_regex = close_regex[: -3] + open_regex = open_regex[: -3] enddef def Match() @@ -44,6 +50,151 @@ def Match() endif enddef + +def g:Match2() + if !!get(w:, 'parenmatch') + silent! matchdelete(w:parenmatch) + w:parenmatch = 0 + endif + + var c = getline('.')[col('.') - 1] + if has_key(paren, c) + var [open, closed, flags, stop] = paren[c] + var q = [line('.'), col('.')] + var r = searchpairpos(open, '', closed, flags, '', line(stop), TIMEOUT) + if r[0] > 0 + w:parenmatch = matchaddpos('MatchParen', [q, r]) + endif + return + endif + + var view = winsaveview() + setl scrolloff=0 + var close_pos = [0, 0] + while 1 + close_pos = searchpos(close_regex, 'W', line('w$'), TIMEOUT) + + if close_pos == [0, 0] | break | endif + + var close = getline('.')[col('.') - 1] + var [open, _, flags, stop] = paren[close] + var open_pos = searchpairpos(open, '', close, flags, '', line(stop), TIMEOUT) + + if open_pos[0] > view.lnum || (open_pos[0] == view.lnum && open_pos[1] > view.col) | continue | endif + + if open_pos[0] > 0 # lnum > 0 + w:parenmatch = matchaddpos('MatchParen', [open_pos, close_pos]) + # echom $'{open_pos}, {close_pos}' + endif + break + endwhile + + cursor([view.lnum, view.col + 1, view.coladd, view.curswant + 1]) + setl scrolloff< + +enddef + +def g:Match3() + if !!get(w:, 'parenmatch') + silent! matchdelete(w:parenmatch) + w:parenmatch = 0 + endif + + var c = getline('.')[col('.') - 1] + if has_key(paren, c) + var [open, closed, flags, stop] = paren[c] + var q = [line('.'), col('.')] + var r = searchpairpos(open, '', closed, flags, '', line(stop), TIMEOUT) + if r[0] > 0 + w:parenmatch = matchaddpos('MatchParen', [q, r]) + endif + return + endif + + # some methods to match: + # - matchbufline(bufnr(), '(', line('.'), line('w$')) + # - matchstrlist(getline('.', 'w$'), '(') + + # [bufnum, lnum, col, off] + var cursor = getpos('.') + for close in matchbufline(bufnr(), close_regex, line('.'), line('w$')) + # skip if closing paren is behind cursor + if close.byteidx + 1 < cursor[2] | continue | endif + + keepjumps cursor(close.lnum, close.byteidx + 1) + var [open, _, flags, stop] = paren[close.text] + var open_pos = searchpairpos(open, '', close.text, flags, '', line(stop), TIMEOUT) + + # echom open_pos + # echom cursor + + if open_pos[0] > cursor[1] || (open_pos[0] == cursor[1] && open_pos[1] > cursor[2]) + continue + endif + + if open_pos[0] > 0 + w:parenmatch = matchaddpos('MatchParen', [open_pos, [close.lnum, close.byteidx + 1]]) + echom $'{open_pos}, {[close.lnum, close.byteidx + 1]}' + break + endif + + endfor + keepjumps cursor(cursor[1], cursor[2]) + +enddef + +def g:Match4() + if !!get(w:, 'parenmatch') + silent! matchdelete(w:parenmatch) + w:parenmatch = 0 + endif + + var c = getline('.')[col('.') - 1] + if has_key(paren, c) + var [open, closed, flags, stop] = paren[c] + var q = [line('.'), col('.')] + var r = searchpairpos(open, '', closed, flags, '', line(stop), TIMEOUT) + if r[0] > 0 + w:parenmatch = matchaddpos('MatchParen', [q, r]) + endif + return + endif + + # some methods to match: + # - matchbufline(bufnr(), '(', line('.'), line('w$')) + # - matchstrlist(getline('.', 'w$'), '(') + + # ( ( ( () ) ) ) + + # [bufnum, lnum, col, off] + var cursor = getpos('.') + var close_list = matchbufline(bufnr(), close_regex, line('.'), line('w$')) + var open_list = matchbufline(bufnr(), open_regex, line('w0'), line('.')) + + for i in range(len(close_list)) + var close = close_list[i] + if close.byteidx + 1 < cursor[2] | continue | endif + + var open_idx = len(open_list) - 1 - i + if open_idx < 0 + break + endif + + var open = open_list[open_idx] + if open.lnum > cursor[1] || (open.lnum == cursor[1] && open.byteidx + 1 > cursor[2]) + continue + endif + + if open.lnum > 0 + w:parenmatch = matchaddpos('MatchParen', [[open.lnum, open.byteidx + 1], [close.lnum, close.byteidx + 1]]) + echom $'{[open.lnum, open.byteidx + 1]}, {[open.lnum, open.byteidx + 1]}' + break + endif + + endfor + +enddef + var timer = 0 def Update() if !timer diff --git a/vim/vimrc b/vim/vimrc index 6e6dfd5..0d50b54 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -130,6 +130,7 @@ def LspOnAttach() nmap [d :LspDiagPrev nmap gh :LspDiagCurrent nmap gla :LspCodeAction + nmap gls :LspSwitchSourceHeader enddef autocmd User LspSetup call LspOptionsSet(lspOpts) @@ -156,6 +157,7 @@ var lspServers = [ ] # }}} Plug 'J-Merle/vim-todo' +Plug 'habamax/vim-dir' plug#end() packadd! comment @@ -204,6 +206,7 @@ set signcolumn=no set ruler set nocursorline set scrolloff=3 +set scrolljump=0 # set showcmd showcmdloc=statusline set shortmess=aoOFtT @@ -289,6 +292,7 @@ syntax on set termguicolors set background=dark color lightgruv +# hi normal guibg=black # ----------------------------------------------- # --- keymaps --- @@ -387,7 +391,7 @@ noremap gd call JumpToDefinition() noremap d call SplitJumpToDefinition() # nnoremap gd :vert call JumpToDefinition() noremap gn ] -noremap gk K +noremap gk exists(":Man") > 0 ? ":vert Man " : "K" nnoremap * *N xnoremap * y/\M"N nnoremap # #N