diff --git a/home-test/.config/fish/functions/fish_prompt.fish b/home-test/.config/fish/functions/fish_prompt.fish new file mode 100644 index 0000000..b4b4cf8 --- /dev/null +++ b/home-test/.config/fish/functions/fish_prompt.fish @@ -0,0 +1,139 @@ +# based on https://github.com/oh-my-fish/theme-eden/blob/master/LICENSE + +function _git_branch_name + echo (command git symbolic-ref HEAD 2> /dev/null | sed -e 's|^refs/heads/||') +end + +function _is_git_dirty + set resStr (timeout 0.2s git status -s --ignore-submodules=dirty 2> /dev/null) + set res $status + if [ $res = 0 ] + if [ "$resStr" = "" ] + echo "clean" + else + echo "dirty" + end + else if [ $res = 124 ] + echo "?" + else + echo "dirty" + end +end + +## Function to show a segment +function _prompt_segment -d "Function to show a segment" + # Get colors + set -l bg $argv[1] + set -l fg $argv[2] + + # Set 'em + set_color -b $bg + set_color $fg + + # Print text + if [ -n "$argv[3]" ] + echo -n -s $argv[3] + end + +# Reset + set_color -b normal + set_color normal + + # Print padding + if [ (count $argv) = 4 ] + echo -n -s $argv[4] + end +end + +function show_ssh_status -d "Function to show the ssh tag" + if test "$THEME_EDEN_HIDE_SSH_TAG" != 'yes' + if [ -n "$SSH_CLIENT" ] + if [ (id -u) = "0" ] + _prompt_segment red white "-SSH-" ' ' + else + _prompt_segment blue white "-SSH-" ' ' + end + end + end +end + +function show_host -d "Show host & user name" + if [ (id -u) = "0" ] + echo -n (set_color red) + else + echo -n (set_color blue) + end + echo -n "$USER@"(hostname|cut -d . -f 1)' ' (set color normal) +end + +function show_cwd -d "Function to show the current working directory" + if test "$theme_short_path" != 'yes' -a (prompt_pwd) != '~' -a (prompt_pwd) != '/' + set -l cwd (dirname (prompt_pwd)) + test $cwd != '/'; and set cwd $cwd'/' + _prompt_segment normal cyan $cwd + end + set_color -o cyan + echo -n (basename (prompt_pwd))' ' + set_color normal +end + +function show_git_info -d "Show git branch and dirty state" + if [ (_git_branch_name) ] + set -l git_branch '['(_git_branch_name)']' + + set_color -o + echo -ne " " + set dirty (_is_git_dirty) + switch "$dirty" + case "clean" + set_color -o green + echo -ne "$git_branch " + case "dirty" + set_color -o red + echo -ne "$git_branch× " + case '*' + set_color -o yellow + echo -ne "$git_branch? " + end + set_color normal + end +end + +function show_times + if test $CMD_DURATION -ge 500 + if test $CMD_DURATION -ge 60000 + set -l duration_minutes (math "floor($CMD_DURATION / 60000)") + set -l duration_seconds (math "round(($CMD_DURATION % 60000) / 1000)") + printf "%02d:%02d " $duration_minutes $duration_seconds + else if test $CMD_DURATION -ge 1000 + set -l duration_seconds (math "round($CMD_DURATION / 1000)") + echo -ns "$duration_seconds""s " + else + echo -ns "$CMD_DURATION""ms " + end + end + # Output the current time + echo -ne (date "+%H:%M:%S") +end + +function show_prompt_char -d "Terminate with a nice prompt char" + echo "" + echo -n -s $normal '» ' +end + +function fish_prompt + set -l code $status + # use tput to move cursor to line start + echo -ne (tput cr) + + show_ssh_status + show_host + show_cwd + show_git_info + show_times + + if test $code != 0 + echo -ns (set_color red) '[' $code ']' + end + show_prompt_char +end diff --git a/home-test/.config/fish/functions/fish_right_prompt.fish b/home-test/.config/fish/functions/fish_right_prompt.fish new file mode 100644 index 0000000..b9473a4 --- /dev/null +++ b/home-test/.config/fish/functions/fish_right_prompt.fish @@ -0,0 +1,37 @@ +function fish_right_prompt + return + + # Last command status + set -l code $status + + # https://github.com/fish-shell/fish-shell/issues/3476#issuecomment-256058730 + # Save the cursor position, move it up one line, and move it to the right two spaces + tput sc; tput cuf 2 + + #if test $code != 0 + # echo -ns (set_color red) '-' $code '- ' + #end + + set_color $fish_color_autosuggestion 2> /dev/null; or set_color 555 + + # Output the duration of the last command + if test $CMD_DURATION -ge 500 + if test $CMD_DURATION -ge 60000 + set -l duration_minutes (math "floor($CMD_DURATION / 60000)") + set -l duration_seconds (math "round(($CMD_DURATION % 60000) / 1000)") + printf "%02d:%02d " $duration_minutes $duration_seconds + else if test $CMD_DURATION -ge 1000 + set -l duration_seconds (math "round($CMD_DURATION / 1000)") + echo "$duration_seconds""s " + else + echo "$CMD_DURATION""ms " + end + end + + # Output the current time + echo (date "+%H:%M:%S") + + # Restores the cursor position + tput rc + +end diff --git a/home/.config/fish/config.fish b/home/.config/fish/config.fish index 56ca284..837d038 100644 --- a/home/.config/fish/config.fish +++ b/home/.config/fish/config.fish @@ -12,7 +12,7 @@ function read_confirm end function fish_greeting - if status is-interactive && ! test -f /encrypt/.exists + if status is-interactive && ! test -f /encrypt/.exists && test -f ~/encrypted.vhdx if test -f /tmp/.skip-encrypt echo "Encrypted drive not installed" return @@ -42,7 +42,7 @@ if test -x ~/.rbenv/bin/rbenv ~/.rbenv/bin/rbenv init - fish | source end if test -f ~/.opam/opam-init/init.fish - source /home/r3vdy-2-b10vv/.opam/opam-init/init.fish + source ~/.opam/opam-init/init.fish end alias clear="printf '\033[2J\033[3J\033[1;1H'" export PATH="$PATH:$HOME/.bin:$HOME/.local/bin" diff --git a/home/.config/kitty/kitty.conf b/home/.config/kitty/kitty.conf index 5f334d9..1c69da0 100644 --- a/home/.config/kitty/kitty.conf +++ b/home/.config/kitty/kitty.conf @@ -1,2 +1,19 @@ -include ~/.cache/wal/colors-kitty.conf -font_family FiraCode Nerd Font Mono +font_family Fira Code Nerd Font Mono + +map alt+1 first_window +map alt+2 second_window +map alt+3 third_window +map alt+4 forth_window +map alt+5 fifth_window +map alt+6 sixth_window +map alt+7 seventh_window +map alt+r start_resizing_window + +map alt+enter launch --location=neighbor --cwd=current + +allow_remote_control yes +listen_on unix:/tmp/mykitty + +scrollback_lines 10000 +scrollback_pager nvim +scrollback_pager_history_size 100 diff --git a/home/.config/nvim/init.vim b/home/.config/nvim/init.vim index cfa4567..93a1d96 100644 --- a/home/.config/nvim/init.vim +++ b/home/.config/nvim/init.vim @@ -3,7 +3,9 @@ call plug#begin() Plug 'kyazdani42/nvim-web-devicons' Plug 'romgrk/barbar.nvim' Plug 'jiangmiao/auto-pairs' - Plug 'neoclide/coc.nvim', {'branch': 'release'} + if executable('node') + Plug 'neoclide/coc.nvim', {'branch': 'release'} + endif Plug 'spinks/vim-leader-guide' Plug 'feline-nvim/feline.nvim' Plug 'folke/tokyonight.nvim', { 'branch': 'main' } diff --git a/set-symlinks.sh b/set-symlinks.sh index 4022d85..d172fa8 100755 --- a/set-symlinks.sh +++ b/set-symlinks.sh @@ -6,4 +6,4 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) cd "$SCRIPT_DIR" -stow --target "$HOME" --dir "$SCRIPT_DIR" home +stow --no-folding --target "$HOME" --dir "$SCRIPT_DIR" home