diff --git a/.config/fuzzel/fuzzel.ini b/.config/fuzzel/fuzzel.ini new file mode 100644 index 0000000..43397a7 --- /dev/null +++ b/.config/fuzzel/fuzzel.ini @@ -0,0 +1,126 @@ + +# output= +font=monospace:size=10:size=10 +dpi-aware=auto +# use-bold=no +# message= +# message-mode=wrap +# prompt="> " +# placeholder= +# icon-theme=default +icons-enabled=no +# hide-before-typing=no +# fields=filename,name,generic +# password-character=* +# filter-desktop=no +match-mode=fzf +# sort-result=yes +# match-counter=no +# delayed-filter-ms=300 +# delayed-filter-limit=20000 +# show-actions=no +# terminal=$TERMINAL -e # Note: you cannot actually use environment variables here +# launch-prefix= +list-executables-in-path=yes + +# anchor=center +# x-margin=0 +# y-margin=0 +# lines=15 +# minimal-lines=no +# width=30 +# tabs=8 +# horizontal-pad=40 +# vertical-pad=8 +# inner-pad=0 + +# scaling-filter=box +# image-size-ratio=0.5 + +# gamma-correct-blending=no +# line-height= +# letter-spacing=0 + +# layer=overlay +# keyboard-focus=exclusive +# exit-on-keyboard-focus-loss=yes + +# cache= + +# render-workers= +# match-workers= + +# enable-mouse=yes + +[colors] +background=282828dd +text=ebdbb2ff +prompt=d5c4a1ff +placeholder=928374ff +input=ebdbb2ff +match=fabd2fff +selection=3c3836ff +selection-text=ebdbb2ff +selection-match=fabd2fff +counter=928374ff +border=fabd2fff + +[border] +# width=1 +# radius=10 + +[dmenu] +# mode=text # text|index +# exit-immediately-if-empty=no + +[key-bindings] +# cancel=Escape Control+g Control+c Control+bracketleft +# execute=Return KP_Enter Control+y +# execute-or-next=Tab +# execute-input=Shift+Return Shift+KP_Enter +# cursor-left=Left Control+b +# cursor-left-word=Control+Left Mod1+b +# cursor-right=Right Control+f +# cursor-right-word=Control+Right Mod1+f +# cursor-home=Home Control+a +# cursor-end=End Control+e +# delete-line=Control+Shift+BackSpace +# delete-prev=BackSpace Control+h +# delete-prev-word=Mod1+BackSpace Control+BackSpace Control+w +# delete-line-backward=Control+u +# delete-next=Delete KP_Delete Control+d +# delete-next-word=Mod1+d Control+Delete Control+KP_Delete +# delete-line-forward=Control+k +# prev=Up Control+p +# prev-with-wrap=ISO_Left_Tab +# prev-page=Page_Up KP_Page_Up +# next=Down Control+n +# next-with-wrap=none +# next-page=Page_Down KP_Page_Down +# expunge=Shift+Delete +# clipboard-paste=Control+v XF86Paste +# primary-paste=Shift+Insert Shift+KP_Insert + +# custom-N: *dmenu mode only*. Like execute, but with a non-zero +# exit-code; custom-1 exits with code 10, custom-2 with 11, custom-3 +# with 12, and so on. + +# custom-1=Mod1+1 +# custom-2=Mod1+2 +# custom-3=Mod1+3 +# custom-4=Mod1+4 +# custom-5=Mod1+5 +# custom-6=Mod1+6 +# custom-7=Mod1+7 +# custom-8=Mod1+8 +# custom-9=Mod1+9 +# custom-10=Mod1+0 +# custom-11=Mod1+exclam +# custom-12=Mod1+at +# custom-13=Mod1+numbersign +# custom-14=Mod1+dollar +# custom-15=Mod1+percent +# custom-16=Mod1+dead_circumflex +# custom-17=Mod1+ampersand +# custom-18=Mod1+asterix +# custom-19=Mod1+parentleft diff --git a/.config/nvim/lua/config/terminal.lua b/.config/nvim/lua/config/terminal.lua index e536b2c..d97f644 100644 --- a/.config/nvim/lua/config/terminal.lua +++ b/.config/nvim/lua/config/terminal.lua @@ -6,18 +6,21 @@ -- fT terminal in the current working directory -- -- This module adds: --- a *dedicated* floating terminal (stable toggle, one-key close) +-- open/focus a *dedicated* floating terminal (close it with ) -- ft a picker that lists every live terminal so any contextual -- terminal can be focused or restored even after its window was -- closed/hidden. local M = {} --- The floating terminal. Tracked as an upvalue so is a real --- open/close toggle regardless of which directory the editor is in. +-- The floating terminal. Tracked as an upvalue so always re-focuses +-- the *same* float regardless of which directory the editor is in. ---@type snacks.win? local float --- Open or focus the floating terminal, or hide it if already focused. +-- NOTE: currently unused; calls open_float() instead so shell +-- tab-completion keeps working while the terminal is open. Kept around for a +-- future explicit open/close toggle. function M.toggle_float() -- Reuse the existing instance: hide if visible, re-show if hidden. if float and float:buf_valid() then @@ -50,6 +53,31 @@ function M.toggle_float() end end +--- Open or focus the floating terminal. This never hides the window, so +--- once the float is open falls through to the shell and stays available +--- for tab-completion. Close the floating terminal with while it is +--- visible (handled by Snacks' native terminal keymap). +function M.open_float() + if float and float:buf_valid() then + if not float:win_valid() then + float:show() + end + if float:win_valid() then + vim.api.nvim_set_current_win(float.win) + end + vim.cmd("startinsert") + return + end + + -- First open: a high fixed count guarantees this terminal never collides with + -- the count-keyed bottom terminals (1, 2, 3 ...), so it is always the *same* + -- float for no matter the context. + float = Snacks.terminal(nil, { + count = 99, + win = { position = "float", border = "rounded" }, + }) +end + --- List every live Snacks terminal in a picker. Restore/focus one with , --- kill one with . function M.picker() diff --git a/.config/nvim/lua/plugins/terminal.lua b/.config/nvim/lua/plugins/terminal.lua index fdc2f4c..cf30a6b 100644 --- a/.config/nvim/lua/plugins/terminal.lua +++ b/.config/nvim/lua/plugins/terminal.lua @@ -7,7 +7,7 @@ return { { "", function() - require("config.terminal").toggle_float() + require("config.terminal").open_float() end, desc = "Terminal (float)", mode = "n",