mirror of
https://github.com/XNM1/linux-nixos-hyprland-config-dotfiles.git
synced 2025-09-15 09:45:58 +03:00
Compare commits
13 Commits
ff45ab768d
...
main
Author | SHA1 | Date | |
---|---|---|---|
![]() |
426bad68f2 | ||
![]() |
47f66398b6 | ||
![]() |
7a4c582b85 | ||
![]() |
4845b84fc5 | ||
![]() |
6940f6d195 | ||
![]() |
76f078cd17 | ||
![]() |
4556f66ab2 | ||
![]() |
c4f4b80836 | ||
![]() |
9eb89bb59f | ||
![]() |
82aebc8cff | ||
![]() |
a6caf5ef5e | ||
![]() |
26fa7f462c | ||
![]() |
f79aad1630 |
158
home/.config/crush/crush.json
Normal file
158
home/.config/crush/crush.json
Normal file
@@ -0,0 +1,158 @@
|
||||
{
|
||||
"$schema": "https://charm.land/crush.json",
|
||||
"lsp": {
|
||||
"typescript": {
|
||||
"command": "typescript-language-server",
|
||||
"args": [
|
||||
"--stdio"
|
||||
]
|
||||
},
|
||||
"javascript": {
|
||||
"command": "typescript-language-server",
|
||||
"args": [
|
||||
"--stdio"
|
||||
]
|
||||
},
|
||||
"rust": {
|
||||
"command": "rust-analyzer"
|
||||
},
|
||||
"nix": {
|
||||
"command": "nil"
|
||||
}
|
||||
},
|
||||
"mcp": {
|
||||
"context7": {
|
||||
"type": "stdio",
|
||||
"command": "npx",
|
||||
"args": [
|
||||
"-y",
|
||||
"@upstash/context7-mcp"
|
||||
]
|
||||
},
|
||||
"playwright": {
|
||||
"type": "stdio",
|
||||
"command": "npx",
|
||||
"args": [
|
||||
"-y",
|
||||
"@playwright/mcp"
|
||||
]
|
||||
},
|
||||
"shadcn": {
|
||||
"type": "stdio",
|
||||
"command": "npx",
|
||||
"args": [
|
||||
"@heilgar/shadcn-ui-mcp-server"
|
||||
]
|
||||
},
|
||||
"searxng": {
|
||||
"type": "stdio",
|
||||
"command": "npx",
|
||||
"args": [
|
||||
"-y",
|
||||
"mcp-searxng"
|
||||
],
|
||||
"env": {
|
||||
"SEARXNG_URL": "http://127.0.0.1:7777"
|
||||
}
|
||||
},
|
||||
"git": {
|
||||
"type": "stdio",
|
||||
"command": "uvx",
|
||||
"args": [
|
||||
"--python",
|
||||
"/run/current-system/sw/bin/python",
|
||||
"mcp-server-git"
|
||||
]
|
||||
},
|
||||
"docker": {
|
||||
"type": "stdio",
|
||||
"command": "uvx",
|
||||
"args": [
|
||||
"--python",
|
||||
"/run/current-system/sw/bin/python",
|
||||
"docker-mcp"
|
||||
]
|
||||
},
|
||||
"time": {
|
||||
"type": "stdio",
|
||||
"command": "uvx",
|
||||
"args": [
|
||||
"--python",
|
||||
"/run/current-system/sw/bin/python",
|
||||
"mcp-server-time"
|
||||
]
|
||||
},
|
||||
"sequential-thinking": {
|
||||
"type": "stdio",
|
||||
"command": "npx",
|
||||
"args": [
|
||||
"-y",
|
||||
"@modelcontextprotocol/server-sequential-thinking"
|
||||
]
|
||||
},
|
||||
"nixos": {
|
||||
"type": "stdio",
|
||||
"command": "uvx",
|
||||
"args": [
|
||||
"--python",
|
||||
"/run/current-system/sw/bin/python",
|
||||
"mcp-nixos"
|
||||
]
|
||||
},
|
||||
"k8s": {
|
||||
"type": "stdio",
|
||||
"command": "npx",
|
||||
"args": [
|
||||
"@strowk/mcp-k8s"
|
||||
]
|
||||
},
|
||||
"filesystem": {
|
||||
"type": "stdio",
|
||||
"command": "npx",
|
||||
"args": [
|
||||
"-y",
|
||||
"@modelcontextprotocol/server-filesystem",
|
||||
"/home/xnm"
|
||||
]
|
||||
},
|
||||
"n8n": {
|
||||
"type": "stdio",
|
||||
"command": "npx",
|
||||
"args": [
|
||||
"n8n-mcp"
|
||||
],
|
||||
"env": {
|
||||
"MCP_MODE": "stdio",
|
||||
"LOG_LEVEL": "error",
|
||||
"DISABLE_CONSOLE_OUTPUT": "true",
|
||||
"N8N_API_URL": "http://localhost:5678",
|
||||
"N8N_API_KEY": "your-api-key"
|
||||
}
|
||||
},
|
||||
"coolify": {
|
||||
"type": "stdio",
|
||||
"command": "npx",
|
||||
"args": [
|
||||
"-y",
|
||||
"@masonator/coolify-mcp"
|
||||
],
|
||||
"env": {
|
||||
"COOLIFY_ACCESS_TOKEN": "0|your-secret-token",
|
||||
"COOLIFY_BASE_URL": "http://localhost:8000"
|
||||
}
|
||||
},
|
||||
"appwrite": {
|
||||
"type": "stdio",
|
||||
"command": "uvx",
|
||||
"args": [
|
||||
"mcp-server-appwrite",
|
||||
"--all"
|
||||
],
|
||||
"env": {
|
||||
"APPWRITE_PROJECT_ID": "your-project-id",
|
||||
"APPWRITE_API_KEY": "your-api-key",
|
||||
"APPWRITE_ENDPOINT": "http://localhost:8088/v1"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -39,6 +39,7 @@ set -gx VOLUME_STEP 5
|
||||
set -gx BRIGHTNESS_STEP 5
|
||||
|
||||
set -gx PATH $HOME/.cargo/bin $PATH
|
||||
set -gx PATH $HOME/.npm-packages/bin $PATH
|
||||
|
||||
set fish_vi_force_cursor
|
||||
set fish_cursor_default block
|
||||
|
@@ -1,5 +1,5 @@
|
||||
function check_night_mode
|
||||
set target_process wlsunset
|
||||
set target_process hyprsunset
|
||||
|
||||
if pgrep $target_process >/dev/null
|
||||
echo "{ \"text\":\"\", \"tooltip\": \"night-mode <span color='#a6da95'>on</span>\", \"class\": \"on\" }"
|
||||
|
@@ -2,6 +2,6 @@ function clipboard_to_wlcopy
|
||||
set clip $(cliphist list | rofi -dmenu -p 'clipboard copy')
|
||||
if not [ -z $clip ]
|
||||
echo $clip | cliphist decode | wl-copy
|
||||
dunstify "Clipboard" "Clip '$clip' was copied" -t 2000
|
||||
dunstify Clipboard "Clip '$clip' was copied" -t 2000
|
||||
end
|
||||
end
|
28
home/.config/fish/functions/fish_bind_count.fish
Normal file
28
home/.config/fish/functions/fish_bind_count.fish
Normal file
@@ -0,0 +1,28 @@
|
||||
function fish_bind_count
|
||||
argparse 'h/help' 'z/zero' 'r/read' -- $argv
|
||||
or return 1
|
||||
if test -n "$_flag_help"
|
||||
echo "Helper function to track count modifier with modal key bindings"
|
||||
echo "Usage: $0 [-h] [-z] [DIGITS ...]"
|
||||
return
|
||||
end
|
||||
if test -n "$_flag_zero" || not string match -rq '[1-9]\d*' "$fish_bind_count"
|
||||
set -g fish_bind_count 0
|
||||
end
|
||||
# Iterate over given digits
|
||||
for arg in $argv
|
||||
for digit in (string split '' "$arg")
|
||||
set -g fish_bind_count $(math "$fish_bind_count" \* 10 \+ "$digit")
|
||||
end
|
||||
end
|
||||
if test -n "$_flag_read"
|
||||
set -l count "$fish_bind_count"
|
||||
set -g fish_bind_count 0
|
||||
if test "$count" = 0
|
||||
echo 1
|
||||
return 1
|
||||
else
|
||||
echo "$count"
|
||||
end
|
||||
end
|
||||
end
|
26
home/.config/fish/functions/fish_default_mode_prompt.fish
Normal file
26
home/.config/fish/functions/fish_default_mode_prompt.fish
Normal file
@@ -0,0 +1,26 @@
|
||||
function fish_default_mode_prompt --description "Display vi/helix prompt mode"
|
||||
# Do nothing if not in vi mode
|
||||
if test "$fish_key_bindings" = fish_vi_key_bindings
|
||||
or test "$fish_key_bindings" = fish_helix_key_bindings
|
||||
or test "$fish_key_bindings" = fish_hybrid_key_bindings
|
||||
switch $fish_bind_mode
|
||||
case default
|
||||
set_color --bold red
|
||||
echo '[N]'
|
||||
case insert
|
||||
set_color --bold green
|
||||
echo '[I]'
|
||||
case replace_one
|
||||
set_color --bold green
|
||||
echo '[R]'
|
||||
case replace
|
||||
set_color --bold cyan
|
||||
echo '[R]'
|
||||
case visual
|
||||
set_color --bold magenta
|
||||
echo '[V]'
|
||||
end
|
||||
set_color normal
|
||||
echo -n ' '
|
||||
end
|
||||
end
|
433
home/.config/fish/functions/fish_helix_command.fish
Normal file
433
home/.config/fish/functions/fish_helix_command.fish
Normal file
@@ -0,0 +1,433 @@
|
||||
# FIXME this can't be called in sequence in general case,
|
||||
# because of unsynchronized `commandline -f` and `commandline -C`
|
||||
|
||||
function fish_helix_command
|
||||
argparse h/help -- $argv
|
||||
or return 1
|
||||
if test -n "$_flag_help"
|
||||
echo "Helper function to handle modal key bindings mostly outside of insert mode"
|
||||
return
|
||||
end
|
||||
|
||||
# TODO only single command allowed really yet,
|
||||
# because `commandline -f` queues actions, while `commandline -C` is immediate
|
||||
for command in $argv
|
||||
set -f count (fish_bind_count -r)
|
||||
set -f count_defined $status
|
||||
|
||||
switch $command
|
||||
case {move,extend}_char_left
|
||||
commandline -C (math max\(0, (commandline -C) - $count\))
|
||||
__fish_helix_extend_by_command $command
|
||||
case {move,extend}_char_right
|
||||
commandline -C (math (commandline -C) + $count)
|
||||
__fish_helix_extend_by_command $command
|
||||
|
||||
case char_up
|
||||
__fish_helix_char_up $fish_bind_mode $count
|
||||
case char_down
|
||||
__fish_helix_char_down $fish_bind_mode $count
|
||||
|
||||
case next_word_start
|
||||
# https://regex101.com/r/KXrl1x/1
|
||||
set -l regex (string join '' \
|
||||
'(?:.?\\n+|' \
|
||||
'[[:alnum:]_](?=[^[:alnum:]_\\s])|' \
|
||||
'[^[:alnum:]_\\s](?=[[:alnum:]_])|' \
|
||||
'[^\\S\\n](?=[\\S\\n])|)' \
|
||||
'((?:[[:alnum:]_]+|[^[:alnum:]_\\s]+|)[^\\S\\n]*)' \
|
||||
)
|
||||
__fish_helix_next_word $fish_bind_mode $count $regex
|
||||
|
||||
case next_long_word_start
|
||||
set -l regex (string join '' \
|
||||
'(?:.?\\n+|' \
|
||||
'[^\\S\\n](?=[\\S\\n])|)' \
|
||||
'(\\S*[^\\S\\n]*)' \
|
||||
)
|
||||
__fish_helix_next_word $fish_bind_mode $count $regex
|
||||
|
||||
case next_word_end
|
||||
# https://regex101.com/r/Gl0KP2/1
|
||||
set -l regex ' (?:
|
||||
.?\\n+ |
|
||||
[[:alnum:]_](?=[^[:alnum:]_]) |
|
||||
[^[:alnum:]_\\s](?=[[:alnum:]_\\s]) | )
|
||||
( [^\\S\\n]*
|
||||
(?: [[:alnum:]_]+ | [^[:alnum:]_\\s]+ | ) ) '
|
||||
__fish_helix_next_word $fish_bind_mode $count $regex
|
||||
|
||||
case next_long_word_end
|
||||
set -l regex ' (?: .?\\n+ | \\S(?=\\s) | )
|
||||
( [^\\S\\n]* \\S* ) '
|
||||
__fish_helix_next_word $fish_bind_mode $count $regex
|
||||
|
||||
case prev_word_start
|
||||
set -l regex ' ( (?:
|
||||
[[:alnum:]_]+ |
|
||||
[^[:alnum:]_\\s]+ | )
|
||||
[^\\S\\n]* )
|
||||
(?: \\n+.? |
|
||||
(?<=[^[:alnum:]_])[[:alnum:]_] |
|
||||
(?<=[[:alnum:]_\\s])[^[:alnum:]_\\s] | ) '
|
||||
__fish_helix_prev_word $fish_bind_mode $count $regex
|
||||
|
||||
case prev_long_word_start
|
||||
set -l regex '
|
||||
( \\S* [^\\S\\n]* )
|
||||
(?: \\n+.? | (?<=\\s)\\S | ) '
|
||||
__fish_helix_prev_word $fish_bind_mode $count $regex
|
||||
|
||||
case till_next_char
|
||||
__fish_helix_find_char $fish_bind_mode $count forward-jump-till forward-char
|
||||
case find_next_char
|
||||
__fish_helix_find_char $fish_bind_mode $count forward-jump
|
||||
case till_prev_char
|
||||
__fish_helix_find_char $fish_bind_mode $count backward-jump-till backward-char
|
||||
case find_prev_char
|
||||
__fish_helix_find_char $fish_bind_mode $count backward-jump
|
||||
|
||||
case till_next_cr
|
||||
__fish_helix_find_next_cr $fish_bind_mode $count 2
|
||||
case find_next_cr
|
||||
__fish_helix_find_next_cr $fish_bind_mode $count 1
|
||||
case till_prev_cr
|
||||
__fish_helix_find_prev_cr $fish_bind_mode $count 1
|
||||
case find_prev_cr
|
||||
__fish_helix_find_prev_cr $fish_bind_mode $count 0
|
||||
|
||||
case goto_line_start
|
||||
commandline -f beginning-of-line
|
||||
__fish_helix_extend_by_mode
|
||||
case goto_line_end
|
||||
__fish_helix_goto_line_end
|
||||
__fish_helix_extend_by_mode
|
||||
case goto_first_nonwhitespace
|
||||
__fish_helix_goto_first_nonwhitespace
|
||||
__fish_helix_extend_by_mode
|
||||
|
||||
case goto_file_start
|
||||
__fish_helix_goto_line $count
|
||||
case goto_line
|
||||
if test "$count_defined" = 0 # if true
|
||||
__fish_helix_goto_line $count
|
||||
end
|
||||
case goto_last_line
|
||||
commandline -f end-of-buffer beginning-of-line
|
||||
__fish_helix_extend_by_mode
|
||||
|
||||
case insert_mode
|
||||
set fish_bind_mode insert
|
||||
commandline -f end-selection repaint-mode
|
||||
|
||||
case append_mode
|
||||
commandline -C (commandline -E)
|
||||
set fish_bind_mode insert
|
||||
commandline -f end-selection repaint-mode
|
||||
|
||||
case prepend_to_line
|
||||
__fish_helix_goto_first_nonwhitespace
|
||||
set fish_bind_mode insert
|
||||
commandline -f end-selection repaint-mode
|
||||
|
||||
case append_to_line
|
||||
set fish_bind_mode insert
|
||||
commandline -f end-selection end-of-line repaint-mode
|
||||
|
||||
case delete_selection
|
||||
commandline -f kill-selection begin-selection
|
||||
case delete_selection_noyank
|
||||
__fish_helix_delete_selection
|
||||
|
||||
case yank
|
||||
__fish_helix_yank
|
||||
case paste_before
|
||||
__fish_helix_paste_before "commandline -f yank"
|
||||
case paste_after
|
||||
__fish_helix_paste_after "commandline -f yank"
|
||||
case replace_selection
|
||||
__fish_helix_replace_selection "$fish_killring[1]" true
|
||||
|
||||
case paste_before_clip
|
||||
__fish_helix_paste_before fish_clipboard_paste
|
||||
case paste_after_clip
|
||||
__fish_helix_paste_after fish_clipboard_paste --clip
|
||||
case replace_selection_clip
|
||||
__fish_helix_replace_selection "" fish_clipboard_paste --clip
|
||||
|
||||
case select_all
|
||||
commandline -f beginning-of-buffer begin-selection end-of-buffer end-of-line backward-char
|
||||
|
||||
case select_line
|
||||
commandline -f beginning-of-line begin-selection end-of-line
|
||||
|
||||
case '*'
|
||||
echo "[fish-helix]" Unknown command $command >&2
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function __fish_helix_extend_by_command -a piece
|
||||
if not string match -qr extend_ $piece
|
||||
commandline -f begin-selection
|
||||
end
|
||||
end
|
||||
|
||||
function __fish_helix_extend_by_mode
|
||||
if test $fish_bind_mode = default
|
||||
commandline -f begin-selection
|
||||
end
|
||||
end
|
||||
|
||||
function __fish_helix_find_char -a mode count fish_cmdline till
|
||||
# FIXME don't reset selection if N/A
|
||||
if test $mode = default
|
||||
commandline -f begin-selection
|
||||
end
|
||||
commandline -f $till $fish_cmdline
|
||||
for i in (seq 2 $count)
|
||||
commandline -f $till repeat-jump
|
||||
end
|
||||
end
|
||||
|
||||
function __fish_helix_find_next_cr -a mode count skip
|
||||
set -l cursor (commandline -C)
|
||||
commandline | # Include endling newline intentionally
|
||||
# Skip until cursor:
|
||||
sed -z 's/^.\{'(math $cursor + $skip)'\}\(.*\)$/\\1/' |
|
||||
# Count characters up to the target newline:
|
||||
sed -z 's/^\(\([^\\n]*\\n\)\{0,'$count'\}\).*/\\1/' |
|
||||
read -zl chars
|
||||
|
||||
if test $mode = default -a -n "$chars"
|
||||
commandline -f begin-selection
|
||||
end
|
||||
for i in (seq 1 (string length -- "$chars"))
|
||||
commandline -f forward-char
|
||||
end
|
||||
end
|
||||
|
||||
function __fish_helix_find_prev_cr -a mode count skip
|
||||
set -l cursor (commandline -C)
|
||||
commandline --cut-at-cursor |
|
||||
sed -z 's/.\{'$skip'\}\n$//' |
|
||||
read -zl buffer
|
||||
|
||||
echo -n $buffer |
|
||||
# Drop characters up to the target newline:
|
||||
sed -z 's/\(\(\\n[^\\n]*\)\{0,'$count'\}\)$//' |
|
||||
read -zl chars
|
||||
set -l n_chars (math (string length -- "$buffer") - (string length -- "$chars"))
|
||||
|
||||
if test $mode = default -a $n_chars != 0
|
||||
commandline -f begin-selection
|
||||
end
|
||||
for i in (seq 1 $n_chars)
|
||||
commandline -f backward-char
|
||||
end
|
||||
end
|
||||
|
||||
function __fish_helix_goto_line_end
|
||||
# check if we are on an empty line first
|
||||
commandline | sed -n (commandline -L)'!b;/^$/q;q5' && return
|
||||
commandline -f end-of-line backward-char
|
||||
end
|
||||
|
||||
function __fish_helix_goto_first_nonwhitespace
|
||||
# check if we are on whitespace line first
|
||||
commandline | sed -n (commandline -L)'!b;/^\\s*$/q;q5' && return
|
||||
commandline -f beginning-of-line forward-bigword backward-bigword
|
||||
end
|
||||
|
||||
function __fish_helix_goto_line -a number
|
||||
set -l lines (math min\($number, (commandline | wc -l)\))
|
||||
commandline -f beginning-of-buffer
|
||||
for i in (seq 2 $lines)
|
||||
commandline -f down-line
|
||||
end
|
||||
__fish_helix_extend_by_mode
|
||||
end
|
||||
|
||||
function __fish_helix_char_up -a mode count
|
||||
if commandline --paging-mode && not commandline --search-mode
|
||||
for i in (seq 1 $count)
|
||||
commandline -f up-line
|
||||
end
|
||||
return
|
||||
end
|
||||
set -l line (commandline -L)
|
||||
if commandline --search-mode || test $line = 1
|
||||
for i in (seq 1 (math min \($count, (count $history)\)))
|
||||
commandline -f history-search-backward
|
||||
end
|
||||
return
|
||||
end
|
||||
set -l count (math min\($count, $line-1\))
|
||||
for i in (seq 1 $count)
|
||||
commandline -f up-line
|
||||
end
|
||||
__fish_helix_extend_by_mode
|
||||
end
|
||||
|
||||
function __fish_helix_char_down -a mode count
|
||||
if commandline --paging-mode && not commandline --search-mode
|
||||
for i in (seq 1 $count)
|
||||
commandline -f down-line
|
||||
end
|
||||
return
|
||||
end
|
||||
set -l line (commandline -L)
|
||||
set -l total (count (commandline))
|
||||
if commandline --search-mode || test $line = $total
|
||||
for i in (seq 1 (math min \($count, (count $history)\)))
|
||||
commandline -f history-search-forward
|
||||
end
|
||||
return
|
||||
end
|
||||
set -l count (math min\($count, $total - $line\))
|
||||
for i in (seq 1 $count)
|
||||
commandline -f down-line
|
||||
end
|
||||
__fish_helix_extend_by_mode
|
||||
end
|
||||
|
||||
function __fish_helix_next_word -a mode count regex
|
||||
set -f cursor (commandline -C)
|
||||
commandline |
|
||||
perl -e '
|
||||
use open qw(:std :utf8);
|
||||
do { local $/; substr <>, '$cursor' } =~ m/(?:'$regex'){0,'$count'}/ux;
|
||||
print $-[1], " ", $+[1];' |
|
||||
read -f left right
|
||||
test "$left" = "$right" && return
|
||||
if test $mode = default
|
||||
commandline -C (math $cursor + $left)
|
||||
commandline -f begin-selection
|
||||
for i in (seq $left (math $right - 2))
|
||||
commandline -f forward-char
|
||||
end
|
||||
else
|
||||
commandline -C (math $cursor + $right - 1)
|
||||
end
|
||||
end
|
||||
|
||||
function __fish_helix_prev_word -a mode count regex
|
||||
set -f left (math (commandline -C) + 1)
|
||||
set -f updated 0
|
||||
for i in (seq 1 $count)
|
||||
commandline |
|
||||
perl -e '
|
||||
use open qw(:std :utf8);
|
||||
do { local $/; substr <>, 0, '$left' } =~ /(?:'$regex')$/ux;
|
||||
print $-[1], " ", $+[1];' |
|
||||
read -l l r
|
||||
test "$l" = "$r" -o "$l" = 0 -a "$r" = 1 && break
|
||||
set -f left $l
|
||||
set -f right $r
|
||||
set -f updated 1
|
||||
end
|
||||
test $updated -eq 0; and return
|
||||
if test $mode = default
|
||||
commandline -C (math $right - 1)
|
||||
commandline -f begin-selection
|
||||
for i in (seq $left (math $right - 2))
|
||||
commandline -f backward-char
|
||||
end
|
||||
else
|
||||
commandline -C (math $left)
|
||||
end
|
||||
end
|
||||
|
||||
function __fish_helix_delete_selection
|
||||
set start (commandline -B)
|
||||
set end (commandline -E)
|
||||
commandline |
|
||||
sed -zE 's/^(.{'$start'})(.{0,'(math $end - $start)'})(.*)\\n$/\\1\\3/' |
|
||||
read -l result
|
||||
|
||||
commandline "$result"
|
||||
commandline -C $start
|
||||
commandline -f begin-selection
|
||||
end
|
||||
|
||||
function __fish_helix_yank
|
||||
set -l end (commandline -E)
|
||||
set -l cursor (commandline -C)
|
||||
commandline -f kill-selection yank backward-char
|
||||
|
||||
for i in (seq $cursor (math $end - 2))
|
||||
commandline -f backward-char
|
||||
end
|
||||
end
|
||||
|
||||
function __fish_helix_paste_before -a cmd_paste
|
||||
set -l cmd_paste $(string split " " $cmd_paste)
|
||||
set -l cursor (commandline -C)
|
||||
set -l start (commandline -B)
|
||||
set -l end (commandline -E)
|
||||
commandline -C $start
|
||||
$cmd_paste
|
||||
commandline -f begin-selection
|
||||
for i in (seq $start (math $end - 2))
|
||||
commandline -f forward-char
|
||||
end
|
||||
if test $cursor = $start
|
||||
commandline -f swap-selection-start-stop
|
||||
end
|
||||
end
|
||||
|
||||
function __fish_helix_paste_after -a cmd_paste
|
||||
set -l cmd_paste $(string split " " $cmd_paste)
|
||||
set -l cursor (commandline -C)
|
||||
set -l start (commandline -B)
|
||||
set -l end (commandline -E)
|
||||
commandline -C $end
|
||||
$cmd_paste
|
||||
|
||||
if test "$argv[2]" = --clip
|
||||
commandline -C (math $end - 1)
|
||||
else
|
||||
for i in (seq 0 (string length "$fish_killring[1]"))
|
||||
commandline -f backward-char
|
||||
end
|
||||
end
|
||||
commandline -f begin-selection
|
||||
for i in (seq $start (math $end - 2))
|
||||
commandline -f backward-char
|
||||
end
|
||||
if test $cursor != $start
|
||||
commandline -f swap-selection-start-stop
|
||||
end
|
||||
end
|
||||
|
||||
function __fish_helix_replace_selection -a replacement cmd_paste
|
||||
set -l cmd_paste $(string split " " $cmd_paste)
|
||||
set cursor (commandline -C)
|
||||
set start (commandline -B)
|
||||
set end (commandline -E)
|
||||
commandline |
|
||||
sed -zE 's/^(.{'$start'})(.{0,'(math $end - $start)'})(.*)\\n$/\\1'"$(string escape --style=regex "$replacement")"'\\3/' |
|
||||
read -l result
|
||||
|
||||
commandline "$result"
|
||||
commandline -C $start
|
||||
$cmd_paste
|
||||
|
||||
if test "$argv[3]" = --clip
|
||||
commandline -f backward-char begin-selection
|
||||
for i in (seq (math $start + 2) (commandline -C))
|
||||
commandline -f backward-char
|
||||
end
|
||||
if test $cursor != $start
|
||||
commandline -f swap-selection-start-stop
|
||||
end
|
||||
else
|
||||
commandline -f begin-selection
|
||||
for i in (seq 2 (string length "$replacement"))
|
||||
commandline -f forward-char
|
||||
end
|
||||
if test $cursor = $start
|
||||
commandline -f swap-selection-start-stop
|
||||
end
|
||||
end
|
||||
end
|
291
home/.config/fish/functions/fish_helix_key_bindings.fish
Normal file
291
home/.config/fish/functions/fish_helix_key_bindings.fish
Normal file
@@ -0,0 +1,291 @@
|
||||
# IMPORTANT!!!
|
||||
#
|
||||
# When defining your own bindings using fish_helix_command, be aware that it can break
|
||||
# stuff sometimes.
|
||||
#
|
||||
# It is safe to define a binding consisting of a lone call to fish_helix_command.
|
||||
# Calls to other functions and executables are allowed along with it, granted they don't mess
|
||||
# with fish's commandline buffer.
|
||||
#
|
||||
# Mixing multiple fish_helix_commandline and commandline calls in one binding MAY trigger issues.
|
||||
# Nothing serious, but don't be surprised. Just test it.
|
||||
|
||||
function fish_helix_key_bindings --description 'helix-like key bindings for fish'
|
||||
if contains -- -h $argv
|
||||
or contains -- --help $argv
|
||||
echo "Sorry but this function doesn't support -h or --help"
|
||||
return 1
|
||||
end
|
||||
|
||||
# Erase all bindings if not explicitly requested otherwise to
|
||||
# allow for hybrid bindings.
|
||||
# This needs to be checked here because if we are called again
|
||||
# via the variable handler the argument will be gone.
|
||||
set -l rebind true
|
||||
if test "$argv[1]" = --no-erase
|
||||
set rebind false
|
||||
set -e argv[1]
|
||||
else
|
||||
bind --erase --all --preset # clear earlier bindings, if any
|
||||
end
|
||||
|
||||
# Allow just calling this function to correctly set the bindings.
|
||||
# Because it's a rather discoverable name, users will execute it
|
||||
# and without this would then have subtly broken bindings.
|
||||
if test "$fish_key_bindings" != fish_helix_key_bindings
|
||||
and test "$rebind" = true
|
||||
# Allow the user to set the variable universally.
|
||||
set -q fish_key_bindings
|
||||
or set -g fish_key_bindings
|
||||
# This triggers the handler, which calls us again and ensures the user_key_bindings
|
||||
# are executed.
|
||||
set fish_key_bindings fish_helix_key_bindings
|
||||
return
|
||||
end
|
||||
|
||||
set -l init_mode insert
|
||||
|
||||
if contains -- $argv[1] insert default visual
|
||||
set init_mode $argv[1]
|
||||
else if set -q argv[1]
|
||||
# We should still go on so the bindings still get set.
|
||||
echo "Unknown argument $argv" >&2
|
||||
end
|
||||
|
||||
# Inherit shared key bindings.
|
||||
# Do this first so helix-bindings win over default.
|
||||
for mode in insert default visual
|
||||
__fish_shared_key_bindings -s -M $mode
|
||||
end
|
||||
|
||||
bind -s --preset -M insert \r execute
|
||||
bind -s --preset -M insert \n execute
|
||||
|
||||
bind -s --preset -M insert "" self-insert
|
||||
|
||||
# Space and other command terminators expand abbrs _and_ inserts itself.
|
||||
bind -s --preset -M insert " " self-insert expand-abbr
|
||||
bind -s --preset -M insert ";" self-insert expand-abbr
|
||||
bind -s --preset -M insert "|" self-insert expand-abbr
|
||||
bind -s --preset -M insert "&" self-insert expand-abbr
|
||||
bind -s --preset -M insert "^" self-insert expand-abbr
|
||||
bind -s --preset -M insert ">" self-insert expand-abbr
|
||||
bind -s --preset -M insert "<" self-insert expand-abbr
|
||||
# Closing a command substitution expands abbreviations
|
||||
bind -s --preset -M insert ")" self-insert expand-abbr
|
||||
# Ctrl-space inserts space without expanding abbrs
|
||||
bind -s --preset -M insert -k nul 'commandline -i " "'
|
||||
|
||||
# Switching to insert mode
|
||||
for mode in default visual
|
||||
bind -s --preset -M $mode -m insert \cc end-selection cancel-commandline repaint-mode
|
||||
bind -s --preset -M $mode -m insert \n end-selection execute
|
||||
bind -s --preset -M $mode -m insert \r end-selection execute
|
||||
bind -s --preset -M $mode -m insert o end-selection insert-line-under repaint-mode
|
||||
bind -s --preset -M $mode -m insert O end-selection insert-line-over repaint-mode
|
||||
# FIXME i/a should keep selection, maybe
|
||||
bind -s --preset -M $mode i "fish_helix_command insert_mode"
|
||||
bind -s --preset -M $mode I "fish_helix_command prepend_to_line"
|
||||
bind -s --preset -M $mode a "fish_helix_command append_mode"
|
||||
bind -s --preset -M $mode A "fish_helix_command append_to_line"
|
||||
end
|
||||
|
||||
# Switching from insert mode
|
||||
# Note if we are paging, we want to stay in insert mode
|
||||
# See #2871
|
||||
bind -s --preset -M insert \e "if commandline -P; commandline -f cancel; else; set fish_bind_mode default; commandline -f begin-selection repaint-mode; end"
|
||||
|
||||
# Switching between normal and visual mode
|
||||
bind -s --preset -M default -m visual v repaint-mode
|
||||
for key in v \e
|
||||
bind -s --preset -M visual -m default $key repaint-mode
|
||||
end
|
||||
|
||||
# Motion and actions in normal/select mode
|
||||
for mode in default visual
|
||||
if test $mode = default
|
||||
set -f n_begin_selection begin-selection # only begin-selection if current mode is Normal
|
||||
set -f ns_move_extend move
|
||||
set -f commandline_v_repaint ""
|
||||
else
|
||||
set -f n_begin_selection
|
||||
set -f ns_move_extend extend
|
||||
set -f commandline_v_repaint "commandline -f repaint-mode"
|
||||
end
|
||||
|
||||
for key in (seq 0 9)
|
||||
bind -s --preset -M $mode $key "fish_bind_count $key"
|
||||
# FIXME example to bind 0
|
||||
# FIXME backspace to edit count
|
||||
end
|
||||
for key in h \e\[D \eOD "-k left"
|
||||
bind -s --preset -M $mode $key "fish_helix_command "$ns_move_extend"_char_left"
|
||||
end
|
||||
for key in l \e\[C \eOC "-k right"
|
||||
bind -s --preset -M $mode $key "fish_helix_command "$ns_move_extend"_char_right"
|
||||
end
|
||||
for key in k \e\[A \eOA "-k up"
|
||||
bind -s --preset -M $mode $key "fish_helix_command char_up"
|
||||
end
|
||||
for key in j \e\[B \eOB "-k down"
|
||||
bind -s --preset -M $mode $key "fish_helix_command char_down"
|
||||
end
|
||||
|
||||
bind -s --preset -M $mode w "fish_helix_command next_word_start"
|
||||
bind -s --preset -M $mode b "fish_helix_command prev_word_start"
|
||||
bind -s --preset -M $mode e "fish_helix_command next_word_end"
|
||||
bind -s --preset -M $mode W "fish_helix_command next_long_word_start"
|
||||
bind -s --preset -M $mode B "fish_helix_command prev_long_word_start"
|
||||
bind -s --preset -M $mode E "fish_helix_command next_long_word_end"
|
||||
|
||||
bind -s --preset -M $mode t "fish_helix_command till_next_char"
|
||||
bind -s --preset -M $mode f "fish_helix_command find_next_char"
|
||||
bind -s --preset -M $mode T "fish_helix_command till_prev_char"
|
||||
bind -s --preset -M $mode F "fish_helix_command find_prev_char"
|
||||
|
||||
bind -s --preset -M $mode t\e ""
|
||||
bind -s --preset -M $mode f\e ""
|
||||
bind -s --preset -M $mode T\e ""
|
||||
bind -s --preset -M $mode F\e ""
|
||||
|
||||
for enter in \r \n
|
||||
bind -s --preset -M $mode t$enter "fish_helix_command till_next_cr"
|
||||
bind -s --preset -M $mode f$enter "fish_helix_command find_next_cr"
|
||||
bind -s --preset -M $mode T$enter "fish_helix_command till_prev_cr"
|
||||
bind -s --preset -M $mode F$enter "fish_helix_command find_prev_cr"
|
||||
end
|
||||
|
||||
for key in gh \e\[H \eOH "-k home"
|
||||
bind -s --preset -M $mode $key "fish_helix_command goto_line_start"
|
||||
end
|
||||
for key in gl \e\[F \eOF "-k end"
|
||||
bind -s --preset -M $mode $key "fish_helix_command goto_line_end"
|
||||
end
|
||||
bind -s --preset -M $mode gs "fish_helix_command goto_first_nonwhitespace"
|
||||
bind -s --preset -M $mode gg "fish_helix_command goto_file_start"
|
||||
bind -s --preset -M $mode G "fish_helix_command goto_line"
|
||||
bind -s --preset -M $mode ge "fish_helix_command goto_last_line"
|
||||
|
||||
# FIXME alt-. doesn't work with t/T
|
||||
# FIXME alt-. doesn't work with [ftFT][\n\r]
|
||||
bind -s --preset -M $mode \e. repeat-jump
|
||||
|
||||
# FIXME reselect after undo/redo
|
||||
bind -s --preset -M $mode u undo begin-selection
|
||||
bind -s --preset -M $mode U redo begin-selection
|
||||
|
||||
bind -s --preset -M $mode -m replace_one r repaint-mode
|
||||
|
||||
# FIXME registers
|
||||
# bind -s --preset -M $mode y fish_clipboard_copy
|
||||
# bind -s --preset -M $mode P fish_clipboard_paste
|
||||
# bind -s --preset -M $mode R kill-selection begin-selection yank-pop yank
|
||||
|
||||
bind -s --preset -M $mode -m default d "fish_helix_command delete_selection; $commandline_v_repaint"
|
||||
bind -s --preset -M $mode -m default \ed "fish_helix_command delete_selection_noyank; $commandline_v_repaint"
|
||||
bind -s --preset -M $mode -m insert c "fish_helix_command delete_selection; commandline -f end-selection repaint-mode"
|
||||
bind -s --preset -M $mode -m insert \ec "fish_helix_command delete_selection_noyank; commandline -f end-selection repaint-mode"
|
||||
|
||||
bind -s --preset -M $mode -m default y "fish_helix_command yank"
|
||||
bind -s --preset -M $mode p "fish_helix_command paste_after"
|
||||
bind -s --preset -M $mode P "fish_helix_command paste_before"
|
||||
bind -s --preset -M $mode R "fish_helix_command replace_selection"
|
||||
|
||||
bind -s --preset -M $mode -m default " y" "fish_clipboard_copy; $commandline_v_repaint"
|
||||
bind -s --preset -M $mode " p" "fish_helix_command paste_after_clip"
|
||||
bind -s --preset -M $mode " P" "fish_helix_command paste_before_clip"
|
||||
bind -s --preset -M $mode " R" "fish_helix_command replace_selection_clip"
|
||||
|
||||
# FIXME keep selection
|
||||
bind -s --preset -M $mode ~ togglecase-selection
|
||||
# FIXME ` and \e`
|
||||
|
||||
# FIXME .
|
||||
# FIXME < and >
|
||||
# FIXME =
|
||||
|
||||
# FIXME \ca \cx
|
||||
# FIXME Qq
|
||||
|
||||
## Shell
|
||||
# FIXME
|
||||
|
||||
## Selection manipulation
|
||||
# FIXME & _
|
||||
|
||||
bind -s --preset -M $mode \; begin-selection
|
||||
bind -s --preset -M $mode \e\; swap-selection-start-stop
|
||||
# FIXME \e:
|
||||
|
||||
bind -s --preset -M $mode % "fish_helix_command select_all"
|
||||
|
||||
bind -s --preset -M $mode x "fish_helix_command select_line"
|
||||
|
||||
# FIXME x X \ex
|
||||
# FIXME J
|
||||
# FIXME \cc
|
||||
|
||||
## Search
|
||||
# FIXME
|
||||
|
||||
## FIXME minor modes: g, m, space
|
||||
|
||||
## FIXME [ and ] motions
|
||||
end
|
||||
|
||||
# FIXME should replace the whole selection
|
||||
# FIXME should be able to go back to visual mode
|
||||
bind -s --preset -M replace_one -m default '' delete-char self-insert backward-char repaint-mode
|
||||
bind -s --preset -M replace_one -m default \r 'commandline -f delete-char; commandline -i \n; commandline -f backward-char; commandline -f repaint-mode'
|
||||
bind -s --preset -M replace_one -m default \e cancel repaint-mode
|
||||
|
||||
## FIXME Insert mode keys
|
||||
|
||||
## Old config from vi:
|
||||
|
||||
# Vi moves the cursor back if, after deleting, it is at EOL.
|
||||
# To emulate that, move forward, then backward, which will be a NOP
|
||||
# if there is something to move forward to.
|
||||
bind -s --preset -M insert -k dc delete-char forward-single-char backward-char
|
||||
bind -s --preset -M default -k dc delete-char forward-single-char backward-char
|
||||
|
||||
# Backspace deletes a char in insert mode, but not in normal/default mode.
|
||||
bind -s --preset -M insert -k backspace backward-delete-char
|
||||
bind -s --preset -M default -k backspace backward-char
|
||||
bind -s --preset -M insert \ch backward-delete-char
|
||||
bind -s --preset -M default \ch backward-char
|
||||
bind -s --preset -M insert \x7f backward-delete-char
|
||||
bind -s --preset -M default \x7f backward-char
|
||||
bind -s --preset -M insert -k sdc backward-delete-char # shifted delete
|
||||
bind -s --preset -M default -k sdc backward-delete-char # shifted delete
|
||||
|
||||
# bind -s --preset '~' togglecase-char forward-single-char
|
||||
# bind -s --preset gu downcase-word
|
||||
# bind -s --preset gU upcase-word
|
||||
#
|
||||
# bind -s --preset J end-of-line delete-char
|
||||
# bind -s --preset K 'man (commandline -t) 2>/dev/null; or echo -n \a'
|
||||
#
|
||||
|
||||
# same vim 'pasting' note as upper
|
||||
bind -s --preset '"*p' forward-char "commandline -i ( xsel -p; echo )[1]"
|
||||
bind -s --preset '"*P' "commandline -i ( xsel -p; echo )[1]"
|
||||
|
||||
#
|
||||
# visual mode
|
||||
#
|
||||
|
||||
# bind -s --preset -M visual -m insert c kill-selection end-selection repaint-mode
|
||||
# bind -s --preset -M visual -m insert s kill-selection end-selection repaint-mode
|
||||
bind -s --preset -M visual -m default '"*y' "fish_clipboard_copy; commandline -f end-selection repaint-mode"
|
||||
bind -s --preset -M visual -m default '~' togglecase-selection end-selection repaint-mode
|
||||
|
||||
# Set the cursor shape
|
||||
# After executing once, this will have defined functions listening for the variable.
|
||||
# Therefore it needs to be before setting fish_bind_mode.
|
||||
fish_vi_cursor
|
||||
set -g fish_cursor_selection_mode inclusive
|
||||
|
||||
set fish_bind_mode $init_mode
|
||||
|
||||
end
|
@@ -1,4 +1,6 @@
|
||||
function fish_user_key_bindings
|
||||
fzf_key_bindings
|
||||
|
||||
# Execute this once per mode that emacs bindings should be used in
|
||||
fish_default_key_bindings -M insert
|
||||
|
||||
@@ -6,7 +8,7 @@ function fish_user_key_bindings
|
||||
# Without --no-erase fish_vi_key_bindings will default to
|
||||
# resetting all bindings.
|
||||
# The argument specifies the initial mode (insert, "default" or visual).
|
||||
fish_vi_key_bindings --no-erase insert
|
||||
fish_helix_key_bindings --no-erase insert
|
||||
|
||||
# Nullify fzf default keybindings
|
||||
bind \cT '' -M insert
|
||||
|
231
home/.config/fish/functions/fzf_key_bindings.fish
Normal file
231
home/.config/fish/functions/fzf_key_bindings.fish
Normal file
@@ -0,0 +1,231 @@
|
||||
### key-bindings.fish ###
|
||||
# ____ ____
|
||||
# / __/___ / __/
|
||||
# / /_/_ / / /_
|
||||
# / __/ / /_/ __/
|
||||
# /_/ /___/_/ key-bindings.fish
|
||||
#
|
||||
# - $FZF_TMUX_OPTS
|
||||
# - $FZF_CTRL_T_COMMAND
|
||||
# - $FZF_CTRL_T_OPTS
|
||||
# - $FZF_CTRL_R_OPTS
|
||||
# - $FZF_ALT_C_COMMAND
|
||||
# - $FZF_ALT_C_OPTS
|
||||
|
||||
# Key bindings
|
||||
# ------------
|
||||
# The oldest supported fish version is 3.1b1. To maintain compatibility, the
|
||||
# command substitution syntax $(cmd) should never be used, even behind a version
|
||||
# check, otherwise the source command will fail on fish versions older than 3.4.0.
|
||||
function fzf_key_bindings
|
||||
|
||||
# Check fish version
|
||||
set -l fish_ver (string match -r '^(\d+).(\d+)' $version 2> /dev/null; or echo 0\n0\n0)
|
||||
if test \( "$fish_ver[2]" -lt 3 \) -o \( "$fish_ver[2]" -eq 3 -a "$fish_ver[3]" -lt 1 \)
|
||||
echo "This script requires fish version 3.1b1 or newer." >&2
|
||||
return 1
|
||||
else if not type -q fzf
|
||||
echo "fzf was not found in path." >&2
|
||||
return 1
|
||||
end
|
||||
|
||||
function __fzf_defaults
|
||||
# $argv[1]: Prepend to FZF_DEFAULT_OPTS_FILE and FZF_DEFAULT_OPTS
|
||||
# $argv[2..]: Append to FZF_DEFAULT_OPTS_FILE and FZF_DEFAULT_OPTS
|
||||
test -n "$FZF_TMUX_HEIGHT"; or set -l FZF_TMUX_HEIGHT 40%
|
||||
string join ' ' -- \
|
||||
"--height $FZF_TMUX_HEIGHT --min-height=20+ --bind=ctrl-z:ignore" $argv[1] \
|
||||
(test -r "$FZF_DEFAULT_OPTS_FILE"; and string join -- ' ' <$FZF_DEFAULT_OPTS_FILE) \
|
||||
$FZF_DEFAULT_OPTS $argv[2..-1]
|
||||
end
|
||||
|
||||
function __fzfcmd
|
||||
test -n "$FZF_TMUX_HEIGHT"; or set -l FZF_TMUX_HEIGHT 40%
|
||||
if test -n "$FZF_TMUX_OPTS"
|
||||
echo "fzf-tmux $FZF_TMUX_OPTS -- "
|
||||
else if test "$FZF_TMUX" = 1
|
||||
echo "fzf-tmux -d$FZF_TMUX_HEIGHT -- "
|
||||
else
|
||||
echo fzf
|
||||
end
|
||||
end
|
||||
|
||||
function __fzf_parse_commandline -d 'Parse the current command line token and return split of existing filepath, fzf query, and optional -option= prefix'
|
||||
set -l fzf_query ''
|
||||
set -l prefix ''
|
||||
set -l dir '.'
|
||||
|
||||
# Set variables containing the major and minor fish version numbers, using
|
||||
# a method compatible with all supported fish versions.
|
||||
set -l -- fish_major (string match -r -- '^\d+' $version)
|
||||
set -l -- fish_minor (string match -r -- '^\d+\.(\d+)' $version)[2]
|
||||
|
||||
# fish v3.3.0 and newer: Don't use option prefix if " -- " is preceded.
|
||||
set -l -- match_regex '(?<fzf_query>[\s\S]*?(?=\n?$)$)'
|
||||
set -l -- prefix_regex '^-[^\s=]+=|^-(?!-)\S'
|
||||
if test "$fish_major" -eq 3 -a "$fish_minor" -lt 3
|
||||
or string match -q -v -- '* -- *' (string sub -l (commandline -Cp) -- (commandline -p))
|
||||
set -- match_regex "(?<prefix>$prefix_regex)?$match_regex"
|
||||
end
|
||||
|
||||
# Set $prefix and expanded $fzf_query with preserved trailing newlines.
|
||||
if test "$fish_major" -ge 4
|
||||
# fish v4.0.0 and newer
|
||||
string match -q -r -- $match_regex (commandline --current-token --tokens-expanded | string collect -N)
|
||||
else if test "$fish_major" -eq 3 -a "$fish_minor" -ge 2
|
||||
# fish v3.2.0 - v3.7.1 (last v3)
|
||||
string match -q -r -- $match_regex (commandline --current-token --tokenize | string collect -N)
|
||||
eval set -- fzf_query (string escape -n -- $fzf_query | string replace -r -a '^\\\(?=~)|\\\(?=\$\w)' '')
|
||||
else
|
||||
# fish older than v3.2.0 (v3.1b1 - v3.1.2)
|
||||
set -l -- cl_token (commandline --current-token --tokenize | string collect -N)
|
||||
set -- prefix (string match -r -- $prefix_regex $cl_token)
|
||||
set -- fzf_query (string replace -- "$prefix" '' $cl_token | string collect -N)
|
||||
eval set -- fzf_query (string escape -n -- $fzf_query | string replace -r -a '^\\\(?=~)|\\\(?=\$\w)|\\\n\\\n$' '')
|
||||
end
|
||||
|
||||
if test -n "$fzf_query"
|
||||
# Normalize path in $fzf_query, set $dir to the longest existing directory.
|
||||
if test \( "$fish_major" -ge 4 \) -o \( "$fish_major" -eq 3 -a "$fish_minor" -ge 5 \)
|
||||
# fish v3.5.0 and newer
|
||||
set -- fzf_query (path normalize -- $fzf_query)
|
||||
set -- dir $fzf_query
|
||||
while not path is -d $dir
|
||||
set -- dir (path dirname $dir)
|
||||
end
|
||||
else
|
||||
# fish older than v3.5.0 (v3.1b1 - v3.4.1)
|
||||
if test "$fish_major" -eq 3 -a "$fish_minor" -ge 2
|
||||
# fish v3.2.0 - v3.4.1
|
||||
string match -q -r -- '(?<fzf_query>^[\s\S]*?(?=\n?$)$)' \
|
||||
(string replace -r -a -- '(?<=/)/|(?<!^)/+(?!\n)$' '' $fzf_query | string collect -N)
|
||||
else
|
||||
# fish v3.1b1 - v3.1.2
|
||||
set -- fzf_query (string replace -r -a -- '(?<=/)/|(?<!^)/+(?!\n)$' '' $fzf_query | string collect -N)
|
||||
eval set -- fzf_query (string escape -n -- $fzf_query | string replace -r '\\\n$' '')
|
||||
end
|
||||
set -- dir $fzf_query
|
||||
while not test -d "$dir"
|
||||
set -- dir (dirname -z -- "$dir" | string split0)
|
||||
end
|
||||
end
|
||||
|
||||
if not string match -q -- '.' $dir; or string match -q -r -- '^\./|^\.$' $fzf_query
|
||||
# Strip $dir from $fzf_query - preserve trailing newlines.
|
||||
if test "$fish_major" -ge 4
|
||||
# fish v4.0.0 and newer
|
||||
string match -q -r -- '^'(string escape --style=regex -- $dir)'/?(?<fzf_query>[\s\S]*)' $fzf_query
|
||||
else if test "$fish_major" -eq 3 -a "$fish_minor" -ge 2
|
||||
# fish v3.2.0 - v3.7.1 (last v3)
|
||||
string match -q -r -- '^/?(?<fzf_query>[\s\S]*?(?=\n?$)$)' \
|
||||
(string replace -- "$dir" '' $fzf_query | string collect -N)
|
||||
else
|
||||
# fish older than v3.2.0 (v3.1b1 - v3.1.2)
|
||||
set -- fzf_query (string replace -- "$dir" '' $fzf_query | string collect -N)
|
||||
eval set -- fzf_query (string escape -n -- $fzf_query | string replace -r -a '^/?|\\\n$' '')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
string escape -n -- "$dir" "$fzf_query" "$prefix"
|
||||
end
|
||||
|
||||
# Store current token in $dir as root for the 'find' command
|
||||
function fzf-file-widget -d "List files and folders"
|
||||
set -l commandline (__fzf_parse_commandline)
|
||||
set -lx dir $commandline[1]
|
||||
set -l fzf_query $commandline[2]
|
||||
set -l prefix $commandline[3]
|
||||
|
||||
set -lx FZF_DEFAULT_OPTS (__fzf_defaults \
|
||||
"--reverse --walker=file,dir,follow,hidden --scheme=path" \
|
||||
"$FZF_CTRL_T_OPTS --multi --print0")
|
||||
|
||||
set -lx FZF_DEFAULT_COMMAND "$FZF_CTRL_T_COMMAND"
|
||||
set -lx FZF_DEFAULT_OPTS_FILE
|
||||
|
||||
set -l result (eval (__fzfcmd) --walker-root=$dir --query=$fzf_query | string split0)
|
||||
and commandline -rt -- (string join -- ' ' $prefix(string escape -- $result))' '
|
||||
|
||||
commandline -f repaint
|
||||
end
|
||||
|
||||
function fzf-history-widget -d "Show command history"
|
||||
set -l -- command_line (commandline)
|
||||
set -l -- current_line (commandline -L)
|
||||
set -l -- total_lines (count $command_line)
|
||||
set -l -- fzf_query (string escape -- $command_line[$current_line])
|
||||
|
||||
set -lx FZF_DEFAULT_OPTS (__fzf_defaults '' \
|
||||
'--nth=2..,.. --scheme=history --multi --wrap-sign="\t↳ "' \
|
||||
'--bind=\'shift-delete:execute-silent(eval history delete --exact --case-sensitive -- (string escape -n -- {+} | string replace -r -a "^\d*\\\\\\t|(?<=\\\\\\n)\\\\\\t" ""))+reload(eval $FZF_DEFAULT_COMMAND)\'' \
|
||||
"--bind=ctrl-r:toggle-sort --highlight-line $FZF_CTRL_R_OPTS" \
|
||||
'--accept-nth=2.. --read0 --print0 --with-shell='(status fish-path)\\ -c)
|
||||
|
||||
set -lx FZF_DEFAULT_OPTS_FILE
|
||||
set -lx FZF_DEFAULT_COMMAND
|
||||
|
||||
if type -q perl
|
||||
set -a FZF_DEFAULT_OPTS --tac
|
||||
set FZF_DEFAULT_COMMAND 'builtin history -z --reverse | command perl -0 -pe \'s/^/$.\t/g; s/\n/\n\t/gm\''
|
||||
else
|
||||
set FZF_DEFAULT_COMMAND \
|
||||
'set -l h (builtin history -z --reverse | string split0);' \
|
||||
'for i in (seq (count $h) -1 1);' \
|
||||
'string join0 -- $i\t(string replace -a -- \n \n\t $h[$i] | string collect);' \
|
||||
end
|
||||
end
|
||||
|
||||
# Merge history from other sessions before searching
|
||||
test -z "$fish_private_mode"; and builtin history merge
|
||||
|
||||
if set -l result (eval $FZF_DEFAULT_COMMAND \| (__fzfcmd) --query=$fzf_query | string split0)
|
||||
if test "$total_lines" -eq 1
|
||||
commandline -- (string replace -a -- \n\t \n $result)
|
||||
else
|
||||
set -l a (math $current_line - 1)
|
||||
set -l b (math $current_line + 1)
|
||||
commandline -- $command_line[1..$a] (string replace -a -- \n\t \n $result)
|
||||
commandline -a -- '' $command_line[$b..-1]
|
||||
end
|
||||
end
|
||||
|
||||
commandline -f repaint
|
||||
end
|
||||
|
||||
function fzf-cd-widget -d "Change directory"
|
||||
set -l commandline (__fzf_parse_commandline)
|
||||
set -lx dir $commandline[1]
|
||||
set -l fzf_query $commandline[2]
|
||||
set -l prefix $commandline[3]
|
||||
|
||||
set -lx FZF_DEFAULT_OPTS (__fzf_defaults \
|
||||
"--reverse --walker=dir,follow,hidden --scheme=path" \
|
||||
"$FZF_ALT_C_OPTS --no-multi --print0")
|
||||
|
||||
set -lx FZF_DEFAULT_OPTS_FILE
|
||||
set -lx FZF_DEFAULT_COMMAND "$FZF_ALT_C_COMMAND"
|
||||
|
||||
if set -l result (eval (__fzfcmd) --query=$fzf_query --walker-root=$dir | string split0)
|
||||
cd -- $result
|
||||
commandline -rt -- $prefix
|
||||
end
|
||||
|
||||
commandline -f repaint
|
||||
end
|
||||
|
||||
bind \cr fzf-history-widget
|
||||
bind -M insert \cr fzf-history-widget
|
||||
|
||||
if not set -q FZF_CTRL_T_COMMAND; or test -n "$FZF_CTRL_T_COMMAND"
|
||||
bind \ct fzf-file-widget
|
||||
bind -M insert \ct fzf-file-widget
|
||||
end
|
||||
|
||||
if not set -q FZF_ALT_C_COMMAND; or test -n "$FZF_ALT_C_COMMAND"
|
||||
bind \ec fzf-cd-widget
|
||||
bind -M insert \ec fzf-cd-widget
|
||||
end
|
||||
|
||||
end
|
||||
### end: key-bindings.fish ###
|
27
home/.config/fish/functions/night_mode_temp_down.fish
Normal file
27
home/.config/fish/functions/night_mode_temp_down.fish
Normal file
@@ -0,0 +1,27 @@
|
||||
function night_mode_temp_down
|
||||
set target_process hyprsunset
|
||||
set temp_file ~/.cache/hyprsunset_temp
|
||||
set decrement 100
|
||||
|
||||
if not pgrep $target_process >/dev/null
|
||||
return
|
||||
end
|
||||
|
||||
if test -f $temp_file
|
||||
set current_temp (cat $temp_file)
|
||||
else
|
||||
set current_temp 4000
|
||||
end
|
||||
|
||||
set new_temp (math $current_temp - $decrement)
|
||||
|
||||
if test $new_temp -lt 2000
|
||||
set new_temp 2000
|
||||
end
|
||||
|
||||
echo $new_temp >$temp_file
|
||||
|
||||
killall -s SIGINT $target_process
|
||||
sleep 0.5
|
||||
$target_process -t $new_temp
|
||||
end
|
27
home/.config/fish/functions/night_mode_temp_up.fish
Normal file
27
home/.config/fish/functions/night_mode_temp_up.fish
Normal file
@@ -0,0 +1,27 @@
|
||||
function night_mode_temp_up
|
||||
set target_process hyprsunset
|
||||
set temp_file ~/.cache/hyprsunset_temp
|
||||
set increment 100
|
||||
|
||||
if not pgrep $target_process >/dev/null
|
||||
return
|
||||
end
|
||||
|
||||
if test -f $temp_file
|
||||
set current_temp (cat $temp_file)
|
||||
else
|
||||
set current_temp 4000
|
||||
end
|
||||
|
||||
set new_temp (math $current_temp + $increment)
|
||||
|
||||
if test $new_temp -gt 6500
|
||||
set new_temp 6500
|
||||
end
|
||||
|
||||
echo $new_temp >$temp_file
|
||||
|
||||
killall -s SIGINT $target_process
|
||||
sleep 0.5
|
||||
$target_process -t $new_temp
|
||||
end
|
@@ -1,9 +1,16 @@
|
||||
function night_mode_toggle
|
||||
set target_process wlsunset
|
||||
set target_process hyprsunset
|
||||
set temp_file ~/.cache/hyprsunset_temp
|
||||
|
||||
if pgrep $target_process >/dev/null
|
||||
killall -s SIGINT wlsunset
|
||||
killall -s SIGINT $target_process
|
||||
else
|
||||
wlsunset
|
||||
if test -f $temp_file
|
||||
set temp (cat $temp_file)
|
||||
else
|
||||
set temp 4000
|
||||
echo $temp >$temp_file
|
||||
end
|
||||
$target_process -t $temp
|
||||
end
|
||||
end
|
||||
|
@@ -17,7 +17,7 @@ from kittens.tui.operations import (
|
||||
)
|
||||
from kitty.config import cached_values_for
|
||||
from kitty.key_encoding import EventType
|
||||
from kitty.typing import KeyEventType, ScreenSize
|
||||
from kitty.typing_compat import KeyEventType, ScreenSize
|
||||
|
||||
NON_SPACE_PATTERN = re.compile(r"\S+")
|
||||
SPACE_PATTERN = re.compile(r"\s+")
|
||||
|
@@ -1,3 +1,4 @@
|
||||
gui:
|
||||
theme:
|
||||
activeBorderColor:
|
||||
- '#8bd5ca'
|
||||
|
1
home/.config/posting/config.yaml
Normal file
1
home/.config/posting/config.yaml
Normal file
@@ -0,0 +1 @@
|
||||
theme: "catppuccin-macchiato-teal"
|
@@ -223,7 +223,10 @@
|
||||
|
||||
"custom/night_mode": {
|
||||
"return-type": "json",
|
||||
"interval": 1,
|
||||
"restart-interval": 1,
|
||||
"on-scroll-down": "fish -c night_mode_temp_up",
|
||||
"on-scroll-up": "fish -c night_mode_temp_down",
|
||||
"smooth-scrolling-threshold": 2.0,
|
||||
"exec": "fish -c check_night_mode",
|
||||
"on-click": "fish -c night_mode_toggle",
|
||||
},
|
||||
|
@@ -0,0 +1,38 @@
|
||||
name: "catppuccin-macchiato-mauve"
|
||||
primary: "#c6a0f6" # buttons, fixed table columns
|
||||
secondary: "#c6a0f6" # method selector, some minor labels
|
||||
accent: "#e3cffb" # header text, scrollbars, cursors, focus highlights
|
||||
background: "#24273a" # background colors
|
||||
surface: "#363a4f" # panels, etc
|
||||
error: "#ed8796" # error messages
|
||||
success: "#a6da95" # success messages
|
||||
warning: "#eed49f" # warning messages
|
||||
dark: "true"
|
||||
|
||||
text_area:
|
||||
cursor: "reverse #f4dbd6"
|
||||
cursor_line: "underline #cad3f5"
|
||||
selection: "reverse #939ab7"
|
||||
gutter: "bold #a6da95"
|
||||
matched_bracket: "reverse #b8c0e0"
|
||||
|
||||
url:
|
||||
base: "italic #8aadf4"
|
||||
protocol: "bold #8bd5ca"
|
||||
separator: "#cad3f5"
|
||||
|
||||
syntax:
|
||||
json_key: "italic #8aadf4"
|
||||
json_number: "#f5a97f"
|
||||
json_string: "#a6da95"
|
||||
json_boolean: "#91d7e3"
|
||||
json_null: "#939ab7"
|
||||
|
||||
method:
|
||||
get: "bold #8aadf4"
|
||||
post: "bold #a6da95"
|
||||
put: "bold #eed49f"
|
||||
delete: "bold #ed8796"
|
||||
patch: "bold #8bd5ca"
|
||||
options: "bold #b7bdf8"
|
||||
head: "bold #c6a0f6"
|
@@ -0,0 +1,38 @@
|
||||
name: "catppuccin-macchiato-teal"
|
||||
primary: "#8bd5ca" # buttons, fixed table columns
|
||||
secondary: "#8bd5ca" # method selector, some minor labels
|
||||
accent: "#b1e3db" # header text, scrollbars, cursors, focus highlights
|
||||
background: "#24273a" # background colors
|
||||
surface: "#363a4f" # panels, etc
|
||||
error: "#ed8796" # error messages
|
||||
success: "#a6da95" # success messages
|
||||
warning: "#eed49f" # warning messages
|
||||
dark: "true"
|
||||
|
||||
text_area:
|
||||
cursor: "reverse #f4dbd6"
|
||||
cursor_line: "underline #cad3f5"
|
||||
selection: "reverse #939ab7"
|
||||
gutter: "bold #a6da95"
|
||||
matched_bracket: "reverse #b8c0e0"
|
||||
|
||||
url:
|
||||
base: "italic #8aadf4"
|
||||
protocol: "bold #8bd5ca"
|
||||
separator: "#cad3f5"
|
||||
|
||||
syntax:
|
||||
json_key: "italic #8aadf4"
|
||||
json_number: "#f5a97f"
|
||||
json_string: "#a6da95"
|
||||
json_boolean: "#91d7e3"
|
||||
json_null: "#939ab7"
|
||||
|
||||
method:
|
||||
get: "bold #8aadf4"
|
||||
post: "bold #a6da95"
|
||||
put: "bold #eed49f"
|
||||
delete: "bold #ed8796"
|
||||
patch: "bold #8bd5ca"
|
||||
options: "bold #b7bdf8"
|
||||
head: "bold #c6a0f6"
|
2
home/.npmrc
Normal file
2
home/.npmrc
Normal file
@@ -0,0 +1,2 @@
|
||||
strict-ssl=true
|
||||
prefix = ${HOME}/.npm-packages
|
@@ -5,7 +5,7 @@
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
rust-overlay.url = "github:oxalica/rust-overlay";
|
||||
wezterm.url = "github:wez/wezterm?dir=nix";
|
||||
radicle-tui.url = "git+https://seed.radicle.xyz/z39mP9rQAaGmERfUMPULfPUi473tY.git";
|
||||
radicle-tui.url = "git+https://seed.radicle.xyz/z39mP9rQAaGmERfUMPULfPUi473tY.git?rev=dcc51b96a90d6e63cd69fae7f29e896f13816a1f";
|
||||
};
|
||||
|
||||
outputs = { nixpkgs, ... } @ inputs:
|
||||
|
@@ -19,6 +19,7 @@
|
||||
hyprlock
|
||||
hypridle
|
||||
hyprpaper
|
||||
hyprsunset
|
||||
hyprpolkitagent
|
||||
|
||||
inputs.wezterm.packages.${pkgs.system}.default
|
||||
|
@@ -4,7 +4,6 @@
|
||||
programs.light.enable = true;
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
wlsunset
|
||||
brightnessctl
|
||||
];
|
||||
}
|
||||
|
@@ -9,10 +9,13 @@
|
||||
git
|
||||
lazygit
|
||||
delta
|
||||
sqlx-cli
|
||||
mermaid-cli
|
||||
posting
|
||||
license-generator
|
||||
git-ignore
|
||||
gitleaks
|
||||
git-secrets
|
||||
# git-secrets
|
||||
pass-git-helper
|
||||
jujutsu
|
||||
jjui
|
||||
|
@@ -18,5 +18,7 @@
|
||||
};
|
||||
|
||||
# Change runtime directory size
|
||||
services.logind.extraConfig = "RuntimeDirectorySize=8G";
|
||||
services.logind.settings.Login = {
|
||||
RuntimeDirectorySize="8G";
|
||||
};
|
||||
}
|
||||
|
@@ -14,6 +14,5 @@
|
||||
surrealdb-migrations
|
||||
surrealist
|
||||
trunk
|
||||
sqlx-cli
|
||||
];
|
||||
}
|
||||
|
Reference in New Issue
Block a user