From 57cb004b71a9a9f688418da05cf88cc670b69f0f Mon Sep 17 00:00:00 2001 From: twells46 Date: Thu, 1 Jan 2026 08:59:03 -0600 Subject: Cleanup x11 vs wayland commands --- dot_config/kak/kakrc | 216 -------------------------------------- dot_config/kak/kakrc.tmpl | 222 ++++++++++++++++++++++++++++++++++++++++ dot_config/newsraft/config | 8 -- dot_config/newsraft/config.tmpl | 12 +++ 4 files changed, 234 insertions(+), 224 deletions(-) delete mode 100644 dot_config/kak/kakrc create mode 100644 dot_config/kak/kakrc.tmpl delete mode 100644 dot_config/newsraft/config create mode 100644 dot_config/newsraft/config.tmpl (limited to 'dot_config') diff --git a/dot_config/kak/kakrc b/dot_config/kak/kakrc deleted file mode 100644 index 4b11572..0000000 --- a/dot_config/kak/kakrc +++ /dev/null @@ -1,216 +0,0 @@ -#colorscheme catppuccin_latte - -# Lines numbers and relative numbers -add-highlighter global/ number-lines -relative - -# Highlight matching pair -add-highlighter global/ show-matching - -# Wrap on word boundaries -add-highlighter global/ wrap -indent -word - -# Highlight trailing whitespace -add-highlighter global/ regex \h+$ 0:Error - -set-option global scrolloff 5,5 - -map global normal ":comment-line" - -# System clipboard bindings -map global user y "cp.sh" -docstring "[Y]ank to system clipboard" -map global user p "|put.sh" -docstring "[P]ut from system clipboard" - -### A note on the /dev/null black magic ### -# %sh is synchronous by design. It will wait for: -# 1. The shell process to exit. -# 2. All pipes (stdin, stdout, stderr) to close. -# -# The final `&` forks the process, satisfying the first condition, but all -# pipes are left open. So, we need to "close" them: -# - `> /dev/null` to close stdout -# - `2>&1` redirects stderr to stdout, which in this case is `/dev/null` - closed -# - `< /dev/null` closes stdin -# Now, as far as kakoune is concerned, the process has finished and all pipes -# are closed, so control immediately returns to the client. -define-command -docstring "Compile the current document" compile %{ - nop %sh{ { - compiler $"{kak_buffile}" - } > /dev/null 2>&1 < /dev/null & } -} -map global user c -docstring "[C]ompile the current file" ":compile" - -map global user = -docstring "Format current buffer with :format" ":format" - -hook global BufCreate .*\.[Rr]md %{ set-option buffer filetype markdown } - -# Pattern for communicating with kak via it's session socket -define-command sockettest %{ - nop %sh{ { - sleep 10 - echo "eval -client '$kak_client' 'echo sleep ended'" | - kak -p ${kak_session} - } > /dev/null 2>&1 < /dev/null & } -} - -# fzf file chooser -define-command fzf_file %{ - nop %sh{ - # Create a temporary file for storage - foot -T 'foot_tmp' dash -c ' - next=$(fzf --height=100% --layout=default --preview "highlight -O ansi {}") - printf "eval -client %s %%{ edit %s }\n" "$kak_client" "$next" | - kak -p "$kak_session" - ' > /dev/null 2>&1 < /dev/null & - } -} -map global user f -docstring "Browse [f]iles with fzf" ":fzf_file" - -# fzf buffer chooser -define-command fzf_buffer %{ - nop %sh{ - # Create a temporary file for storage - foot -T 'foot_tmp' dash -c ' - next=$(printf "%s\n" "$kak_buflist" | tr " " "\n" | - fzf --height=100% --layout=default --preview "highlight -O ansi {}") - printf "eval -client %s %%{ buffer %s }\n" "$kak_client" "$next" | - kak -p "$kak_session" - ' > /dev/null 2>&1 < /dev/null & - } -} -map global user b -docstring "Browse [b]uffers with fzf" ":fzf_buffer" - -define-command fifotest %{ - evaluate-commands %sh{ - # Create a temporary fifo for communication - output=$(mktemp -d -t kak-temp-XXXXXXXX)/fifo - mkfifo ${output} - # run command detached from the shell - { fzf > ${output} } > /dev/null 2>&1 < /dev/null & - # Open the file in Kakoune and add a hook to remove the fifo - echo "edit! -fifo ${output} *buffer-name* - hook buffer BufClose .* %{ nop %sh{ rm -r $(dirname ${output})} }" - } -} - - -# Trick to make compiler run async -#hook global BufWritePost .*\.(md|tex|ms)$ %{ -# nop %sh{ { -# compiler $"{kak_buffile}" -# } > /dev/null 2>&1 < /dev/null & } -#} -# Simpler version -# hook global BufWritePost .*\.(md|tex)$ %{ -# echo -debug %sh{compiler "${kak_buffile}"} -# } - -# Filetypes with two-space indentation -hook global BufCreate .*\.(js|html|ts|tsx|hs)$ %{ - # Map tab key to `>` in normal mode -- inserts spaces - map global insert '' - set-option buffer indentwidth 2 -} -# Filetypes with four-space indentation -hook global BufCreate .*\.(py|json|jsonc)$ %{ - map global insert '' - set-option buffer indentwidth 4 -} - -eval %sh{kak-lsp} -hook global WinSetOption filetype=(haskell|rust|python|go|javascript|typescript|c|cpp) %{ - lsp-enable-window -} - -remove-hooks global lsp-filetype-python -hook -group lsp-filetype-python global BufSetOption filetype=python %{ - # set-option buffer lsp_servers %{ - # [pylsp] - # root_globs = ["requirements.txt", "setup.py", "pyproject.toml", ".git", ".hg"] - # settings_section = "_" - # [pylsp.settings._] - # # See https://github.com/python-lsp/python-lsp-server#configuration - # # pylsp.configurationSources = ["flake8"] - # pylsp.plugins.jedi_completion.include_params = true - # } - set-option buffer lsp_servers %{ - [pyright-langserver] - root_globs = ["requirements.txt", "setup.py", "pyproject.toml", "pyrightconfig.json", ".git", ".hg"] - args = ["--stdio"] - } - # set-option -add buffer lsp_servers %{ - # [ruff] - # args = ["server", "--quiet"] - # root_globs = ["requirements.txt", "setup.py", "pyproject.toml", ".git", ".hg"] - # settings_section = "_" - # [ruff.settings._.globalSettings] - # organizeImports = true - # fixAll = true - # } -} - -hook -group lsp-filetype-javascript global BufSetOption filetype=(?:javascript|typescript) %{ - set-option buffer lsp_servers %{ - [vtsls] - root_globs = ["package.json", "tsconfig.json", "jsconfig.json", ".git", ".hg"] - args = ["--stdio"] - settings_section = "_" - [vtsls.settings._] - quotePreference = "single" - # typescript.format.semicolons = "insert" - } - #set-option buffer lsp_servers %{ - # [typescript-language-server] - # root_globs = ["package.json", "tsconfig.json", "jsconfig.json", ".git", ".hg"] - # args = ["--stdio"] - # settings_section = "_" - # [typescript-language-server.settings._] - # # quotePreference = "double" - # # typescript.format.semicolons = "insert" - #} - # set-option buffer lsp_servers %{ - # [deno] - # root_globs = ["package.json", "tsconfig.json", ".git", ".hg"] - # args = ["lsp"] - # settings_section = "deno" - # [deno.settings.deno] - # enable = true - # lint = true - # } - # set-option buffer lsp_servers %opt{lsp_server_biome} - # set-option buffer lsp_servers %{ - # [eslint-language-server] - # root_globs = [".eslintrc", ".eslintrc.json"] - # args = ["--stdio"] - # workaround_eslint = true - # [eslint-language-server.settings] - # codeActionsOnSave = { mode = "all", "source.fixAll.eslint" = true } - # format = { enable = true } - # quiet = false - # rulesCustomizations = [] - # run = "onType" - # validate = "on" - # experimental = {} - # problems = { shortenToSingleLine = false } - # codeAction.disableRuleComment = { enable = true, location = "separateLine" } - # codeAction.showDocumentation = { enable = false } - # } - # set-option buffer lsp_servers %{ - # [tailwindcss-language-server] - # root_globs = ["tailwind.*"] - # args = ["--stdio"] - # [tailwindcss-language-server.settings.tailwindCSS] - # editor = {} - # } -} - -map global user l ':enter-user-mode lsp' -docstring 'LSP mode' - -map global insert ':try lsp-snippets-select-next-placeholders catch %{ execute-keys -with-hooks tab> }' -docstring 'Select next snippet placeholder' -map global user h ':lsp-hover' -docstring 'LSP hover' - -map global object a 'lsp-object' -docstring 'LSP any symbol' -map global object 'lsp-object' -docstring 'LSP any symbol' -map global object f 'lsp-object Function Method' -docstring 'LSP function or method' -map global object t 'lsp-object Class Interface Struct' -docstring 'LSP class interface or struct' -map global object d 'lsp-diagnostic-object --include-warnings' -docstring 'LSP errors and warnings' -map global object D 'lsp-diagnostic-object' -docstring 'LSP errors' diff --git a/dot_config/kak/kakrc.tmpl b/dot_config/kak/kakrc.tmpl new file mode 100644 index 0000000..729889b --- /dev/null +++ b/dot_config/kak/kakrc.tmpl @@ -0,0 +1,222 @@ +#colorscheme catppuccin_latte + +# Lines numbers and relative numbers +add-highlighter global/ number-lines -relative + +# Highlight matching pair +add-highlighter global/ show-matching + +# Wrap on word boundaries +add-highlighter global/ wrap -indent -word + +# Highlight trailing whitespace +add-highlighter global/ regex \h+$ 0:Error + +set-option global scrolloff 5,5 + +map global normal ":comment-line" + +# System clipboard bindings +{{- if eq .wm "x11" }} +map global user y "xsel -ib" -docstring "[Y]ank to system clipboard" +map global user p "|xsel -ob" -docstring "[P]ut from system clipboard" +{{- else }} +map global user y "wl-copy" -docstring "[Y]ank to system clipboard" +map global user p "|wl-paste" -docstring "[P]ut from system clipboard" +{{- end }} + + +### A note on the /dev/null black magic ### +# %sh is synchronous by design. It will wait for: +# 1. The shell process to exit. +# 2. All pipes (stdin, stdout, stderr) to close. +# +# The final `&` forks the process, satisfying the first condition, but all +# pipes are left open. So, we need to "close" them: +# - `> /dev/null` to close stdout +# - `2>&1` redirects stderr to stdout, which in this case is `/dev/null` - closed +# - `< /dev/null` closes stdin +# Now, as far as kakoune is concerned, the process has finished and all pipes +# are closed, so control immediately returns to the client. +define-command -docstring "Compile the current document" compile %{ + nop %sh{ { + compiler $"{kak_buffile}" + } > /dev/null 2>&1 < /dev/null & } +} +map global user c -docstring "[C]ompile the current file" ":compile" + +map global user = -docstring "Format current buffer with :format" ":format" + +hook global BufCreate .*\.[Rr]md %{ set-option buffer filetype markdown } + +# Pattern for communicating with kak via it's session socket +define-command sockettest %{ + nop %sh{ { + sleep 10 + echo "eval -client '$kak_client' 'echo sleep ended'" | + kak -p ${kak_session} + } > /dev/null 2>&1 < /dev/null & } +} + +# fzf file chooser +define-command fzf_file %{ + nop %sh{ + # Create a temporary file for storage + foot -T 'foot_tmp' dash -c ' + next=$(fzf --height=100% --layout=default --preview "highlight -O ansi {}") + printf "eval -client %s %%{ edit %s }\n" "$kak_client" "$next" | + kak -p "$kak_session" + ' > /dev/null 2>&1 < /dev/null & + } +} +map global user f -docstring "Browse [f]iles with fzf" ":fzf_file" + +# fzf buffer chooser +define-command fzf_buffer %{ + nop %sh{ + # Create a temporary file for storage + foot -T 'foot_tmp' dash -c ' + next=$(printf "%s\n" "$kak_buflist" | tr " " "\n" | + fzf --height=100% --layout=default --preview "highlight -O ansi {}") + printf "eval -client %s %%{ buffer %s }\n" "$kak_client" "$next" | + kak -p "$kak_session" + ' > /dev/null 2>&1 < /dev/null & + } +} +map global user b -docstring "Browse [b]uffers with fzf" ":fzf_buffer" + +define-command fifotest %{ + evaluate-commands %sh{ + # Create a temporary fifo for communication + output=$(mktemp -d -t kak-temp-XXXXXXXX)/fifo + mkfifo ${output} + # run command detached from the shell + { fzf > ${output} } > /dev/null 2>&1 < /dev/null & + # Open the file in Kakoune and add a hook to remove the fifo + echo "edit! -fifo ${output} *buffer-name* + hook buffer BufClose .* %{ nop %sh{ rm -r $(dirname ${output})} }" + } +} + + +# Trick to make compiler run async +#hook global BufWritePost .*\.(md|tex|ms)$ %{ +# nop %sh{ { +# compiler $"{kak_buffile}" +# } > /dev/null 2>&1 < /dev/null & } +#} +# Simpler version +# hook global BufWritePost .*\.(md|tex)$ %{ +# echo -debug %sh{compiler "${kak_buffile}"} +# } + +# Filetypes with two-space indentation +hook global BufCreate .*\.(js|html|ts|tsx|hs)$ %{ + # Map tab key to `>` in normal mode -- inserts spaces + map global insert '' + set-option buffer indentwidth 2 +} +# Filetypes with four-space indentation +hook global BufCreate .*\.(py|json|jsonc)$ %{ + map global insert '' + set-option buffer indentwidth 4 +} + +eval %sh{kak-lsp} +hook global WinSetOption filetype=(haskell|rust|python|go|javascript|typescript|c|cpp) %{ + lsp-enable-window +} + +remove-hooks global lsp-filetype-python +hook -group lsp-filetype-python global BufSetOption filetype=python %{ + # set-option buffer lsp_servers %{ + # [pylsp] + # root_globs = ["requirements.txt", "setup.py", "pyproject.toml", ".git", ".hg"] + # settings_section = "_" + # [pylsp.settings._] + # # See https://github.com/python-lsp/python-lsp-server#configuration + # # pylsp.configurationSources = ["flake8"] + # pylsp.plugins.jedi_completion.include_params = true + # } + set-option buffer lsp_servers %{ + [pyright-langserver] + root_globs = ["requirements.txt", "setup.py", "pyproject.toml", "pyrightconfig.json", ".git", ".hg"] + args = ["--stdio"] + } + # set-option -add buffer lsp_servers %{ + # [ruff] + # args = ["server", "--quiet"] + # root_globs = ["requirements.txt", "setup.py", "pyproject.toml", ".git", ".hg"] + # settings_section = "_" + # [ruff.settings._.globalSettings] + # organizeImports = true + # fixAll = true + # } +} + +hook -group lsp-filetype-javascript global BufSetOption filetype=(?:javascript|typescript) %{ + set-option buffer lsp_servers %{ + [vtsls] + root_globs = ["package.json", "tsconfig.json", "jsconfig.json", ".git", ".hg"] + args = ["--stdio"] + settings_section = "_" + [vtsls.settings._] + quotePreference = "single" + # typescript.format.semicolons = "insert" + } + #set-option buffer lsp_servers %{ + # [typescript-language-server] + # root_globs = ["package.json", "tsconfig.json", "jsconfig.json", ".git", ".hg"] + # args = ["--stdio"] + # settings_section = "_" + # [typescript-language-server.settings._] + # # quotePreference = "double" + # # typescript.format.semicolons = "insert" + #} + # set-option buffer lsp_servers %{ + # [deno] + # root_globs = ["package.json", "tsconfig.json", ".git", ".hg"] + # args = ["lsp"] + # settings_section = "deno" + # [deno.settings.deno] + # enable = true + # lint = true + # } + # set-option buffer lsp_servers %opt{lsp_server_biome} + # set-option buffer lsp_servers %{ + # [eslint-language-server] + # root_globs = [".eslintrc", ".eslintrc.json"] + # args = ["--stdio"] + # workaround_eslint = true + # [eslint-language-server.settings] + # codeActionsOnSave = { mode = "all", "source.fixAll.eslint" = true } + # format = { enable = true } + # quiet = false + # rulesCustomizations = [] + # run = "onType" + # validate = "on" + # experimental = {} + # problems = { shortenToSingleLine = false } + # codeAction.disableRuleComment = { enable = true, location = "separateLine" } + # codeAction.showDocumentation = { enable = false } + # } + # set-option buffer lsp_servers %{ + # [tailwindcss-language-server] + # root_globs = ["tailwind.*"] + # args = ["--stdio"] + # [tailwindcss-language-server.settings.tailwindCSS] + # editor = {} + # } +} + +map global user l ':enter-user-mode lsp' -docstring 'LSP mode' + +map global insert ':try lsp-snippets-select-next-placeholders catch %{ execute-keys -with-hooks tab> }' -docstring 'Select next snippet placeholder' +map global user h ':lsp-hover' -docstring 'LSP hover' + +map global object a 'lsp-object' -docstring 'LSP any symbol' +map global object 'lsp-object' -docstring 'LSP any symbol' +map global object f 'lsp-object Function Method' -docstring 'LSP function or method' +map global object t 'lsp-object Class Interface Struct' -docstring 'LSP class interface or struct' +map global object d 'lsp-diagnostic-object --include-warnings' -docstring 'LSP errors and warnings' +map global object D 'lsp-diagnostic-object' -docstring 'LSP errors' diff --git a/dot_config/newsraft/config b/dot_config/newsraft/config deleted file mode 100644 index 8b95559..0000000 --- a/dot_config/newsraft/config +++ /dev/null @@ -1,8 +0,0 @@ -copy-to-clipboard-command "xsel -ib" - -bind a mark-read -bind u mark-unread -bind U mark-unread-all -bind d exec st yt-dlp '%l' -bind v exec st mpv '%l' -#bind a exec st mpv --no-video '%l' diff --git a/dot_config/newsraft/config.tmpl b/dot_config/newsraft/config.tmpl new file mode 100644 index 0000000..17da714 --- /dev/null +++ b/dot_config/newsraft/config.tmpl @@ -0,0 +1,12 @@ +{{- if eq .wm "x11" -}} +copy-to-clipboard-command "xsel -ib" +{{- else }} +copy-to-clipboard-command "wl-copy" +{{- end }} + +bind a mark-read +bind u mark-unread +bind U mark-unread-all +bind d exec st yt-dlp '%l' +bind v exec st mpv '%l' +#bind a exec st mpv --no-video '%l' -- cgit v1.2.3