More changes
I have the worst commits
This commit is contained in:
parent
2f3d51b4be
commit
b4259aa2a2
7 changed files with 140 additions and 203 deletions
|
@ -1,36 +1,32 @@
|
||||||
font_family Iosevka
|
font_family Iosevka
|
||||||
|
font_size 11.0
|
||||||
|
|
||||||
allow_remote_control yes
|
allow_remote_control yes
|
||||||
repaint_delay 5
|
repaint_delay 5
|
||||||
input_delay 1
|
input_delay 5
|
||||||
sync_to_monitor yes
|
sync_to_monitor yes
|
||||||
|
|
||||||
disable_ligatures always
|
disable_ligatures always
|
||||||
# font_features Iosevka Fixed SS07 Medium -liga -dlig -calt
|
|
||||||
|
|
||||||
font_size 11.0
|
|
||||||
adjust_line_height 0
|
adjust_line_height 0
|
||||||
window_padding_width 10.0
|
window_padding_width 10.0
|
||||||
window_margin_width 0.0
|
window_margin_width 0.0
|
||||||
|
|
||||||
clear_all_shortcuts yes
|
|
||||||
|
|
||||||
map ctrl+shift+equal change_font_size all +0.5
|
map ctrl+shift+equal change_font_size all +0.5
|
||||||
map ctrl+shift+minus change_font_size all -0.5
|
map ctrl+shift+minus change_font_size all -0.5
|
||||||
map shift+insert paste_from_clipboard
|
map shift+insert paste_from_clipboard
|
||||||
map ctrl+shift+v paste_from_selection
|
map ctrl+shift+v paste_from_selection
|
||||||
|
|
||||||
enable_audio_bell yes
|
enable_audio_bell no
|
||||||
|
visual_bell_duration 1.0
|
||||||
|
|
||||||
url_style curly
|
url_style single
|
||||||
|
|
||||||
strip_trailing_spaces smart
|
strip_trailing_spaces smart
|
||||||
|
|
||||||
kitty_mod ctrl+shift+alt
|
kitty_mod ctrl+shift+alt
|
||||||
open_url_modifiers ctrl
|
open_url_modifiers ctrl
|
||||||
|
|
||||||
# TODO: generate via color scheme generator
|
|
||||||
|
|
||||||
background #111111
|
background #111111
|
||||||
foreground #f8f8f2
|
foreground #f8f8f2
|
||||||
|
|
||||||
|
|
|
@ -94,6 +94,9 @@ command! W write
|
||||||
inoremap jj <Esc>
|
inoremap jj <Esc>
|
||||||
inoremap jk <Esc>
|
inoremap jk <Esc>
|
||||||
|
|
||||||
|
nnoremap <C-q> :qa<CR>
|
||||||
|
inoremap <C-q> <Esc><C-q>
|
||||||
|
|
||||||
nnoremap <C-p> :GitFiles<CR>
|
nnoremap <C-p> :GitFiles<CR>
|
||||||
nnoremap <C-o> :Files<CR>
|
nnoremap <C-o> :Files<CR>
|
||||||
nnoremap <C-u> :GFiles?<CR>
|
nnoremap <C-u> :GFiles?<CR>
|
||||||
|
|
|
@ -1,70 +1,8 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
# Description: Terminal based file previewer
|
SPLIT="$SPLIT"
|
||||||
#
|
TERMINAL="$TERMINAL"
|
||||||
# Note: This plugin needs a "NNN_FIFO" to work. See man.
|
|
||||||
#
|
|
||||||
# Dependencies:
|
|
||||||
# - Supports 3 independent methods to preview with:
|
|
||||||
# - tmux (>=3.0), or
|
|
||||||
# - kitty with allow_remote_control on, or
|
|
||||||
# - $TERMINAL set to a terminal (it's xterm by default).
|
|
||||||
# - less or $PAGER
|
|
||||||
# - tree or exa or ls
|
|
||||||
# - mediainfo or file
|
|
||||||
# - mktemp
|
|
||||||
# - unzip
|
|
||||||
# - tar
|
|
||||||
# - man
|
|
||||||
# - optional: bat for code syntax highlighting
|
|
||||||
# - optional: kitty terminal or catimg for images
|
|
||||||
# - optional: scope.sh file viewer from ranger.
|
|
||||||
# To use:
|
|
||||||
# 1. drop scope.sh executable in $PATH
|
|
||||||
# 2. set/export $USE_SCOPE as 1
|
|
||||||
# - optional: pistol file viewer (https://github.com/doronbehar/pistol).
|
|
||||||
# To use:
|
|
||||||
# 1. install pistol
|
|
||||||
# 2. set/export $USE_PISTOL as 1
|
|
||||||
#
|
|
||||||
# Usage:
|
|
||||||
# You need to set a NNN_FIFO path and a key for the plugin with NNN_PLUG,
|
|
||||||
# then start `nnn`:
|
|
||||||
#
|
|
||||||
# $ nnn -a
|
|
||||||
#
|
|
||||||
# or
|
|
||||||
#
|
|
||||||
# $ NNN_FIFO=/tmp/nnn.fifo nnn
|
|
||||||
#
|
|
||||||
# Then in `nnn`, launch the `preview-tui` plugin.
|
|
||||||
#
|
|
||||||
# If you provide the same NNN_FIFO to all nnn instances, there will be a
|
|
||||||
# single common preview window. If you provide different FIFO path (e.g.
|
|
||||||
# with -a), they will be independent.
|
|
||||||
#
|
|
||||||
# The previews will be shown in a tmux split. If that isn't possible, it
|
|
||||||
# will try to use a kitty terminal split. And as a final fallback, a
|
|
||||||
# different terminal window will be used ($TERMINAL).
|
|
||||||
#
|
|
||||||
# Tmux and kitty users can configure $SPLIT to either "h" or "v" to set a
|
|
||||||
# 'h'orizontal split or a 'v'ertical split (as in, the line that splits the
|
|
||||||
# windows will be horizontal or vertical).
|
|
||||||
#
|
|
||||||
# Kitty users need `allow_remote_control` set to `yes`. To customize the
|
|
||||||
# window split, `enabled_layouts` has to be set to `all` or `splits` (the
|
|
||||||
# former is the default value). This terminal is also able to show images
|
|
||||||
# without extra dependencies.
|
|
||||||
#
|
|
||||||
# Shell: POSIX compliant
|
|
||||||
# Authors: Todd Yamakawa, Léo Villeveygoux, @Recidiviste, Mario Ortiz Manero
|
|
||||||
|
|
||||||
SPLIT="$SPLIT" # you can set a permanent split here
|
|
||||||
TERMINAL="$TERMINAL" # same goes for the terminal
|
|
||||||
USE_SCOPE="${USE_SCOPE:-0}"
|
USE_SCOPE="${USE_SCOPE:-0}"
|
||||||
USE_PISTOL="${USE_PISTOL:-0}"
|
|
||||||
PAGER="${PAGER:-less -R}"
|
|
||||||
[ "$PAGER" = "most" ] && PAGER="less -R"
|
|
||||||
|
|
||||||
if [ -e "${TMUX%%,*}" ] && tmux -V | grep -q '[ -][3456789]\.'; then
|
if [ -e "${TMUX%%,*}" ] && tmux -V | grep -q '[ -][3456789]\.'; then
|
||||||
TERMINAL=tmux
|
TERMINAL=tmux
|
||||||
|
@ -85,30 +23,24 @@ exists() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fifo_pager() {
|
fifo_pager() {
|
||||||
cmd="$1"
|
cmd="$1"; shift
|
||||||
shift
|
|
||||||
|
|
||||||
# We use a FIFO to access $PAGER PID in jobs control
|
|
||||||
tmpfifopath="${TMPDIR:-/tmp}/nnn-preview-tui-fifo.$$"
|
tmpfifopath="${TMPDIR:-/tmp}/nnn-preview-tui-fifo.$$"
|
||||||
mkfifo "$tmpfifopath" || return
|
mkfifo "$tmpfifopath" || return
|
||||||
|
|
||||||
$PAGER < "$tmpfifopath" &
|
$PAGER < "$tmpfifopath" &
|
||||||
|
|
||||||
(
|
(
|
||||||
exec > "$tmpfifopath"
|
exec > "$tmpfifopath"
|
||||||
"$cmd" "$@" &
|
"$cmd" "$@" &
|
||||||
)
|
)
|
||||||
|
|
||||||
rm "$tmpfifopath"
|
rm "$tmpfifopath"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Binary file: show file info inside the pager
|
|
||||||
print_bin_info() {
|
print_bin_info() {
|
||||||
printf -- "-------- \033[1;31mBinary file\033[0m --------\n"
|
printf -- "-------- \033[1;31mBinary file\033[0m --------\n"
|
||||||
if exists mediainfo; then
|
if exists mediainfo; then
|
||||||
mediainfo "$1" 2>/dev/null
|
mediainfo "$1" 2>/dev/null
|
||||||
else
|
else
|
||||||
file -b "$1"
|
file -b "$1"
|
||||||
|
# TODO: hexyl?
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,17 +49,10 @@ preview_file () {
|
||||||
clear
|
clear
|
||||||
|
|
||||||
# Trying to use pistol if it's available.
|
# Trying to use pistol if it's available.
|
||||||
if [ "$USE_PISTOL" -ne 0 ] && exists pistol; then
|
# if [ "$USE_PISTOL" -ne 0 ] && exists pistol; then
|
||||||
fifo_pager pistol "$1"
|
# fifo_pager pistol "$1"
|
||||||
return
|
# return
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
# Trying to use scope.sh if it's available.
|
|
||||||
if [ "$USE_SCOPE" -ne 0 ] && exists scope.sh; then
|
|
||||||
fifo_pager scope.sh "$1" "$cols" "$lines" "$(mktemp -d)" \
|
|
||||||
"True" 2>/dev/null
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Detecting the exact type of the file: the encoding, mime type, and
|
# Detecting the exact type of the file: the encoding, mime type, and
|
||||||
# extension in lowercase.
|
# extension in lowercase.
|
||||||
|
@ -154,8 +79,7 @@ preview_file () {
|
||||||
if [ "${mimetype%%/*}" = "image" ] ; then
|
if [ "${mimetype%%/*}" = "image" ] ; then
|
||||||
if [ "$TERMINAL" = "kitty" ]; then
|
if [ "$TERMINAL" = "kitty" ]; then
|
||||||
# Kitty terminal users can use the native image preview method.
|
# Kitty terminal users can use the native image preview method.
|
||||||
kitty +kitten icat --silent --transfer-mode=stream --stdin=no \
|
kitty +kitten icat --silent --transfer-mode=stream --stdin=no "$1" &
|
||||||
"$1" &
|
|
||||||
elif exists catimg; then
|
elif exists catimg; then
|
||||||
catimg "$1"
|
catimg "$1"
|
||||||
elif exists viu; then
|
elif exists viu; then
|
||||||
|
@ -193,11 +117,13 @@ if [ "$PREVIEW_MODE" ] ; then
|
||||||
|
|
||||||
# use cat instead of 'exec <' to avoid issues with dash shell
|
# use cat instead of 'exec <' to avoid issues with dash shell
|
||||||
# shellcheck disable=SC2002
|
# shellcheck disable=SC2002
|
||||||
cat "$NNN_FIFO" |\
|
cat "$NNN_FIFO" | \
|
||||||
while read -r selection ; do
|
while read -r selection ; do
|
||||||
preview_file "$selection"
|
preview_file "$selection"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# TODO: detect if file is opened and close preview until back in nnn
|
||||||
|
|
||||||
# Restoring the previous layout for kitty users. This will only work for
|
# Restoring the previous layout for kitty users. This will only work for
|
||||||
# kitty >= 0.18.0.
|
# kitty >= 0.18.0.
|
||||||
if [ "$TERMINAL" = "kitty" ]; then
|
if [ "$TERMINAL" = "kitty" ]; then
|
||||||
|
@ -210,7 +136,6 @@ fi
|
||||||
if [ "$TERMINAL" = "tmux" ]; then
|
if [ "$TERMINAL" = "tmux" ]; then
|
||||||
# tmux splits are inverted
|
# tmux splits are inverted
|
||||||
if [ "$SPLIT" = "v" ]; then SPLIT="h"; else SPLIT="v"; fi
|
if [ "$SPLIT" = "v" ]; then SPLIT="h"; else SPLIT="v"; fi
|
||||||
|
|
||||||
tmux split-window -e "NNN_FIFO=$NNN_FIFO" -e "PREVIEW_MODE=1" -d"$SPLIT" "$0" "$1"
|
tmux split-window -e "NNN_FIFO=$NNN_FIFO" -e "PREVIEW_MODE=1" -d"$SPLIT" "$0" "$1"
|
||||||
elif [ "$TERMINAL" = "kitty" ]; then
|
elif [ "$TERMINAL" = "kitty" ]; then
|
||||||
# Setting the layout for the new window. It will be restored after the
|
# Setting the layout for the new window. It will be restored after the
|
||||||
|
|
|
@ -13,10 +13,15 @@ alias la 'll -A' # show all
|
||||||
# TODO: cat > bat
|
# TODO: cat > bat
|
||||||
alias tree 'tree -Csuh'
|
alias tree 'tree -Csuh'
|
||||||
alias f fzf
|
alias f fzf
|
||||||
alias r 'nnn -P p'
|
|
||||||
alias t "tmux"
|
alias t "tmux"
|
||||||
alias rcp 'rsync -r -ah --progress'
|
alias rcp 'rsync -r -ah --progress'
|
||||||
|
|
||||||
|
function r --wraps nnn --description 'support nnn quit and change directory'
|
||||||
|
set NNN_TMPFILE "$XDG_CONFIG_HOME/nnn/.lastd"
|
||||||
|
nnn -P p $argv
|
||||||
|
test -e $NNN_TMPFILE && source $NNN_TMPFILE && rm $NNN_TMPFILE
|
||||||
|
end
|
||||||
|
|
||||||
alias vltl "$EDITOR (ltl)"
|
alias vltl "$EDITOR (ltl)"
|
||||||
alias cdltl "cd (ltld)"
|
alias cdltl "cd (ltld)"
|
||||||
|
|
||||||
|
@ -119,4 +124,5 @@ alias grep "rg"
|
||||||
|
|
||||||
alias vim nvim
|
alias vim nvim
|
||||||
alias vi nvim
|
alias vi nvim
|
||||||
|
alias v nvim
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ set -Ux ERL_AFLAGS "-kernel shell_history enabled -kernel shell_history_file_byt
|
||||||
set -Ux LESS "-r"
|
set -Ux LESS "-r"
|
||||||
set -Ux LS_COLORS 'ow=01;36;40' # more sane ls colors
|
set -Ux LS_COLORS 'ow=01;36;40' # more sane ls colors
|
||||||
set -Ux EDITOR nvim
|
set -Ux EDITOR nvim
|
||||||
set -Ux VISUAL less
|
set -Ux VISUAL nvim
|
||||||
set -Ux PAGER less
|
set -Ux PAGER less
|
||||||
set -Ux MANPAGER 'env MANWIDTH="" nvim --cmd "let g:prosession_on_startup=0" +Man!'
|
set -Ux MANPAGER 'env MANWIDTH="" nvim --cmd "let g:prosession_on_startup=0" +Man!'
|
||||||
|
|
||||||
|
@ -28,7 +28,10 @@ has_command fd && set -Ux FZF_DEFAULT_COMMAND 'fd --type f --hidden --follow --e
|
||||||
|
|
||||||
test -f ~/.fzf/shell/key-bindings.fish && source ~/.fzf/shell/key-bindings.fish
|
test -f ~/.fzf/shell/key-bindings.fish && source ~/.fzf/shell/key-bindings.fish
|
||||||
|
|
||||||
function fish_greeting; date; end
|
function fish_greeting;
|
||||||
|
set_color -b black brblack
|
||||||
|
printf "%s@%s %s\n" $USER (hostname) (date)
|
||||||
|
end
|
||||||
|
|
||||||
# we assume the user uses "$HOME" to just store their mess of dotfiles and other
|
# we assume the user uses "$HOME" to just store their mess of dotfiles and other
|
||||||
# nonsense that clutters it up and that they have a preferred starting
|
# nonsense that clutters it up and that they have a preferred starting
|
||||||
|
@ -61,5 +64,8 @@ function src-hidden-dir
|
||||||
echo "Checking $f..."
|
echo "Checking $f..."
|
||||||
test -f $f && source $f
|
test -f $f && source $f
|
||||||
end
|
end
|
||||||
|
test -d $ENV_PATH/.hidden/fish.d && \
|
||||||
|
complete --command src-hidden-dir -a \
|
||||||
|
"(pushd $NICE_HOME && fd . $ENV_PATH/.hidden/fish.d/ --max-depth 1 --min-depth 1 -x ls -p && popd)"
|
||||||
|
|
||||||
mkdir -p $NOTES_PATH $USER_LOGS_PATH $SCROTS_PATH
|
mkdir -p $NOTES_PATH $USER_LOGS_PATH $SCROTS_PATH
|
||||||
|
|
|
@ -59,6 +59,7 @@ yay -Sy \
|
||||||
openssl `# Crypto` \
|
openssl `# Crypto` \
|
||||||
asdf-vm `# Runtime Version Manager` \
|
asdf-vm `# Runtime Version Manager` \
|
||||||
python python-pip `# Python 3 Language` \
|
python python-pip `# Python 3 Language` \
|
||||||
|
hexyl `# CLI Hex Viewer` \
|
||||||
pass `# Password Management` \
|
pass `# Password Management` \
|
||||||
firefox-developer-edition `# Default Web Browser` \
|
firefox-developer-edition `# Default Web Browser` \
|
||||||
rsync `# File Transfer` \
|
rsync `# File Transfer` \
|
||||||
|
|
Reference in a new issue