Compare commits
8 Commits
wip
...
94fc8c036c
| Author | SHA1 | Date | |
|---|---|---|---|
| 94fc8c036c | |||
| 84d26c68a5 | |||
| d03dda4979 | |||
| 5464d111d0 | |||
| bd15a7b443 | |||
| 2024651e33 | |||
| ff66a92104 | |||
| 7fef9a8760 |
@@ -7,7 +7,10 @@ mod4 + p
|
||||
|
||||
# terminal
|
||||
mod4 + shift + Return
|
||||
alacritty
|
||||
st
|
||||
|
||||
mod4 + ctrl + shift + Return
|
||||
st-abduco-tabbed
|
||||
|
||||
# screenshot and selection capture
|
||||
{_,mod4 + }@Print
|
||||
@@ -107,4 +110,8 @@ mod4 + ctrl + shift + l
|
||||
mod4 + ctrl + shift + s
|
||||
systemctl suspend
|
||||
|
||||
# toggle light/dark theme
|
||||
mod4 + F6
|
||||
lupan-set-theme toggle
|
||||
|
||||
# vim:ft=sxhkdrc
|
||||
|
||||
281
vis/.config/vis/fzf.sh
Executable file
281
vis/.config/vis/fzf.sh
Executable file
@@ -0,0 +1,281 @@
|
||||
#!/bin/sh
|
||||
|
||||
prompt=${FZF_PROMPT%> }
|
||||
cmd=${prompt%+*}
|
||||
hidden=${prompt#$cmd}
|
||||
|
||||
ripgrep='rg --column --line-number --color=always --smart-case'
|
||||
|
||||
if [ "$1" = list ]; then
|
||||
case "$FZF_HEADER_LABEL" in
|
||||
:?*)
|
||||
dir=${FZF_HEADER_LABEL#?}
|
||||
;;
|
||||
*)
|
||||
dir=
|
||||
;;
|
||||
esac
|
||||
case "$prompt" in
|
||||
dir:*)
|
||||
dir=${FZF_HEADER_LABEL#?}
|
||||
zoxide query -l
|
||||
echo $dir
|
||||
exit
|
||||
;;
|
||||
files)
|
||||
exec fd --type f '' $dir
|
||||
;;
|
||||
files+hidden)
|
||||
exec fd --type f -H '' $dir
|
||||
;;
|
||||
search)
|
||||
exec $ripgrep "$FZF_QUERY" $dir
|
||||
;;
|
||||
search+hidden)
|
||||
exec $ripgrep -. "$FZF_QUERY" $dir
|
||||
;;
|
||||
git-files*)
|
||||
if [ -z "$dir" ]; then
|
||||
exec git ls-files
|
||||
else
|
||||
exec git -C $dir ls-files --format "$dir/%(path)"
|
||||
fi
|
||||
;;
|
||||
git-search*)
|
||||
if [ -z "$dir" ]; then
|
||||
exec git grep --column --line-number --color=always "$FZF_QUERY"
|
||||
else
|
||||
exec git -C $dir grep --column --line-number --color=always "$FZF_QUERY" | sed "s:^:$dir/:"
|
||||
fi
|
||||
;;
|
||||
jj-files*)
|
||||
if [ -z "$dir" ]; then
|
||||
exec jj file list --ignore-working-copy
|
||||
else
|
||||
jj=$(cd $dir && jj root --ignore-working-copy 2> /dev/null)
|
||||
exec jj -R $jj file list --ignore-working-copy $dir
|
||||
fi
|
||||
;;
|
||||
jj-search*)
|
||||
if [ -z "$dir" ]; then
|
||||
exec $ripgrep "$FZF_QUERY" $(jj file list --ignore-working-copy)
|
||||
else
|
||||
jj=$(cd $dir && jj root --ignore-working-copy 2> /dev/null)
|
||||
exec $ripgrep "$FZF_QUERY" $(jj -R $jj file list --ignore-working-copy $dir)
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ "$1" = preview ]; then
|
||||
if [ -n "$3" ]; then
|
||||
start=$(( $3 - $FZF_PREVIEW_LINES / 2 ))
|
||||
if [ $start -lt 1 ]; then
|
||||
start=1
|
||||
fi
|
||||
end=$(( $start + $FZF_PREVIEW_LINES ))
|
||||
exec bat --style=numbers --color=always --highlight-line $3 --line-range $start:$end $2
|
||||
else
|
||||
exec bat --style=numbers --color=always $2
|
||||
fi
|
||||
fi
|
||||
|
||||
reload="reload(sh $0 list || true)"
|
||||
no_search="rebind(change)+disable-search"
|
||||
search="unbind(change)+enable-search"
|
||||
|
||||
if [ "$1" = key ]; then
|
||||
case "$FZF_KEY" in
|
||||
alt-a)
|
||||
prompt=${FZF_PROMPT#dir:}
|
||||
if [ $prompt = $FZF_PROMPT ]; then
|
||||
echo "change-prompt(dir:$FZF_PROMPT)+$search+$reload"
|
||||
else
|
||||
case "$cmd" in
|
||||
*files)
|
||||
infix="$search"
|
||||
;;
|
||||
*)
|
||||
infix="$no_search"
|
||||
;;
|
||||
esac
|
||||
echo "change-prompt($prompt)+$infix+$reload"
|
||||
fi
|
||||
;;
|
||||
alt-d)
|
||||
dir=${FZF_HEADER_LABEL#?}
|
||||
case "$FZF_HEADER_LABEL" in
|
||||
.?*)
|
||||
echo "change-header(path: $dir)+change-header-label(:$dir)+$reload"
|
||||
;;
|
||||
*)
|
||||
echo "change-header()+change-header-label(.$dir)+$reload"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
alt-f)
|
||||
case "$cmd" in
|
||||
*files|search)
|
||||
prompt="files$hidden"
|
||||
;;
|
||||
*search)
|
||||
prompt="${cmd%-*}-files$hidden"
|
||||
;;
|
||||
esac
|
||||
echo "change-prompt($prompt> )+$search+$reload"
|
||||
;;
|
||||
alt-g)
|
||||
case "$cmd" in
|
||||
*files)
|
||||
prompt="git-files$hidden"
|
||||
echo "change-prompt($prompt> )+$search+$reload"
|
||||
;;
|
||||
*search)
|
||||
prompt="git-search$hidden"
|
||||
echo "change-prompt($prompt> )+$no_search+$reload"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
alt-h)
|
||||
if [ -z "$hidden" ]; then
|
||||
prompt="$cmd+hidden"
|
||||
else
|
||||
prompt="$cmd"
|
||||
fi
|
||||
echo "change-prompt($prompt> )+$reload"
|
||||
;;
|
||||
alt-j)
|
||||
case "$cmd" in
|
||||
*files)
|
||||
prompt="jj-files$hidden"
|
||||
echo "change-prompt($prompt> )+$search+$reload"
|
||||
;;
|
||||
*search)
|
||||
prompt="jj-search$hidden"
|
||||
echo "change-prompt($prompt> )+$no_search+$reload"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
alt-s)
|
||||
case "$cmd" in
|
||||
*search|files)
|
||||
prompt="search$hidden"
|
||||
;;
|
||||
*files)
|
||||
prompt="${cmd%-*}-search$hidden"
|
||||
;;
|
||||
esac
|
||||
echo "change-prompt($prompt> )+$no_search+$reload"
|
||||
;;
|
||||
esac
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ "$1" = chdir ]; then
|
||||
dir="$2"
|
||||
prompt=${FZF_PROMPT#dir:}
|
||||
case "$cmd" in
|
||||
*files)
|
||||
infix="$search"
|
||||
;;
|
||||
*)
|
||||
infix="$no_search"
|
||||
;;
|
||||
esac
|
||||
echo "change-header(path: $dir)+change-header-label(:$dir)+change-prompt($prompt)+$infix+$reload"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ -n "$2" ]; then
|
||||
label=".$2"
|
||||
else
|
||||
label=".."
|
||||
fi
|
||||
|
||||
case ${1%+hidden} in
|
||||
auto-files)
|
||||
git=$(git rev-parse --show-toplevel 2> /dev/null)
|
||||
jj=$(jj root --ignore-working-copy 2> /dev/null)
|
||||
if [ -n "$jj" ] && [ "${git#$jj}" = "$git" -o "$git" = "$jj" ]; then
|
||||
cmd="jj-files$hidden"
|
||||
elif [ -n "$git" ] && [ "${jj#$git}" = "$jj" ]; then
|
||||
cmd="git-files$hidden"
|
||||
else
|
||||
cmd="files"
|
||||
fi
|
||||
action="$search"
|
||||
prompt="$cmd> "
|
||||
;;
|
||||
auto-search)
|
||||
git=$(git rev-parse --show-toplevel 2> /dev/null)
|
||||
jj=$(jj root --ignore-working-copy 2> /dev/null)
|
||||
if [ -n "$jj" ] && [ "${git#$jj}" = "$git" -o "$git" = "$jj" ]; then
|
||||
cmd="jj-search$hidden"
|
||||
elif [ -n "$git" ] && [ "${jj#$git}" = "$jj" ]; then
|
||||
cmd="git-search$hidden"
|
||||
else
|
||||
cmd="search"
|
||||
fi
|
||||
action="$no_search"
|
||||
prompt="$cmd> "
|
||||
;;
|
||||
files|git-files|jj-files)
|
||||
cmd="$1"
|
||||
action="$search"
|
||||
prompt="$1> "
|
||||
;;
|
||||
search|git-search|jj-search)
|
||||
cmd="$1"
|
||||
action="$no_search"
|
||||
prompt="$1> "
|
||||
;;
|
||||
*)
|
||||
cmd="files"
|
||||
action="$search"
|
||||
prompt="files> "
|
||||
;;
|
||||
esac
|
||||
key="transform(sh $0 key)"
|
||||
|
||||
HELP='Keys:
|
||||
|
||||
alt-? help
|
||||
alt-a select alternative directory
|
||||
alt-d toggle alternative directory
|
||||
alt-f switch to files (twice for plain files)
|
||||
alt-g switch to git
|
||||
alt-j switch to jj
|
||||
alt-h toggle hidden
|
||||
alt-p toggle preview (also to turn off help)
|
||||
alt-s switch to search (twice for plain search)
|
||||
alt-u toggle preview window position (right or up)
|
||||
'
|
||||
|
||||
accept="
|
||||
if [ \${FZF_PROMPT#dir:} = \$FZF_PROMPT ]; then
|
||||
echo accept
|
||||
else
|
||||
sh $0 chdir {1}
|
||||
fi
|
||||
"
|
||||
|
||||
exec fzf --query "$3" \
|
||||
--prompt "$prompt" \
|
||||
--header-label "$label" \
|
||||
--ansi \
|
||||
--delimiter : \
|
||||
--ghost ' (Use alt-? for help)' \
|
||||
--bind "enter:transform($accept)" \
|
||||
--bind "change:$reload" \
|
||||
--bind "start:$reload+$action" \
|
||||
--bind "alt-a:$key" \
|
||||
--bind "alt-d:$key" \
|
||||
--bind "alt-f:$key" \
|
||||
--bind "alt-g:$key" \
|
||||
--bind "alt-j:$key" \
|
||||
--bind "alt-h:$key" \
|
||||
--bind "alt-s:$key" \
|
||||
--bind "alt-p:change-preview(sh $0 preview {1} {2})+toggle-preview" \
|
||||
--bind "alt-u:change-preview-window(up|right)" \
|
||||
--bind "alt-?:change-preview(echo '$HELP')+show-preview"
|
||||
2
vis/.config/vis/global-marks.txt
Normal file
2
vis/.config/vis/global-marks.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
/home/lupan/dotfiles/Makefile:23:22: (PREFIX): make -C dwm install PREFIX="${HOME}/.local"
|
||||
/home/lupan/dotfiles/Makefile:41:15: (clock): install-lupan-clock:
|
||||
158
vis/.config/vis/themes/lupan-dark.lua
Normal file
158
vis/.config/vis/themes/lupan-dark.lua
Normal file
@@ -0,0 +1,158 @@
|
||||
-- Eight-color scheme
|
||||
local lexers = vis.lexers
|
||||
lexers.STYLE_DEFAULT ='back:#1f212e,fore:#9da0af'
|
||||
lexers.STYLE_NOTHING = ''
|
||||
lexers.STYLE_ATTRIBUTE = 'fore:#a1a3aa,bold'
|
||||
lexers.STYLE_CLASS = 'fore:yellow,bold'
|
||||
lexers.STYLE_COMMENT = 'fore:#334d40,bold'
|
||||
lexers.STYLE_CONSTANT = 'fore:cyan,bold'
|
||||
lexers.STYLE_DEFINITION = 'fore:blue,bold'
|
||||
lexers.STYLE_ERROR = 'fore:red,italics'
|
||||
lexers.STYLE_FUNCTION = 'fore:#6b8ac7,bold'
|
||||
lexers.STYLE_HEADING = 'fore:#d1d147'
|
||||
lexers.STYLE_KEYWORD = 'fore:#bf8040,bold'
|
||||
lexers.STYLE_LABEL = 'fore:green,bold'
|
||||
lexers.STYLE_NUMBER = 'fore:#acac53,bold'
|
||||
lexers.STYLE_OPERATOR = 'fore:#93806c,bold'
|
||||
lexers.STYLE_REGEX = 'fore:#59862d,bold'
|
||||
lexers.STYLE_STRING = 'fore:#3d8f66,bold'
|
||||
lexers.STYLE_PREPROCESSOR = 'fore:#cc66cc,bold'
|
||||
lexers.STYLE_TAG = 'fore:#705943,bold'
|
||||
lexers.STYLE_TYPE = 'fore:#7461d1,bold'
|
||||
lexers.STYLE_VARIABLE = 'fore:#8c5eba,bold'
|
||||
lexers.STYLE_WHITESPACE = ''
|
||||
lexers.STYLE_EMBEDDED = 'back:#2d3353,bold'
|
||||
lexers.STYLE_IDENTIFIER = ''
|
||||
|
||||
lexers.STYLE_LINENUMBER = ''
|
||||
lexers.STYLE_LINENUMBER_CURSOR = 'fore:#bf8040'
|
||||
lexers.STYLE_CURSOR = 'back:#bf8040,fore:#1f212e'
|
||||
lexers.STYLE_CURSOR_PRIMARY = lexers.STYLE_CURSOR..',fore:#e6fefe'
|
||||
lexers.STYLE_CURSOR_LINE = 'underlined'
|
||||
lexers.STYLE_COLOR_COLUMN = 'back:red'
|
||||
lexers.STYLE_SELECTION = 'back:#4d5580,bold'
|
||||
lexers.STYLE_STATUS = 'reverse'
|
||||
lexers.STYLE_STATUS_FOCUSED = 'reverse,bold'
|
||||
lexers.STYLE_SEPARATOR = lexers.STYLE_DEFAULT
|
||||
lexers.STYLE_INFO = 'bold'
|
||||
lexers.STYLE_EOF = ''
|
||||
|
||||
-- lexer specific styles
|
||||
|
||||
-- Diff
|
||||
lexers.STYLE_ADDITION = 'fore:#3a783a'
|
||||
lexers.STYLE_DELETION = 'fore:#862d2d'
|
||||
lexers.STYLE_CHANGE = 'fore:#2d3353'
|
||||
|
||||
-- CSS
|
||||
lexers.STYLE_PROPERTY = lexers.STYLE_ATTRIBUTE
|
||||
lexers.STYLE_PSEUDOCLASS = ''
|
||||
lexers.STYLE_PSEUDOELEMENT = ''
|
||||
|
||||
-- HTML
|
||||
lexers.STYLE_TAG_UNKNOWN = lexers.STYLE_TAG .. ',italics'
|
||||
lexers.STYLE_TAG_SINGLE = lexers.STYLE_TAG
|
||||
lexers.STYLE_TAG_DOCTYPE = lexers.STYLE_TAG .. ',bold'
|
||||
lexers.STYLE_ATTRIBUTE_UNKNOWN = lexers.STYLE_ATTRIBUTE .. ',italics'
|
||||
|
||||
-- Latex, TeX, and Texinfo
|
||||
lexers.STYLE_COMMAND = lexers.STYLE_KEYWORD
|
||||
lexers.STYLE_COMMAND_SECTION = lexers.STYLE_CLASS
|
||||
lexers.STYLE_ENVIRONMENT = lexers.STYLE_TYPE
|
||||
lexers.STYLE_ENVIRONMENT_MATH = lexers.STYLE_NUMBER
|
||||
|
||||
-- Makefile
|
||||
lexers.STYLE_TARGET = ''
|
||||
|
||||
-- Markdown
|
||||
lexers.STYLE_HR = ''
|
||||
for i = 1,6 do lexers['STYLE_HEADING_H'..i] = lexers.STYLE_HEADING end
|
||||
lexers.STYLE_BOLD = 'bold'
|
||||
lexers.STYLE_ITALIC = 'italics'
|
||||
lexers.STYLE_LIST = lexers.STYLE_KEYWORD
|
||||
lexers.STYLE_LINK = lexers.STYLE_KEYWORD
|
||||
lexers.STYLE_REFERENCE = lexers.STYLE_KEYWORD
|
||||
lexers.STYLE_CODE = lexers.STYLE_EMBEDDED
|
||||
|
||||
-- Output
|
||||
lexers.STYE_FILENAME = ''
|
||||
lexers.STYLE_LINE = ''
|
||||
lexers.STYLE_COLUMN = ''
|
||||
lexers.STYLE_MESSAGE = ''
|
||||
|
||||
-- Python
|
||||
lexers.STYLE_KEYWORD_SOFT = ''
|
||||
|
||||
-- Taskpaper
|
||||
lexers.STYLE_NOTE = ''
|
||||
lexers.STYLE_TAG_EXTENDED = ''
|
||||
lexers.STYLE_TAG_DAY = 'fore:yellow'
|
||||
lexers.STYLE_TAG_OVERDUE = 'fore:red'
|
||||
lexers.STYLE_TAG_PLAIN = ''
|
||||
|
||||
-- XML
|
||||
lexers.STYLE_CDATA = ''
|
||||
|
||||
-- YAML
|
||||
lexers.STYLE_ERROR_INDENT = 'back:red'
|
||||
|
||||
-- The following are temporary styles until their legacy lexers are migrated.
|
||||
|
||||
-- Antlr
|
||||
lexers.STYLE_ACTION = ''
|
||||
|
||||
-- Clojure
|
||||
lexers.STYLE_CLOJURE_KEYWORD = lexers.STYLE_TYPE
|
||||
lexers.STYLE_CLOJURE_SYMBOL = lexers.STYLE_TYPE .. ',bold'
|
||||
|
||||
-- Crystal
|
||||
--lexers.STYLE_SYMBOL = lexers.STYLE_STRING
|
||||
|
||||
-- Gleam
|
||||
lexers.STYLE_MODULE = lexers.STYLE_CONSTANT
|
||||
lexers.STYLE_DISCARD = lexers.STYLE_COMMENT
|
||||
|
||||
-- Icon
|
||||
lexers.STYLE_SPECIAL_KEYWORD = lexers.STYLE_TYPE
|
||||
|
||||
-- jq
|
||||
lexers.STYLE_FORMAT = lexers.STYLE_CONSTANT
|
||||
lexers.STYLE_SYSVAR = lexers.STYLE_CONSTANT .. ',bold'
|
||||
|
||||
-- Julia
|
||||
-- lexers.STYLE_SYMBOL = lexers.STYLE_STRING
|
||||
lexers.STYLE_CHARACTER = lexers.STYLE_CONSTANT
|
||||
|
||||
-- Mediawiki
|
||||
lexers.STYLE_BEHAVIOR_SWITCH = lexers.STYLE_KEYWORD
|
||||
|
||||
-- Moonscript
|
||||
lexers.STYLE_TBL_KEY = lexers.STYLE_REGEX
|
||||
lexers.STYLE_SELF_REF = lexers.STYLE_LABEL
|
||||
lexers.STYLE_PROPER_IDENT = lexers.STYLE_CLASS
|
||||
lexers.STYLE_FNDEF = lexers.STYLE_PREPROCESSOR
|
||||
-- lexers.STYLE_SYMBOL = lexers.STYLE_EMBEDDED
|
||||
|
||||
-- reST
|
||||
lexers.STYLE_LITERAL_BLOCK = lexers.STYLE_EMBEDDED
|
||||
lexers.STYLE_FOOTNOTE_BLOCK = lexers.STYLE_LABEL
|
||||
lexers.STYLE_CITATION_BLOCK = lexers.STYLE_LABEL
|
||||
lexers.STYLE_LINK_BLOCK = lexers.STYLE_LABEL
|
||||
lexers.STYLE_CODE_BLOCK = lexers.STYLE_CODE
|
||||
lexers.STYLE_DIRECTIVE = lexers.STYLE_KEYWORD
|
||||
lexers.STYLE_SPHINX_DIRECTIVE = lexers.STYLE_KEYWORD
|
||||
lexers.STYLE_UNKNOWN_DIRECTIVE = lexers.STYLE_KEYWORD
|
||||
lexers.STYLE_SUBSTITUTION = lexers.STYLE_VARIABLE
|
||||
lexers.STYLE_INLINE_LITERAL = lexers.STYLE_EMBEDDED
|
||||
lexers.STYLE_ROLE = lexers.STYLE_CLASS
|
||||
lexers.STYLE_INTERPRETED = lexers.STYLE_STRING
|
||||
|
||||
-- txt2tags
|
||||
lexers.STYLE_LINE = 'bold'
|
||||
for i = 1,5 do lexers['STYLE_H'..i] = lexers.STYLE_HEADING end
|
||||
lexers.STYLE_IMAGE = 'fore:green'
|
||||
lexers.STYLE_STRIKE = 'italics'
|
||||
lexers.STYLE_TAGGED = lexers.STYLE_EMBEDDED
|
||||
lexers.STYLE_TAGGED_AREA = lexers.STYLE_EMBEDDED
|
||||
lexers.STYLE_TABLE_SEP = 'fore:green'
|
||||
lexers.STYLE_HEADER_CELL_CONTENT = 'fore:green'
|
||||
158
vis/.config/vis/themes/lupan-light.lua
Normal file
158
vis/.config/vis/themes/lupan-light.lua
Normal file
@@ -0,0 +1,158 @@
|
||||
-- Eight-color scheme
|
||||
local lexers = vis.lexers
|
||||
lexers.STYLE_DEFAULT ='back:#dbdff0,fore:#1f212e'
|
||||
lexers.STYLE_NOTHING = ''
|
||||
lexers.STYLE_ATTRIBUTE = 'fore:#a1a3aa,bold'
|
||||
lexers.STYLE_CLASS = 'fore:yellow,bold'
|
||||
lexers.STYLE_COMMENT = 'fore:#334d40,bold'
|
||||
lexers.STYLE_CONSTANT = 'fore:cyan,bold'
|
||||
lexers.STYLE_DEFINITION = 'fore:blue,bold'
|
||||
lexers.STYLE_ERROR = 'fore:red,italics'
|
||||
lexers.STYLE_FUNCTION = 'fore:#6b8ac7,bold'
|
||||
lexers.STYLE_HEADING = 'fore:#d1d147'
|
||||
lexers.STYLE_KEYWORD = 'fore:#bf8040,bold'
|
||||
lexers.STYLE_LABEL = 'fore:green,bold'
|
||||
lexers.STYLE_NUMBER = 'fore:#acac53,bold'
|
||||
lexers.STYLE_OPERATOR = 'fore:#93806c,bold'
|
||||
lexers.STYLE_REGEX = 'fore:#59862d,bold'
|
||||
lexers.STYLE_STRING = 'fore:#3d8f66,bold'
|
||||
lexers.STYLE_PREPROCESSOR = 'fore:#cc66cc,bold'
|
||||
lexers.STYLE_TAG = 'fore:#705943,bold'
|
||||
lexers.STYLE_TYPE = 'fore:#7461d1,bold'
|
||||
lexers.STYLE_VARIABLE = 'fore:#8c5eba,bold'
|
||||
lexers.STYLE_WHITESPACE = ''
|
||||
lexers.STYLE_EMBEDDED = 'back:#2d3353,bold'
|
||||
lexers.STYLE_IDENTIFIER = ''
|
||||
|
||||
lexers.STYLE_LINENUMBER = ''
|
||||
lexers.STYLE_LINENUMBER_CURSOR = 'fore:#bf8040'
|
||||
lexers.STYLE_CURSOR = 'back:#bf8040,fore:#1f212e'
|
||||
lexers.STYLE_CURSOR_PRIMARY = lexers.STYLE_CURSOR..',fore:#e6fefe'
|
||||
lexers.STYLE_CURSOR_LINE = 'underlined'
|
||||
lexers.STYLE_COLOR_COLUMN = 'back:red'
|
||||
lexers.STYLE_SELECTION = 'back:#a1a3aa,bold'
|
||||
lexers.STYLE_STATUS = 'reverse'
|
||||
lexers.STYLE_STATUS_FOCUSED = 'reverse,bold'
|
||||
lexers.STYLE_SEPARATOR = lexers.STYLE_DEFAULT
|
||||
lexers.STYLE_INFO = 'bold'
|
||||
lexers.STYLE_EOF = ''
|
||||
|
||||
-- lexer specific styles
|
||||
|
||||
-- Diff
|
||||
lexers.STYLE_ADDITION = 'fore:#3a783a'
|
||||
lexers.STYLE_DELETION = 'fore:#862d2d'
|
||||
lexers.STYLE_CHANGE = 'fore:#2d3353'
|
||||
|
||||
-- CSS
|
||||
lexers.STYLE_PROPERTY = lexers.STYLE_ATTRIBUTE
|
||||
lexers.STYLE_PSEUDOCLASS = ''
|
||||
lexers.STYLE_PSEUDOELEMENT = ''
|
||||
|
||||
-- HTML
|
||||
lexers.STYLE_TAG_UNKNOWN = lexers.STYLE_TAG .. ',italics'
|
||||
lexers.STYLE_TAG_SINGLE = lexers.STYLE_TAG
|
||||
lexers.STYLE_TAG_DOCTYPE = lexers.STYLE_TAG .. ',bold'
|
||||
lexers.STYLE_ATTRIBUTE_UNKNOWN = lexers.STYLE_ATTRIBUTE .. ',italics'
|
||||
|
||||
-- Latex, TeX, and Texinfo
|
||||
lexers.STYLE_COMMAND = lexers.STYLE_KEYWORD
|
||||
lexers.STYLE_COMMAND_SECTION = lexers.STYLE_CLASS
|
||||
lexers.STYLE_ENVIRONMENT = lexers.STYLE_TYPE
|
||||
lexers.STYLE_ENVIRONMENT_MATH = lexers.STYLE_NUMBER
|
||||
|
||||
-- Makefile
|
||||
lexers.STYLE_TARGET = ''
|
||||
|
||||
-- Markdown
|
||||
lexers.STYLE_HR = ''
|
||||
for i = 1,6 do lexers['STYLE_HEADING_H'..i] = lexers.STYLE_HEADING end
|
||||
lexers.STYLE_BOLD = 'bold'
|
||||
lexers.STYLE_ITALIC = 'italics'
|
||||
lexers.STYLE_LIST = lexers.STYLE_KEYWORD
|
||||
lexers.STYLE_LINK = lexers.STYLE_KEYWORD
|
||||
lexers.STYLE_REFERENCE = lexers.STYLE_KEYWORD
|
||||
lexers.STYLE_CODE = lexers.STYLE_EMBEDDED
|
||||
|
||||
-- Output
|
||||
lexers.STYE_FILENAME = ''
|
||||
lexers.STYLE_LINE = ''
|
||||
lexers.STYLE_COLUMN = ''
|
||||
lexers.STYLE_MESSAGE = ''
|
||||
|
||||
-- Python
|
||||
lexers.STYLE_KEYWORD_SOFT = ''
|
||||
|
||||
-- Taskpaper
|
||||
lexers.STYLE_NOTE = ''
|
||||
lexers.STYLE_TAG_EXTENDED = ''
|
||||
lexers.STYLE_TAG_DAY = 'fore:yellow'
|
||||
lexers.STYLE_TAG_OVERDUE = 'fore:red'
|
||||
lexers.STYLE_TAG_PLAIN = ''
|
||||
|
||||
-- XML
|
||||
lexers.STYLE_CDATA = ''
|
||||
|
||||
-- YAML
|
||||
lexers.STYLE_ERROR_INDENT = 'back:red'
|
||||
|
||||
-- The following are temporary styles until their legacy lexers are migrated.
|
||||
|
||||
-- Antlr
|
||||
lexers.STYLE_ACTION = ''
|
||||
|
||||
-- Clojure
|
||||
lexers.STYLE_CLOJURE_KEYWORD = lexers.STYLE_TYPE
|
||||
lexers.STYLE_CLOJURE_SYMBOL = lexers.STYLE_TYPE .. ',bold'
|
||||
|
||||
-- Crystal
|
||||
--lexers.STYLE_SYMBOL = lexers.STYLE_STRING
|
||||
|
||||
-- Gleam
|
||||
lexers.STYLE_MODULE = lexers.STYLE_CONSTANT
|
||||
lexers.STYLE_DISCARD = lexers.STYLE_COMMENT
|
||||
|
||||
-- Icon
|
||||
lexers.STYLE_SPECIAL_KEYWORD = lexers.STYLE_TYPE
|
||||
|
||||
-- jq
|
||||
lexers.STYLE_FORMAT = lexers.STYLE_CONSTANT
|
||||
lexers.STYLE_SYSVAR = lexers.STYLE_CONSTANT .. ',bold'
|
||||
|
||||
-- Julia
|
||||
-- lexers.STYLE_SYMBOL = lexers.STYLE_STRING
|
||||
lexers.STYLE_CHARACTER = lexers.STYLE_CONSTANT
|
||||
|
||||
-- Mediawiki
|
||||
lexers.STYLE_BEHAVIOR_SWITCH = lexers.STYLE_KEYWORD
|
||||
|
||||
-- Moonscript
|
||||
lexers.STYLE_TBL_KEY = lexers.STYLE_REGEX
|
||||
lexers.STYLE_SELF_REF = lexers.STYLE_LABEL
|
||||
lexers.STYLE_PROPER_IDENT = lexers.STYLE_CLASS
|
||||
lexers.STYLE_FNDEF = lexers.STYLE_PREPROCESSOR
|
||||
-- lexers.STYLE_SYMBOL = lexers.STYLE_EMBEDDED
|
||||
|
||||
-- reST
|
||||
lexers.STYLE_LITERAL_BLOCK = lexers.STYLE_EMBEDDED
|
||||
lexers.STYLE_FOOTNOTE_BLOCK = lexers.STYLE_LABEL
|
||||
lexers.STYLE_CITATION_BLOCK = lexers.STYLE_LABEL
|
||||
lexers.STYLE_LINK_BLOCK = lexers.STYLE_LABEL
|
||||
lexers.STYLE_CODE_BLOCK = lexers.STYLE_CODE
|
||||
lexers.STYLE_DIRECTIVE = lexers.STYLE_KEYWORD
|
||||
lexers.STYLE_SPHINX_DIRECTIVE = lexers.STYLE_KEYWORD
|
||||
lexers.STYLE_UNKNOWN_DIRECTIVE = lexers.STYLE_KEYWORD
|
||||
lexers.STYLE_SUBSTITUTION = lexers.STYLE_VARIABLE
|
||||
lexers.STYLE_INLINE_LITERAL = lexers.STYLE_EMBEDDED
|
||||
lexers.STYLE_ROLE = lexers.STYLE_CLASS
|
||||
lexers.STYLE_INTERPRETED = lexers.STYLE_STRING
|
||||
|
||||
-- txt2tags
|
||||
lexers.STYLE_LINE = 'bold'
|
||||
for i = 1,5 do lexers['STYLE_H'..i] = lexers.STYLE_HEADING end
|
||||
lexers.STYLE_IMAGE = 'fore:green'
|
||||
lexers.STYLE_STRIKE = 'italics'
|
||||
lexers.STYLE_TAGGED = lexers.STYLE_EMBEDDED
|
||||
lexers.STYLE_TAGGED_AREA = lexers.STYLE_EMBEDDED
|
||||
lexers.STYLE_TABLE_SEP = 'fore:green'
|
||||
lexers.STYLE_HEADER_CELL_CONTENT = 'fore:green'
|
||||
@@ -48,7 +48,9 @@ local function open_file_pos(line, open_cmd)
|
||||
local file = iter()
|
||||
local line_num = nil_or_tonumber(iter())
|
||||
local col = nil_or_tonumber(iter()) or 1
|
||||
if open_cmd ~= 'e' or vis.win.file ~= file then
|
||||
open_file(file, open_cmd)
|
||||
end
|
||||
if line_num ~= nil then
|
||||
vis.win.selection:to(line_num, col)
|
||||
end
|
||||
@@ -64,6 +66,32 @@ local function escape_and_quoted(s)
|
||||
return "'" .. s:gsub("'", "\\'") .. "'"
|
||||
end
|
||||
|
||||
local function cmd_action(cmd, action)
|
||||
local code, out, err = vis:pipe(cmd, true)
|
||||
if code == 0 then
|
||||
action(out)
|
||||
elseif err ~= nil then
|
||||
vis:info(err)
|
||||
elseif code ~= 0 then
|
||||
vis:info('Program exit code ' .. code)
|
||||
end
|
||||
end
|
||||
|
||||
local function fzf_sh(arg)
|
||||
action = function(out)
|
||||
open_file_pos(out, vis.win.file.modified and 'o' or 'e')
|
||||
end
|
||||
local home = os.getenv('HOME')
|
||||
local path = vis.win.file.path or ''
|
||||
local dir = path:match('^.*/') or ''
|
||||
local reg = ''
|
||||
if reg ~= '"' then
|
||||
reg = string.gsub(vis.registers[vis.register][1], '%z', '')
|
||||
end
|
||||
local cmd = home .. '/.config/vis/fzf.sh ' .. escape_and_quoted(arg) .. ' ' .. escape_and_quoted(dir) .. ' ' .. escape_and_quoted(reg)
|
||||
cmd_action(cmd, action)
|
||||
end
|
||||
|
||||
local function search(cmd, action)
|
||||
if action == nil then
|
||||
action = function(out)
|
||||
@@ -76,14 +104,7 @@ local function search(cmd, action)
|
||||
cmd = cmd .. ' --query=' .. escape_and_quoted(reg)
|
||||
end
|
||||
end
|
||||
local code, out, err = vis:pipe(cmd, true)
|
||||
if code == 0 then
|
||||
action(out)
|
||||
elseif err ~= nil then
|
||||
vis:info(err)
|
||||
elseif code ~= 0 then
|
||||
vis:info('Program exit code ' .. code)
|
||||
end
|
||||
cmd_action(cmd, action)
|
||||
end
|
||||
|
||||
local file_slots = {}
|
||||
@@ -120,6 +141,43 @@ local function fzf_reload(cmd)
|
||||
' --bind "alt-enter:unbind(change,alt-enter)+change-prompt(2. fzf> )+enable-search+clear-query"'
|
||||
end
|
||||
|
||||
local function add_global_mark()
|
||||
local file = vis.win.file.path
|
||||
if file ~= nil then
|
||||
local code, out, err = vis:pipe('vis-menu -p "global mark comment:"', true)
|
||||
if code == 0 then
|
||||
local prefix = file .. ':' .. vis.win.selection.line .. ':' .. vis.win.selection.col .. ': '
|
||||
local line = vis.win.file.lines[vis.win.selection.line]
|
||||
out = out:gsub('\n$', '')
|
||||
if out ~= '' then
|
||||
prefix = prefix .. '(' .. out .. '): '
|
||||
end
|
||||
out = io.open(os.getenv('HOME') .. '/.config/vis/global-marks.txt', 'a')
|
||||
out:write(prefix .. line .. '\n')
|
||||
out:close()
|
||||
elseif err ~= nil then
|
||||
vis:info(err)
|
||||
elseif code ~= 0 then
|
||||
vis:info('Program exit code ' .. code)
|
||||
end
|
||||
else
|
||||
vis:info('Save file first')
|
||||
end
|
||||
end
|
||||
|
||||
function set_current_theme()
|
||||
local f = io.open(os.getenv('HOME') .. '/.config/xsettingsd/xsettingsd.conf')
|
||||
if f then
|
||||
local s = f:read('*all')
|
||||
f:close()
|
||||
if s:match('light') then
|
||||
vis:command('set theme lupan-light')
|
||||
else
|
||||
vis:command('set theme lupan-dark')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local ripgrep = 'rg --column --line-number --color=always --smart-case'
|
||||
|
||||
vis.events.subscribe(vis.events.INIT, function()
|
||||
@@ -139,74 +197,49 @@ vis.events.subscribe(vis.events.INIT, function()
|
||||
vis:map(vis.modes.NORMAL, ' l=', ':lspc-format<Enter>')
|
||||
|
||||
for num = 1, 9 do
|
||||
vis:map(vis.modes.NORMAL, ' s' .. num, function() set_file_slot(num) end, 'set file slot ' .. num)
|
||||
vis:map(vis.modes.NORMAL, ' r' .. num, function() set_file_slot(num) end, 'set file slot ' .. num)
|
||||
vis:map(vis.modes.NORMAL, ' ' .. num, function() open_file_slot(num, 'e') end, 'open file slot ' .. num)
|
||||
vis:map(vis.modes.NORMAL, ' h' .. num, function() open_file_slot(num, 'o') end, 'open file slot ' .. num)
|
||||
vis:map(vis.modes.NORMAL, ' v' .. num, function() open_file_slot(num, 'vsplit') end,
|
||||
'open file slot ' .. num)
|
||||
end
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' fg', function()
|
||||
search(fzf_reload(ripgrep))
|
||||
end, 'fzf: rg')
|
||||
vis:map(vis.modes.NORMAL, ' s', function()
|
||||
fzf_sh('auto-search')
|
||||
end, 'fzf: search')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' hg', function()
|
||||
search(fzf_reload(ripgrep .. ' -.'))
|
||||
end, 'fzf: rg with hidden files')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' ff', function()
|
||||
search('fd --type f | fzf')
|
||||
vis:map(vis.modes.NORMAL, ' f', function()
|
||||
fzf_sh('auto-files')
|
||||
end, 'fzf: files')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' fh', function()
|
||||
search('fd -H --type f | fzf')
|
||||
end, 'fzf: files with hidden files')
|
||||
vis:map(vis.modes.NORMAL, ' /', function()
|
||||
search(fzf_reload(ripgrep .. ' --with-filename {q} ' .. escape_and_quoted(vis.win.file.path)))
|
||||
end, 'fzf: rg current file')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' .', function()
|
||||
local shell = os.getenv('SHELL')
|
||||
vis:command('!' .. shell)
|
||||
end, 'run shell')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' ds', function()
|
||||
local shell = os.getenv('SHELL')
|
||||
local path = vis.win.file.path
|
||||
if path then
|
||||
local dir = path:match('^.*/')
|
||||
local arg = escape_and_quoted(dir)
|
||||
search('fd --type f "" ' .. arg .. ' | fzf')
|
||||
vis:command('!cd ' .. arg .. ' && ' .. shell)
|
||||
else
|
||||
search('fd --type f | fzf')
|
||||
vis:command('!' .. shell)
|
||||
end
|
||||
end, 'fzf in file directory')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' h.', function()
|
||||
local path = vis.win.file.path
|
||||
if path then
|
||||
local dir = path:match('^.*/')
|
||||
local arg = escape_and_quoted(dir)
|
||||
search('fd -H --type f "" ' .. arg .. ' | fzf')
|
||||
else
|
||||
search('fd -H --type f | fzf')
|
||||
end
|
||||
end, 'fzf in file directory with hidden files')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' gf', function()
|
||||
search('git ls-files | fzf')
|
||||
end, 'fzf: git files')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' gg', function()
|
||||
search(fzf_reload('git grep --column --line-number --color=always'))
|
||||
end, 'fzf: jj grep')
|
||||
end, 'run shell in file directory')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' gl', function()
|
||||
vis:command('!lazygit')
|
||||
end, 'lazygit')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' jf', function()
|
||||
search('jj file list | fzf')
|
||||
end, 'fzf: jj files')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' jg', function()
|
||||
search(fzf_reload(ripgrep .. ' {q} $(jj file list | xargs)'))
|
||||
end, 'fzf: jj grep')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' jl', function()
|
||||
vis:command('!lazyjj')
|
||||
end, 'fzf open')
|
||||
end, 'lazyjj')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' ', function()
|
||||
vis:command('fzfmru')
|
||||
@@ -236,6 +269,27 @@ vis.events.subscribe(vis.events.INIT, function()
|
||||
vis:command('!yazi')
|
||||
end
|
||||
end, 'yazi in file directory')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' ma', add_global_mark, 'global marks: add')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' mj', function()
|
||||
search('cat ~/.config/vis/global-marks.txt | fzf --tac')
|
||||
end, 'global marks: jump')
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' me', function()
|
||||
vis:command('o ~/.config/vis/global-marks.txt')
|
||||
end, 'global marks: edit')
|
||||
|
||||
|
||||
vis:map(vis.modes.NORMAL, ' td', function()
|
||||
vis:command('set theme lupan-dark')
|
||||
end, 'change to dark theme')
|
||||
vis:map(vis.modes.NORMAL, ' tl', function()
|
||||
vis:command('set theme lupan-light')
|
||||
end, 'change to light theme')
|
||||
vis:map(vis.modes.NORMAL, ' tt', set_current_theme)
|
||||
|
||||
set_current_theme()
|
||||
end)
|
||||
|
||||
vis.events.subscribe(vis.events.WIN_OPEN, function(win)
|
||||
|
||||
15
xsession/bin/st-abduco-tabbed
Executable file
15
xsession/bin/st-abduco-tabbed
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
exec tabbed "$0" -w
|
||||
fi
|
||||
|
||||
if [ "$1" = "-w" ] && [ -n "$2" ]; then
|
||||
name=$(abduco | tail +2 | awk -F'\t' '{ print $NF }' | dmenu -p session: -l 10)
|
||||
if [ -n "$name" ]; then
|
||||
exec st -w "$2" -t "$name" -e abduco -A "$name" "$SHELL"
|
||||
fi
|
||||
else
|
||||
echo error: requires either no arguments or single option -w with and argument >&2
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user