mirror of
https://github.com/kristoferssolo/solorice.git
synced 2025-10-21 20:10:34 +00:00
Reformated files
This commit is contained in:
parent
da5f9ad0f1
commit
897fbd4666
@ -29,12 +29,15 @@
|
|||||||
"terminal.integrated.fontFamily": "JetBrainsMono NF",
|
"terminal.integrated.fontFamily": "JetBrainsMono NF",
|
||||||
"terminal.integrated.defaultProfile.linux": "zsh",
|
"terminal.integrated.defaultProfile.linux": "zsh",
|
||||||
"cSpell.userWords": [
|
"cSpell.userWords": [
|
||||||
|
"alacritty",
|
||||||
"blit",
|
"blit",
|
||||||
"Cagulis",
|
"Cagulis",
|
||||||
"Cena",
|
"Cena",
|
||||||
"cenu",
|
"cenu",
|
||||||
|
"cirala",
|
||||||
"dirnx",
|
"dirnx",
|
||||||
"dirny",
|
"dirny",
|
||||||
|
"dotfiles",
|
||||||
"grafiki",
|
"grafiki",
|
||||||
"Istabu",
|
"Istabu",
|
||||||
"Izvietošanas",
|
"Izvietošanas",
|
||||||
@ -42,10 +45,14 @@
|
|||||||
"Kristiāns",
|
"Kristiāns",
|
||||||
"Kristofers",
|
"Kristofers",
|
||||||
"Kvadratūra",
|
"Kvadratūra",
|
||||||
|
"lfimg",
|
||||||
|
"nsxiv",
|
||||||
|
"nvim",
|
||||||
"pathlib",
|
"pathlib",
|
||||||
"pygame",
|
"pygame",
|
||||||
"roboto",
|
"roboto",
|
||||||
"Sērija",
|
"Sērija",
|
||||||
|
"Solorice",
|
||||||
"Stāvs",
|
"Stāvs",
|
||||||
"xlabel",
|
"xlabel",
|
||||||
"xticks",
|
"xticks",
|
||||||
@ -56,7 +63,10 @@
|
|||||||
"suppressLineUncommittedWarning": true
|
"suppressLineUncommittedWarning": true
|
||||||
},
|
},
|
||||||
"vsicons.dontShowNewVersionMessage": true,
|
"vsicons.dontShowNewVersionMessage": true,
|
||||||
"indentRainbow.excludedLanguages": ["plaintext", "django-txt"],
|
"indentRainbow.excludedLanguages": [
|
||||||
|
"plaintext",
|
||||||
|
"django-txt"
|
||||||
|
],
|
||||||
"[markdown]": {
|
"[markdown]": {
|
||||||
"editor.defaultFormatter": "yzhang.markdown-all-in-one"
|
"editor.defaultFormatter": "yzhang.markdown-all-in-one"
|
||||||
},
|
},
|
||||||
@ -109,5 +119,6 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"workbench.colorTheme": "Dracula Soft",
|
"workbench.colorTheme": "Dracula Soft",
|
||||||
"workbench.iconTheme": "material-icon-theme"
|
"workbench.iconTheme": "material-icon-theme",
|
||||||
|
"Lua.telemetry.enable": true
|
||||||
}
|
}
|
||||||
@ -39,8 +39,6 @@ window:
|
|||||||
columns: 0
|
columns: 0
|
||||||
lines: 0
|
lines: 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
opacity: 0.9
|
opacity: 0.9
|
||||||
# Window position (changes require restart)
|
# Window position (changes require restart)
|
||||||
#
|
#
|
||||||
@ -72,9 +70,6 @@ window:
|
|||||||
# - buttonless: Title bar, transparent background and no title bar buttons
|
# - buttonless: Title bar, transparent background and no title bar buttons
|
||||||
decorations: none
|
decorations: none
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Startup Mode (changes require restart)
|
# Startup Mode (changes require restart)
|
||||||
#
|
#
|
||||||
# Values for `startup_mode`:
|
# Values for `startup_mode`:
|
||||||
@ -191,8 +186,8 @@ draw_bold_text_with_bright_colors: true
|
|||||||
colors:
|
colors:
|
||||||
# Default colors
|
# Default colors
|
||||||
primary:
|
primary:
|
||||||
background: '#1d1f21'
|
background: "#1d1f21"
|
||||||
foreground: '#c5c8c6'
|
foreground: "#c5c8c6"
|
||||||
|
|
||||||
# Bright and dim foreground colors
|
# Bright and dim foreground colors
|
||||||
#
|
#
|
||||||
@ -200,8 +195,8 @@ colors:
|
|||||||
# present. If the bright foreground color is not set, or
|
# present. If the bright foreground color is not set, or
|
||||||
# `draw_bold_text_with_bright_colors` is `false`, the normal foreground
|
# `draw_bold_text_with_bright_colors` is `false`, the normal foreground
|
||||||
# color will be used.
|
# color will be used.
|
||||||
dim_foreground: '#828482'
|
dim_foreground: "#828482"
|
||||||
bright_foreground: '#eaeaea'
|
bright_foreground: "#eaeaea"
|
||||||
|
|
||||||
# Cursor colors
|
# Cursor colors
|
||||||
#
|
#
|
||||||
@ -237,8 +232,8 @@ colors:
|
|||||||
# background: '#000000'
|
# background: '#000000'
|
||||||
|
|
||||||
bar:
|
bar:
|
||||||
background: '#282828'
|
background: "#282828"
|
||||||
foreground: '#EBEBE9'
|
foreground: "#EBEBE9"
|
||||||
|
|
||||||
# Keyboard regex hints
|
# Keyboard regex hints
|
||||||
hints:
|
hints:
|
||||||
@ -247,16 +242,16 @@ colors:
|
|||||||
# Allowed values are CellForeground/CellBackground, which reference the
|
# Allowed values are CellForeground/CellBackground, which reference the
|
||||||
# affected cell, or hexadecimal colors like #ff00ff.
|
# affected cell, or hexadecimal colors like #ff00ff.
|
||||||
start:
|
start:
|
||||||
foreground: '#1d1f21'
|
foreground: "#1d1f21"
|
||||||
background: '#e9ff5e'
|
background: "#e9ff5e"
|
||||||
|
|
||||||
# All characters after the first one in the hint label
|
# All characters after the first one in the hint label
|
||||||
#
|
#
|
||||||
# Allowed values are CellForeground/CellBackground, which reference the
|
# Allowed values are CellForeground/CellBackground, which reference the
|
||||||
# affected cell, or hexadecimal colors like #ff00ff.
|
# affected cell, or hexadecimal colors like #ff00ff.
|
||||||
end:
|
end:
|
||||||
foreground: '#e9ff5e'
|
foreground: "#e9ff5e"
|
||||||
background: '#1d1f21'
|
background: "#1d1f21"
|
||||||
|
|
||||||
# Line indicator
|
# Line indicator
|
||||||
#
|
#
|
||||||
@ -280,39 +275,39 @@ colors:
|
|||||||
|
|
||||||
# Normal colors
|
# Normal colors
|
||||||
normal:
|
normal:
|
||||||
black: '#313539'
|
black: "#313539"
|
||||||
red: '#b02626'
|
red: "#b02626"
|
||||||
green: '#40a62f'
|
green: "#40a62f"
|
||||||
yellow: '#f1e635'
|
yellow: "#f1e635"
|
||||||
blue: '#314ad0'
|
blue: "#314ad0"
|
||||||
magenta: '#b30ad0'
|
magenta: "#b30ad0"
|
||||||
cyan: '#32d0fc'
|
cyan: "#32d0fc"
|
||||||
white: '#acadb1'
|
white: "#acadb1"
|
||||||
|
|
||||||
# Bright colors
|
# Bright colors
|
||||||
bright:
|
bright:
|
||||||
black: '#717174'
|
black: "#717174"
|
||||||
red: '#b02626'
|
red: "#b02626"
|
||||||
green: '#40a62f'
|
green: "#40a62f"
|
||||||
yellow: '#f1e635'
|
yellow: "#f1e635"
|
||||||
blue: '#314ad0'
|
blue: "#314ad0"
|
||||||
magenta: '#b30ad0'
|
magenta: "#b30ad0"
|
||||||
cyan: '#32d0fc'
|
cyan: "#32d0fc"
|
||||||
white: '#acadb1'
|
white: "#acadb1"
|
||||||
|
|
||||||
# Dim colors
|
# Dim colors
|
||||||
#
|
#
|
||||||
# If the dim colors are not set, they will be calculated automatically based
|
# If the dim colors are not set, they will be calculated automatically based
|
||||||
# on the `normal` colors.
|
# on the `normal` colors.
|
||||||
dim:
|
dim:
|
||||||
black: '#676f78'
|
black: "#676f78"
|
||||||
red: '#b55454'
|
red: "#b55454"
|
||||||
green: '#78a670'
|
green: "#78a670"
|
||||||
yellow: '#faf380'
|
yellow: "#faf380"
|
||||||
blue: '#707fd0'
|
blue: "#707fd0"
|
||||||
magenta: '#c583d0'
|
magenta: "#c583d0"
|
||||||
cyan: '#8adaf1'
|
cyan: "#8adaf1"
|
||||||
white: '#e0e3e7'
|
white: "#e0e3e7"
|
||||||
|
|
||||||
# Indexed Colors
|
# Indexed Colors
|
||||||
#
|
#
|
||||||
@ -359,8 +354,6 @@ colors:
|
|||||||
# Visual bell animation color.
|
# Visual bell animation color.
|
||||||
#color: '#ffffff'
|
#color: '#ffffff'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Bell Command
|
# Bell Command
|
||||||
#
|
#
|
||||||
# This program is executed whenever the bell is rung.
|
# This program is executed whenever the bell is rung.
|
||||||
@ -858,7 +851,6 @@ key_bindings:
|
|||||||
#- { key: F, mods: Command|Control, action: ToggleFullscreen }
|
#- { key: F, mods: Command|Control, action: ToggleFullscreen }
|
||||||
#- { key: F, mods: Command, mode: ~Search, action: SearchForward }
|
#- { key: F, mods: Command, mode: ~Search, action: SearchForward }
|
||||||
#- { key: B, mods: Command, mode: ~Search, action: SearchBackward }
|
#- { key: B, mods: Command, mode: ~Search, action: SearchBackward }
|
||||||
|
|
||||||
#debug:
|
#debug:
|
||||||
# Display the time it takes to redraw each frame.
|
# Display the time it takes to redraw each frame.
|
||||||
#render_timer: false
|
#render_timer: false
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
-- If LuaRocks is installed, make sure that packages installed through it are
|
-- If LuaRocks is installed, make sure that packages installed through it are
|
||||||
-- found (e.g. lgi). If LuaRocks is not installed, do nothing.
|
-- found (e.g. lgi). If LuaRocks is not installed, do nothing.
|
||||||
pcall(require, "luarocks.loader")
|
pcall(require, "luarocks.loader")
|
||||||
@ -643,4 +642,3 @@ client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_n
|
|||||||
-- Autostart Applications
|
-- Autostart Applications
|
||||||
awful.spawn.with_shell("picom --experimental-backends")
|
awful.spawn.with_shell("picom --experimental-backends")
|
||||||
awful.spawn.with_shell("setxkbmap lv")
|
awful.spawn.with_shell("setxkbmap lv")
|
||||||
|
|
||||||
|
|||||||
@ -50,12 +50,10 @@ local function escape_char(c)
|
|||||||
return "\\" .. (escape_char_map[c] or string.format("u%04x", c:byte()))
|
return "\\" .. (escape_char_map[c] or string.format("u%04x", c:byte()))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function encode_nil(val)
|
local function encode_nil(val)
|
||||||
return "null"
|
return "null"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function encode_table(val, stack)
|
local function encode_table(val, stack)
|
||||||
local res = {}
|
local res = {}
|
||||||
stack = stack or {}
|
stack = stack or {}
|
||||||
@ -97,12 +95,10 @@ local function encode_table(val, stack)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function encode_string(val)
|
local function encode_string(val)
|
||||||
return '"' .. val:gsub('[%z\1-\31\\"]', escape_char) .. '"'
|
return '"' .. val:gsub('[%z\1-\31\\"]', escape_char) .. '"'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function encode_number(val)
|
local function encode_number(val)
|
||||||
-- Check for NaN, -inf and inf
|
-- Check for NaN, -inf and inf
|
||||||
if val ~= val or val <= -math.huge or val >= math.huge then
|
if val ~= val or val <= -math.huge or val >= math.huge then
|
||||||
@ -111,7 +107,6 @@ local function encode_number(val)
|
|||||||
return string.format("%.14g", val)
|
return string.format("%.14g", val)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local type_func_map = {
|
local type_func_map = {
|
||||||
["nil"] = encode_nil,
|
["nil"] = encode_nil,
|
||||||
["table"] = encode_table,
|
["table"] = encode_table,
|
||||||
@ -135,7 +130,6 @@ function json.encode(val)
|
|||||||
return (encode(val))
|
return (encode(val))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
-- Decode
|
-- Decode
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@ -171,7 +165,6 @@ local function next_char(str, idx, set, negate)
|
|||||||
return #str + 1
|
return #str + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function decode_error(str, idx, msg)
|
local function decode_error(str, idx, msg)
|
||||||
local line_count = 1
|
local line_count = 1
|
||||||
local col_count = 1
|
local col_count = 1
|
||||||
@ -185,7 +178,6 @@ local function decode_error(str, idx, msg)
|
|||||||
error(string.format("%s at line %d col %d", msg, line_count, col_count))
|
error(string.format("%s at line %d col %d", msg, line_count, col_count))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function codepoint_to_utf8(n)
|
local function codepoint_to_utf8(n)
|
||||||
-- http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=iws-appendixa
|
-- http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=iws-appendixa
|
||||||
local f = math.floor
|
local f = math.floor
|
||||||
@ -202,7 +194,6 @@ local function codepoint_to_utf8(n)
|
|||||||
error(string.format("invalid unicode codepoint '%x'", n))
|
error(string.format("invalid unicode codepoint '%x'", n))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function parse_unicode_escape(s)
|
local function parse_unicode_escape(s)
|
||||||
local n1 = tonumber(s:sub(1, 4), 16)
|
local n1 = tonumber(s:sub(1, 4), 16)
|
||||||
local n2 = tonumber(s:sub(7, 10), 16)
|
local n2 = tonumber(s:sub(7, 10), 16)
|
||||||
@ -214,7 +205,6 @@ local function parse_unicode_escape(s)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function parse_string(str, i)
|
local function parse_string(str, i)
|
||||||
local res = ""
|
local res = ""
|
||||||
local j = i + 1
|
local j = i + 1
|
||||||
@ -255,7 +245,6 @@ local function parse_string(str, i)
|
|||||||
decode_error(str, i, "expected closing quote for string")
|
decode_error(str, i, "expected closing quote for string")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function parse_number(str, i)
|
local function parse_number(str, i)
|
||||||
local x = next_char(str, i, delim_chars)
|
local x = next_char(str, i, delim_chars)
|
||||||
local s = str:sub(i, x - 1)
|
local s = str:sub(i, x - 1)
|
||||||
@ -266,7 +255,6 @@ local function parse_number(str, i)
|
|||||||
return n, x
|
return n, x
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function parse_literal(str, i)
|
local function parse_literal(str, i)
|
||||||
local x = next_char(str, i, delim_chars)
|
local x = next_char(str, i, delim_chars)
|
||||||
local word = str:sub(i, x - 1)
|
local word = str:sub(i, x - 1)
|
||||||
@ -276,7 +264,6 @@ local function parse_literal(str, i)
|
|||||||
return literal_map[word], x
|
return literal_map[word], x
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function parse_array(str, i)
|
local function parse_array(str, i)
|
||||||
local res = {}
|
local res = {}
|
||||||
local n = 1
|
local n = 1
|
||||||
@ -303,7 +290,6 @@ local function parse_array(str, i)
|
|||||||
return res, i
|
return res, i
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function parse_object(str, i)
|
local function parse_object(str, i)
|
||||||
local res = {}
|
local res = {}
|
||||||
i = i + 1
|
i = i + 1
|
||||||
@ -340,7 +326,6 @@ local function parse_object(str, i)
|
|||||||
return res, i
|
return res, i
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local char_func_map = {
|
local char_func_map = {
|
||||||
['"'] = parse_string,
|
['"'] = parse_string,
|
||||||
["0"] = parse_number,
|
["0"] = parse_number,
|
||||||
@ -384,5 +369,4 @@ function json.decode(str)
|
|||||||
return res
|
return res
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
return json
|
return json
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
-- If LuaRocks is installed, make sure that packages installed through it are
|
-- If LuaRocks is installed, make sure that packages installed through it are
|
||||||
-- found (e.g. lgi). If LuaRocks is not installed, do nothing.
|
-- found (e.g. lgi). If LuaRocks is not installed, do nothing.
|
||||||
pcall(require, "luarocks.loader")
|
pcall(require, "luarocks.loader")
|
||||||
@ -324,7 +323,8 @@ globalkeys = gears.table.join(
|
|||||||
awful.key({ modkey, }, "Tab", function() awful.client.focus.history.previous()
|
awful.key({ modkey, }, "Tab", function() awful.client.focus.history.previous()
|
||||||
if client.focus then
|
if client.focus then
|
||||||
client.focus:raise()
|
client.focus:raise()
|
||||||
end end,
|
end
|
||||||
|
end,
|
||||||
{ description = "go back", group = "client" }),
|
{ description = "go back", group = "client" }),
|
||||||
|
|
||||||
-- Standard program
|
-- Standard program
|
||||||
@ -624,11 +624,6 @@ client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_n
|
|||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- Autostart Applications
|
-- Autostart Applications
|
||||||
awful.spawn.with_shell("picom --experimental-backends")
|
awful.spawn.with_shell("picom --experimental-backends")
|
||||||
awful.spawn.with_shell("libinput-gestures-setup start")
|
|
||||||
awful.spawn.with_shell("dropbox")
|
|
||||||
awful.spawn.with_shell("flameshot")
|
|
||||||
awful.spawn.with_shell("setxkbmap lv")
|
awful.spawn.with_shell("setxkbmap lv")
|
||||||
awful.spawn.with_shell("corectrl")
|
|
||||||
|
|||||||
@ -12,8 +12,7 @@ image() {
|
|||||||
batorcat() {
|
batorcat() {
|
||||||
file="$1"
|
file="$1"
|
||||||
shift
|
shift
|
||||||
if command -v bat > /dev/null 2>&1
|
if command -v bat >/dev/null 2>&1; then
|
||||||
then
|
|
||||||
bat --color=always --style=plain --pager=never "$file" "$@"
|
bat --color=always --style=plain --pager=never "$file" "$@"
|
||||||
else
|
else
|
||||||
cat "$file"
|
cat "$file"
|
||||||
@ -46,22 +45,22 @@ case "$(printf "%s\n" "$(readlink -f "$1")" | awk '{print tolower($0)}')" in
|
|||||||
exiftool "$1"
|
exiftool "$1"
|
||||||
;;
|
;;
|
||||||
*.pdf)
|
*.pdf)
|
||||||
[ ! -f "${CACHE}.jpg" ] && \
|
[ ! -f "${CACHE}.jpg" ] &&
|
||||||
pdftoppm -jpeg -f 1 -singlefile "$1" "$CACHE"
|
pdftoppm -jpeg -f 1 -singlefile "$1" "$CACHE"
|
||||||
image "${CACHE}.jpg" "$2" "$3" "$4" "$5"
|
image "${CACHE}.jpg" "$2" "$3" "$4" "$5"
|
||||||
;;
|
;;
|
||||||
*.epub)
|
*.epub)
|
||||||
[ ! -f "$CACHE" ] && \
|
[ ! -f "$CACHE" ] &&
|
||||||
epub-thumbnailer "$1" "$CACHE" 1024
|
epub-thumbnailer "$1" "$CACHE" 1024
|
||||||
image "$CACHE" "$2" "$3" "$4" "$5"
|
image "$CACHE" "$2" "$3" "$4" "$5"
|
||||||
;;
|
;;
|
||||||
*.cbz | *.cbr | *.cbt)
|
*.cbz | *.cbr | *.cbt)
|
||||||
[ ! -f "$CACHE" ] && \
|
[ ! -f "$CACHE" ] &&
|
||||||
comicthumb "$1" "$CACHE" 1024
|
comicthumb "$1" "$CACHE" 1024
|
||||||
image "$CACHE" "$2" "$3" "$4" "$5"
|
image "$CACHE" "$2" "$3" "$4" "$5"
|
||||||
;;
|
;;
|
||||||
*.avi | *.mp4 | *.wmv | *.dat | *.3gp | *.ogv | *.mkv | *.mpg | *.mpeg | *.vob | *.fl[icv] | *.m2v | *.mov | *.webm | *.ts | *.mts | *.m4v | *.r[am] | *.qt | *.divx)
|
*.avi | *.mp4 | *.wmv | *.dat | *.3gp | *.ogv | *.mkv | *.mpg | *.mpeg | *.vob | *.fl[icv] | *.m2v | *.mov | *.webm | *.ts | *.mts | *.m4v | *.r[am] | *.qt | *.divx)
|
||||||
[ ! -f "${CACHE}.jpg" ] && \
|
[ ! -f "${CACHE}.jpg" ] &&
|
||||||
ffmpegthumbnailer -i "$1" -o "${CACHE}.jpg" -s 0 -q 5
|
ffmpegthumbnailer -i "$1" -o "${CACHE}.jpg" -s 0 -q 5
|
||||||
image "${CACHE}.jpg" "$2" "$3" "$4" "$5"
|
image "${CACHE}.jpg" "$2" "$3" "$4" "$5"
|
||||||
;;
|
;;
|
||||||
@ -69,7 +68,7 @@ case "$(printf "%s\n" "$(readlink -f "$1")" | awk '{print tolower($0)}')" in
|
|||||||
image "$1" "$2" "$3" "$4" "$5"
|
image "$1" "$2" "$3" "$4" "$5"
|
||||||
;;
|
;;
|
||||||
*.svg)
|
*.svg)
|
||||||
[ ! -f "${CACHE}.jpg" ] && \
|
[ ! -f "${CACHE}.jpg" ] &&
|
||||||
convert "$1" "${CACHE}.jpg"
|
convert "$1" "${CACHE}.jpg"
|
||||||
image "${CACHE}.jpg" "$2" "$3" "$4" "$5"
|
image "${CACHE}.jpg" "$2" "$3" "$4" "$5"
|
||||||
;;
|
;;
|
||||||
|
|||||||
@ -215,7 +215,6 @@ function string:join(parts)
|
|||||||
return text
|
return text
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- table size
|
-- table size
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -226,7 +225,6 @@ function table.length(T)
|
|||||||
return count
|
return count
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- print table
|
-- print table
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -243,7 +241,6 @@ function dump(o)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- print table
|
-- print table
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -277,7 +274,6 @@ function printT(table, level)
|
|||||||
func(table, level)
|
func(table, level)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- invoke command and retrive output
|
-- invoke command and retrive output
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -291,7 +287,6 @@ function os.call(command)
|
|||||||
return line
|
return line
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- write log
|
-- write log
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -308,7 +303,6 @@ function os.log(text)
|
|||||||
fp:close()
|
fp:close()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- ffi optimize (luajit has builtin ffi module)
|
-- ffi optimize (luajit has builtin ffi module)
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -335,24 +329,30 @@ if os.native.status then
|
|||||||
local hr = kernel32.GetFullPathNameA(name, 4096, buffer, nil)
|
local hr = kernel32.GetFullPathNameA(name, 4096, buffer, nil)
|
||||||
return (hr > 0) and ffi.string(buffer, hr) or nil
|
return (hr > 0) and ffi.string(buffer, hr) or nil
|
||||||
end
|
end
|
||||||
|
|
||||||
function os.native.ReplaceFile(replaced, replacement)
|
function os.native.ReplaceFile(replaced, replacement)
|
||||||
local hr = kernel32.ReplaceFileA(replaced, replacement, nil, 2, nil, nil)
|
local hr = kernel32.ReplaceFileA(replaced, replacement, nil, 2, nil, nil)
|
||||||
return (hr ~= 0) and true or false
|
return (hr ~= 0) and true or false
|
||||||
end
|
end
|
||||||
|
|
||||||
function os.native.GetTickCount()
|
function os.native.GetTickCount()
|
||||||
return kernel32.GetTickCount()
|
return kernel32.GetTickCount()
|
||||||
end
|
end
|
||||||
|
|
||||||
function os.native.GetFileAttributes(name)
|
function os.native.GetFileAttributes(name)
|
||||||
return kernel32.GetFileAttributesA(name)
|
return kernel32.GetFileAttributesA(name)
|
||||||
end
|
end
|
||||||
|
|
||||||
function os.native.GetLongPathName(name)
|
function os.native.GetLongPathName(name)
|
||||||
local hr = kernel32.GetLongPathNameA(name, buffer, 4096)
|
local hr = kernel32.GetLongPathNameA(name, buffer, 4096)
|
||||||
return (hr ~= 0) and ffi.string(buffer, hr) or nil
|
return (hr ~= 0) and ffi.string(buffer, hr) or nil
|
||||||
end
|
end
|
||||||
|
|
||||||
function os.native.GetShortPathName(name)
|
function os.native.GetShortPathName(name)
|
||||||
local hr = kernel32.GetShortPathNameA(name, buffer, 4096)
|
local hr = kernel32.GetShortPathNameA(name, buffer, 4096)
|
||||||
return (hr ~= 0) and ffi.string(buffer, hr) or nil
|
return (hr ~= 0) and ffi.string(buffer, hr) or nil
|
||||||
end
|
end
|
||||||
|
|
||||||
function os.native.GetRealPathName(name)
|
function os.native.GetRealPathName(name)
|
||||||
local short = os.native.GetShortPathName(name)
|
local short = os.native.GetShortPathName(name)
|
||||||
if short then
|
if short then
|
||||||
@ -360,10 +360,12 @@ if os.native.status then
|
|||||||
end
|
end
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
function os.native.exists(name)
|
function os.native.exists(name)
|
||||||
local attr = os.native.GetFileAttributes(name)
|
local attr = os.native.GetFileAttributes(name)
|
||||||
return attr ~= INVALID_FILE_ATTRIBUTES
|
return attr ~= INVALID_FILE_ATTRIBUTES
|
||||||
end
|
end
|
||||||
|
|
||||||
function os.native.isdir(name)
|
function os.native.isdir(name)
|
||||||
local attr = os.native.GetFileAttributes(name)
|
local attr = os.native.GetFileAttributes(name)
|
||||||
local isdir = FILE_ATTRIBUTE_DIRECTORY
|
local isdir = FILE_ATTRIBUTE_DIRECTORY
|
||||||
@ -372,6 +374,7 @@ if os.native.status then
|
|||||||
end
|
end
|
||||||
return (attr % (2 * isdir)) >= isdir
|
return (attr % (2 * isdir)) >= isdir
|
||||||
end
|
end
|
||||||
|
|
||||||
function os.native.getcwd()
|
function os.native.getcwd()
|
||||||
local hr = kernel32.GetCurrentDirectoryA(4096, buffer)
|
local hr = kernel32.GetCurrentDirectoryA(4096, buffer)
|
||||||
if hr <= 0 then return nil end
|
if hr <= 0 then return nil end
|
||||||
@ -393,13 +396,16 @@ if os.native.status then
|
|||||||
local usec = tonumber(timeval[0].tv_usec)
|
local usec = tonumber(timeval[0].tv_usec)
|
||||||
return sec + (usec * 0.000001)
|
return sec + (usec * 0.000001)
|
||||||
end
|
end
|
||||||
|
|
||||||
function os.native.access(name, mode)
|
function os.native.access(name, mode)
|
||||||
return ffi.C.access(name, mode)
|
return ffi.C.access(name, mode)
|
||||||
end
|
end
|
||||||
|
|
||||||
function os.native.realpath(name)
|
function os.native.realpath(name)
|
||||||
local path = ffi.C.realpath(name, buffer)
|
local path = ffi.C.realpath(name, buffer)
|
||||||
return (path ~= nil) and ffi.string(buffer) or nil
|
return (path ~= nil) and ffi.string(buffer) or nil
|
||||||
end
|
end
|
||||||
|
|
||||||
function os.native.getcwd()
|
function os.native.getcwd()
|
||||||
local hr = ffi.C.getcwd(buffer, 4099)
|
local hr = ffi.C.getcwd(buffer, 4099)
|
||||||
return hr ~= nil and ffi.string(buffer) or nil
|
return hr ~= nil and ffi.string(buffer) or nil
|
||||||
@ -412,6 +418,7 @@ if os.native.status then
|
|||||||
return math.floor(os.native.gettimeofday() * 1000)
|
return math.floor(os.native.gettimeofday() * 1000)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
os.native.init = true
|
os.native.init = true
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -446,7 +453,6 @@ function os.pwd()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- which executable
|
-- which executable
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -478,7 +484,6 @@ function os.path.which(exename)
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- absolute path (simulated)
|
-- absolute path (simulated)
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -487,7 +492,6 @@ function os.path.absolute(path)
|
|||||||
return os.path.normpath(os.path.join(pwd, path))
|
return os.path.normpath(os.path.join(pwd, path))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- absolute path (system call, can fall back to os.path.absolute)
|
-- absolute path (system call, can fall back to os.path.absolute)
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -543,7 +547,6 @@ function os.path.abspath(path)
|
|||||||
return os.path.absolute(path)
|
return os.path.absolute(path)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- dir exists
|
-- dir exists
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -570,7 +573,6 @@ function os.path.isdir(pathname)
|
|||||||
return os.path.exists(name)
|
return os.path.exists(name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- file or path exists
|
-- file or path exists
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -603,7 +605,6 @@ function os.path.exists(name)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- is absolute path
|
-- is absolute path
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -624,7 +625,6 @@ function os.path.isabs(path)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- normalize path
|
-- normalize path
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -638,7 +638,6 @@ function os.path.norm(pathname)
|
|||||||
return pathname
|
return pathname
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- normalize . and ..
|
-- normalize . and ..
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -683,7 +682,6 @@ function os.path.normpath(path)
|
|||||||
return path == '' and '.' or path
|
return path == '' and '.' or path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- join two path
|
-- join two path
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -744,7 +742,6 @@ function os.path.join(path1, path2)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- split
|
-- split
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -797,7 +794,6 @@ function os.path.split(path)
|
|||||||
return head, tail
|
return head, tail
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- check subdir
|
-- check subdir
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -818,7 +814,6 @@ function os.path.subdir(basename, subname)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- check single name element
|
-- check single name element
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -834,7 +829,6 @@ function os.path.single(path)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- expand user home
|
-- expand user home
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -862,14 +856,12 @@ function os.path.expand(pathname)
|
|||||||
return pathname
|
return pathname
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- search executable
|
-- search executable
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
function os.path.search(name)
|
function os.path.search(name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- get lua executable
|
-- get lua executable
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -892,7 +884,6 @@ function os.interpreter()
|
|||||||
return os.path.abspath(lua)
|
return os.path.abspath(lua)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- get script name
|
-- get script name
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -908,7 +899,6 @@ function os.scriptname()
|
|||||||
return os.path.abspath(script)
|
return os.path.abspath(script)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- get environ
|
-- get environ
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -943,7 +933,6 @@ function os.environ(name, default)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- parse option
|
-- parse option
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -985,7 +974,6 @@ function os.getopt(argv)
|
|||||||
return options, args
|
return options, args
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- generate random seed
|
-- generate random seed
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -1022,7 +1010,6 @@ function math.random_init()
|
|||||||
math.randomseed(number)
|
math.randomseed(number)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- math random string
|
-- math random string
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -1042,7 +1029,6 @@ function math.random_string(N)
|
|||||||
return text
|
return text
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- returns true for path is insensitive
|
-- returns true for path is insensitive
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -1059,7 +1045,6 @@ function path_case_insensitive()
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- load and split data
|
-- load and split data
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -1094,7 +1079,6 @@ function data_load(filename)
|
|||||||
return M
|
return M
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- save data
|
-- save data
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -1151,7 +1135,6 @@ function data_save(filename, M)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- filter out bad dirname
|
-- filter out bad dirname
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -1168,7 +1151,6 @@ function data_filter(M)
|
|||||||
return N
|
return N
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- insert item
|
-- insert item
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -1224,7 +1206,6 @@ function data_insert(M, filename)
|
|||||||
return M
|
return M
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- change database
|
-- change database
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -1232,7 +1213,6 @@ function data_file_set(name)
|
|||||||
DATA_FILE = name
|
DATA_FILE = name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- change pattern
|
-- change pattern
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -1251,7 +1231,6 @@ function case_insensitive_pattern(pattern)
|
|||||||
return p
|
return p
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- pathmatch
|
-- pathmatch
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -1286,7 +1265,6 @@ function path_match(pathname, patterns, matchlast)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- select matched pathnames
|
-- select matched pathnames
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -1310,7 +1288,6 @@ function data_select(M, patterns, matchlast)
|
|||||||
return N
|
return N
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- update frecent
|
-- update frecent
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -1333,7 +1310,6 @@ function data_update_frecent(M)
|
|||||||
return M
|
return M
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- add path
|
-- add path
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -1403,7 +1379,6 @@ function z_add(path)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- remove path
|
-- remove path
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -1447,7 +1422,6 @@ function z_remove(path)
|
|||||||
data_save(DATA_FILE, X)
|
data_save(DATA_FILE, X)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- match method: frecent, rank, time
|
-- match method: frecent, rank, time
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -1511,7 +1485,6 @@ function z_match(patterns, method, subdir)
|
|||||||
return M
|
return M
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- pretty print
|
-- pretty print
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -1574,7 +1547,6 @@ function z_print(M, weight, number)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- calculate jump dir
|
-- calculate jump dir
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -1667,7 +1639,6 @@ function z_cd(patterns)
|
|||||||
return (retval ~= '' and retval or nil)
|
return (retval ~= '' and retval or nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- purge invalid paths
|
-- purge invalid paths
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -1683,7 +1654,6 @@ function z_purge()
|
|||||||
return x, y
|
return x, y
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- find_vcs_root
|
-- find_vcs_root
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -1706,7 +1676,6 @@ function find_vcs_root(path)
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- cd to parent directories which contains keyword
|
-- cd to parent directories which contains keyword
|
||||||
-- #args == 0 -> returns to vcs root
|
-- #args == 0 -> returns to vcs root
|
||||||
@ -1775,7 +1744,6 @@ function cd_backward(args, options, pwd)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- cd minus: "z -", "z --", "z -2"
|
-- cd minus: "z -", "z --", "z -2"
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -1801,7 +1769,6 @@ function cd_minus(args, options)
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- cd breadcrumbs: z -b -i, z -b -I
|
-- cd breadcrumbs: z -b -i, z -b -I
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -1886,7 +1853,6 @@ function cd_breadcrumbs(pwd, interactive)
|
|||||||
return elements[index][2]
|
return elements[index][2]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- main entry
|
-- main entry
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -1987,7 +1953,6 @@ function main(argv)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- initialize from environment variable
|
-- initialize from environment variable
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -2060,7 +2025,6 @@ function z_init()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- initialize clink hooks
|
-- initialize clink hooks
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -2078,6 +2042,7 @@ function z_clink_init()
|
|||||||
end
|
end
|
||||||
z_add(clink.get_cwd())
|
z_add(clink.get_cwd())
|
||||||
end
|
end
|
||||||
|
|
||||||
clink.prompt.register_filter(z_add_to_database, _zl_clink_prompt_priority)
|
clink.prompt.register_filter(z_add_to_database, _zl_clink_prompt_priority)
|
||||||
function z_match_completion(word)
|
function z_match_completion(word)
|
||||||
local M = z_match({ word }, Z_METHOD, Z_SUBDIR)
|
local M = z_match({ word }, Z_METHOD, Z_SUBDIR)
|
||||||
@ -2086,6 +2051,7 @@ function z_clink_init()
|
|||||||
end
|
end
|
||||||
return {}
|
return {}
|
||||||
end
|
end
|
||||||
|
|
||||||
local z_parser = clink.arg.new_parser()
|
local z_parser = clink.arg.new_parser()
|
||||||
z_parser:set_arguments({ z_match_completion })
|
z_parser:set_arguments({ z_match_completion })
|
||||||
z_parser:set_flags("-c", "-r", "-i", "--cd", "-e", "-b", "--add", "-x", "--purge",
|
z_parser:set_flags("-c", "-r", "-i", "--cd", "-e", "-b", "--add", "-x", "--purge",
|
||||||
@ -2093,7 +2059,6 @@ function z_clink_init()
|
|||||||
clink.arg.register_parser("z", z_parser)
|
clink.arg.register_parser("z", z_parser)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- shell scripts
|
-- shell scripts
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -2343,7 +2308,6 @@ function z_shell_init(opts)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- Fish shell init
|
-- Fish shell init
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -2468,7 +2432,6 @@ function z_fish_init(opts)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- windows .cmd script
|
-- windows .cmd script
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -2694,7 +2657,6 @@ function z_windows_init(opts)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- help
|
-- help
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
@ -2713,7 +2675,6 @@ function z_help()
|
|||||||
print(cmd .. '-b foo # cd to the parent directory starting with foo')
|
print(cmd .. '-b foo # cd to the parent directory starting with foo')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
-- LFS optimize
|
-- LFS optimize
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
#!/bin/zsh
|
#!/bin/zsh
|
||||||
|
|
||||||
if [[ "$(tty)" = "/dev/tty1" ]]; then
|
if [[ '$(tty)' = '/dev/tty1' ]]; then
|
||||||
pgrep awesome || sx
|
pgrep awesome || sx
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,3 @@
|
|||||||
# clear
|
|
||||||
# cd ~
|
|
||||||
|
|
||||||
# Flex on ubuntu users
|
# Flex on ubuntu users
|
||||||
fastfetch
|
fastfetch
|
||||||
# pfetch
|
# pfetch
|
||||||
@ -38,8 +35,7 @@ _comp_options+=(globdots) # Include hidden file
|
|||||||
HISTFILE=~/.config/zsh/.zshistory
|
HISTFILE=~/.config/zsh/.zshistory
|
||||||
HISTSIZE=10000
|
HISTSIZE=10000
|
||||||
SAVEHIST=10000
|
SAVEHIST=10000
|
||||||
WORDCHARS=${WORDCHARS//\/[&.;]} # Don't consider certain part of the word
|
WORDCHARS=${WORDCHARS//\/[&.;]/} # Don't consider certain part of the word
|
||||||
|
|
||||||
|
|
||||||
# theme/plugins
|
# theme/plugins
|
||||||
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh 2>/dev/null
|
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh 2>/dev/null
|
||||||
@ -53,44 +49,42 @@ bindkey -e
|
|||||||
bindkey -v
|
bindkey -v
|
||||||
export KEYTIMEOUT=1
|
export KEYTIMEOUT=1
|
||||||
|
|
||||||
|
|
||||||
# Change cursor shape for different vi modes.
|
# Change cursor shape for different vi modes.
|
||||||
function zle-keymap-select {
|
function zle-keymap-select {
|
||||||
case $KEYMAP in
|
case $KEYMAP in
|
||||||
vicmd) echo -ne "\e[1 q";; # block
|
vicmd) echo -ne '\e[1 q' ;; # block
|
||||||
viins|main) echo -ne "\e[5 q";; # beam
|
viins | main) echo -ne '\e[5 q' ;; # beam
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
zle -N zle-keymap-select
|
zle -N zle-keymap-select
|
||||||
zle-line-init() {
|
zle-line-init() {
|
||||||
zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere)
|
zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere)
|
||||||
echo -ne "\e[5 q"
|
echo -ne '\e[5 q'
|
||||||
}
|
}
|
||||||
zle -N zle-line-init
|
zle -N zle-line-init
|
||||||
echo -ne "\e[5 q" # Use beam shape cursor on startup.
|
echo -ne '\e[5 q' # Use beam shape cursor on startup.
|
||||||
preexec() { echo -ne "\e[5 q" ;} # Use beam shape cursor for each new prompt.
|
preexec() { echo -ne '\e[5 q'; } # Use beam shape cursor for each new prompt.
|
||||||
|
|
||||||
|
|
||||||
|
# Run exa on directory change
|
||||||
function cd() {
|
function cd() {
|
||||||
new_directory="$*";
|
new_directory="$*"
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
new_directory=${HOME};
|
new_directory=${HOME}
|
||||||
fi;
|
fi
|
||||||
builtin cd "${new_directory}" && exa -a --icons --group-directories-first
|
builtin cd "${new_directory}" && exa -a --icons --group-directories-first
|
||||||
}
|
}
|
||||||
|
|
||||||
# Use lf to switch directories and bind it to ctrl-o
|
# Use lf to switch directories and bind it to ctrl-o
|
||||||
lfcd () {
|
function lfcd() {
|
||||||
tmp="$(mktemp)"
|
tmp="$(mktemp)"
|
||||||
lfrun -last-dir-path="$tmp" "$@"
|
lfrun -last-dir-path="$tmp" "$@"
|
||||||
if [ -f "$tmp" ]; then
|
if [ -f "$tmp" ]; then
|
||||||
dir="$(cat "$tmp")"
|
dir="$(bat "$tmp")"
|
||||||
rm -f "$tmp" >/dev/null
|
rm -f "$tmp" >/dev/null
|
||||||
[ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir"
|
[ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Navigate words with CTRL+ARROW keys
|
# Navigate words with CTRL+ARROW keys
|
||||||
bindkey '^[Oc' forward-word
|
bindkey '^[Oc' forward-word
|
||||||
bindkey '^[Od' backward-word
|
bindkey '^[Od' backward-word
|
||||||
@ -98,7 +92,7 @@ bindkey '^[[1;5C' forward-word
|
|||||||
bindkey '^[[1;5D' backward-word
|
bindkey '^[[1;5D' backward-word
|
||||||
bindkey '^H' backward-kill-word # delete previous word with CTRL+BACKSPACE
|
bindkey '^H' backward-kill-word # delete previous word with CTRL+BACKSPACE
|
||||||
bindkey '^[[Z' undo # SHIFT+TAB undo last action
|
bindkey '^[[Z' undo # SHIFT+TAB undo last action
|
||||||
bindkey "^[[3~" delete-char
|
bindkey '^[[3~' delete-char
|
||||||
|
|
||||||
bindkey '^[[A' history-substring-search-up
|
bindkey '^[[A' history-substring-search-up
|
||||||
bindkey '^[[B' history-substring-search-down
|
bindkey '^[[B' history-substring-search-down
|
||||||
@ -110,22 +104,23 @@ bindkey -M menuselect 'l' vi-forward-char
|
|||||||
bindkey -M menuselect 'j' vi-down-line-or-history
|
bindkey -M menuselect 'j' vi-down-line-or-history
|
||||||
bindkey -v '^?' backward-delete-char
|
bindkey -v '^?' backward-delete-char
|
||||||
|
|
||||||
bindkey -s "^o" "^ulfcd\n"
|
bindkey -s '^o' '^ulfcd\n'
|
||||||
bindkey -s "^a" "ubc -lq\n"
|
# bindkey -s '^a' 'ubc -lq\n'
|
||||||
bindkey "^[[P" delete-char
|
bindkey '^[[P' delete-char
|
||||||
|
|
||||||
# Edit line in vim with ctrl-e
|
# Edit line in vim with ctrl-e
|
||||||
autoload edit-command-line; zle -N edit-command-line
|
autoload edit-command-line
|
||||||
bindkey "^e" edit-command-line
|
zle -N edit-command-line
|
||||||
bindkey -M vicmd "^[[P" vi-delete-char
|
bindkey '^e' edit-command-line
|
||||||
bindkey -M vicmd "^e" edit-command-line
|
bindkey -M vicmd '^[[P' vi-delete-char
|
||||||
bindkey -M visual "^[[P" vi-delete
|
bindkey -M vicmd '^e' edit-command-line
|
||||||
|
bindkey -M visual '^[[P' vi-delete
|
||||||
|
|
||||||
# Aliases
|
# Aliases
|
||||||
alias cp='cp -iv' # Confirm before overwriting something
|
alias cp='cp -iv' # Confirm before overwriting something
|
||||||
alias mv="mv -iv"
|
alias mv='mv -iv'
|
||||||
alias rm="rm -vI"
|
alias rm='rm -vI'
|
||||||
alias mkdir="mkdir -pv"
|
alias mkdir='mkdir -pv'
|
||||||
alias df='df -h' # Human-readable sizes
|
alias df='df -h' # Human-readable sizes
|
||||||
alias free='free -m' # Show sizes in MB
|
alias free='free -m' # Show sizes in MB
|
||||||
alias gitu='git add . && git commit && git push'
|
alias gitu='git add . && git commit && git push'
|
||||||
@ -138,18 +133,18 @@ alias pman='doas pacman'
|
|||||||
alias battery='acpi'
|
alias battery='acpi'
|
||||||
alias airpods='bluetoothctl connect C8:B1:CD:E0:14:4F'
|
alias airpods='bluetoothctl connect C8:B1:CD:E0:14:4F'
|
||||||
alias weather='curl wttr.in/'
|
alias weather='curl wttr.in/'
|
||||||
alias ww="nvim ~/vimwiki/index.wiki"
|
alias ww='nvim ~/vimwiki/index.wiki'
|
||||||
alias py="python"
|
alias py='python'
|
||||||
alias grep="grep --color=auto"
|
alias grep='grep --color=auto'
|
||||||
alias diff="diff --color=auto"
|
alias diff='diff --color=auto'
|
||||||
alias ip="ip -color=auto"
|
alias ip='ip -color=auto'
|
||||||
alias grep="rg"
|
alias grep='rg'
|
||||||
alias code="vscodium"
|
alias code='vscodium'
|
||||||
|
|
||||||
|
|
||||||
source /usr/share/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh 2>/dev/null
|
source /usr/share/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh 2>/dev/null
|
||||||
|
|
||||||
autoload -U promptinit; promptinit
|
autoload -U promptinit
|
||||||
|
promptinit
|
||||||
prompt spaceship
|
prompt spaceship
|
||||||
|
|
||||||
# PROMPT
|
# PROMPT
|
||||||
@ -225,4 +220,3 @@ SPACESHIP_VENV_SHOW=true
|
|||||||
SPACESHIP_CONDA_SHOW=false
|
SPACESHIP_CONDA_SHOW=false
|
||||||
SPACESHIP_PYENV_SHOW=true
|
SPACESHIP_PYENV_SHOW=true
|
||||||
SPACESHIP_VI_MODE_SHOW=false
|
SPACESHIP_VI_MODE_SHOW=false
|
||||||
|
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1 @@
|
|||||||
vscodium/extensions
|
|
||||||
|
|||||||
@ -11,6 +11,6 @@
|
|||||||
- All configs that can be in `~/.config/` are.
|
- All configs that can be in `~/.config/` are.
|
||||||
- Some environmental variables have been set in `~/.zprofile` to move configs into `~/.config/`
|
- Some environmental variables have been set in `~/.zprofile` to move configs into `~/.config/`
|
||||||
|
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
|
|
||||||
- [lfimg by cirala](https://github.com/cirala/lfimg)
|
- [lfimg by cirala](https://github.com/cirala/lfimg)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user