- Shell Scripts: FZF function to fuzzy find all of my projects and open nvim on that project

- Shell Scripts: WIP efforts to comply all to POSIX
This commit is contained in:
Pratik Tripathy
2024-02-06 23:17:01 +05:30
parent 5fa524dd1d
commit 6b2d076cdc
10 changed files with 146 additions and 2636 deletions

View File

@@ -8,7 +8,7 @@
"extensions.ignoreRecommendations": true,
// Editor
"editor.fontSize": 20, // Reduces the Activity Bar size
"editor.fontSize": 21, // Reduces the Activity Bar size
"editor.cursorWidth": 4,
"editor.minimap.enabled": false,
"editor.wordWrap": "on",
@@ -208,7 +208,7 @@
"python.jediEnabled": false,
"python.languageServer": "Pylance",
"workbench.iconTheme": "material-icon-theme",
"workbench.colorTheme": "GitHub Dark",
"workbench.colorTheme": "GitHub Dark Dimmed",
// Rust
// "rust.build_on_save": true,

View File

@@ -1,5 +1,11 @@
# vim:fileencoding=utf-8:foldmethod=marker
# TODO:
# - Display current directory on OS title: even when nvim or any other forground app is running
# - Vim keymaps <ctrl>+hjkl to move around splits: https://github.com/knubie/vim-kitty-navigator
# - OR <ctrl+shift>+ <arrow_keys>??? in sync with konsole???
# - <Ctrl+shift> [/] to decrease/increase split size
#: Fonts {{{
#: kitty has very powerful font management. You can configure
@@ -422,10 +428,21 @@ cursor_beam_thickness 1
#: }}}
scrollback_lines 10000
scrollback_pager_history_size 10
scrollback_lines 100000
scrollback_pager_history_size 100000
scrollback_pager nvim -c 'set ft=man'
# Enable kitty scrollback.nvim plugin
allow_remote_control yes
listen_on unix:/tmp/kitty
shell_integration enabled no-sudo no-complete
action_alias kitty_scrollback_nvim kitten /home/pratik/.local/share/nvim/lazy/kitty-scrollback.nvim/python/kitty_scrollback_nvim.py --nvim-args --clean --noplugin -n
map kitty_mod+h kitty_scrollback_nvim
map kitty_mod+g kitty_scrollback_nvim --config ksb_builtin_last_cmd_output
mouse_map kitty_mod+right press ungrabbed combine : mouse_select_command_output : kitty_scrollback_nvim --config ksb_builtin_last_cmd_output
map kitty_mod+f7 show_kitty_env_vars
#: Mouse {{{
# mouse_hide_wait 3.0
@@ -1184,7 +1201,7 @@ map ctrl+shift+o launch --cwd=current --type=tab nvim
#: }}}
tab_title_template "{sup.index}{fmt.fg.red}{bell_symbol}{activity_symbol}{fmt.fg.tab}{title[title.rfind('/')+1:]} : {tab.active_exe}"
tab_title_template "{fmt.fg.red}{bell_symbol}{activity_symbol}{fmt.fg.tab}{title[title.rfind('/')+1:]} : {tab.active_exe}{sup.index}"
#: Color scheme {{{
@@ -1656,15 +1673,6 @@ background_blur 65
update_check_interval 0
# Enable kitty scrollback.nvim plugin
allow_remote_control yes
listen_on unix:/tmp/kitty
shell_integration enabled
action_alias kitty_scrollback_nvim kitten /home/pratik/.local/share/nvim/lazy/kitty-scrollback.nvim/python/kitty_scrollback_nvim.py
map kitty_mod+h kitty_scrollback_nvim
map kitty_mod+g kitty_scrollback_nvim --config ksb_builtin_last_cmd_output
mouse_map kitty_mod+right press ungrabbed combine : mouse_select_command_output : kitty_scrollback_nvim --config ksb_builtin_last_cmd_output
#: OS specific tweaks {{{
# wayland_titlebar_color system

