new file: desktop/mpv/scripts/keymap-viewer.lua
This commit is contained in:
@@ -132,10 +132,10 @@ device {
|
||||
|
||||
## special window rules
|
||||
windowrule = suppress_event maximize, match:class .* # You'll probably like this.
|
||||
windowrule = no_screen_share on, match:class ^(Bitwarden)$
|
||||
windowrule = no_screen_share on, match:class ^(Bitwarden)$, match:class ^(Nemo)$
|
||||
windowrule = float on, size 413 689, match:class ^(io.bassi.Amberol)$
|
||||
windowrule = float on, match:class ^(qalculate-gtk)$, match:title ^(Qalculate!)$
|
||||
windowrule = tile on, workspace 10, match:class ^(affinity.exe)$
|
||||
# windowrule = tile on, workspace 10, match:class ^(affinity.exe)$
|
||||
|
||||
$mainMod = SUPER
|
||||
|
||||
|
||||
+26
-34
@@ -3,18 +3,10 @@
|
||||
###########
|
||||
# GPU API #
|
||||
###########
|
||||
# Controls which type of graphics APIs will be accepted, switch to "d3d11" (on Windows) or "opengl" if you have issues
|
||||
# Uncomment one API only
|
||||
|
||||
###### Vulkan Linux, Windows (preferred)
|
||||
gpu-api=vulkan
|
||||
|
||||
###### DirectX on Windows
|
||||
# gpu-api=d3d11
|
||||
|
||||
###### OpenGL on Linux or macOS or Windows
|
||||
# gpu-api=opengl
|
||||
|
||||
##########
|
||||
# Player #
|
||||
##########
|
||||
@@ -37,7 +29,7 @@ cursor-autohide=100 # Cursor hide in ms
|
||||
###############
|
||||
|
||||
screenshot-template="%x/Screens/Screenshot-%F-T%wH.%wM.%wS.%wT-F%{estimated-frame-number}"
|
||||
screenshot-format=png # Set screenshot format
|
||||
screenshot-format=png # Set screenshot format
|
||||
screenshot-png-compression=4 # Range is 0 to 10. 0 being no compression.
|
||||
screenshot-tag-colorspace=yes
|
||||
screenshot-high-bit-depth=yes # Same output bitdepth as the video
|
||||
@@ -46,32 +38,32 @@ screenshot-high-bit-depth=yes # Same output bitdepth as the video
|
||||
# OSC/OSD #
|
||||
###########
|
||||
|
||||
osc=no # 'no' required for MordernX OSC
|
||||
osd-bar=yes # Do not remove/comment if mpv_thumbnail_script_client_osc.lua is being used.
|
||||
osc=no # 'no' required for MordernX OSC
|
||||
osd-bar=yes # Do not remove/comment if mpv_thumbnail_script_client_osc.lua is being used.
|
||||
osd-font='Inter Tight Medium' # Set a font for OSC
|
||||
osd-font-size=30 # Set a font size
|
||||
osd-color='#CCFFFFFF' # ARGB format
|
||||
osd-font-size=30 # Set a font size
|
||||
osd-color='#CCFFFFFF' # ARGB format
|
||||
osd-border-color='#DD322640' # ARGB format
|
||||
osd-bar-align-y=-1 # progress bar y alignment (-1 top, 0 centered, 1 bottom)
|
||||
osd-border-size=2 # size for osd text and progress bar
|
||||
osd-bar-h=1 # height of osd bar as a fractional percentage of your screen height
|
||||
osd-bar-w=60 # width of " " "
|
||||
osd-bar-align-y=-1 # progress bar y alignment (-1 top, 0 centered, 1 bottom)
|
||||
osd-border-size=2 # size for osd text and progress bar
|
||||
osd-bar-h=1 # height of osd bar as a fractional percentage of your screen height
|
||||
osd-bar-w=60 # width of " " "
|
||||
|
||||
########
|
||||
# Subs #
|
||||
########
|
||||
|
||||
blend-subtitles=no
|
||||
sub-ass-scale-with-window=no # May have undesired effects with signs being misplaced.
|
||||
sub-ass-scale-with-window=no # May have undesired effects with signs being misplaced.
|
||||
sub-auto=fuzzy # external subs don't have to match the file name exactly to autoload
|
||||
# sub-gauss=0.6 # Some settings fixing VOB/PGS subtitles (creating blur & changing yellow subs to gray)
|
||||
# sub-gauss=0.6 # Some settings fixing VOB/PGS subtitles (creating blur & changing yellow subs to gray)
|
||||
sub-file-paths-append=ass # search for external subs in these relative subdirectories
|
||||
sub-file-paths-append=srt
|
||||
sub-file-paths-append=sub
|
||||
sub-file-paths-append=subs
|
||||
sub-file-paths-append=subtitles
|
||||
demuxer-mkv-subtitle-preroll=yes # try to correctly show embedded subs when seeking
|
||||
embeddedfonts=yes # use embedded fonts for SSA/ASS subs
|
||||
embeddedfonts=yes # use embedded fonts for SSA/ASS subs
|
||||
sub-fix-timing=no # do not try to fix gaps (which might make it worse in some cases). Enable if there are scenebleeds.
|
||||
|
||||
# Subs - Forced #
|
||||
@@ -92,32 +84,32 @@ sub-shadow-offset=0
|
||||
#########
|
||||
ao=alsa
|
||||
audio-device=auto
|
||||
volume-max=200 # maximum volume in %, everything above 100 results in amplification
|
||||
audio-stream-silence # fix audio popping on random seek
|
||||
audio-file-auto=fuzzy # external audio doesn't has to match the file name exactly to autoload
|
||||
audio-pitch-correction=yes # automatically insert scaletempo when playing with higher speed
|
||||
volume-max=200 # maximum volume in %, everything above 100 results in amplification
|
||||
audio-stream-silence # fix audio popping on random seek
|
||||
audio-file-auto=fuzzy # external audio doesn't has to match the file name exactly to autoload
|
||||
audio-pitch-correction=yes # automatically insert scaletempo when playing with higher speed
|
||||
|
||||
# Languages #
|
||||
alang=jpn,jp,eng,en,enUS,en-US,de,ger # Audio language priority
|
||||
slang=eng,en,und,de,ger,jp,jap # Subtitle language priority
|
||||
slang=eng,en,und,de,ger,jp,jap # Subtitle language priority
|
||||
|
||||
##################
|
||||
# Video Profiles #
|
||||
##################
|
||||
|
||||
profile=gpu-hq # mpv --show-profile=gpu-hq
|
||||
hwdec=auto-copy # enable hardware decoding, defaults to 'no'
|
||||
vo=gpu-next # GPU-Next: https://github.com/mpv-player/mpv/wiki/GPU-Next-vs-GPU
|
||||
profile=high-quality # mpv --show-profile=gpu-hq
|
||||
hwdec=auto-copy # enable hardware decoding, defaults to 'no'
|
||||
vo=gpu-next # GPU-Next: https://github.com/mpv-player/mpv/wiki/GPU-Next-vs-GPU
|
||||
|
||||
####### Dither
|
||||
#dither-depth=auto
|
||||
dither-depth=auto
|
||||
|
||||
####### Debanding
|
||||
#deband=yes
|
||||
#deband-iterations=4
|
||||
#deband-threshold=35
|
||||
#deband-range=16
|
||||
#deband-grain=4
|
||||
deband=yes
|
||||
deband-iterations=4
|
||||
deband-threshold=35
|
||||
deband-range=16
|
||||
deband-grain=4
|
||||
|
||||
####### Luma up (uncomment one shader line only) See: https://artoriuz.github.io/blog/mpv_upscaling.html
|
||||
glsl-shader="~/.config/mpv/shaders/ravu-zoom-ar-r3-rgb.hook" # good balance between performance and quality
|
||||
|
||||
@@ -0,0 +1,406 @@
|
||||
-- keymap-viewer.lua
|
||||
-- Telescope-style keybinding viewer for mpv
|
||||
-- Default trigger: F12 (override with: script-opts=keymap-viewer-key=<key>)
|
||||
|
||||
local mp = require 'mp'
|
||||
local opts = require 'mp.options'
|
||||
|
||||
local cfg = {
|
||||
key = '?',
|
||||
max_visible = 20,
|
||||
font = 'monospace',
|
||||
font_size = 13,
|
||||
}
|
||||
opts.read_options(cfg, 'keymap-viewer')
|
||||
|
||||
-- ── state ────────────────────────────────────────────────────────────────────
|
||||
|
||||
local ov = mp.create_osd_overlay('ass-events')
|
||||
|
||||
local st = {
|
||||
active = false,
|
||||
query = '',
|
||||
sel = 1,
|
||||
offset = 0,
|
||||
all = {},
|
||||
list = {}, -- filtered
|
||||
}
|
||||
|
||||
-- ── helpers ───────────────────────────────────────────────────────────────────
|
||||
|
||||
local function esc_ass(s)
|
||||
return tostring(s):gsub('\\', '\\\\'):gsub('{', '\\{'):gsub('}', '\\}')
|
||||
end
|
||||
|
||||
local function pad(s, n)
|
||||
s = tostring(s)
|
||||
if #s >= n then return s:sub(1, n-1) .. '…' end
|
||||
return s .. string.rep(' ', n - #s)
|
||||
end
|
||||
|
||||
-- Make the command column human-readable
|
||||
local function format_cmd(cmd)
|
||||
-- strip leading flags like "nonscalable", "no-osd", "osd-auto"
|
||||
cmd = cmd:gsub('^%s*nonscalable%s+', '')
|
||||
cmd = cmd:gsub('^%s*no%-osd%s+', '')
|
||||
cmd = cmd:gsub('^%s*osd%-[a-z]+%s+', '')
|
||||
|
||||
-- script-binding owner/action → just the action, humanised
|
||||
local action = cmd:match('^script%-binding%s+[^/%s]+/(.+)$')
|
||||
if action then
|
||||
-- skip auto-generated names like __keybinding3
|
||||
if action:match('^__') then return cmd end
|
||||
-- underscores/hyphens → spaces, split camelCase, lowercase
|
||||
action = action:gsub('[_%-]', ' ')
|
||||
action = action:gsub('(%l)(%u)', '%1 %2')
|
||||
return action:lower()
|
||||
end
|
||||
|
||||
-- script-message-to script toggle-foo → toggle foo
|
||||
local msg = cmd:match('^script%-message%-to%s+%S+%s+(.+)$')
|
||||
if msg then
|
||||
return msg:gsub('[_%-]', ' '):lower()
|
||||
end
|
||||
|
||||
-- script-message toggle-foo
|
||||
local smsg = cmd:match('^script%-message%s+(.+)$')
|
||||
if smsg then
|
||||
return smsg:gsub('[_%-]', ' '):lower()
|
||||
end
|
||||
|
||||
return cmd
|
||||
end
|
||||
|
||||
-- ── data ──────────────────────────────────────────────────────────────────────
|
||||
|
||||
-- Read input.conf to know which keys the user has explicitly bound
|
||||
local function user_defined_keys()
|
||||
local keys = {}
|
||||
local path = mp.find_config_file('input.conf')
|
||||
if not path then return keys end
|
||||
local f = io.open(path, 'r')
|
||||
if not f then return keys end
|
||||
for line in f:lines() do
|
||||
-- skip blank lines and comment-only lines
|
||||
local key = line:match('^%s*([^%s#][^%s]*)')
|
||||
if key then keys[key] = true end
|
||||
end
|
||||
f:close()
|
||||
return keys
|
||||
end
|
||||
|
||||
-- Priority: 0 = script, 1 = user input.conf, 2 = mpv default
|
||||
local function binding_priority(b, user_keys)
|
||||
if b.owner and b.owner ~= '' and b.owner ~= 'default' then
|
||||
return 0 -- registered by a script
|
||||
end
|
||||
if user_keys[b.key] then
|
||||
return 1 -- explicitly set in input.conf
|
||||
end
|
||||
return 2 -- built-in default
|
||||
end
|
||||
|
||||
local function collect()
|
||||
local raw = mp.get_property_native('input-bindings') or {}
|
||||
local user_keys = user_defined_keys()
|
||||
local out = {}
|
||||
for _, b in ipairs(raw) do
|
||||
local cmd = b.cmd or ''
|
||||
if cmd ~= '' and cmd ~= 'ignore' and not cmd:match('^%s*#') then
|
||||
local owner = b.owner or ''
|
||||
out[#out+1] = {
|
||||
key = b.key or '',
|
||||
cmd = cmd,
|
||||
owner = owner ~= '' and owner or 'default',
|
||||
section = b.section or '',
|
||||
priority = binding_priority(
|
||||
{owner = owner, key = b.key or ''},
|
||||
user_keys
|
||||
),
|
||||
}
|
||||
end
|
||||
end
|
||||
table.sort(out, function(a, b)
|
||||
if a.priority ~= b.priority then return a.priority < b.priority end
|
||||
return a.key < b.key
|
||||
end)
|
||||
return out
|
||||
end
|
||||
|
||||
local function apply_filter(q)
|
||||
if q == '' then return st.all end
|
||||
local lq = q:lower()
|
||||
local res = {}
|
||||
for _, b in ipairs(st.all) do
|
||||
if b.key:lower():find(lq, 1, true)
|
||||
or b.cmd:lower():find(lq, 1, true)
|
||||
or b.owner:lower():find(lq, 1, true)
|
||||
then
|
||||
res[#res+1] = b
|
||||
end
|
||||
end
|
||||
return res
|
||||
end
|
||||
|
||||
-- ── rendering ─────────────────────────────────────────────────────────────────
|
||||
|
||||
local COL_KEY = 20
|
||||
local COL_CMD = 52
|
||||
local COL_OWN = 18
|
||||
|
||||
local function clamp_scroll()
|
||||
local n = cfg.max_visible
|
||||
local idx = st.sel
|
||||
if idx < st.offset + 1 then st.offset = idx - 1 end
|
||||
if idx > st.offset + n then st.offset = idx - n end
|
||||
local max_off = math.max(0, #st.list - n)
|
||||
st.offset = math.min(math.max(st.offset, 0), max_off)
|
||||
end
|
||||
|
||||
-- Draw a filled rectangle using ASS vector drawing
|
||||
local function make_rect(x1, y1, x2, y2, color_hex, alpha_hex)
|
||||
-- alpha_hex: '00'=opaque … 'FF'=invisible
|
||||
return string.format(
|
||||
'{\\an7\\pos(0,0)\\p1\\c&H%s&\\1a&H%s&\\3a&HFF&\\4a&HFF&\\bord0\\shad0}' ..
|
||||
'm %d %d l %d %d l %d %d l %d %d{\\p0}',
|
||||
color_hex, alpha_hex,
|
||||
x1, y1, x2, y1, x2, y2, x1, y2
|
||||
)
|
||||
end
|
||||
|
||||
local function render()
|
||||
-- Fix coordinate space so positions are predictable regardless of video res
|
||||
ov.res_x = 1280
|
||||
ov.res_y = 720
|
||||
|
||||
local lines = {}
|
||||
local x, y = 32, 20
|
||||
local f = cfg.font
|
||||
local fs = cfg.font_size
|
||||
local row_h = fs + 4
|
||||
|
||||
-- Pre-calculate total panel height
|
||||
local n_shown = math.min(cfg.max_visible, math.max(1, #st.list))
|
||||
local panel_h = 28 + 24 + 22 + 14 + (n_shown * row_h) + 24 + 16
|
||||
local panel_x1 = 16
|
||||
local panel_y1 = 10
|
||||
local panel_x2 = 960
|
||||
local panel_y2 = panel_y1 + panel_h
|
||||
|
||||
-- ── background ──
|
||||
-- Outer dark panel
|
||||
lines[#lines+1] = make_rect(panel_x1, panel_y1, panel_x2, panel_y2, '0D0D0D', '00')
|
||||
-- Top accent bar
|
||||
lines[#lines+1] = make_rect(panel_x1, panel_y1, panel_x2, panel_y1 + 3, '00CCCC', '00')
|
||||
-- Thin border around panel
|
||||
lines[#lines+1] = make_rect(panel_x1, panel_y1, panel_x2, panel_y1 + 1, '333333', '00')
|
||||
lines[#lines+1] = make_rect(panel_x1, panel_y2 - 1, panel_x2, panel_y2, '333333', '00')
|
||||
lines[#lines+1] = make_rect(panel_x1, panel_y1, panel_x1 + 1, panel_y2, '333333', '00')
|
||||
lines[#lines+1] = make_rect(panel_x2 - 1, panel_y1, panel_x2, panel_y2, '333333', '00')
|
||||
|
||||
-- ── header ──
|
||||
lines[#lines+1] = string.format(
|
||||
'{\\an7\\pos(%d,%d)\\fn%s\\fs%d\\bord0\\shad0\\c&H00CCCC&\\b1}⌨ MPV Keymaps' ..
|
||||
'{\\b0\\c&H666666&} %d / %d',
|
||||
x, y, f, fs + 4, #st.list, #st.all
|
||||
)
|
||||
|
||||
-- ── search bar ──
|
||||
y = y + 26
|
||||
-- Search bg highlight
|
||||
lines[#lines+1] = make_rect(panel_x1 + 1, y - 4, panel_x2 - 1, y + fs + 4, '1A1A1A', '00')
|
||||
local cursor = '{\\c&H00CCCC&}▌{\\c&HFFFFFF&}'
|
||||
local qdisp = st.query ~= '' and esc_ass(st.query)
|
||||
or '{\\c&H444444&}type to search…{\\c&HFFFFFF&}'
|
||||
lines[#lines+1] = string.format(
|
||||
'{\\an7\\pos(%d,%d)\\fn%s\\fs%d\\bord0\\shad0\\c&HFFFFFF&}/ %s%s',
|
||||
x, y, f, fs, qdisp, cursor
|
||||
)
|
||||
|
||||
-- ── column headers ──
|
||||
y = y + 24
|
||||
lines[#lines+1] = string.format(
|
||||
'{\\an7\\pos(%d,%d)\\fn%s\\fs%d\\bord0\\shad0\\c&H555555&\\b1}%-' ..
|
||||
COL_KEY .. 's %-' .. COL_CMD .. 's %s{\\b0}',
|
||||
x, y, f, fs - 2,
|
||||
'KEY', 'COMMAND', 'OWNER'
|
||||
)
|
||||
-- Separator line under headers
|
||||
y = y + 12
|
||||
lines[#lines+1] = make_rect(panel_x1 + 1, y, panel_x2 - 1, y + 1, '2A2A2A', '00')
|
||||
|
||||
-- ── entries ──
|
||||
y = y + 8
|
||||
clamp_scroll()
|
||||
|
||||
if #st.list == 0 then
|
||||
lines[#lines+1] = string.format(
|
||||
'{\\an7\\pos(%d,%d)\\fn%s\\fs%d\\bord0\\shad0\\c&H555555&} (no matches)',
|
||||
x, y, f, fs
|
||||
)
|
||||
y = y + row_h
|
||||
else
|
||||
local vis_end = math.min(st.offset + cfg.max_visible, #st.list)
|
||||
for i = st.offset + 1, vis_end do
|
||||
local b = st.list[i]
|
||||
local sel = (i == st.sel)
|
||||
|
||||
local key_s = esc_ass(pad(b.key, COL_KEY))
|
||||
local cmd_s = esc_ass(pad(format_cmd(b.cmd), COL_CMD))
|
||||
local own_s = esc_ass(b.owner)
|
||||
|
||||
if sel then
|
||||
-- Selection highlight row
|
||||
lines[#lines+1] = make_rect(panel_x1 + 1, y - 2, panel_x2 - 1, y + fs + 2, '1E3A3A', '00')
|
||||
lines[#lines+1] = make_rect(panel_x1 + 1, y - 2, panel_x1 + 3, y + fs + 2, '00CCCC', '00')
|
||||
lines[#lines+1] = string.format(
|
||||
'{\\an7\\pos(%d,%d)\\fn%s\\fs%d\\bord0\\shad0}' ..
|
||||
'{\\c&H00CCCC&\\b1}%s{\\b0} {\\c&HFFFFFF&}%s {\\c&H44BB77&}%s',
|
||||
x + 4, y, f, fs, key_s, cmd_s, own_s
|
||||
)
|
||||
else
|
||||
lines[#lines+1] = string.format(
|
||||
'{\\an7\\pos(%d,%d)\\fn%s\\fs%d\\bord0\\shad0}' ..
|
||||
'{\\c&HAAAA00&}%s{\\c&H999999&} %s {\\c&H444444&}%s',
|
||||
x + 4, y, f, fs, key_s, cmd_s, own_s
|
||||
)
|
||||
end
|
||||
y = y + row_h
|
||||
end
|
||||
end
|
||||
|
||||
-- ── scrollbar ──
|
||||
if #st.list > cfg.max_visible then
|
||||
local entries_y0 = panel_y1 + 28 + 24 + 22 + 14 + 8
|
||||
local track_h = cfg.max_visible * row_h
|
||||
local frac = st.offset / math.max(1, #st.list - cfg.max_visible)
|
||||
local thumb_h = math.max(8, math.floor(track_h * cfg.max_visible / #st.list))
|
||||
local thumb_y = entries_y0 + math.floor(frac * (track_h - thumb_h))
|
||||
-- Track
|
||||
lines[#lines+1] = make_rect(panel_x2 - 8, entries_y0, panel_x2 - 3, entries_y0 + track_h, '222222', '00')
|
||||
-- Thumb
|
||||
lines[#lines+1] = make_rect(panel_x2 - 8, thumb_y, panel_x2 - 3, thumb_y + thumb_h, '00CCCC', '00')
|
||||
end
|
||||
|
||||
-- ── footer ──
|
||||
y = y + 6
|
||||
lines[#lines+1] = make_rect(panel_x1 + 1, y - 4, panel_x2 - 1, panel_y2 - 1, '111111', '00')
|
||||
lines[#lines+1] = string.format(
|
||||
'{\\an7\\pos(%d,%d)\\fn%s\\fs9\\bord0\\shad0\\c&H505050&}' ..
|
||||
'↑↓ / PgUp PgDn navigate Enter execute BS delete char Esc / q close',
|
||||
x, y, f
|
||||
)
|
||||
|
||||
ov.data = table.concat(lines, '\n')
|
||||
ov:update()
|
||||
end
|
||||
|
||||
-- ── actions ───────────────────────────────────────────────────────────────────
|
||||
|
||||
-- Track which binding names we registered so we can clean up
|
||||
local bound_names = {}
|
||||
|
||||
local function bind(key, name, fn)
|
||||
bound_names[#bound_names+1] = name
|
||||
mp.add_forced_key_binding(key, name, fn)
|
||||
end
|
||||
|
||||
local function search_update(extra_char, delete)
|
||||
if delete then
|
||||
if #st.query > 0 then
|
||||
st.query = st.query:sub(1, -2)
|
||||
end
|
||||
elseif extra_char then
|
||||
st.query = st.query .. extra_char
|
||||
end
|
||||
st.sel = 1
|
||||
st.offset = 0
|
||||
st.list = apply_filter(st.query)
|
||||
render()
|
||||
end
|
||||
|
||||
local function close_viewer()
|
||||
if not st.active then return end
|
||||
st.active = false
|
||||
ov:remove()
|
||||
for _, name in ipairs(bound_names) do
|
||||
mp.remove_key_binding(name)
|
||||
end
|
||||
bound_names = {}
|
||||
end
|
||||
|
||||
local function execute()
|
||||
if #st.list == 0 then return end
|
||||
local cmd = st.list[st.sel].cmd
|
||||
close_viewer()
|
||||
mp.add_timeout(0.04, function() mp.command(cmd) end)
|
||||
end
|
||||
|
||||
local function open_viewer()
|
||||
if st.active then close_viewer(); return end
|
||||
st.active = true
|
||||
st.query = ''
|
||||
st.sel = 1
|
||||
st.offset = 0
|
||||
st.all = collect()
|
||||
st.list = st.all
|
||||
bound_names = {}
|
||||
|
||||
-- Navigation
|
||||
bind('UP', 'kv-up', function()
|
||||
if st.sel > 1 then st.sel = st.sel - 1; render() end
|
||||
end)
|
||||
bind('DOWN', 'kv-down', function()
|
||||
if st.sel < #st.list then st.sel = st.sel + 1; render() end
|
||||
end)
|
||||
bind('PGUP', 'kv-pgup', function()
|
||||
st.sel = math.max(1, st.sel - cfg.max_visible); render()
|
||||
end)
|
||||
bind('PGDWN', 'kv-pgdn', function()
|
||||
st.sel = math.min(#st.list, st.sel + cfg.max_visible); render()
|
||||
end)
|
||||
bind('ENTER', 'kv-enter', execute)
|
||||
bind('ESC', 'kv-esc', close_viewer)
|
||||
bind('q', 'kv-q', close_viewer)
|
||||
bind('BS', 'kv-bs', function() search_update(nil, true) end)
|
||||
bind('Ctrl+h', 'kv-ch', function() search_update(nil, true) end)
|
||||
|
||||
-- Printable characters → search
|
||||
local chars_lower = 'abcdefghijklmnopqrstuvwxyz'
|
||||
local chars_upper = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||
local chars_digit = '0123456789'
|
||||
|
||||
for i = 1, #chars_lower do
|
||||
local c = chars_lower:sub(i, i)
|
||||
bind(c, 'kv-l'..c, function() search_update(c) end)
|
||||
end
|
||||
for i = 1, #chars_upper do
|
||||
local C = chars_upper:sub(i, i)
|
||||
bind(C, 'kv-u'..C, function() search_update(C) end)
|
||||
end
|
||||
for i = 1, #chars_digit do
|
||||
local d = chars_digit:sub(i, i)
|
||||
bind(d, 'kv-d'..d, function() search_update(d) end)
|
||||
end
|
||||
|
||||
local syms = {
|
||||
{'SPACE', ' '},
|
||||
{'KP_DEC', '.'},
|
||||
{'-', '-'},
|
||||
{'_', '_'},
|
||||
{'.', '.'},
|
||||
{'/', '/'},
|
||||
{':', ':'},
|
||||
{';', ';'},
|
||||
{'Shift+SPACE',' '},
|
||||
}
|
||||
for _, pair in ipairs(syms) do
|
||||
local key, char = pair[1], pair[2]
|
||||
bind(key, 'kv-sym'..string.byte(char)..key, function() search_update(char) end)
|
||||
end
|
||||
|
||||
render()
|
||||
end
|
||||
|
||||
mp.add_key_binding(cfg.key, 'keymap-viewer', open_viewer)
|
||||
mp.msg.info('keymap-viewer loaded — press ' .. cfg.key .. ' to open')
|
||||
+149
-168
@@ -1,19 +1,17 @@
|
||||
require('plugins')
|
||||
require("plugins")
|
||||
-- General settings
|
||||
require('options')
|
||||
require("options")
|
||||
-- keymaps
|
||||
require('keymaps')
|
||||
|
||||
require("keymaps")
|
||||
|
||||
-- Luasnip
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
-- Code runners
|
||||
require('coderun')
|
||||
require("coderun")
|
||||
--plugin short settings
|
||||
require('pluginSettings')
|
||||
require('lspConfig')
|
||||
require('cmpConf')
|
||||
|
||||
require("pluginSettings")
|
||||
require("lspConfig")
|
||||
require("cmpConf")
|
||||
|
||||
--############
|
||||
-- # Autorun #
|
||||
@@ -21,230 +19,213 @@ require('cmpConf')
|
||||
|
||||
-- remove_trailing_whitespace on save
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
require('functions').remove_trailing_whitespace()
|
||||
end,
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
require("functions").remove_trailing_whitespace()
|
||||
end,
|
||||
})
|
||||
|
||||
-- treat qss as css
|
||||
vim.api.nvim_create_autocmd({"BufNewFile", "BufRead"}, {
|
||||
pattern = "*.qss",
|
||||
command = "set filetype=css"
|
||||
vim.api.nvim_create_autocmd({ "BufNewFile", "BufRead" }, {
|
||||
pattern = "*.qss",
|
||||
command = "set filetype=css",
|
||||
})
|
||||
|
||||
|
||||
|
||||
-- set spelling on these files
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "markdown", "text" },
|
||||
callback = function()
|
||||
vim.opt_local.spell = true
|
||||
end,
|
||||
pattern = { "markdown", "text" },
|
||||
callback = function()
|
||||
vim.opt_local.spell = true
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
vim.api.nvim_create_autocmd("TextYankPost", {
|
||||
callback = function()
|
||||
vim.highlight.on_yank()
|
||||
end,
|
||||
callback = function()
|
||||
vim.highlight.on_yank()
|
||||
end,
|
||||
})
|
||||
|
||||
-- Auto-open the preview window whenever Oil finishes rendering
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "OilEnter",
|
||||
callback = function()
|
||||
require("oil").open_preview()
|
||||
end,
|
||||
pattern = "OilEnter",
|
||||
callback = function()
|
||||
require("oil").open_preview()
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
--############
|
||||
--# setup #
|
||||
--###########
|
||||
|
||||
|
||||
-- telescope
|
||||
require("telescope").setup {
|
||||
extensions = {
|
||||
["ui-select"] = {
|
||||
require("telescope.themes").get_dropdown {
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
require("telescope").setup({
|
||||
extensions = {
|
||||
["ui-select"] = {
|
||||
require("telescope.themes").get_dropdown({}),
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
require("telescope").load_extension("ui-select")
|
||||
|
||||
|
||||
-- ''''''''''Splash''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||
require('customSplash')
|
||||
require("customSplash")
|
||||
|
||||
--''''''''''''''''''''''''My snippets''''''''''''''''''''''''''''''''''
|
||||
require("lsnip")
|
||||
|
||||
--"''''''''''''''''''nvim-colorizer'''''''''''''''''''''''''''''''''''''
|
||||
require'colorizer'.setup()
|
||||
require("colorizer").setup()
|
||||
-- this is an autocomand to force colorizer to attach to some files
|
||||
vim.api.nvim_exec([[
|
||||
vim.api.nvim_exec(
|
||||
[[
|
||||
augroup ColorizerAttach
|
||||
autocmd!
|
||||
autocmd BufRead,BufNewFile *.config,*.rasi,*.conf,*.qss,*.css :ColorizerAttachToBuffer
|
||||
augroup END
|
||||
]], false)
|
||||
]],
|
||||
false
|
||||
)
|
||||
|
||||
--'''''''''''''' Theme ''''''''''''''''''''''''''''''''''''''''''''''''
|
||||
local function force_backgraund(color)
|
||||
color = color or "catppuccin-mocha"
|
||||
vim.cmd.colorscheme(color)
|
||||
color = color or "catppuccin-mocha"
|
||||
vim.cmd.colorscheme(color)
|
||||
|
||||
vim.api.nvim_set_hl(0, "Normal",{bg = "none"} )
|
||||
vim.api.nvim_set_hl(0, "NormalFloat",{bg = "none"} )
|
||||
vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
|
||||
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })
|
||||
end
|
||||
force_backgraund()
|
||||
|
||||
|
||||
--"''''''''Neotree''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||
require("neo-tree").setup({
|
||||
close_if_last_window = true,
|
||||
filesystem = {
|
||||
hijack_netrw_behavior = "disabled"
|
||||
},
|
||||
window = {
|
||||
width = 25
|
||||
},
|
||||
close_if_last_window = true,
|
||||
filesystem = {
|
||||
hijack_netrw_behavior = "disabled",
|
||||
},
|
||||
window = {
|
||||
width = 25,
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
--'''''''''''''nvim-ts-autotag'''''''''''''''''''''''''''''''''''''''''
|
||||
require('nvim-ts-autotag').setup({
|
||||
opts = {
|
||||
enable_close = true, -- Auto close tags
|
||||
enable_rename = true, -- Auto rename pairs of tags
|
||||
enable_close_on_slash = false -- Auto close on trailing </
|
||||
},
|
||||
require("nvim-ts-autotag").setup({
|
||||
opts = {
|
||||
enable_close = true, -- Auto close tags
|
||||
enable_rename = true, -- Auto rename pairs of tags
|
||||
enable_close_on_slash = false, -- Auto close on trailing </
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
|
||||
--''''''''''''''''''''''''rainbow'''''''''''''''''''''''''''''''''''''''
|
||||
require('rainbow-delimiters.setup').setup {
|
||||
strategy = {
|
||||
},
|
||||
query = {
|
||||
},
|
||||
highlight = {
|
||||
},
|
||||
}
|
||||
require("rainbow-delimiters.setup").setup({
|
||||
strategy = {},
|
||||
query = {},
|
||||
highlight = {},
|
||||
})
|
||||
|
||||
--''''''''''Lualine''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||
require('lualine').setup {
|
||||
options = {
|
||||
theme = 'catppuccin',
|
||||
icons_enabled = true,
|
||||
component_separators = { left = ' ', right = ' ' },
|
||||
section_separators = { left = '|', right = '|' },
|
||||
globalstatus = true,
|
||||
},
|
||||
require("lualine").setup({
|
||||
options = {
|
||||
theme = "catppuccin-mocha",
|
||||
icons_enabled = true,
|
||||
component_separators = { left = " ", right = " " },
|
||||
section_separators = { left = "|", right = "|" },
|
||||
globalstatus = true,
|
||||
},
|
||||
|
||||
sections = {
|
||||
lualine_z = {
|
||||
function()
|
||||
local line = vim.fn.line('.')
|
||||
local total = vim.fn.line('$')
|
||||
local percent = math.floor((line / total) * 100)
|
||||
return string.format("%3d%%%% %d☰", percent, total)
|
||||
end
|
||||
}
|
||||
}
|
||||
}
|
||||
sections = {
|
||||
lualine_z = {
|
||||
function()
|
||||
local line = vim.fn.line(".")
|
||||
local total = vim.fn.line("$")
|
||||
local percent = math.floor((line / total) * 100)
|
||||
return string.format("%3d%%%% %d☰", percent, total)
|
||||
end,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
--'''''''''Barbar'''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||
require('barbar').setup({
|
||||
animation = false,
|
||||
auto_hide = 1,
|
||||
tabpages = false,
|
||||
clickable = true,
|
||||
icons = {
|
||||
buffer_index = true,
|
||||
buffer_number = false,
|
||||
diagnostics = {
|
||||
[vim.diagnostic.severity.ERROR] = { enabled = true, icon = ' ' },
|
||||
[vim.diagnostic.severity.WARN] = { enabled = true, icon = ' ' },
|
||||
[vim.diagnostic.severity.INFO] = { enabled = false },
|
||||
[vim.diagnostic.severity.HINT] = { enabled = false },
|
||||
},
|
||||
filetype = {
|
||||
enabled = true,
|
||||
},
|
||||
separator = { left = '▎', right = '' },
|
||||
modified = { button = '●' },
|
||||
pinned = { button = '車', filename = true },
|
||||
},
|
||||
require("barbar").setup({
|
||||
animation = false,
|
||||
auto_hide = 1,
|
||||
tabpages = false,
|
||||
clickable = true,
|
||||
icons = {
|
||||
buffer_index = true,
|
||||
buffer_number = false,
|
||||
diagnostics = {
|
||||
[vim.diagnostic.severity.ERROR] = { enabled = true, icon = " " },
|
||||
[vim.diagnostic.severity.WARN] = { enabled = true, icon = " " },
|
||||
[vim.diagnostic.severity.INFO] = { enabled = false },
|
||||
[vim.diagnostic.severity.HINT] = { enabled = false },
|
||||
},
|
||||
filetype = {
|
||||
enabled = true,
|
||||
},
|
||||
separator = { left = "▎", right = "" },
|
||||
modified = { button = "●" },
|
||||
pinned = { button = "車", filename = true },
|
||||
},
|
||||
})
|
||||
|
||||
-- '''''''''''' highlight ''''''''''''''''''''''''''''''''''''''''
|
||||
require('local-highlight').setup({ animate = { enabled = false}})
|
||||
|
||||
require("local-highlight").setup({ animate = { enabled = false } })
|
||||
|
||||
--'''''''''''''''OIL'''''''''''''''''''''''''''''''''''''''''''''''
|
||||
require("oil").setup({
|
||||
default_file_explorer = true,
|
||||
keymaps = {
|
||||
["?"] = { "actions.show_help", mode = "n" },
|
||||
["<CR>"] = "actions.select",
|
||||
["<C-s>"] = { "actions.select", opts = { vertical = true } },
|
||||
["<C-h>"] = { "actions.select", opts = { horizontal = true } },
|
||||
["<C-t>"] = { "actions.select", opts = { tab = true } },
|
||||
["-"] = { "actions.parent", mode = "n" },
|
||||
["_"] = { "actions.open_cwd", mode = "n" },
|
||||
["gs"] = { "actions.change_sort", mode = "n" },
|
||||
["gx"] = "actions.open_external",
|
||||
["H"] = { "actions.toggle_hidden", mode = "n" },
|
||||
},
|
||||
lsp_file_methods = {
|
||||
enabled = true,
|
||||
timeout_ms = 1000,
|
||||
autosave_changes = false,
|
||||
},
|
||||
float = {
|
||||
preview_split = "right",
|
||||
},
|
||||
preview_win = {
|
||||
update_on_cursor_moved = true,
|
||||
preview_method = "fast_scratch",
|
||||
},
|
||||
|
||||
default_file_explorer = true,
|
||||
keymaps = {
|
||||
["?"] = { "actions.show_help", mode = "n" },
|
||||
["<CR>"] = "actions.select",
|
||||
["<C-s>"] = { "actions.select", opts = { vertical = true } },
|
||||
["<C-h>"] = { "actions.select", opts = { horizontal = true } },
|
||||
["<C-t>"] = { "actions.select", opts = { tab = true } },
|
||||
["-"] = { "actions.parent", mode = "n" },
|
||||
["_"] = { "actions.open_cwd", mode = "n" },
|
||||
["gs"] = { "actions.change_sort", mode = "n" },
|
||||
["gx"] = "actions.open_external",
|
||||
["H"] = { "actions.toggle_hidden", mode = "n" },
|
||||
},
|
||||
lsp_file_methods = {
|
||||
enabled = true,
|
||||
timeout_ms = 1000,
|
||||
autosave_changes = false,
|
||||
},
|
||||
float = {
|
||||
preview_split = "right",
|
||||
},
|
||||
preview_win = {
|
||||
update_on_cursor_moved = true,
|
||||
preview_method = "fast_scratch",
|
||||
},
|
||||
})
|
||||
|
||||
-- ''''''''''''''autopairs'''''''''''''''''''''''''''''''''''''''
|
||||
local npairs = require("nvim-autopairs")
|
||||
npairs.setup({
|
||||
check_ts = true,
|
||||
ts_config = {
|
||||
lua = {'string'},-- it will not add a pair on that treesitter node
|
||||
javascript = {'template_string'},
|
||||
java = false,-- don't check treesitter on java
|
||||
},
|
||||
fast_wrap = {
|
||||
map = '<M-e>',
|
||||
chars = { '{', '[', '(', '"', "'" },
|
||||
pattern = [=[[%'%"%>%]%)%}%,]]=],
|
||||
end_key = '$',
|
||||
before_key = 'h',
|
||||
after_key = 'l',
|
||||
cursor_pos_before = true,
|
||||
keys = 'qwertyuiopzxcvbnmasdfghjkl',
|
||||
manual_position = true,
|
||||
highlight = 'Search',
|
||||
highlight_grey='Comment'
|
||||
},
|
||||
check_ts = true,
|
||||
ts_config = {
|
||||
lua = { "string" }, -- it will not add a pair on that treesitter node
|
||||
javascript = { "template_string" },
|
||||
java = false, -- don't check treesitter on java
|
||||
},
|
||||
fast_wrap = {
|
||||
map = "<M-e>",
|
||||
chars = { "{", "[", "(", '"', "'" },
|
||||
pattern = [=[[%'%"%>%]%)%}%,]]=],
|
||||
end_key = "$",
|
||||
before_key = "h",
|
||||
after_key = "l",
|
||||
cursor_pos_before = true,
|
||||
keys = "qwertyuiopzxcvbnmasdfghjkl",
|
||||
manual_position = true,
|
||||
highlight = "Search",
|
||||
highlight_grey = "Comment",
|
||||
},
|
||||
})
|
||||
|
||||
local cmp = require'cmp'
|
||||
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
|
||||
cmp.event:on(
|
||||
'confirm_done',
|
||||
cmp_autopairs.on_confirm_done()
|
||||
)
|
||||
|
||||
local cmp = require("cmp")
|
||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "dae4f5aaa3574bd0c2b9dd20fb9542a02c10471c" },
|
||||
"LuaSnip": { "branch": "master", "commit": "642b0c595e11608b4c18219e93b88d7637af27bc" },
|
||||
"barbar.nvim": { "branch": "master", "commit": "539d73def39c9172b4d4d769f14090e08f37b29d" },
|
||||
"buffer-vacuum": { "branch": "main", "commit": "917986d31cce6501c929ab6088c0887beff56b69" },
|
||||
"catppuccin": { "branch": "main", "commit": "12c004cde3f36cb1d57242f1e6aac46b09a0e5b4" },
|
||||
"catppuccin": { "branch": "main", "commit": "50c34a2cf18776a77f770fcf5df777de6fe69e08" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
|
||||
"cmp-nvim-lua": { "branch": "main", "commit": "e3a22cb071eb9d6508a156306b102c45cd2d573d" },
|
||||
@@ -22,15 +22,15 @@
|
||||
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "59bce2eef357189c3305e25bc6dd2d138c1683f5" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "da88697d7f45d16852c6b2769dc52387d1ddc45f" },
|
||||
"nvim-colorizer.lua": { "branch": "master", "commit": "ef211089af881bea206c7aa3f2693a81feee7e90" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "0203a9608d63eda57679b01e69f33a7b4c34b0d1" },
|
||||
"nvim-colorizer.lua": { "branch": "master", "commit": "85a5e83cd4daa258cf95c3204e277991d6fbe747" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "841c6d4139aedb8a3f2baf30cef5327371385b93" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "5ca4aaa6efdcc59be46b95a3e876300cfead05ef" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "8e1c0a389f20bf7f5b0dd0e00306c1247bda2595" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "d7462543c9e366c0d196c7f67a945eaaf5d99414" },
|
||||
"oil.nvim": { "branch": "master", "commit": "0fcc83805ad11cf714a949c98c605ed717e0b83e" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||
"rainbow-delimiters.nvim": { "branch": "master", "commit": "01993eb20c6cdc1d33e7e98252368840309f99b9" },
|
||||
"rainbow-delimiters.nvim": { "branch": "master", "commit": "607a438d8c647a355749973fd295e33505afafde" },
|
||||
"ruffer": { "branch": "plugin", "commit": "5248604605bf1039147f3f29dcd46aa296557e9c" },
|
||||
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
[2024-07-14 18:18:16.679] [info] Using configuration file /home/mahalo/.config/waybar/config
|
||||
[2024-07-14 18:18:16.681] [info] Discovered appearance 'dark'
|
||||
[2024-07-14 18:18:16.681] [info] Using CSS file /home/mahalo/.config/waybar/style.css
|
||||
[2024-07-14 18:18:16.683] [info] Hyprland IPC starting
|
||||
[2024-07-14 18:18:16.683] [warning] $XDG_RUNTIME_DIR/hypr does not exist, falling back to /tmp/hypr
|
||||
[2024-07-14 18:18:16.684] [info] Loading persistent workspaces from Hyprland workspace rules
|
||||
[2024-07-14 18:18:16.702] [info] Bar configured (width: 1920, height: 24) for output: DP-1
|
||||
|
||||
** (waybar:40524): WARNING **: 18:18:16.704: Status Notifier Item with bus name ':1.6' and object path '/org/ayatana/NotificationItem/nm_applet' is already registered
|
||||
last: write error
|
||||
Gdk-Message: 18:45:44.244: Error reading events from display: Connection reset by peer
|
||||
@@ -34,6 +34,7 @@ text/x-makefile=org.gnome.TextEditor.desktop
|
||||
application/x-tiled-tsx=org.gnome.TextEditor.desktop
|
||||
text/x-c++src=org.gnome.TextEditor.desktop
|
||||
application/x-bat=org.gnome.TextEditor.desktop
|
||||
x-scheme-handler/claude-cli=claude-code-url-handler.desktop
|
||||
|
||||
[Added Associations]
|
||||
image/svg+xml=org.gnome.Loupe.desktop;
|
||||
|
||||
Reference in New Issue
Block a user