Compare commits

...

4 Commits

5 changed files with 224 additions and 2 deletions

View File

@@ -7,7 +7,10 @@ mod4 + p
# terminal # terminal
mod4 + shift + Return mod4 + shift + Return
alacritty st
mod4 + ctrl + shift + Return
st-abduco-tabbed
# screenshot and selection capture # screenshot and selection capture
{_,mod4 + }@Print {_,mod4 + }@Print
@@ -107,4 +110,8 @@ mod4 + ctrl + shift + l
mod4 + ctrl + shift + s mod4 + ctrl + shift + s
systemctl suspend systemctl suspend
# toggle light/dark theme
mod4 + F6
lupan-set-theme toggle
# vim:ft=sxhkdrc # vim:ft=sxhkdrc

View 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:

View File

@@ -0,0 +1,158 @@
-- Eight-color scheme
local lexers = vis.lexers
lexers.STYLE_DEFAULT ='fore:#a6a6a6,back:#1f212e'
lexers.STYLE_NOTHING = ''
lexers.STYLE_ATTRIBUTE = 'fore:#949438,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'

View File

@@ -48,7 +48,9 @@ local function open_file_pos(line, open_cmd)
local file = iter() local file = iter()
local line_num = nil_or_tonumber(iter()) local line_num = nil_or_tonumber(iter())
local col = nil_or_tonumber(iter()) or 1 local col = nil_or_tonumber(iter()) or 1
if open_cmd ~= 'e' or vis.win.file ~= file then
open_file(file, open_cmd) open_file(file, open_cmd)
end
if line_num ~= nil then if line_num ~= nil then
vis.win.selection:to(line_num, col) vis.win.selection:to(line_num, col)
end end
@@ -120,6 +122,30 @@ local function fzf_reload(cmd)
' --bind "alt-enter:unbind(change,alt-enter)+change-prompt(2. fzf> )+enable-search+clear-query"' ' --bind "alt-enter:unbind(change,alt-enter)+change-prompt(2. fzf> )+enable-search+clear-query"'
end 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
local ripgrep = 'rg --column --line-number --color=always --smart-case' local ripgrep = 'rg --column --line-number --color=always --smart-case'
vis.events.subscribe(vis.events.INIT, function() vis.events.subscribe(vis.events.INIT, function()
@@ -154,6 +180,10 @@ vis.events.subscribe(vis.events.INIT, function()
search(fzf_reload(ripgrep .. ' -.')) search(fzf_reload(ripgrep .. ' -.'))
end, 'fzf: rg with hidden files') end, 'fzf: rg 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, ' ff', function() vis:map(vis.modes.NORMAL, ' ff', function()
search('fd --type f | fzf') search('fd --type f | fzf')
end, 'fzf: files') end, 'fzf: files')
@@ -236,6 +266,16 @@ vis.events.subscribe(vis.events.INIT, function()
vis:command('!yazi') vis:command('!yazi')
end end
end, 'yazi in file directory') 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')
end) end)
vis.events.subscribe(vis.events.WIN_OPEN, function(win) vis.events.subscribe(vis.events.WIN_OPEN, function(win)

15
xsession/bin/st-abduco-tabbed Executable file
View 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