From 5625ad83d978dac49045cc2ba64aff9db9e5bae0 Mon Sep 17 00:00:00 2001 From: Nathan Anderson Date: Thu, 15 Feb 2024 12:30:03 -0700 Subject: [PATCH] Removed plugins folder from kak and added kakrc changes --- nate/dotfiles/kak/autoload/auto-pairs.kak | 185 ------------------ .../kak/autoload/phantom-selection.kak | 84 -------- nate/dotfiles/kak/colors/kakoune | 1 + nate/dotfiles/kak/colors/nord.kak | 1 + nate/dotfiles/kak/colors/pastel.kak | 87 ++++++++ nate/dotfiles/kak/kakrc | 149 +++++++++----- nate/dotfiles/kak/rc/close_tag.kak | 40 ++++ nate/modules/apps/firefox/firefox.nix | 4 - 8 files changed, 234 insertions(+), 317 deletions(-) delete mode 100644 nate/dotfiles/kak/autoload/auto-pairs.kak delete mode 100644 nate/dotfiles/kak/autoload/phantom-selection.kak create mode 160000 nate/dotfiles/kak/colors/kakoune create mode 100644 nate/dotfiles/kak/colors/nord.kak create mode 100644 nate/dotfiles/kak/colors/pastel.kak create mode 100644 nate/dotfiles/kak/rc/close_tag.kak diff --git a/nate/dotfiles/kak/autoload/auto-pairs.kak b/nate/dotfiles/kak/autoload/auto-pairs.kak deleted file mode 100644 index 16798d2..0000000 --- a/nate/dotfiles/kak/autoload/auto-pairs.kak +++ /dev/null @@ -1,185 +0,0 @@ -# Auto-pairing of characters -# Heavily based on Visual Studio Code. -# https://code.visualstudio.com -# -# Public commands: ["enable-auto-pairs", "disable-auto-pairs"] -# Public options: ["auto_pairs"] -# -# Usage: -# -# enable-auto-pairs -# -# Configuration: -# -# set-option global auto_pairs ( ) { } [ ] '"' '"' "'" "'" ` ` “ ” ‘ ’ « » ‹ › -# -# How does it work? -# -# The script installs insert hooks on opening pair characters, such as brackets and quotes. -# When auto-closing has been triggered, it activates the following functionalities: -# -# – {closing-pair} ⇒ Insert closing pair or move right in pair -# – Enter ⇒ Insert a new indented line in pair (only for the next key) -# – Control+Enter ⇒ Prompt a count for new indented lines in pair (only for the next key) -# -# When moving or leaving insert mode, the functionalities deactivate. -# -# Technical details: -# -# – Insert hooks are added on opening pair characters from %opt{auto_pairs} option. -# – Evaluates %opt{auto_close_trigger} option to activate auto-pairing. -# – Provides %opt{opening_pair} expansion in expressions. -# – Uses %opt{inserted_pairs} count to keep track of inserted pairs for inserting or moving in pair. -# – Uses the same implementation for nestable (such as brackets) and non-nestable (such as quotes) pairs. -# Since insert hooks are added on opening pair characters (for auto-pairing) and mappings on closing pair characters (for moving in pair), -# we can distinguish same pair characters once auto-pairing has been activated. - -# Configuration ──────────────────────────────────────────────────────────────── - -# List of surrounding pairs -declare-option -docstring 'list of surrounding pairs' str-list auto_pairs ( ) { } [ ] '"' '"' "'" "'" ` ` “ ” ‘ ’ « » ‹ › - -# Auto-pairing of characters activates only when this expression does not fail. -# By default, it avoids non-nestable pairs (such as quotes), escaped pairs and word characters. -declare-option -docstring 'auto-pairing of characters activates only when this expression does not fail' str auto_close_trigger '(\w["''`]|""|''''|``).\z[^\\]?\Q%opt{opening_pair}\E\W\z' - -# Internal variables ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ - -# Retain inserted pairs -declare-option -hidden str opening_pair -declare-option -hidden int inserted_pairs - -# Commands ───────────────────────────────────────────────────────────────────── - -define-command -override enable-auto-pairs -docstring 'enable auto-pairs' %{ - remove-hooks global auto-pairs - evaluate-commands %sh{ - set -- ${kak_opt_auto_pairs} - while [ "$2" ] - do - printf 'auto-close-pair %%<%s> %%<%s>\n' "$1" "$2" - shift 2 - done - } -} - -define-command -override disable-auto-pairs -docstring 'disable auto-pairs' %{ - remove-hooks global auto-pairs -} - -# Internal commands ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ - -define-command -override -hidden auto-close-pair -params 2 %{ - hook -group auto-pairs global InsertChar "\Q%arg{1}" "handle-inserted-opening-pair %%<%arg{1}> %%<%arg{2}>" - hook -group auto-pairs global InsertDelete "\Q%arg{1}" "handle-deleted-opening-pair %%<%arg{1}> %%<%arg{2}>" -} - -# Internal hooks ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ - -define-command -override -hidden handle-inserted-opening-pair -params 2 %{ - try %{ - # Test whether the commands contained in the option pass. - # If not, it will throw an exception and execution will jump to - # the “catch” block below. - set-option window opening_pair %arg{1} - execute-keys -draft %opt{auto_close_trigger} - - # Action: Close pair - execute-keys %arg{2} - - # Keep the track of inserted pairs - increment-inserted-pairs-count - - # Move back in pair (preserve selected text): - try %{ - execute-keys -draft '..' - execute-keys 'H' - } catch %{ - execute-keys 'h' - } - - # Add insert mappings - map -docstring 'insert closing pair or move right in pair' window insert %arg{2} ":insert-closing-pair-or-move-right-in-pair %%🐈%arg{2}🐈" - map -docstring 'insert a new indented line in pair' window insert ':insert-new-line-in-pair' - map -docstring 'prompt a count for new indented lines in pair' window insert ':prompt-insert-new-line-in-pair' - - # Enter is only available on next key. - hook -group auto-pairs -once window InsertChar '.*' %{ - unmap window insert - unmap window insert - } - - # Clean insert mappings and remove hooks - hook -group auto-pairs -once window WinSetOption 'inserted_pairs=0' " - unmap window insert %%🐈%arg{2}🐈 - unmap window insert - unmap window insert - remove-hooks window auto-pairs - " - - # Clean state when moving or leaving insert mode - hook -group auto-pairs -once window InsertMove '.*' %{ - reset-inserted-pairs-count - } - - hook -always -once window ModeChange 'pop:insert:normal' %{ - reset-inserted-pairs-count - } - } -} - -# Backspace ⇒ Erases the whole bracket -define-command -override -hidden handle-deleted-opening-pair -params 2 %{ - try %{ - execute-keys -draft ";\Q%arg{2}" - execute-keys '' - decrement-inserted-pairs-count - } -} - -# Internal mappings ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ - -# {closing-pair} ⇒ Insert closing pair or move right in pair -define-command -override -hidden insert-closing-pair-or-move-right-in-pair -params 1 %{ - try %{ - execute-keys -draft ";\Q%arg{1}" - # Move right in pair - execute-keys 'l' - decrement-inserted-pairs-count - } catch %{ - # Insert character with hooks - execute-keys -with-hooks %arg{1} - } -} - -# Enter ⇒ Insert a new indented line in pair (only for the next key) -define-command -override -hidden insert-new-line-in-pair %{ - execute-keys ';KKj' - execute-keys -with-hooks A - reset-inserted-pairs-count -} - -# Control+Enter ⇒ Prompt a count for new indented lines in pair (only for the next key) -define-command -override -hidden prompt-insert-new-line-in-pair %{ - prompt count: %{ - execute-keys ';KKj' - execute-keys "xHyx%val{text}O""" - execute-keys -with-hooks A - reset-inserted-pairs-count - } -} - -# ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ - -# Increment and decrement inserted pairs count -define-command -override -hidden increment-inserted-pairs-count %{ - set-option -add window inserted_pairs 1 -} - -define-command -override -hidden decrement-inserted-pairs-count %{ - set-option -remove window inserted_pairs 1 -} - -define-command -override -hidden reset-inserted-pairs-count %{ - set-option window inserted_pairs 0 -} diff --git a/nate/dotfiles/kak/autoload/phantom-selection.kak b/nate/dotfiles/kak/autoload/phantom-selection.kak deleted file mode 100644 index e64c468..0000000 --- a/nate/dotfiles/kak/autoload/phantom-selection.kak +++ /dev/null @@ -1,84 +0,0 @@ -provide-module phantom-selection %{ - -set-face global PhantomSelection black,green+F - -declare-option -hidden str-list phantom_selections -declare-option -hidden range-specs phantom_selections_ranges - -add-highlighter global/ ranges phantom_selections_ranges - -define-command -hidden phantom-selection-store-and-highlight %{ - set window phantom_selections %reg{^} - set window phantom_selections_ranges %val{timestamp} - eval -no-hooks -draft -itersel %{ - set -add window phantom_selections_ranges "%val{selection_desc}|PhantomSelection" - } -} - -define-command -hidden phantom-selection-iterate-impl -params 1 %{ - eval -save-regs ^ %{ - reg ^ %opt{phantom_selections} - try %{ - exec z - exec %arg{1} - # keep the main selection and put all the other in the mark - # a recent change to Kakoune swaps with "," (and - # with ). Try both to make sure we clear selections - # both with and without this breaking change. Pad them with - # to cancel out the key with the other behavior. - exec -save-regs '' 'Z' - phantom-selection-store-and-highlight - exec '<,>' - } catch %{ - fail 'No phantom selections' - } - } -} - -define-command phantom-selection-iterate-next -docstring " -Turn secondary selections into phantoms and select the next phantom -" %{ - phantom-selection-iterate-impl ')' -} - -define-command phantom-selection-iterate-prev -docstring " -Turn secondary selections into phantoms and select the previous phantom -" %{ - phantom-selection-iterate-impl '(' -} - -define-command phantom-selection-clear -docstring " -Remove all phantom selections -" %{ - unset window phantom_selections - unset window phantom_selections_ranges -} - -define-command phantom-selection-select-all -docstring " -Select all phantom selections -" %{ - eval -save-regs ^ %{ - reg ^ %opt{phantom_selections} - try %{ - exec z - echo "" - } catch %{ - fail 'No phantom selections' - } - } -} - -define-command phantom-selection-add-selection -docstring " -Create phantoms out of the current selections -" %{ - eval -draft -save-regs ^ %{ - reg ^ %opt{phantom_selections} - try %{ exec "a" } - exec -save-regs '' "Z" - phantom-selection-store-and-highlight - } -} - -} - -require-module phantom-selection diff --git a/nate/dotfiles/kak/colors/kakoune b/nate/dotfiles/kak/colors/kakoune new file mode 160000 index 0000000..5db7476 --- /dev/null +++ b/nate/dotfiles/kak/colors/kakoune @@ -0,0 +1 @@ +Subproject commit 5db74769ca8710b27140cf5a1107183b339f2916 diff --git a/nate/dotfiles/kak/colors/nord.kak b/nate/dotfiles/kak/colors/nord.kak new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/nate/dotfiles/kak/colors/nord.kak @@ -0,0 +1 @@ + diff --git a/nate/dotfiles/kak/colors/pastel.kak b/nate/dotfiles/kak/colors/pastel.kak new file mode 100644 index 0000000..fbf401f --- /dev/null +++ b/nate/dotfiles/kak/colors/pastel.kak @@ -0,0 +1,87 @@ + +# Pastel theme for Kakoune + +# Color palette +# declare-option str black 'rgb:2b2e33' +declare-option str black default +declare-option str dark 'rgb:3b3b46' +declare-option str gray 'rgb:5a5b5b' +declare-option str aqua 'rgb:6bbac1' +declare-option str white 'rgb:dcdbd7' +declare-option str blue 'rgb:65a4cf' +declare-option str cyan 'rgb:6dcac0' +declare-option str blue_green 'rgb:81bba3' +declare-option str green 'rgb:8dbc92' +declare-option str orange 'rgb:dea981' +declare-option str pink 'rgb:d38da9' +declare-option str purple 'rgb:ca9bf7' +declare-option str red 'rgb:db948e' +declare-option str yellow 'rgb:e1d179' +declare-option str lime 'rgb:adc47e' +declare-option str dimgray 'rgb:3d4747' +declare-option str psel 'rgba:46466480' +declare-option str ssel 'rgba:37375580' + +declare-option str background %opt{black} +declare-option str dimmed_background %opt{gray} +declare-option str foreground %opt{white} + +# Reference +# https://github.com/mawww/kakoune/blob/master/colors/default.kak +# For code +set-face global value "%opt{yellow}" +set-face global type "%opt{aqua}" +set-face global variable "%opt{purple}" +set-face global module "%opt{white}" +set-face global function "%opt{orange}" +set-face global string "%opt{pink}" +set-face global keyword "%opt{green}" +set-face global operator "%opt{aqua}" +set-face global attribute "%opt{blue_green}" +set-face global bracket "%opt{white}+b" +set-face global arguement "%opt{blue_green}" +set-face global comma "%opt{white}" +set-face global constant "%opt{blue_green}+b" +set-face global class "%opt{lime}" +set-face global comment "%opt{gray}+i" +set-face global meta "%opt{blue}" +set-face global builtin "%opt{cyan}+b" + +# For markup +set-face global title "%opt{pink}" +set-face global header "%opt{orange}" +set-face global bold "%opt{pink}" +set-face global italic "%opt{purple}" +set-face global mono "%opt{green}" +set-face global block "%opt{cyan}" +set-face global link "%opt{green}" +set-face global bullet "%opt{green}" +set-face global list "%opt{white}" + +# Builtin faces +set-face global Default "%opt{white},%opt{black}" +# set-face global Default "%opt{white},default" +set-face global PrimarySelection "default,%opt{psel}" +set-face global SecondarySelection "default,%opt{ssel}" +set-face global PrimaryCursor "%opt{dark},%opt{purple}" +set-face global SecondaryCursor "%opt{dark},%opt{aqua}" +set-face global PrimaryCursorEol "%opt{dark},%opt{yellow}" +set-face global SecondaryCursorEol "%opt{dark},%opt{blue}" +set-face global LineNumbers "%opt{gray},%opt{black}" +set-face global LineNumberCursor "%opt{purple},%opt{black}+b" +set-face global LineNumbersWrapped "%opt{gray},%opt{black}+i" +set-face global MenuForeground "%opt{dark},%opt{white}+b" +set-face global MenuBackground "%opt{white},%opt{dark}" +set-face global MenuInfo "%opt{dark},%opt{orange}" +set-face global Information "%opt{yellow},%opt{black}" +set-face global Error "%opt{red},%opt{black}" +set-face global StatusLine "%opt{white},%opt{black}" +set-face global StatusLineMode "%opt{aqua},%opt{black}" +set-face global StatusLineInfo "%opt{purple},%opt{black}" +set-face global StatusLineValue "%opt{orange},%opt{black}" +set-face global StatusCursor "%opt{white},%opt{blue}" +set-face global Prompt "%opt{green},%opt{black}" +set-face global MatchingChar "%opt{blue},%opt{black}" +set-face global Whitespace "%opt{dimgray},%opt{black}+f" +set-face global WrapMarker Whitespace +set-face global BufferPadding "%opt{black},%opt{black}" diff --git a/nate/dotfiles/kak/kakrc b/nate/dotfiles/kak/kakrc index 8dd10ec..5dbfd50 100644 --- a/nate/dotfiles/kak/kakrc +++ b/nate/dotfiles/kak/kakrc @@ -1,3 +1,23 @@ +# ------------------ +# Plugin Setup +# ------------------ + +# IMORTANT NOTE: +# I needed to open kakoune and type ':plug-install' to actually +# install the plugins listed in this file. I did not see this +# mentioned in wikis or anything, so make sure to do this to +# avoid searching github wikis and reddit needlessly. + +# Creates the /plugins folder if it doesnt exist each startup +evaluate-commands %sh{ + plugins="$kak_config/plugins" + mkdir -p "$plugins" + [ ! -e "$plugins/plug.kak" ] && \ + git clone -q https://github.com/andreyorst/plug.kak.git "$plugins/plug.kak" + printf "%s\n" "source '$plugins/plug.kak/rc/plug.kak'" +} +plug "andreyorst/plug.kak" noload + # ------------------ # Editor Settings # ------------------ @@ -8,16 +28,17 @@ set-option global startup_info_version 30000000 set-option global tabstop 4 set-option global indentwidth 4 set-option global scrolloff 5,3 - declare-option str kakrc_path "~/system/nate/dotfiles/kak/kakrc" declare-option str sway_conf_path "~/system/nate/dotfiles/sway/config.d/default" -declare-option str shell_config "~/system/nate/dotfiles/.zshrc" +declare-option str shell_config "~/system/nate/modules/home-manager/home.nix" +# plug "catppuccin/kakoune" theme config %{ +# colorscheme catppuccin_macchiato +# } colorscheme catppuccin_macchiato - # relative line numbers hook global BufCreate .* %{ - add-highlighter buffer/ number-lines -hlcursor + add-highlighter buffer/ number-lines -hlcursor } # Git Gutters @@ -29,12 +50,26 @@ hook global WinCreate .* %{ evaluate-commands %sh{ # Write on unfocus hook global FocusOut .* %{ try %{ - write + write }} hook global BufWritePost .* %{ evaluate-commands 'git update-diff' } hook global BufReload .* %{ evaluate-commands 'git update-diff' } +# Color Render in Echo Area +hook global WinSetOption filetype=kak %{ hook global NormalIdle .* %{ + evaluate-commands -save-regs 'a' %{ try %{ + execute-keys -draft w"ay + evaluate-commands %sh{ ( + color="${kak_reg_a}" + inverted_color=$(echo "${color}" | perl -pe 'tr/0123456789abcdefABCDEF/fedcba9876543210543210/') + printf "%s\n" "evaluate-commands -client $kak_client %{ try %{ + echo -markup %{{rgb:${inverted_color},rgb:${color}+b} #${color} } + }}" | kak -p $kak_session + ) >/dev/null 2>&1 -docstring 'select first and last character of ea map global normal '' '' -docstring 'flip direction of each selection' map global normal -docstring 'ensure selections are in forward direction (cursor then anchor)' map global normal -docstring 'clear the main selection' +map global normal -docstring 'Repeat last object or f/t selection' # Scrolling remap map global normal -docstring 'Scroll screen up' @@ -132,9 +168,7 @@ map global normal -docstring 'prev result add selection' map global insert -docstring 'next completion' map global insert -docstring 'prev completion' -# ------------------ -# User mode Bindings -# ------------------ +# User Mode Bindings # Accessed with declare-user-mode git map global user g ': enter-user-mode git' -docstring "Git mode" @@ -154,61 +188,88 @@ map global git d ':git show-diff' -docstring "Show diff" # LSP Configuration # ----------------- -# plug "kak-lsp/kak-lsp" do %{ -# cargo install --locked --force --path . -# mkdir -p ~/.config/kak-lsp -# cp -n kak-lsp.toml ~/.config/kak-lsp/ -# } config %{ +plug "kak-lsp/kak-lsp" do %{ + cargo install --locked --force --path . + mkdir -p ~/.config/kak-lsp + cp -n kak-lsp.toml ~/.config/kak-lsp/ +} config %{ # enable inlay hints + lsp-inlay-hints-enable global + lsp-inlay-diagnostics-enable global + # set global lsp_diagnostic_line_error_sign '║' # set global lsp_diagnostic_line_warning_sign '┊' -define-command lsp-restart -docstring 'restart lsp server' %{ lsp-stop; lsp-start } -map global insert ':try lsp-snippets-select-next-placeholders catch %{ execute-keys -with-hooks tab> }' -docstring 'Select next snippet placeholder' -map global object a 'lsp-object' -docstring 'LSP any symbol' -map global object 'lsp-object' -docstring 'LSP any symbol' -map global object e 'lsp-object Function Method' -docstring 'LSP function or method' -map global object k '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' + define-command lsp-restart -docstring 'restart lsp server' %{ lsp-stop; lsp-start } -eval %sh{kak-lsp --kakoune -s $kak_session} # Not needed if you load it with plug.kak. -hook global WinSetOption filetype=(rust|python|go|javascript|typescript|c|cpp|dart|zig|nix|ocaml) %{ + map global insert ':try lsp-snippets-select-next-placeholders catch %{ execute-keys -with-hooks tab> }' -docstring 'Select next snippet placeholder' + map global object a 'lsp-object' -docstring 'LSP any symbol' + map global object 'lsp-object' -docstring 'LSP any symbol' + map global object e 'lsp-object Function Method' -docstring 'LSP function or method' + map global object k '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' + + # load lsp for supported filetypes + set-option global lsp_cmd "kak-lsp -s %val{session} -vvv --log /tmp/kak-lsp.log" + hook global WinSetOption filetype=(rust|python|go|javascript|typescript|c|cpp|zig|dart|ruby) %{ lsp-enable-window + # lsp-auto-hover-enable map global user l ': enter-user-mode lsp' -docstring 'lsp mode' map global user h ': enter-user-mode lsph' -docstring 'lsp help' map global user a ': enter-user-mode lspa' -docstring 'lsp code action' - set-option global lsp_hover_anchor true - lsp-inlay-hints-enable global - lsp-inlay-diagnostics-enable global + set-option global lsp_hover_anchor false + } + + hook global KakEnd .* lsp-exit } -hook global KakEnd .* lsp-exit - # load lsp for supported filetypes - # set-option global lsp_cmd "kak-lsp -s %val{session} -vvv --log /tmp/kak-lsp.log" - # hook global WinSetOption filetype=(rust|python|go|javascript|typescript|c|cpp|zig|dart|ruby) %{ - # lsp-enable-window - # # lsp-auto-hover-enable - # map global user l ': enter-user-mode lsp' -docstring 'lsp mode' - # map global user h ': enter-user-mode lsph' -docstring 'lsp help' - # map global user a ': enter-user-mode lspa' -docstring 'lsp code action' - # set-option global lsp_hover_anchor false - # } - - -# } - # ----------------- # Other Plugins # ----------------- -# fzf file picker map global goto f ':prompt -shell-script-candidates %{ fd --type f --hidden } file: %{ edit %val{text} }' -docstring "file" map global goto b ':prompt -buffer-completion buffer: %{ buffer %val{text} }' -docstring "buffer" -map global user b ':fzf-modeb' -docstring 'fzf current buffers' -map global user / ':fzf-modeg' -docstring 'fzf search in project' +# Fzf Plugin +plug "andreyorst/fzf.kak" config %{ + # map global user f ':fzf-modev' -docstring 'fzf file in project' + map global user b ':fzf-modeb' -docstring 'fzf current buffers' + + map global user / ':fzf-modeg' -docstring 'fzf search in project' + + # def fzf_file %{ + # evaluate-commands %sh{ + # printf "%s\n" ":fzf-mode:fzf -items-cmd fd" + # } + # } + +# Change FZF colors +# FZF_DEFAULT_OPTS=" \ +# --color=bg+:#313244,bg:#1e1e2e,spinner:#f5e0dc,hl:#f38ba8 \ +# --color=fg:#cdd6f4,header:#f38ba8,info:#cba6f7,pointer:#f5e0dc \ +# --color=marker:#f5e0dc,fg+:#cdd6f4,prompt:#cba6f7,hl+:#f38ba8" +} + + + +plug "alexherbo2/auto-pairs.kak" %{ + enable-auto-pairs +} + + +plug "https://github.com/h-youhei/kakoune-surround" map global normal ':surround' + +# Custom scripts + +# evaluate-commands %sh{ +# for file in ~/.config/kak/rc/*.kak; do +# printf "source %s\n" $file +# done +# } + +# source "~/.config/kak/rc/" diff --git a/nate/dotfiles/kak/rc/close_tag.kak b/nate/dotfiles/kak/rc/close_tag.kak new file mode 100644 index 0000000..66f7cd7 --- /dev/null +++ b/nate/dotfiles/kak/rc/close_tag.kak @@ -0,0 +1,40 @@ +#use evaluate-commands to collapse undo +define-command close_tag %{ evaluate-commands %{ + #revert removing indent after leaving insert mode + try %{ + execute-keys -draft 's[^\n]' + } catch %{ + execute-keys -draft 'K' + } + execute-keys ';Gg' + evaluate-commands %sh{ + tag_list=`echo "$kak_selection" | grep -P -o '(?<=<)[^>]*[^/>](?=>)' | tac | cut -d ' ' -f 1` + close= + close_stack= + result= + for tag in $tag_list ; do + if [ `echo $tag | cut -c 1` = / ] ; then + close=${tag#/} + close_stack=$close\\n$close_stack + else + if [ $kak_opt_filetype != xml ] ; then + case $tag in + #self-closing tags + area|base|br|col|command|embed|hr|img|input|keygen|link|meta|param|source|track|wbr) continue ;; + esac + fi + if [ $tag = $close ] ; then + close_stack=${close_stack#*\\n} + close=`echo $close_stack | head -n 1` + else + result=$tag + break + fi + fi + done + [ -z $result ] && echo "fail 'no un-closed tag'" + echo "execute-keys -with-hooks \;i/$result>" + } +}} + +map global user c ':close_tag' -docstring "Close tag" diff --git a/nate/modules/apps/firefox/firefox.nix b/nate/modules/apps/firefox/firefox.nix index e874d5f..09775a7 100644 --- a/nate/modules/apps/firefox/firefox.nix +++ b/nate/modules/apps/firefox/firefox.nix @@ -15,10 +15,6 @@ in # Add pipewire support package = (pkgs.wrapFirefox (pkgs.firefox-unwrapped.override { pipewireSupport = true;}) {}); enable = true; - # Use system file picker - preferences = { - "widget.use-xdg-desktop-portal.file-picker" = 1; - }; profiles = { default = { id = 0;