File diff suppressed because it is too large Load Diff

View File

@@ -1,11 +1,8 @@
#!/bin/sh
# Generic
alias sb="source ~/.bashrc"
alias bashreload="source ~/.bashrc"
alias sz="source ~/.zshrc"
alias zshreload="source ~/.zshrc"
alias zshrc="${EDITOR} ~/.zshrc"
alias free="free -ht"
alias type="type -a"
alias grep='grep --color=auto'
@@ -16,7 +13,7 @@ alias untar='tar -zxvf '
alias wget="wget --hsts-file ${WGET_HSTS_FILE}"
alias v="${EDITOR}"
alias snvim="${HOMEBREW_PREFIX}"/bin/nvim # Stable nvim
alias snvim="${HOMEBREW_PREFIX}/bin/nvim" # Stable nvim
url_encode(){
python3 -c "import urllib.parse, sys; print(urllib.parse.quote(sys.stdin.read()))" <<< "$1"
@@ -35,7 +32,6 @@ alias ..="cd .."
alias ...='cd ../../../' # Go back 3 directory levels
alias cd_root='cd $(git rev-parse --show-toplevel 2>/dev/null || echo ".")'
alias cd_git_root=cd_root
alias c=clear
alias cl=clear
alias lsc='ls --color=auto --hyperlink=auto'
alias ll='lsc -alhF'
@@ -49,7 +45,6 @@ mkcd () {
cd "$1" || exit
}
# Network
alias ping="ping -c 10"
alias ping8="ping 8.8.8.8"
@@ -57,18 +52,17 @@ alias ping1="ping 1.1.1.1"
alias p8="ping8"
alias p1="ping1"
alias pubip="curl https://ipinfo.io/ip; echo"
alias speedtest="speedtest-cli --secure" # needs speedtest-cli installed
alias speedtest="speedtest-cli --secure"
geoip () {
curl -s https://ipinfo.io | sed '/readme/d;/loc/d;/postal/d;s/org/ISP/' | tr -d {},\" | awk -F ':' 'NF {printf ("%10s: %.25s \n", $1, $2)}'
curl -s https://ipinfo.io | sed '/readme\|loc\|postal\|{\|}\|hostname/d;s/org/ISP/;s/"\|,$//g' | awk -F ':' 'NF { printf("%10s: %s \n", $1, $2)}'
}
# Git
# To use this - Ensure all git server SSH are in ~/.ssh
alias git_signin='(for i in ~/.ssh/{*github*,*gitea*}; do ssh-add -k $i; done; ) && (echo; echo Identities added successfully)'
git_push_all_changes(){
git add . && git commit -am "${1}" && git push
}
alias git_just_push=git_push_all_changes
alias ta="tmux a"
@@ -83,11 +77,24 @@ alias OldConfig="NVIM_APPNAME=oldconfig nvim"
nvims() {
items=$(find -L "$HOME"/.config -maxdepth 2 -name "init.lua" -type f -execdir sh -c 'pwd | xargs basename' \;)
config=$(printf "%s\n" "${items[@]}" | fzf --prompt=" Neovim Config  " --height=~50% --layout=reverse --border --exit-0)
if [[ -z $config ]]; then
if [ -z "$config" ]; then
echo "Nothing selected"
return 0
elif [[ $config == "default" ]]; then
elif [ "$config" = "default" ]; then
config=""
fi
NVIM_APPNAME=$config nvim $@
NVIM_APPNAME=$config nvim "$@"
}
op() {
local chosen_project
chosen_project="$(find -L ~/Code -mindepth 2 -maxdepth 2 -not -path '*/.*' -printf "%T@ %p\n" | sort -nr | cut -d ' ' -f 2- | fzf --border --layout=reverse --height=~50% --prompt='Select a project: ' --preview 'ls -Lltc {1}')"
if [ -z "$chosen_project" ]; then
return 0
fi
cd "$chosen_project" || return
nvim
}
# TODO: Create fuzzy finder for cht.sh & tldr