From 28ea0e3cbe1c0f980a05d6fb13a428bcab2ea1c5 Mon Sep 17 00:00:00 2001 From: Vikas Kushwaha Date: Fri, 13 Jun 2025 08:37:31 +0530 Subject: neovim updates --- .config/X11/Xresources | 2 +- .config/X11/xprofile | 7 +- .config/git/config | 2 + .config/i3/config | 32 +++--- .config/i3blocks/bar2 | 7 +- .config/i3blocks/config | 5 +- .config/keepassxc/keepassxc.ini | 6 +- .config/lf/lfrc | 4 +- .config/nvim/coc.vim | 15 ++- .config/nvim/init.vim | 103 +++++++++++------- .config/nvim/plugins.conf.d/coc-onload.vim | 147 ++++++++++++++++++++++++++ .config/nvim/plugins.conf.d/coc-settings.json | 10 ++ .config/nvim/plugins.conf.d/fzf.vim | 23 ++++ .config/nvim/plugins.conf.d/onedark.vim | 38 +++++++ .config/nvim/plugins.conf.d/out.vim | 36 +++++++ .config/nvim/plugins.conf.d/vimspector.vim | 21 ++++ .config/nvim/plugins.conf.d/zeal.vim | 7 ++ .config/nvim/templates/_default.sh | 2 + .config/nvim/templates/sh/err.sh | 2 + .config/nvim/templates/sh/getopts.sh | 6 ++ .config/nvim/templates/sh/help.sh | 10 ++ .config/nvim/user/coc-onload.vim | 147 -------------------------- .config/nvim/user/coc-settings.json | 10 -- .config/nvim/user/fzf.vim | 19 ---- .config/nvim/user/onedark.vim | 38 ------- .config/nvim/user/out.vim | 36 ------- .config/nvim/user/vimspector.vim | 21 ---- .config/nvim/user/zeal.vim | 7 -- .config/shell/aliasrc | 1 - .config/shell/bm-dirs | 41 +++---- .config/shell/bm-files | 34 +++--- .config/shell/profile | 15 ++- .config/starship.toml | 12 +-- .config/tmux/tmux.conf | 12 +-- .config/yt-dlp/channel.conf | 5 +- .config/yt-dlp/config | 2 +- .config/yt-dlp/playlist.conf | 3 +- .config/yt-dlp/videos.conf | 1 + .config/zsh/.zshrc | 53 +++++----- .config/zsh/command-tools.zsh | 2 +- 40 files changed, 495 insertions(+), 449 deletions(-) create mode 100644 .config/nvim/plugins.conf.d/coc-onload.vim create mode 100644 .config/nvim/plugins.conf.d/coc-settings.json create mode 100644 .config/nvim/plugins.conf.d/fzf.vim create mode 100644 .config/nvim/plugins.conf.d/onedark.vim create mode 100644 .config/nvim/plugins.conf.d/out.vim create mode 100644 .config/nvim/plugins.conf.d/vimspector.vim create mode 100644 .config/nvim/plugins.conf.d/zeal.vim create mode 100644 .config/nvim/templates/_default.sh create mode 100644 .config/nvim/templates/sh/err.sh create mode 100644 .config/nvim/templates/sh/getopts.sh create mode 100644 .config/nvim/templates/sh/help.sh delete mode 100644 .config/nvim/user/coc-onload.vim delete mode 100644 .config/nvim/user/coc-settings.json delete mode 100644 .config/nvim/user/fzf.vim delete mode 100644 .config/nvim/user/onedark.vim delete mode 100644 .config/nvim/user/out.vim delete mode 100644 .config/nvim/user/vimspector.vim delete mode 100644 .config/nvim/user/zeal.vim (limited to '.config') diff --git a/.config/X11/Xresources b/.config/X11/Xresources index e03daba..9ce1a52 100644 --- a/.config/X11/Xresources +++ b/.config/X11/Xresources @@ -6,7 +6,7 @@ st.alpha: 0.95 st.alphaOffset: 0.1 !! Set a default font and font size as below: -st.font: MesloLGS Nerd\ Font:size=17 +*.font: monospace:size=16 ! st.termname: st-256color ! st.borderpx: 2 diff --git a/.config/X11/xprofile b/.config/X11/xprofile index dec8036..ebd736b 100644 --- a/.config/X11/xprofile +++ b/.config/X11/xprofile @@ -2,13 +2,12 @@ # gui -e +setdp xrdb "${XDG_CONFIG_HOME:-$HOME/.config}/X11/Xresources" & xrdbpid=$! numlockx on & -setdp -setbg logdir="${XDG_STATE_HOME:-$HOME/.local/state}/startup" -autostart="copyq dunst pipewire syncthing remapd gammastep prime-offload picom mailsyncd" +autostart="copyq dunst pipewire syncthing remapd setdp gammastep prime-offload mailsyncd background-cleanup" sleep 1 mkdir -pv "$logdir" @@ -16,5 +15,5 @@ for program in $autostart; do pidof -sx "$program" || "$program" >"$logdir/$program.stdout.log" 2>"$logdir/$program.stderr.log" & done -{ sleep 5; wireplumber; } & +{ sleep 5 && wireplumber; } & [ -n "$xrdbpid" ] && wait "$xrdbpid" diff --git a/.config/git/config b/.config/git/config index e63dac2..5ad6ffe 100644 --- a/.config/git/config +++ b/.config/git/config @@ -3,3 +3,5 @@ name = Vikas Kushwaha [init] defaultBranch = master +[http] + postbuffer = 10g diff --git a/.config/i3/config b/.config/i3/config index 2c12947..12cbff0 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -18,6 +18,7 @@ # exec --no-startup-id pasystray exec st -c dropdown_tmuxdd -e tmux new -A -s ddterm +exec sh -c "sleep 1 && i3-msg scratchpad show" ################################ ### Commonly Used Variables: ### @@ -27,11 +28,6 @@ exec st -c dropdown_tmuxdd -e tmux new -A -s ddterm # - Make sure that you give the absolute path to the binary / program / executable # - You may specify any additional arguments required by the binary / executable -### Wallpaper: ### -# - You need to specify homescreen wallpaper using azote -set $lockScreenWallpaper '/usr/share/wallpapers/garuda-wallpapers/Garuda-Desert.png' -set $homeScreenWallpaper '/usr/share/wallpapers/garuda-wallpapers/background.jpg' - ### Applications: ### set $preferredTerminalEmulator $TERMINAL set $preferredBrowser librewolf @@ -50,6 +46,7 @@ set $right l set $super Mod4 set $alt Mod1 +set $passmenu '$PASSWORD_STORE_DIR=$HOME/Phone/Backup/pass passmenu' @@ -59,11 +56,13 @@ set $alt Mod1 bindsym $super+F2 exec --no-startup-id dmenu-unicode bindsym $super+Shift+F2 exec --no-startup-id dmenu-unicode get-code -bindsym $super+F3 exec --no-startup-id st -c "dropdown_sender" -e fsend -bindsym $super+F4 exec --no-startup-id passmenu -bindsym $super+Shift+F4 exec --no-startup-id passmenu --type +bindsym $super+F3 exec --no-startup-id dmenu-file-history +bindsym $super+F4 exec --no-startup-id $passmenu +bindsym $super+Shift+F4 exec --no-startup-id $passmenu --type bindsym $super+F5 exec --no-startup-id dmenu-zeal +bindsym $super+F6 exec --no-startup-id st -c "dropdown_sender" -e fsend bindsym $super+F7 exec --no-startup-id sh -c 'find ~/.librewolf -mindepth 1 -maxdepth 1 -type d -name '????????.*' -printf "%f\n" | cut -d. -f2- | dmenu -p "LibreWolf Profile" | xargs -I{} setsid -f librewolf -P "{}"' +bindsym $super+F8 exec --no-startup-id sh -c 'yth dmenu | xclip -in -sel clip' bindsym $super+b exec --no-startup-id librewolf-open bindsym $super+c exec --no-startup-id edit-graphical-buffer bindsym $super+x exec --no-startup-id toggle-xeyes @@ -100,6 +99,7 @@ bindsym Ctrl+Print exec --no-startup-id $preferredScreenCaptureTool # - $TERMINAL & xfce4-terminal can also be started using their individual keybindings bindsym $super+Return exec --no-startup-id $preferredTerminalEmulator +bindsym $super+Shift+Return exec --no-startup-id sh -c 'cd "$(tail -1 $CD_HISTFILE)" && $TERMINAL' bindsym $super+t exec --no-startup-id xfce4-terminal bindsym $super+Shift+t exec --no-startup-id notify-send Temprature "$(sensors --no-adapter coretemp-isa-0000 | tail +2 | sed "s|(.*)||")" @@ -169,13 +169,13 @@ bindsym $super+Ctrl+Left exec $brightnessDown bindsym $super+Ctrl+Up exec --no-startup-id $raiseVolume bindsym $super+Ctrl+Down exec --no-startup-id $lowerVolume -bindsym $super+Ctrl+Insert exec --no-startup-id $muteOutput -bindsym $super+Ctrl+Del exec --no-startup-id $muteInput +bindsym $super+Ctrl+Home exec --no-startup-id volctl toggle +bindsym $super+Ctrl+End exec --no-startup-id $muteInput bindsym $super+Ctrl+Next exec $nextAudio bindsym $super+Ctrl+Prior exec $prevAudio -bindsym $super+Ctrl+Home exec $playAudio -bindsym $super+Ctrl+End exec $stopAudio +# bindsym $super+Ctrl+Home exec $playAudio +# bindsym $super+Ctrl+End exec $stopAudio # bindsym XF86TouchpadToggle exec ~/bin/toggletouchpad.sh @@ -285,15 +285,10 @@ bindsym $super+Shift+Right move right ################## # navigate workspaces -bindsym $super+bracketleft workspace $ws1 bindsym $super+n workspace next bindsym $super+p workspace prev -bindsym $super+bracketright workspace $ws10 - -bindsym $super+Home workspace $ws1 bindsym $super+Prior workspace prev bindsym $super+Next workspace next -bindsym $super+End workspace $ws10 bindsym $super+Tab workspace back_and_forth bindsym $super+Shift+Tab move container to workspace back_and_forth; workspace back_and_forth @@ -468,6 +463,7 @@ for_window [window_type='dialog'] move position center for_window [title="Android Emulator - *"] floating enable border none sticky enable for_window [title="Emulator"] floating enable border none sticky enable for_window [class="mpv"] floating enable +for_window [class="flameshot"] floating enable # for_window [class="Zeal"] floating enable move position below # #---Dropdown Windows---# # @@ -644,6 +640,6 @@ mode "$mode_system" { # TODO: create your own i3exit script as ?syst-power # Lock screen -bindsym $super+Escape exec i3lock -t -i $lockScreenWallpaper +bindsym $super+Escape exec i3exit lock # exec_always xrandr --output eDP-1-1-1 --auto --primary diff --git a/.config/i3blocks/bar2 b/.config/i3blocks/bar2 index 3bcfe48..575a78d 100644 --- a/.config/i3blocks/bar2 +++ b/.config/i3blocks/bar2 @@ -29,7 +29,7 @@ separator_block_width=60 [weather] separator=true separator_block_width=50 -command=i3weather 2 +command=i3weather info interval=1800 color=#A4C2F4 @@ -57,13 +57,14 @@ color=#A4C2F4 # command=echo " $(i3memory)" # interval=1 -[disk_nas] +[disk_root] label=   -instance=/nas +instance=/ interval=30 command=disk_usage [disk-io] +separator=true separator_block_width=60 command=disk-io #command=$SCRIPT_DIR/disk-io -w 3 -M -P 0 diff --git a/.config/i3blocks/config b/.config/i3blocks/config index 96f2448..8b7838c 100644 --- a/.config/i3blocks/config +++ b/.config/i3blocks/config @@ -29,7 +29,7 @@ separator_block_width=35 [weather] separator=true separator_block_width=50 -command=i3weather 1 +command=i3weather cache interval=1800 color=#A4C2F4 @@ -59,8 +59,7 @@ interval=1 [datetime] separator=true -# command=case "$BLOCK_BUTTON" in 1) TERM=256colors clearx -n 'cal -y --color=always | less' ;; 2) $TERMINAL -e nvim ~/.config/i3blocks/config ;; esac; date +'🕒 %H:%M:%S 🗓️ %a %d.%m.%Y ' -command=case "$BLOCK_BUTTON" in 1) $TERMINAL -e sh -c 'cal -y --color=always | less' ;; 2) $TERMINAL -e nvim ~/.config/i3blocks/config ;; esac; date +' %H:%M:%S 󰃭 %a %d.%m.%Y ✝ ' +command=sb-clock color=#BBDDDD interval=1 diff --git a/.config/keepassxc/keepassxc.ini b/.config/keepassxc/keepassxc.ini index be49131..c84bbd3 100644 --- a/.config/keepassxc/keepassxc.ini +++ b/.config/keepassxc/keepassxc.ini @@ -17,9 +17,11 @@ CheckForUpdates=false CompactMode=false HidePreviewPanel=true HideToolbar=false -MinimizeOnClose=false +MinimizeOnClose=true MinimizeOnStartup=true -TrayIconAppearance=monochrome-light +MinimizeToTray=true +ShowTrayIcon=true +TrayIconAppearance=colorful [KeeShare] Active="\n" diff --git a/.config/lf/lfrc b/.config/lf/lfrc index d2937e6..2d10228 100644 --- a/.config/lf/lfrc +++ b/.config/lf/lfrc @@ -112,9 +112,9 @@ map :toggle; up map Z :toggle; up map select_eval "fzf --reverse --track --header-first --header='Jump to location' --query \"^${f##*/}$\" --bind 'load:change-query(!/$ )'" map ${{ lf -remote "send $id select \"$(cat "${OPEN_HISTFILE:-${XDG_STATE_HOME:-$HOME/.local/state}/open_history}" | - fzf --reverse --tac --header-first --header='File History')\"" }} + fzf --reverse --tac --no-sort --header-first --header='File History')\"" }} map ${{ lf -remote "send $id cd \"$(cat ${CD_HISTFILE:-${XDG_STATE_HOME:-$HOME/.local/state}/cd_history} | - fzf --reverse --tac --header-first --header='Path History')\"" }} + fzf --reverse --tac --no-sort --header-first --header='Path History')\"" }} map select_eval "fzf --reverse --track --header-first --header='Jump to location' --query \"^${f##*/}/$\" --bind 'load:change-query(/$ )'" map d diff --git a/.config/nvim/coc.vim b/.config/nvim/coc.vim index 1175735..2ba6c06 100644 --- a/.config/nvim/coc.vim +++ b/.config/nvim/coc.vim @@ -7,21 +7,21 @@ packadd! vim-jsx-pretty " packadd! copilot.vim " --> Fzf -" source ~/.config/nvim/user/fzf.vim +" source ~/.config/nvim/plugins.conf.d/fzf.vim " set rtp+=/usr/share/vim/vimfiles " --> Zeal -source ~/.config/nvim/user/zeal.vim +source ~/.config/nvim/plugins.conf.d/zeal.vim " --> Onedark theme -source ~/.config/nvim/user/onedark.vim +source ~/.config/nvim/plugins.conf.d/onedark.vim " --> Vimspector -source ~/.config/nvim/user/vimspector.vim +source ~/.config/nvim/plugins.conf.d/vimspector.vim " --> COC -autocmd! User coc.nvim source $HOME/.config/nvim/user/coc-onload.vim -let g:coc_config_home = '$HOME/.config/nvim/user' +autocmd! User coc.nvim source $HOME/.config/nvim/plugins.conf.d/coc-onload.vim +let g:coc_config_home = '$HOME/.config/nvim/plugins.conf.d' let g:coc_data_home = '$HOME/.local/share/nvim/site/coc' let g:coc_global_extensions = [ \ 'coc-json', @@ -45,8 +45,5 @@ inoremap coc#refresh() nnoremap :source ~/.config/nvim/coc.vim -" autocmd VimLeave * call SaveSess() -" autocmd VimEnter * nested call RestoreSess() - AirlineTheme CocList extensions diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 67eb5b8..fbda0fa 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -33,13 +33,12 @@ if filereadable(config_dir . "autoload/plug.vim") endif packadd! fzf.vim -source ~/.config/nvim/user/fzf.vim +source ~/.config/nvim/plugins.conf.d/fzf.vim set rtp+=/usr/share/vim/vimfiles let g:Verdin#autocomplete = 1 let g:livepreview_previewer = 'zathura' let g:tex_flavor = 'latex' -let g:session_filename = '.session.vim' set title showmatch nowrap mouse=a scrolloff=5 set tabstop=2 shiftwidth=0 @@ -88,46 +87,74 @@ nnoremap o :LfWorkingDirectory nnoremap l :LfCurrentFileNewTab nnoremap o :LfWorkingDirectoryExistingOrNewTab + " --> Sessions -fu! SaveSess() - execute 'mksession! ' . getcwd() . '/' . g:session_filename +let g:session_filename = '.session.vim' + +function! SaveSess() + execute 'mksession! ' . getcwd() . '/' . g:session_filename endfunction -fu! RestoreSess() -if filereadable(getcwd() . '/' . g:session_filename) - execute 'so ' . getcwd() . '/' . g:session_filename - if bufexists(1) - for l in range(1, bufnr('$')) - if bufwinnr(l) == -1 - exec 'sbuffer ' . l - endif - endfor - endif -endif +function! RestoreSess() + execute 'so ' . getcwd() . '/' . g:session_filename + if bufexists(1) + for l in range(1, bufnr('$')) + if bufwinnr(l) == -1 + exec 'sbuffer ' . l + endif + endfor + endif endfunction -command! -nargs=0 Mksess :call SaveSess() -command! -nargs=0 Resess :call RestoreSess() +if argc() == 0 && filereadable(getcwd() . '/' . g:session_filename) + autocmd VimLeave * call SaveSess() + autocmd VimEnter * nested call RestoreSess() +endif + +command! -nargs=0 Mksession :call SaveSess() + " --> Template Management -function SourceTemplate() - let b:template = glob("${XDG_CONFIG_HOME:-$HOME/.config}/nvim/templates/_default." . expand('%:e')) - if !empty(b:template) - execute('0r' . b:template) +let g:templates_dir = "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/templates" + +function ReadDefaultTemplate() + let b:default_template = glob(g:templates_dir . "/_default." . expand('%:e')) + if !empty(b:default_template) + execute('0r ' . b:default_template) endif endfunction -autocmd BufNewFile * call SourceTemplate() +autocmd BufNewFile * call ReadDefaultTemplate() + +function ReadTemplate(template) + execute('r ' . a:template) +endfunction + +function FzfTemplates() + call fzf#run(fzf#wrap({ + \ 'source': 'find ' . g:templates_dir . '/' . &filetype . ' -mindepth 1', + \ 'sink': function('ReadTemplate'), + \ 'options': ['--delimiter', '/templates/' . &filetype . '/', '--with-nth', '2..'], + \ })) +endfunction + +command -nargs=0 Templates call FzfTemplates() +nnoremap t :Templates + + +" --> Other commands autocmd TermOpen * startinsert -command! -nargs=* TermSplit split | terminal -command! -nargs=* TermVSplit vsplit | terminal +command! -nargs=* TermSplit split | terminal +command! -nargs=* TermVSplit vsplit | terminal + +command -nargs=* T tabnew +command Gi execute "tabnew" system('EDITOR=echo gi') -command! -nargs=* T tabnew -" --> Bindings and configs +" --> Bindings if !exists('g:lasttab') let g:lasttab = 1 @@ -194,24 +221,21 @@ autocmd FileType go inoremap ;ae err:=<++>iferr! nnoremap fl :w:!dev lint "%" nnoremap fm :w:%!dev format "%" nnoremap fM :w:%!dev minify "%" -nnoremap fc :w:!dev compile "%" -nnoremap fe :w:!dev run "%" -nnoremap ft :w:!dev test "%" -nnoremap fb :w:!dev build "%" +nnoremap fc :w:se nornu:!dev compile "%":se rnu +nnoremap fe :w:se nornu:!dev run "%":se rnu +nnoremap fa :w:se nornu:!dev test "%":se rnu +nnoremap fb :w:se nornu:!dev build "%":se rnu nnoremap fr :w:!dev clean "%" nnoremap Fl :w:TermSplit dev lint "%" nnoremap Fm :w:TermSplit dev format "%" -nnoremap Fc :w:TermSplit dev compile "%" -nnoremap Fe :w:TermSplit dev run "%" -nnoremap Ft :w:TermSplit dev test "%" +nnoremap Fc :w:se nornu:TermSplit dev compile "%" +nnoremap Fe :w:se nornu:TermSplit dev run "%" +nnoremap Fb :w:se nornu:TermSplit dev build "%" +nnoremap Fa :w:se nornu:TermSplit dev test "%" nnoremap Fr :w:TermSplit dev clean "%" -nnoremap b :w:se nornu:!dev build "%":se rnu -nnoremap B :w:se nornu:TermSplit dev build "%" -nnoremap t :w:se nornu:!dev test "%":se rnu -nnoremap T :w:se nornu:TermSplit dev test "%" - +nnoremap a :w:se nornu:!dev test "%":se rnu nnoremap w :set wrap! nnoremap fo :!opout "%:p" nnoremap :source ~/.config/nvim/init.vim @@ -220,6 +244,9 @@ nnoremap s :%s//gc nnoremap gc :TermSplit git add --all && git commit nnoremap gp :TermSplit gitpush + +" --> Update shortcuts + let shortcuts = config_dir . "shortcuts.vim" if filereadable(shortcuts) execute "source " . shortcuts diff --git a/.config/nvim/plugins.conf.d/coc-onload.vim b/.config/nvim/plugins.conf.d/coc-onload.vim new file mode 100644 index 0000000..b3db607 --- /dev/null +++ b/.config/nvim/plugins.conf.d/coc-onload.vim @@ -0,0 +1,147 @@ + +" May need for Vim (not Neovim) since coc.nvim calculates byte offset by count +" utf-8 byte sequence +set encoding=utf-8 +" Some servers have issues with backup files, see #649 +set nobackup +set nowritebackup + +" Having longer updatetime (default is 4000 ms = 4s) leads to noticeable +" delays and poor user experience +set updatetime=1000 + +" Always show the signcolumn, otherwise it would shift the text each time +" diagnostics appear/become resolved +set signcolumn=yes + +" Use tab for trigger completion with characters ahead and navigate +" NOTE: There's always complete item selected by default, you may want to enable +" no select by `"suggest.noselect": true` in your configuration file +" NOTE: Use command ':verbose imap ' to make sure tab is not mapped by +" other plugin before putting this into your config + inoremap + \ coc#pum#visible() ? coc#pum#next(1) : + \ CheckBackspace() ? "\" : + \ coc#refresh() + inoremap coc#pum#visible() ? coc#pum#prev(1) : "\" + +" Make to accept selected completion item or notify coc.nvim to format +" u breaks current undo, please make your own choice +inoremap coc#pum#visible() ? coc#pum#confirm() + \: "\u\\=coc#on_enter()\" + +function! CheckBackspace() abort + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~# '\s' +endfunction + +" Use to trigger completion +if has('nvim') + inoremap coc#refresh() +else + inoremap coc#refresh() +endif + +" Use `[g` and `]g` to navigate diagnostics +" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list +nmap [g (coc-diagnostic-prev) +nmap ]g (coc-diagnostic-next) + +" GoTo code navigation +nmap gd (coc-definition) +nmap gy (coc-type-definition) +nmap gi (coc-implementation) +nmap gr (coc-references) + +" Override neovim's builtin referencing +nmap grr (coc-references) + +" Use K to show documentation in preview window +nnoremap :call ShowDocumentation() + +function! ShowDocumentation() + if CocAction('hasProvider', 'hover') + call CocActionAsync('doHover') + else + call feedkeys('K', 'in') + endif +endfunction + +" Highlight the symbol and its references when holding the cursor +autocmd CursorHold * silent call CocActionAsync('highlight') + +" Symbol renaming +nmap rn (coc-rename) + +" Formatting selected code +xmap cf (coc-format-selected) +nmap cf (coc-format-selected) + +augroup mygroup + autocmd! + " Setup formatexpr specified filetype(s) + autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') + " Update signature help on jump placeholder + autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') +augroup end + +" Applying code actions to the selected code block +" Example: `aap` for current paragraph +xmap aa (coc-codeaction-selected) +nmap aa (coc-codeaction-selected) + +" Remap keys for applying code actions at the cursor position +nmap ac (coc-codeaction-cursor) +" Remap keys for apply code actions affect whole buffer +nmap as (coc-codeaction-source) +" Apply the most preferred quickfix action to fix diagnostic on the current line +nmap aq (coc-fix-current) + +" Remap keys for applying refactor code actions +nmap re (coc-codeaction-refactor) +xmap r (coc-codeaction-refactor-selected) +nmap r (coc-codeaction-refactor-selected) + +" Run the Code Lens action on the current line +nmap cl (coc-codelens-action) + +" Map function and class text objects +" NOTE: Requires 'textDocument.documentSymbol' support from the language server +xmap if (coc-funcobj-i) +omap if (coc-funcobj-i) +xmap af (coc-funcobj-a) +omap af (coc-funcobj-a) +xmap ic (coc-classobj-i) +omap ic (coc-classobj-i) +xmap ac (coc-classobj-a) +omap ac (coc-classobj-a) + +" Remap and to scroll float windows/popups +if has('nvim-0.4.0') || has('patch-8.2.0750') + nnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" + nnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" + inoremap coc#float#has_scroll() ? "\=coc#float#scroll(1)\" : "\" + inoremap coc#float#has_scroll() ? "\=coc#float#scroll(0)\" : "\" + vnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" + vnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" +endif + +" Use CTRL-S for selections ranges +" Requires 'textDocument/selectionRange' support of language server +nmap (coc-range-select) +xmap (coc-range-select) + +" Add `:Format` command to format current buffer +command! -nargs=0 Format :call CocActionAsync('format') + +" Add `:Fold` command to fold current buffer +command! -nargs=? Fold :call CocAction('fold', ) + +" Add `:OR` command for organize imports of the current buffer +command! -nargs=0 OR :call CocActionAsync('runCommand', 'editor.action.organizeImport') + +" Add (Neo)Vim's native statusline support +" NOTE: Please see `:h coc-status` for integrations with external plugins that +" provide custom statusline: lightline.vim, vim-airline +set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} + diff --git a/.config/nvim/plugins.conf.d/coc-settings.json b/.config/nvim/plugins.conf.d/coc-settings.json new file mode 100644 index 0000000..437572d --- /dev/null +++ b/.config/nvim/plugins.conf.d/coc-settings.json @@ -0,0 +1,10 @@ +{ + "suggest.autoTrigger": "always", + "diagnostic.enable": true, + "python.linting.pycodestyleEnabled": true, + "html.autoCreateQuotes": false, + "coc.preferences.formatOnType": true, + "copilot.showRemainingText": true, + "copilot.enable": false, + "typescript.autoClosingTags": false +} diff --git a/.config/nvim/plugins.conf.d/fzf.vim b/.config/nvim/plugins.conf.d/fzf.vim new file mode 100644 index 0000000..49fec8d --- /dev/null +++ b/.config/nvim/plugins.conf.d/fzf.vim @@ -0,0 +1,23 @@ +" --> Fzf + +let g:fzf_history_dir = system('echo "${XDG_STATE_HOME:-$HOME/.local/state}/fzf/fzf_vim_history') + +let g:fzf_layout = { 'window': { 'width': 1, 'height': 1 } } +command! -bang -nargs=? -complete=dir Files + \ call fzf#vim#files(, {'options': ['--info=inline', '--preview', 'preview {}']}, 0) + +" Mapping selecting mappings +nmap (fzf-maps-n) +xmap (fzf-maps-x) +omap (fzf-maps-o) + +" Insert mode completion +imap (fzf-complete-word) +imap (fzf-complete-path) +imap (fzf-complete-line) + +" Fzf keybindings +nnoremap fh :History +nnoremap ff :Files +nnoremap f. :Files %:p:h + diff --git a/.config/nvim/plugins.conf.d/onedark.vim b/.config/nvim/plugins.conf.d/onedark.vim new file mode 100644 index 0000000..6f526bd --- /dev/null +++ b/.config/nvim/plugins.conf.d/onedark.vim @@ -0,0 +1,38 @@ +" --> Onedark Theme +if exists('+termguicolors') + let g:airline_theme = 'onedark' + let g:onedark_terminal_italics = 1 + let g:onedark_color_overrides = { + \ "foreground": { "gui": "#BBC2CF", "cterm": "145", "cterm16": "NONE" }, + \ "background": { "gui": "#181C24", "cterm": "235", "cterm16": "NONE" }, + \ "comment_grey": { "gui": "#6C7380", "cterm": "59", "cterm16": "7" }, + \ "gutter_fg_grey": { "gui": "#6272A4", "cterm": "238", "cterm16": "8" }, + \ "special_grey": { "gui": "#5Ba078", "cterm": "238", "cterm16": "7" }, + \ } + " \ "background": { "gui": "#202426", "cterm": "235", "cterm16": "NONE" }, + " + " \ "red": { "gui": "#E06C75", "cterm": "204", "cterm16": "1" }, + " \ "dark_red": { "gui": "#BE5046", "cterm": "196", "cterm16": "9" }, + " \ "green": { "gui": "#98C379", "cterm": "114", "cterm16": "2" }, + " \ "yellow": { "gui": "#E5C07B", "cterm": "180", "cterm16": "3" }, + " \ "dark_yellow": { "gui": "#D19A66", "cterm": "173", "cterm16": "11" }, + " \ "blue": { "gui": "#61AFEF", "cterm": "39", "cterm16": "4" }, + " \ "purple": { "gui": "#C678DD", "cterm": "170", "cterm16": "5" }, + " \ "cyan": { "gui": "#56B6C2", "cterm": "38", "cterm16": "6" }, + " \ "black": { "gui": "#282C34", "cterm": "235", "cterm16": "0" }, + " \ "white": { "gui": "#ABB2BF", "cterm": "145", "cterm16": "15" }, + " \ "cursor_grey": { "gui": "#2C323C", "cterm": "236", "cterm16": "0" }, + " \ "visual_grey": { "gui": "#3E4452", "cterm": "237", "cterm16": "8" }, + " \ "menu_grey": { "gui": "#3E4452", "cterm": "237", "cterm16": "7" }, + " \ "vertsplit": { "gui": "#3E4452", "cterm": "59", "cterm16": "7" }, + + " autocmd ColorScheme * call onedark#extend_highlight("LineNr", { + " \ "fg": { "gui": "#6272A4", "cterm": "238", "cterm16": "8" }, + " \ }) + let &t_8f="\[38;2;%lu;%lu;%lum" + let &t_8b="\[48;2;%lu;%lu;%lum" + " set termguicolors noshowmode + colorscheme onedark + " autocmd VimEnter * AirlineTheme +endif + diff --git a/.config/nvim/plugins.conf.d/out.vim b/.config/nvim/plugins.conf.d/out.vim new file mode 100644 index 0000000..6e4e1f1 --- /dev/null +++ b/.config/nvim/plugins.conf.d/out.vim @@ -0,0 +1,36 @@ +" capture (dump) the (somewhat long) ouput of the commands like `:digraph`, `:map', `:highlight`, `:scripnames` etc. + +function! s:dump(cmd) abort + + " Start a new split or maybe a buffer or a tab + " enew | " open a new buffer + 10split | enew | " open a new split (with 10% height (?)) + " tabnew | " open a new tab + + " Make it a scratch buffer ( `:help special-buffers`) + setlocal + \ bufhidden=wipe + \ buftype=nofile + \ nobuflisted + \ nolist + \ noswapfile + \ norelativenumber + \ nonumber + + " Write the cmd output to the buffer + put =execute(a:cmd) + " There are 2 empty line at the beginning of the buffer before the ouput of + " the cmd. Not sure from where they are comning from. Anyhow I will delete + " them. + norm gg2dd + + " No modifications to this buffer + setlocal readonly nomodifiable nomodified + + " Press escape to close when you're done + nnoremap :bd + +endfunction + +" Define a command to use the function easier +command! -nargs=1 Dump execute "call s:dump(" string() ")" diff --git a/.config/nvim/plugins.conf.d/vimspector.vim b/.config/nvim/plugins.conf.d/vimspector.vim new file mode 100644 index 0000000..521e252 --- /dev/null +++ b/.config/nvim/plugins.conf.d/vimspector.vim @@ -0,0 +1,21 @@ +" --> Vimspector +let g:vimspector_base_dir = expand('$HOME/.local/share/nvim/vimspector') +let g:vimspector_enable_mappings = 'HUMAN' +nnoremap dc VimspectorContinue +nnoremap ds VimspectorStop +nnoremap dr VimspectorRestart +nnoremap dp VimspectorPause +nnoremap dl VimspectorBreakpoints +nnoremap dd VimspectorToggleBreakpoint +nnoremap db VimspectorToggleConditionalBreakpoint +nnoremap df VimspectorAddFunctionBreakpoint +nnoremap dg VimspectorGoToCurrentLine +nnoremap dx :call vimspector#ClearBreakpoints() +nnoremap dq :VimspectorReset +nnoremap VimspectorContinue +nnoremap VimspectorStepOver +nnoremap VimspectorStepInto +nnoremap VimspectorStepOut +nnoremap VimspectorToggleBreakpoint +nnoremap VimspectorRunToCursor + diff --git a/.config/nvim/plugins.conf.d/zeal.vim b/.config/nvim/plugins.conf.d/zeal.vim new file mode 100644 index 0000000..1b2734f --- /dev/null +++ b/.config/nvim/plugins.conf.d/zeal.vim @@ -0,0 +1,7 @@ +" --> Zeal docs +let g:zv_disable_mapping = 1 +nmap z Zeavim +vmap z ZVVisSelection +nmap gz ZVOperator +nmap z ZVKeyDocset + diff --git a/.config/nvim/templates/_default.sh b/.config/nvim/templates/_default.sh new file mode 100644 index 0000000..13f4793 --- /dev/null +++ b/.config/nvim/templates/_default.sh @@ -0,0 +1,2 @@ +#!/bin/sh + diff --git a/.config/nvim/templates/sh/err.sh b/.config/nvim/templates/sh/err.sh new file mode 100644 index 0000000..a4414cd --- /dev/null +++ b/.config/nvim/templates/sh/err.sh @@ -0,0 +1,2 @@ +err() { printf '%s: %s\n' "$0" "$@" >&2; exit 1; } + diff --git a/.config/nvim/templates/sh/getopts.sh b/.config/nvim/templates/sh/getopts.sh new file mode 100644 index 0000000..9013ff9 --- /dev/null +++ b/.config/nvim/templates/sh/getopts.sh @@ -0,0 +1,6 @@ +while getopts 'h' o; do case "$o" in + h) help >&2; exit ;; + *) err "invalid option -- '$OPTARG'" ;; +esac done +shift $((OPTIND - 1)) + diff --git a/.config/nvim/templates/sh/help.sh b/.config/nvim/templates/sh/help.sh new file mode 100644 index 0000000..953de68 --- /dev/null +++ b/.config/nvim/templates/sh/help.sh @@ -0,0 +1,10 @@ +help() { echo "<++> - + +USAGE: + <++> [OPTION]... + +OPTIONS: + -h show this help message"; } + +[ "$#" -lt 1 ] && help >&2 && exit 1 + diff --git a/.config/nvim/user/coc-onload.vim b/.config/nvim/user/coc-onload.vim deleted file mode 100644 index b3db607..0000000 --- a/.config/nvim/user/coc-onload.vim +++ /dev/null @@ -1,147 +0,0 @@ - -" May need for Vim (not Neovim) since coc.nvim calculates byte offset by count -" utf-8 byte sequence -set encoding=utf-8 -" Some servers have issues with backup files, see #649 -set nobackup -set nowritebackup - -" Having longer updatetime (default is 4000 ms = 4s) leads to noticeable -" delays and poor user experience -set updatetime=1000 - -" Always show the signcolumn, otherwise it would shift the text each time -" diagnostics appear/become resolved -set signcolumn=yes - -" Use tab for trigger completion with characters ahead and navigate -" NOTE: There's always complete item selected by default, you may want to enable -" no select by `"suggest.noselect": true` in your configuration file -" NOTE: Use command ':verbose imap ' to make sure tab is not mapped by -" other plugin before putting this into your config - inoremap - \ coc#pum#visible() ? coc#pum#next(1) : - \ CheckBackspace() ? "\" : - \ coc#refresh() - inoremap coc#pum#visible() ? coc#pum#prev(1) : "\" - -" Make to accept selected completion item or notify coc.nvim to format -" u breaks current undo, please make your own choice -inoremap coc#pum#visible() ? coc#pum#confirm() - \: "\u\\=coc#on_enter()\" - -function! CheckBackspace() abort - let col = col('.') - 1 - return !col || getline('.')[col - 1] =~# '\s' -endfunction - -" Use to trigger completion -if has('nvim') - inoremap coc#refresh() -else - inoremap coc#refresh() -endif - -" Use `[g` and `]g` to navigate diagnostics -" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list -nmap [g (coc-diagnostic-prev) -nmap ]g (coc-diagnostic-next) - -" GoTo code navigation -nmap gd (coc-definition) -nmap gy (coc-type-definition) -nmap gi (coc-implementation) -nmap gr (coc-references) - -" Override neovim's builtin referencing -nmap grr (coc-references) - -" Use K to show documentation in preview window -nnoremap :call ShowDocumentation() - -function! ShowDocumentation() - if CocAction('hasProvider', 'hover') - call CocActionAsync('doHover') - else - call feedkeys('K', 'in') - endif -endfunction - -" Highlight the symbol and its references when holding the cursor -autocmd CursorHold * silent call CocActionAsync('highlight') - -" Symbol renaming -nmap rn (coc-rename) - -" Formatting selected code -xmap cf (coc-format-selected) -nmap cf (coc-format-selected) - -augroup mygroup - autocmd! - " Setup formatexpr specified filetype(s) - autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') - " Update signature help on jump placeholder - autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') -augroup end - -" Applying code actions to the selected code block -" Example: `aap` for current paragraph -xmap aa (coc-codeaction-selected) -nmap aa (coc-codeaction-selected) - -" Remap keys for applying code actions at the cursor position -nmap ac (coc-codeaction-cursor) -" Remap keys for apply code actions affect whole buffer -nmap as (coc-codeaction-source) -" Apply the most preferred quickfix action to fix diagnostic on the current line -nmap aq (coc-fix-current) - -" Remap keys for applying refactor code actions -nmap re (coc-codeaction-refactor) -xmap r (coc-codeaction-refactor-selected) -nmap r (coc-codeaction-refactor-selected) - -" Run the Code Lens action on the current line -nmap cl (coc-codelens-action) - -" Map function and class text objects -" NOTE: Requires 'textDocument.documentSymbol' support from the language server -xmap if (coc-funcobj-i) -omap if (coc-funcobj-i) -xmap af (coc-funcobj-a) -omap af (coc-funcobj-a) -xmap ic (coc-classobj-i) -omap ic (coc-classobj-i) -xmap ac (coc-classobj-a) -omap ac (coc-classobj-a) - -" Remap and to scroll float windows/popups -if has('nvim-0.4.0') || has('patch-8.2.0750') - nnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" - nnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" - inoremap coc#float#has_scroll() ? "\=coc#float#scroll(1)\" : "\" - inoremap coc#float#has_scroll() ? "\=coc#float#scroll(0)\" : "\" - vnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" - vnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" -endif - -" Use CTRL-S for selections ranges -" Requires 'textDocument/selectionRange' support of language server -nmap (coc-range-select) -xmap (coc-range-select) - -" Add `:Format` command to format current buffer -command! -nargs=0 Format :call CocActionAsync('format') - -" Add `:Fold` command to fold current buffer -command! -nargs=? Fold :call CocAction('fold', ) - -" Add `:OR` command for organize imports of the current buffer -command! -nargs=0 OR :call CocActionAsync('runCommand', 'editor.action.organizeImport') - -" Add (Neo)Vim's native statusline support -" NOTE: Please see `:h coc-status` for integrations with external plugins that -" provide custom statusline: lightline.vim, vim-airline -set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} - diff --git a/.config/nvim/user/coc-settings.json b/.config/nvim/user/coc-settings.json deleted file mode 100644 index 437572d..0000000 --- a/.config/nvim/user/coc-settings.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "suggest.autoTrigger": "always", - "diagnostic.enable": true, - "python.linting.pycodestyleEnabled": true, - "html.autoCreateQuotes": false, - "coc.preferences.formatOnType": true, - "copilot.showRemainingText": true, - "copilot.enable": false, - "typescript.autoClosingTags": false -} diff --git a/.config/nvim/user/fzf.vim b/.config/nvim/user/fzf.vim deleted file mode 100644 index 371b680..0000000 --- a/.config/nvim/user/fzf.vim +++ /dev/null @@ -1,19 +0,0 @@ -" --> Fzf -let g:fzf_layout = { 'window': { 'width': 1, 'height': 1 } } -command! -bang -nargs=? -complete=dir Files - \ call fzf#vim#files(, {'options': ['--info=inline', '--preview', 'preview {}']}, 0) - -" Mapping selecting mappings -nmap (fzf-maps-n) -xmap (fzf-maps-x) -omap (fzf-maps-o) - -" Insert mode completion -imap (fzf-complete-word) -imap (fzf-complete-path) -imap (fzf-complete-line) - -" Fzf keybindings -nnoremap ff :Files -nnoremap f. :Files %:p:h - diff --git a/.config/nvim/user/onedark.vim b/.config/nvim/user/onedark.vim deleted file mode 100644 index 6f526bd..0000000 --- a/.config/nvim/user/onedark.vim +++ /dev/null @@ -1,38 +0,0 @@ -" --> Onedark Theme -if exists('+termguicolors') - let g:airline_theme = 'onedark' - let g:onedark_terminal_italics = 1 - let g:onedark_color_overrides = { - \ "foreground": { "gui": "#BBC2CF", "cterm": "145", "cterm16": "NONE" }, - \ "background": { "gui": "#181C24", "cterm": "235", "cterm16": "NONE" }, - \ "comment_grey": { "gui": "#6C7380", "cterm": "59", "cterm16": "7" }, - \ "gutter_fg_grey": { "gui": "#6272A4", "cterm": "238", "cterm16": "8" }, - \ "special_grey": { "gui": "#5Ba078", "cterm": "238", "cterm16": "7" }, - \ } - " \ "background": { "gui": "#202426", "cterm": "235", "cterm16": "NONE" }, - " - " \ "red": { "gui": "#E06C75", "cterm": "204", "cterm16": "1" }, - " \ "dark_red": { "gui": "#BE5046", "cterm": "196", "cterm16": "9" }, - " \ "green": { "gui": "#98C379", "cterm": "114", "cterm16": "2" }, - " \ "yellow": { "gui": "#E5C07B", "cterm": "180", "cterm16": "3" }, - " \ "dark_yellow": { "gui": "#D19A66", "cterm": "173", "cterm16": "11" }, - " \ "blue": { "gui": "#61AFEF", "cterm": "39", "cterm16": "4" }, - " \ "purple": { "gui": "#C678DD", "cterm": "170", "cterm16": "5" }, - " \ "cyan": { "gui": "#56B6C2", "cterm": "38", "cterm16": "6" }, - " \ "black": { "gui": "#282C34", "cterm": "235", "cterm16": "0" }, - " \ "white": { "gui": "#ABB2BF", "cterm": "145", "cterm16": "15" }, - " \ "cursor_grey": { "gui": "#2C323C", "cterm": "236", "cterm16": "0" }, - " \ "visual_grey": { "gui": "#3E4452", "cterm": "237", "cterm16": "8" }, - " \ "menu_grey": { "gui": "#3E4452", "cterm": "237", "cterm16": "7" }, - " \ "vertsplit": { "gui": "#3E4452", "cterm": "59", "cterm16": "7" }, - - " autocmd ColorScheme * call onedark#extend_highlight("LineNr", { - " \ "fg": { "gui": "#6272A4", "cterm": "238", "cterm16": "8" }, - " \ }) - let &t_8f="\[38;2;%lu;%lu;%lum" - let &t_8b="\[48;2;%lu;%lu;%lum" - " set termguicolors noshowmode - colorscheme onedark - " autocmd VimEnter * AirlineTheme -endif - diff --git a/.config/nvim/user/out.vim b/.config/nvim/user/out.vim deleted file mode 100644 index 6e4e1f1..0000000 --- a/.config/nvim/user/out.vim +++ /dev/null @@ -1,36 +0,0 @@ -" capture (dump) the (somewhat long) ouput of the commands like `:digraph`, `:map', `:highlight`, `:scripnames` etc. - -function! s:dump(cmd) abort - - " Start a new split or maybe a buffer or a tab - " enew | " open a new buffer - 10split | enew | " open a new split (with 10% height (?)) - " tabnew | " open a new tab - - " Make it a scratch buffer ( `:help special-buffers`) - setlocal - \ bufhidden=wipe - \ buftype=nofile - \ nobuflisted - \ nolist - \ noswapfile - \ norelativenumber - \ nonumber - - " Write the cmd output to the buffer - put =execute(a:cmd) - " There are 2 empty line at the beginning of the buffer before the ouput of - " the cmd. Not sure from where they are comning from. Anyhow I will delete - " them. - norm gg2dd - - " No modifications to this buffer - setlocal readonly nomodifiable nomodified - - " Press escape to close when you're done - nnoremap :bd - -endfunction - -" Define a command to use the function easier -command! -nargs=1 Dump execute "call s:dump(" string() ")" diff --git a/.config/nvim/user/vimspector.vim b/.config/nvim/user/vimspector.vim deleted file mode 100644 index 521e252..0000000 --- a/.config/nvim/user/vimspector.vim +++ /dev/null @@ -1,21 +0,0 @@ -" --> Vimspector -let g:vimspector_base_dir = expand('$HOME/.local/share/nvim/vimspector') -let g:vimspector_enable_mappings = 'HUMAN' -nnoremap dc VimspectorContinue -nnoremap ds VimspectorStop -nnoremap dr VimspectorRestart -nnoremap dp VimspectorPause -nnoremap dl VimspectorBreakpoints -nnoremap dd VimspectorToggleBreakpoint -nnoremap db VimspectorToggleConditionalBreakpoint -nnoremap df VimspectorAddFunctionBreakpoint -nnoremap dg VimspectorGoToCurrentLine -nnoremap dx :call vimspector#ClearBreakpoints() -nnoremap dq :VimspectorReset -nnoremap VimspectorContinue -nnoremap VimspectorStepOver -nnoremap VimspectorStepInto -nnoremap VimspectorStepOut -nnoremap VimspectorToggleBreakpoint -nnoremap VimspectorRunToCursor - diff --git a/.config/nvim/user/zeal.vim b/.config/nvim/user/zeal.vim deleted file mode 100644 index 1b2734f..0000000 --- a/.config/nvim/user/zeal.vim +++ /dev/null @@ -1,7 +0,0 @@ -" --> Zeal docs -let g:zv_disable_mapping = 1 -nmap z Zeavim -vmap z ZVVisSelection -nmap gz ZVOperator -nmap z ZVKeyDocset - diff --git a/.config/shell/aliasrc b/.config/shell/aliasrc index 06b59da..888705d 100644 --- a/.config/shell/aliasrc +++ b/.config/shell/aliasrc @@ -8,7 +8,6 @@ alias md='mkdir' alias s='sudo' alias l='ls -A' alias ll='ls -al' -alias lr='ls -aR' # open alias o="${OPENER:-xdg-open}" alias e="${EDITOR:-vi}" diff --git a/.config/shell/bm-dirs b/.config/shell/bm-dirs index 25eb1ea..794d362 100644 --- a/.config/shell/bm-dirs +++ b/.config/shell/bm-dirs @@ -1,38 +1,31 @@ # You can add comments to these files with # -cac ${XDG_CACHE_HOME:-$HOME/.cache} -cg ${XDG_CONFIG_HOME:-$HOME/.config} -lb ${XDG_SCRIPTS_DIR:-$HOME/.local/bin} -lsh ${XDG_DATA_DIR:-$HOME/.local/share} -lst ${XDG_STATE_DIR:-$HOME/.local/state} -lsr ${XDG_SOURCE_DIR:-$HOME/.local/src} -dn ${XDG_DOWNLOAD_DIR:-$HOME/Downloads} -dx ${XDG_DOCUMENTS_DIR:-$HOME/Documents} -ms ${XDG_MUSIC_DIR:-$HOME/Music} -px ${XDG_PICTURES_DIR:-$HOME/Pictures} -vd ${XDG_VIDEOS_DIR:-$HOME/Videos} +ch ${XDG_CACHE_HOME:-$HOME/.cache} # CacHe +cf ${XDG_CONFIG_HOME:-$HOME/.config} # ConFig +lb ${XDG_SCRIPTS_DIR:-$HOME/.local/bin} # Local Bin +dt ${XDG_DATA_DIR:-$HOME/.local/share} # DaTa +hs ${XDG_STATE_DIR:-$HOME/.local/state} # HiStory +sr ${XDG_SOURCE_DIR:-$HOME/.local/src} # SRc +ds ${XDG_DOWNLOAD_DIR:-$HOME/Desktop} # DeSktop +dn ${XDG_DOWNLOAD_DIR:-$HOME/Downloads} # DowNloads +dx ${XDG_DOCUMENTS_DIR:-$HOME/Documents} # DoX +ms ${XDG_MUSIC_DIR:-$HOME/Music} # MuSic +px ${XDG_PICTURES_DIR:-$HOME/Pictures} # PiX +vd ${XDG_VIDEOS_DIR:-$HOME/Videos} # ViDeos -nv ${XDG_CONFIG_HOME:-$HOME/.config}/nvim lsa ${XDG_DATA_DIR:-$HOME/.local/share}/applications vnv ${XDG_DATA_DIR:-$HOME/.local/share}/virtualenvs ltr ${XDG_DATA_DIR:-$HOME/.local/share}/Trash -dl ${XDG_DOCUMENTS_DIR:-$HOME/Documents}/latex -dr ${XDG_DOCUMENTS_DIR:-$HOME/Documents}/latex/resume -nt ${XDG_DOCUMENTS_DIR:-$HOME/Documents}/Notes bn ~/bin sd ~/sdcard rp ~/repos an ~/Android -ap ~/Applications dv ~/Dev -vr ~/Dev/sites/vikas.rocks -vc ~/Dev/sites/vikas.rocks/content -vl ~/Dev/sites/vikas.rocks/layouts -vp ~/Dev/sites/vikas.rocks/public -td ~/Dev/test -gd ~/GDrive/vartak/CS -ph ~/Phone -sv ~/Phone/.stversions +dp ~/Dev/sites/personal +td ~/Dev/test # Test Dir +gd ~/GDrive # Google Drive +ph ~/Phone # PHone +stv ~/Phone/.stversions # SyncThing Versions pw ~/Phone/Android/media/com.whatsapp.w4b/WhatsApp\ Business/Media/WhatsApp\ Business\ Documents mn /mnt diff --git a/.config/shell/bm-files b/.config/shell/bm-files index 2585175..6324347 100644 --- a/.config/shell/bm-files +++ b/.config/shell/bm-files @@ -4,25 +4,27 @@ bf ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-files bd ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs -pf ~/.profile -zp ~/.zprofile -xp ~/.xprofile -gi ~/.gitignore -zr ${XDG_CONFIG_HOME:-$HOME/.config}/zsh/.zshrc -ar ${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc -lf ${XDG_CONFIG_HOME:-$HOME/.config}/lf/lfrc -sx ${XDG_CONFIG_HOME:-$HOME/.config}/sxiv/exec/key-handler -in ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/init.vim -ac ${XDG_CONFIG_HOME:-$HOME/.config}/alacritty/alacritty.toml -xr ${XDG_CONFIG_HOME:-$HOME/.config}/X11/Xresources -xi ${XDG_CONFIG_HOME:-$HOME/.config}/X11/xinitrc -ml ${XDG_CONFIG_HOME:-$HOME/.config}/mimeapps.list -fi ${XDG_CONFIG_HOME:-$HOME/.config}/fd/ignore -sc ~/.ssh/config +cfpf ~/.profile +cfzp ~/.zprofile +cfxp ~/.xprofile +cfgi ~/.gitignore +cfzc ${XDG_CONFIG_HOME:-$HOME/.config}/zsh/.zshrc +cfar ${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc +cflc ${XDG_CONFIG_HOME:-$HOME/.config}/lf/lfrc +cfsx ${XDG_CONFIG_HOME:-$HOME/.config}/sxiv/exec/key-handler +cfin ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/init.vim +cfac ${XDG_CONFIG_HOME:-$HOME/.config}/alacritty/alacritty.toml +cfza ${XDG_CONFIG_HOME:-$HOME/.config}/zathura/zathurarc +cfxr ${XDG_CONFIG_HOME:-$HOME/.config}/X11/Xresources +cfxi ${XDG_CONFIG_HOME:-$HOME/.config}/X11/xinitrc +cfml ${XDG_CONFIG_HOME:-$HOME/.config}/mimeapps.list +cffi ${XDG_CONFIG_HOME:-$HOME/.config}/fd/ignore +cfsc ~/.ssh/config zh ${XDG_STATE_HOME:-$HOME/.local/state}/zsh/history qn ${XDG_DOCUMENTS_HOME:-$HOME/Documents}/Notes/QuickNote.md bm ${XDG_DOCUMENTS_HOME:-$HOME/Documents}/Notes/bookmarks.txt -akn ${XDG_DOCUMENTS_HOME:-$HOME/Documents}/Notes/ak47.txt li ${XDG_DOCUMENTS_HOME:-$HOME/Documents}/latex/lorem-ipsum.txt vh ~/Dev/sites/vikas.rocks/layouts/_default/home.html +wtr /tmp/wttr.txt + diff --git a/.config/shell/profile b/.config/shell/profile index af1b4a9..d512687 100644 --- a/.config/shell/profile +++ b/.config/shell/profile @@ -14,15 +14,15 @@ export TERMINAL="st" export PREVIEWER="preview" export MOUNTPATH="/run/media/$USER" -export PASSWORD_STORE_DIR="$HOME/Phone/Backup/pass" +export CUSTOM_PASSWORD_STORE="$HOME/Phone/Backup/pass" export SSH_AUTH_SOCK="$HOME/.ssh/ssh_auth_sock" export NCFTPDIR="$XDG_DATA_HOME/ncftp" export R_ENVIRON_USER="$XDG_DATA_HOME/R/.Renviron" export GOPATH="$XDG_DATA_HOME/go" export ANDROID_USER_HOME="$XDG_DATA_HOME/android" export ANDROID_HOME="$HOME/Android/Sdk" -export __GL_SHADER_DISK_CACHE_PATH="$HOME/.cache/nv" export PYENV_ROOT="$XDG_DATA_HOME/pyenv" +export __GL_SHADER_DISK_CACHE_PATH="$HOME/.cache/nv" export XINITRC="$XDG_CONFIG_HOME/X11/xinitrc" export ZDOTDIR="$XDG_CONFIG_HOME/zsh" @@ -50,6 +50,7 @@ export CD_HISTFILE="$XDG_STATE_HOME/cd_history" export LESS='-fiR --mouse --use-color -j 10 -Dd+r -Du+b' export LESSOPEN='|lessopen.sh %s' export GROFF_NO_SGR=1 +export SUDO_ASKPASS='/usr/lib/ssh/ssh-askpass' export GTK_IM_MODULE='fcitx' export QT_IM_MODULE='fcitx' export SDL_IM_MODULE='fcitx' @@ -62,14 +63,14 @@ export CHROME_EXECUTABLE='chromium' export FZF_DEFAULT_COMMAND="find -H . ! -wholename '*.git*' ! \( -type d -printf '%p/\n' , ! -type d -print \)" export FZF_DEFAULT_OPTS=" --history='$FZF_HISTFILE' - --preview='\$PREVIEWER {}' --preview-window=hidden + --preview='\$PREVIEWER {}' + --preview-window='<30(up,border-bottom),right,border-left,hidden' --bind 'ctrl-s:toggle-sort' --bind 'ctrl-y:execute-silent(printf \"%s\\\n\" {+} | xsel --clipboard)' --bind 'ctrl-v:toggle-preview,ctrl-space:toggle-preview' --bind 'alt-space:toggle-preview,alt-w:toggle-preview-wrap' - --bind 'alt-enter:print-query' --bind 'ctrl-alt-c:change-preview-window(up|left:50%|down|right:50%)' - --bind 'ctrl-alt-k:change-preview-window(50%|60%|70%|80%|90%)' + --bind 'ctrl-alt-k:change-preview-window(60%|70%|80%|90%)' --bind 'ctrl-alt-j:change-preview-window(50%|40%|30%|20%)' --bind 'ctrl-alt-a:select-all,ctrl-alt-d:deselect-all' --bind 'alt-n:half-page-down,alt-p:half-page-up' @@ -79,8 +80,6 @@ export FZF_DEFAULT_OPTS=" --bind 'alt-j:preview-half-page-down,alt-k:preview-half-page-up' --bind 'alt-l:preview-page-down,alt-h:preview-page-up' --bind 'alt-H:preview-top,alt-L:preview-bottom' - --bind 'alt-g:preview-top,alt-G:preview-bottom' - --bind 'alt-s:execute(dmenu-send {})' --bind 'alt-0:change-preview(echo {})' --bind 'alt-1:change-preview(text-preview {})' --bind 'alt-2:change-preview(\$PREVIEWER {})' @@ -92,7 +91,7 @@ export FZF_DEFAULT_OPTS=" --bind 'alt-e:execute(append-to-history {q} \"$FZF_HISTFILE\"; eval \"\${EDITOR:-vi} {}\")' --bind 'alt-O:execute(append-to-history {q} \"$FZF_HISTFILE\"; mimeopen --ask {})' --bind 'alt-o:execute(append-to-history {q} \"$FZF_HISTFILE\"; eval \"\${FILES:-lf} {}\")' - --bind 'alt-D:become(append-to-history {q} \"$FZF_HISTFILE\"; dirname {} )' + --bind 'alt-s:execute(append-to-history {q} \"$FZF_HISTFILE\"; fsend {} )' " ## Custom themes for GTypist diff --git a/.config/starship.toml b/.config/starship.toml index 06f8b23..127847f 100644 --- a/.config/starship.toml +++ b/.config/starship.toml @@ -35,6 +35,9 @@ min_time = 50 format = "took [$duration]($style)" disabled = false +[line_break] +disabled = true + ## SECOND LINE/ROW: Prompt # Somethere at the beginning @@ -47,24 +50,21 @@ disabled = true [[battery.display]] # "bold red" style when capacity is between 0% and 10% threshold = 15 style = "bold red" -disabled = true [[battery.display]] # "bold yellow" style when capacity is between 10% and 30% threshold = 50 style = "bold yellow" -disabled = true [[battery.display]] # "bold green" style when capacity is between 10% and 30% threshold = 80 style = "bold green" -disabled = true # Prompt: optional param 1 [time] -format = " 🕙 $time($style)\n" +format = " [󱑋 $time]($style)\n" time_format = "%T" -style = "bright-white" -disabled = true +style = "#aaaa33" +disabled = false # # Prompt: param 2 └─ # [character] diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf index cc53fde..cc14782 100644 --- a/.config/tmux/tmux.conf +++ b/.config/tmux/tmux.conf @@ -1,9 +1,9 @@ -if-shell '[ "$COLORTERM" != "${COLORTERM#*truecolor}" ]' { - set -g default-terminal "tmux-256color" - set -ga terminal-overrides ',*256col*:Tc' - source ~/.config/tmux/tmux-gruvbox-dark.conf - # run 'bash ~/.config/tmux/tmux-onedark-theme.tmux' -} +# if-shell '[ "$COLORTERM" != "${COLORTERM#*truecolor}" ]' { +# set -g default-terminal "tmux-256color" +# set -ga terminal-overrides ',*256col*:Tc' +# source ~/.config/tmux/tmux-gruvbox-dark.conf +# # run 'bash ~/.config/tmux/tmux-onedark-theme.tmux' +# } if-shell '[ -z "$SSH_CONNECTION" ] && [ -n "$TERMUX_VERSION" ]' { set -g status-right "" diff --git a/.config/yt-dlp/channel.conf b/.config/yt-dlp/channel.conf index e67e86c..925cb02 100644 --- a/.config/yt-dlp/channel.conf +++ b/.config/yt-dlp/channel.conf @@ -1,12 +1,13 @@ ---config videos.conf +--config config --output '%(channel)s/%(title)s.%(ext)s' --output 'thumbnail:%(channel)s/.thumbnail/%(title)s.%(ext)s' --output 'description:%(channel)s/.description/%(title)s.txt' ---print-to-file %(title)s.%(ext)s %(channel)s/%(channel)s.channel.pl.txt +--print-to-file %(title)s %(channel)s/%(channel)s.channel.pl.txt # --playlist-items ::-1 +--write-description --write-thumbnail --embed-thumbnail --write-playlist-metafiles diff --git a/.config/yt-dlp/config b/.config/yt-dlp/config index 20f6aad..9e817f8 100644 --- a/.config/yt-dlp/config +++ b/.config/yt-dlp/config @@ -1,5 +1,5 @@ ---output %(title)s.%(ext)s --restrict-filenames +--output %(title)s.%(ext)s --format bestvideo*[height<=1080][fps<=30]+bestaudio --prefer-free-format diff --git a/.config/yt-dlp/playlist.conf b/.config/yt-dlp/playlist.conf index 74af4dd..43ed334 100644 --- a/.config/yt-dlp/playlist.conf +++ b/.config/yt-dlp/playlist.conf @@ -1,4 +1,4 @@ ---config videos.conf +--config config --output '%(playlist)s/%(title)s.%(ext)s' --output 'thumbnail:%(playlist)s/.thumbnail/%(title)s.%(ext)s' @@ -7,6 +7,7 @@ --print-to-file %(title)s %(playlist)s/%(playlist)s.pl.txt --playlist-items ::-1 +--write-description --write-thumbnail --embed-thumbnail --write-playlist-metafiles diff --git a/.config/yt-dlp/videos.conf b/.config/yt-dlp/videos.conf index 42d9c40..10d2564 100644 --- a/.config/yt-dlp/videos.conf +++ b/.config/yt-dlp/videos.conf @@ -1,3 +1,4 @@ --config config --format bestvideo*[height<=1080][fps<=60]+bestaudio --write-description +--print-to-file "%(original_url)s %(channel)s %(title)s %(filepath)s" $HOME/.local/state/yt_history.tsv diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index a1a32d8..d3ba554 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -6,8 +6,12 @@ bindkey -e alias find="2> >(grep -v 'Permission denied' >&2) find" source ~/.profile + [ -n "$SDOTDIR" ] || SDOTDIR="${XDG_CONFIG_HOME:-$HOME/.config}/shell" [ -n "$ZDOTDIR" ] || ZDOTDIR="${XDG_CONFIG_HOME:-HOME/.config}/zsh" +[ -n "$CD_HISTFILE" ] || CD_HISTFILE="${XDG_STATE_HOME:-$HOME/.local/state}/cd_history" +[ -n "$OPEN_HISTFILE" ] || OPEN_HISTFILE="${XDG_STATE_HOME:-$HOME/.local/state}/open_history" + source "${PREFIX:-/usr}/share/fzf/completion.zsh" source "$ZDOTDIR/command-tools.zsh" source "$ZDOTDIR/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh" @@ -67,7 +71,9 @@ zstyle ':completion:*' cache-path ~/.cache/zsh # automatically load bash completion functions autoload -U +X bashcompinit && bashcompinit -source "$ZDOTDIR/completion/arduino-cli.zsh" + +unset WORDCHARS +stty -ixon ZSH_AUTOSUGGEST_STRATEGY=(history completion) ZSH_AUTOSUGGEST_ACCEPT_WIDGETS=(end-of-line vi-end-of-line vi-add-eol) @@ -77,14 +83,7 @@ HISTFILE="${XDG_STATE_HOME:=$HOME/.local/state}/zsh/history" HISTSIZE=100000 SAVEHIST=50000 -unset WORDCHARS -stty -ixon - -[ -z "$CD_HISTFILE" ] && - export CD_HISTFILE="${XDG_STATE_HOME:-$HOME/.local/state}/cd_history" - -[ -z "$OPEN_HISTFILE" ] && - export OPEN_HISTFILE="${XDG_STATE_HOME:-$HOME/.local/state}/open_history" +# source "$ZDOTDIR/completion/arduino-cli.zsh" # Angular # _ng_yargs_completions() @@ -99,12 +98,20 @@ stty -ixon # compdef _ng_yargs_completions ng +[ -n "$DISPLAY" ] && command -V xdotool >/dev/null && { + TERMINAL_WINDOW_ID="$(xdotool getactivewindow)" + function set_win_title() { + echo -ne "\033]0; $USER@$HOST:${PWD/$HOME/~} \007" + } + precmd_functions+=(set_win_title) +} + _command_fail_hook() { [ $? = 1 ] || return if [ -n "$TMUX" ]; then tmux send-keys C-p - elif [ -n "$XDOTOOL_WINDOW_ID" ]; then - xdotool key --window "$XDOTOOL_WINDOW_ID" ctrl+p + elif [ -n "$TERMINAL_WINDOW_ID" ]; then + xdotool key --window "$TERMINAL_WINDOW_ID" ctrl+p fi } add-zsh-hook precmd _command_fail_hook @@ -150,21 +157,18 @@ if (( ${+terminfo[smkx]} && ${+terminfo[rmkx]} )); then fi -[ -n "$DISPLAY" ] && command -V xdotool >/dev/null && - XDOTOOL_WINDOW_ID="$(xdotool getactivewindow)" - [ -f "$BUFFER_CACHE" ] && { { if [ -n "$TMUX" ]; then tmux send-keys -l "$(cat "$BUFFER_CACHE")" elif [ -z "$TERMUX_VERSION" ]; then - xdotool type --window "$XDOTOOL_WINDOW_ID" "$(cat "$BUFFER_CACHE")" + xdotool type --window "$TERMINAL_WINDOW_ID" "$(cat "$BUFFER_CACHE")" fi rm -f "$BUFFER_CACHE" } & disown } -BUFFER_CACHE="${ZCACHEDIR:=$HOME/.cache/zsh}/previous-command-buffer-$$.tmp" +export BUFFER_CACHE="${ZCACHEDIR:=$HOME/.cache/zsh}/previous-command-buffer-$$.tmp" _exec-zsh() { echo "$BUFFER" > "$BUFFER_CACHE" BUFFER=' exec zsh' @@ -266,27 +270,22 @@ case "$TERM" in *256*) command -v fd >/dev/null && { FZF_DEFAULT_COMMAND="fd --hidden --color=always" FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS --ansi" - ff() { fzf -m "$@"; } alias f='fd --hidden --no-ignore-vcs' alias sr='fd --no-ignore-vcs --color=always . ~/.config ~/.local/bin ~/bin | fzf --ansi' } command -v starship >/dev/null && { eval "$(starship init zsh)" - function set_win_title() { - echo -ne "\033]0; $USER@$HOST:${PWD/$HOME/~} \007" - } - precmd_functions+=(set_win_title) } ;; esac +alias s='sudo ' alias p='pacman' alias sp='sudo pacman' alias sv='sudo sv' +alias pm='PASSWORD_STORE_DIR=$CUSTOM_PASSWORD_STORE pass' alias mmv='noglob zmv -W' -alias s='sudo ' -alias fh='fzf --tac < "$OPEN_HISTFILE"' alias ide='nvim -u "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/coc.vim"' alias mirror='sudo reflector -f 30 -l 30 --number 10 --verbose --save /etc/pacman.d/mirrorlist-arch' alias mirrord='sudo reflector --latest 50 --number 20 --sort delay --save /etc/pacman.d/mirrorlist-arch' @@ -295,14 +294,18 @@ alias fixpacman='sudo rm /var/lib/pacman/db.lck' alias gtypist="gtypist $GTYPIST_OPTS" alias typ='launch-gtypist -l "$(sed "/^gtypist lesson - \(.*\)$/!d; s//\1/" ~/Documents/Notes/QuickNote.md)"' alias typa='launch-gtypist -e 3 -l "$(sed "/^gtypist lesson - \(.*\)$/!d; s//\1/" ~/Documents/Notes/ak47.txt)"' +alias uc='cd ~ && gitpush' # update config +alias gpu='gitpush' +alias wtr='less -r /tmp/wttr.in' # Launch new (W)indow in background -W() { +new_window() { windowid="$(xdotool getactivewindow)" - setsid -f $TERMINAL >/dev/null 2>&1 + setsid -f $TERMINAL -e sh -c "${*:-$SHELL}" >/dev/null 2>&1 while [ "$(xdotool getactivewindow)" = "$windowid" ]; do sleep 0.1; done xdotool windowfocus "$windowid" } +alias W='new_window ' # Find command package F() { diff --git a/.config/zsh/command-tools.zsh b/.config/zsh/command-tools.zsh index b63b0ac..fe17ed1 100644 --- a/.config/zsh/command-tools.zsh +++ b/.config/zsh/command-tools.zsh @@ -1,5 +1,5 @@ whereis_alias() { - location="$(zsh -xic exit 2>&1 | sed -E "/alias[ '$]*$1=/!d; /\/plugins\//d" | + location="$(zsh -xic exit 2>&1 | sed -E "/sh.*alias[ '$]*$1=/!d; /\/plugins\//d" | fzf --exit-0 --select-1 --ansi --header-first --header='Select alias location' | sed -n "s|^\+\(/.*:[0-9]*\)>.*$|\1|p")" -- cgit v1.2.3