Skip to content

Commit

Permalink
dot
Browse files Browse the repository at this point in the history
  • Loading branch information
S4deghN committed Jan 14, 2025
1 parent 7c9aea9 commit 874b72f
Show file tree
Hide file tree
Showing 6 changed files with 169 additions and 113 deletions.
6 changes: 4 additions & 2 deletions .bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -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!!!!
Expand Down Expand Up @@ -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@"'
Expand Down
103 changes: 0 additions & 103 deletions fontconfig/fonts.conf
Original file line number Diff line number Diff line change
@@ -1,103 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<alias binding="strong">
<family>monospace</family>
<prefer>
<family>Symbols Nerd Font</family>
</prefer>
</alias>
<!-- add Farsi font preference -->
<match target="font">
<test name="lang" compare="contains"> <string>fa</string> </test>
<alias>
<family>sans-serif</family>
<prefer>
<family>Vazir</family>
</prefer>
</alias>
</match>
<!-- Add generic family. -->
<match target="pattern">
<test name="family" qual="any">
<string>emoji</string>
</test>
<edit binding="same" name="family" mode="assign">
<string>Noto Color Emoji</string>
</edit>
</match>
<!-- This adds Noto Color Emoji as a final fallback font for the default font families. -->
<match target="pattern">
<test name="family">
<string>sans</string>
</test>
<edit name="family" mode="append">
<string>Noto Color Emoji</string>
</edit>
</match>
<match target="pattern">
<test name="family">
<string>serif</string>
</test>
<edit name="family" mode="append">
<string>Noto Color Emoji</string>
</edit>
</match>
<match target="pattern">
<test name="family">
<string>sans-serif</string>
</test>
<edit name="family" mode="append">
<string>Noto Color Emoji</string>
</edit>
</match>
<match target="pattern">
<test name="family">
<string>monospace</string>
</test>
<edit name="family" mode="append">
<string>Symbols Nerd Font</string>
</edit>
</match>
<!-- Block Symbola from the list of fallback fonts. -->
<selectfont>
<rejectfont>
<pattern>
<patelt name="family">
<string>Symbola</string>
</patelt>
</pattern>
</rejectfont>
</selectfont>
<dir>~/.fonts</dir>
<match target="font">
<edit name="rgba" mode="assign">
<const>rgb</const>
</edit>
</match>
<match target="font">
<edit name="hinting" mode="assign">
<bool>true</bool>
</edit>
</match>
<match target="font">
<edit name="hintstyle" mode="assign">
<const>hintslight</const>
</edit>
</match>
<match target="font">
<edit name="antialias" mode="assign">
<bool>true</bool>
</edit>
</match>
</fontconfig>

<!-- <?xml version="1.0"?><!DOCTYPE fontconfig SYSTEM "fonts.dtd"> -->
<!-- <fontconfig> -->
<!-- <alias> -->
<!-- <family>JetBrains Mono</family> -->
<!-- <prefer> -->
<!-- <family>Symbols Nerd Font Mono</family> -->
<!-- </prefer> -->
<!-- </alias> -->
<!-- </fontconfig> -->
4 changes: 2 additions & 2 deletions i3/config
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion vim/colors/lightgruv.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
159 changes: 155 additions & 4 deletions vim/plugin/parenmatch.vim
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,27 @@ 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()
if matchpairs ==# &l:matchpairs
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()
Expand All @@ -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
Expand Down
6 changes: 5 additions & 1 deletion vim/vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ def LspOnAttach()
nmap <buffer> [d :LspDiagPrev<cr>
nmap <buffer> gh :LspDiagCurrent<cr>
nmap <buffer> gla :LspCodeAction<cr>
nmap <buffer> gls :LspSwitchSourceHeader<cr>
enddef

autocmd User LspSetup call LspOptionsSet(lspOpts)
Expand All @@ -156,6 +157,7 @@ var lspServers = [
]
# }}}
Plug 'J-Merle/vim-todo'
Plug 'habamax/vim-dir'
plug#end()

packadd! comment
Expand Down Expand Up @@ -204,6 +206,7 @@ set signcolumn=no
set ruler
set nocursorline
set scrolloff=3
set scrolljump=0

# set showcmd showcmdloc=statusline
set shortmess=aoOFtT
Expand Down Expand Up @@ -289,6 +292,7 @@ syntax on
set termguicolors
set background=dark
color lightgruv
# hi normal guibg=black

# -----------------------------------------------
# --- keymaps ---
Expand Down Expand Up @@ -387,7 +391,7 @@ noremap <silent> gd <cmd>call JumpToDefinition()<cr>
noremap <C-w>d <cmd>call SplitJumpToDefinition()<cr>
# nnoremap <C-W>gd <Cmd>:vert call JumpToDefinition()<CR>
noremap gn ]<C-I>
noremap gk K
noremap <expr> gk exists(":Man") > 0 ? ":vert Man <cword><CR>" : "K"
nnoremap * *N
xnoremap * y/\M<C-R>"<cr>N
nnoremap # #N
Expand Down

0 comments on commit 874b72f

Please sign in to comment.