Compare commits
No commits in common. "b73cad9444372a7a88850a6236b61dd04aeb87a7" and "ba4e1700e9cd0878b171eab65537e914acc6c79e" have entirely different histories.
b73cad9444
...
ba4e1700e9
24
flake.lock
24
flake.lock
|
@ -7,11 +7,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1705269478,
|
||||
"narHash": "sha256-j7Rp8Y3ckBHOlIzqe0g2+/BVce9SU/dVtn4Eb0rMuY4=",
|
||||
"lastModified": 1706435589,
|
||||
"narHash": "sha256-yhEYJxMv5BkfmUuNe4QELKo+V5eq1pwhtVs6kEziHfE=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "846200eb574faa2af808ed02e653c2b8ed51fd71",
|
||||
"rev": "4d54c29bce71f8c261513e0662cc573d30f3e33e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -22,11 +22,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1705133751,
|
||||
"narHash": "sha256-rCIsyE80jgiOU78gCWN3A0wE0tR2GI5nH6MlS+HaaSQ=",
|
||||
"lastModified": 1706371002,
|
||||
"narHash": "sha256-dwuorKimqSYgyu8Cw6ncKhyQjUDOyuXoxDTVmAXq88s=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "9b19f5e77dd906cb52dade0b7bd280339d2a1f3d",
|
||||
"rev": "c002c6aa977ad22c60398daaa9be52f2203d0006",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -38,11 +38,11 @@
|
|||
},
|
||||
"nixpkgs-stable": {
|
||||
"locked": {
|
||||
"lastModified": 1705183652,
|
||||
"narHash": "sha256-rnfkyUH0x72oHfiSDhuCHDHg3gFgF+lF8zkkg5Zihsw=",
|
||||
"lastModified": 1706373441,
|
||||
"narHash": "sha256-S1hbgNbVYhuY2L05OANWqmRzj4cElcbLuIkXTb69xkk=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "428544ae95eec077c7f823b422afae5f174dee4b",
|
||||
"rev": "56911ef3403a9318b7621ce745f5452fb9ef6867",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -54,11 +54,11 @@
|
|||
},
|
||||
"nur": {
|
||||
"locked": {
|
||||
"lastModified": 1705283909,
|
||||
"narHash": "sha256-7F2KyTB4cApsHg7oltJ1r0QFWMjWTOaS9m2IbKFhj6Y=",
|
||||
"lastModified": 1706559951,
|
||||
"narHash": "sha256-yfez9ZnYWsm3m3K8HvN3bGEdWe8aO0ni9r82bAq+q9k=",
|
||||
"owner": "nix-community",
|
||||
"repo": "NUR",
|
||||
"rev": "375b9a949232cd1e31bd89d197a5605a17d2aeb3",
|
||||
"rev": "24478b9e556e4366ef0a2ff58590d8cf24c77267",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
185
nate/dotfiles/kak/autoload/auto-pairs.kak
Normal file
185
nate/dotfiles/kak/autoload/auto-pairs.kak
Normal file
|
@ -0,0 +1,185 @@
|
|||
# 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 '<a-h><a-K>(\w["''`]|""|''''|``).\z<ret><a-k>[^\\]?\Q%opt{opening_pair}<a-!>\E\W\z<ret>'
|
||||
|
||||
# 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 '<a-k>..<ret>'
|
||||
execute-keys '<a-;>H'
|
||||
} catch %{
|
||||
execute-keys '<a-;>h'
|
||||
}
|
||||
|
||||
# Add insert mappings
|
||||
map -docstring 'insert closing pair or move right in pair' window insert %arg{2} "<a-;>:insert-closing-pair-or-move-right-in-pair %%🐈%arg{2}🐈<ret>"
|
||||
map -docstring 'insert a new indented line in pair' window insert <ret> '<a-;>:insert-new-line-in-pair<ret>'
|
||||
map -docstring 'prompt a count for new indented lines in pair' window insert <c-ret> '<a-;>:prompt-insert-new-line-in-pair<ret>'
|
||||
|
||||
# Enter is only available on next key.
|
||||
hook -group auto-pairs -once window InsertChar '.*' %{
|
||||
unmap window insert <ret>
|
||||
unmap window insert <c-ret>
|
||||
}
|
||||
|
||||
# Clean insert mappings and remove hooks
|
||||
hook -group auto-pairs -once window WinSetOption 'inserted_pairs=0' "
|
||||
unmap window insert %%🐈%arg{2}🐈
|
||||
unmap window insert <ret>
|
||||
unmap window insert <c-ret>
|
||||
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 "<space>;<a-k>\Q%arg{2}<ret>"
|
||||
execute-keys '<del>'
|
||||
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 "<space>;<a-k>\Q%arg{1}<ret>"
|
||||
# Move right in pair
|
||||
execute-keys '<a-;>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 '<a-;>;<ret><ret><esc>KK<a-&>j<a-gt>'
|
||||
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 '<a-;>;<ret><ret><esc>KK<a-&>j<a-gt>'
|
||||
execute-keys "xHyx<a-d>%val{text}O<c-r>""<esc>"
|
||||
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
|
||||
}
|
84
nate/dotfiles/kak/autoload/phantom-selection.kak
Normal file
84
nate/dotfiles/kak/autoload/phantom-selection.kak
Normal file
|
@ -0,0 +1,84 @@
|
|||
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 <space> with "," (and
|
||||
# <a-space> with <a-,>). Try both to make sure we clear selections
|
||||
# both with and without this breaking change. Pad them with <esc>
|
||||
# to cancel out the key with the other behavior.
|
||||
exec -save-regs '' 'Z'
|
||||
phantom-selection-store-and-highlight
|
||||
exec '<space><esc><,><esc>'
|
||||
} 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-z>a" }
|
||||
exec -save-regs '' "Z"
|
||||
phantom-selection-store-and-highlight
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
require-module phantom-selection
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 5db74769ca8710b27140cf5a1107183b339f2916
|
|
@ -1 +0,0 @@
|
|||
|
|
@ -1,87 +0,0 @@
|
|||
|
||||
# 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}"
|
|
@ -1,23 +1,3 @@
|
|||
# ------------------
|
||||
# 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
|
||||
# ------------------
|
||||
|
@ -28,17 +8,16 @@ 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/modules/home-manager/home.nix"
|
||||
declare-option str shell_config "~/system/nate/dotfiles/.zshrc"
|
||||
|
||||
# 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
|
||||
|
@ -50,26 +29,12 @@ 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 <a-i>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 </dev/null & }
|
||||
}}
|
||||
}}
|
||||
|
||||
# Add default,red and bold style to these regex matches
|
||||
add-highlighter global/ regex \b(TODO|FIXME|XXX|NOTE)\b 0:default,red+rb
|
||||
|
||||
|
@ -105,7 +70,6 @@ map global normal <c-S> <a-S> -docstring 'select first and last character of ea
|
|||
map global normal '<c-;>' '<a-;>' -docstring 'flip direction of each selection'
|
||||
map global normal <c-:> <a-:> -docstring 'ensure selections are in forward direction (cursor then anchor)'
|
||||
map global normal <c-,> <a-,> -docstring 'clear the main selection'
|
||||
map global normal <c-.> <a-.> -docstring 'Repeat last object or f/t selection'
|
||||
|
||||
# Scrolling remap
|
||||
map global normal <c-e> <pageup> -docstring 'Scroll screen up'
|
||||
|
@ -168,7 +132,9 @@ map global normal <a-K> <c-N> -docstring 'prev result add selection'
|
|||
map global insert <down> <c-n> -docstring 'next completion'
|
||||
map global insert <up> <c-p> -docstring 'prev completion'
|
||||
|
||||
# User Mode Bindings
|
||||
# ------------------
|
||||
# User mode Bindings
|
||||
# ------------------
|
||||
# Accessed with <space>
|
||||
declare-user-mode git
|
||||
map global user g ': enter-user-mode git<ret>' -docstring "Git mode"
|
||||
|
@ -188,88 +154,61 @@ map global git d '<esc>:git show-diff<ret>' -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 }
|
||||
define-command lsp-restart -docstring 'restart lsp server' %{ lsp-stop; lsp-start }
|
||||
map global insert <tab> '<a-;>:try lsp-snippets-select-next-placeholders catch %{ execute-keys -with-hooks <lt>tab> }<ret>' -docstring 'Select next snippet placeholder'
|
||||
map global object a '<a-semicolon>lsp-object<ret>' -docstring 'LSP any symbol'
|
||||
map global object <a-a> '<a-semicolon>lsp-object<ret>' -docstring 'LSP any symbol'
|
||||
map global object e '<a-semicolon>lsp-object Function Method<ret>' -docstring 'LSP function or method'
|
||||
map global object k '<a-semicolon>lsp-object Class Interface Struct<ret>' -docstring 'LSP class interface or struct'
|
||||
map global object d '<a-semicolon>lsp-diagnostic-object --include-warnings<ret>' -docstring 'LSP errors and warnings'
|
||||
map global object D '<a-semicolon>lsp-diagnostic-object<ret>' -docstring 'LSP errors'
|
||||
|
||||
map global insert <tab> '<a-;>:try lsp-snippets-select-next-placeholders catch %{ execute-keys -with-hooks <lt>tab> }<ret>' -docstring 'Select next snippet placeholder'
|
||||
map global object a '<a-semicolon>lsp-object<ret>' -docstring 'LSP any symbol'
|
||||
map global object <a-a> '<a-semicolon>lsp-object<ret>' -docstring 'LSP any symbol'
|
||||
map global object e '<a-semicolon>lsp-object Function Method<ret>' -docstring 'LSP function or method'
|
||||
map global object k '<a-semicolon>lsp-object Class Interface Struct<ret>' -docstring 'LSP class interface or struct'
|
||||
map global object d '<a-semicolon>lsp-diagnostic-object --include-warnings<ret>' -docstring 'LSP errors and warnings'
|
||||
map global object D '<a-semicolon>lsp-diagnostic-object<ret>' -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) %{
|
||||
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) %{
|
||||
lsp-enable-window
|
||||
# lsp-auto-hover-enable
|
||||
map global user l ': enter-user-mode lsp<ret>' -docstring 'lsp mode'
|
||||
map global user h ': enter-user-mode lsp<ret>h' -docstring 'lsp help'
|
||||
map global user a ': enter-user-mode lsp<ret>a' -docstring 'lsp code action'
|
||||
set-option global lsp_hover_anchor false
|
||||
}
|
||||
|
||||
hook global KakEnd .* lsp-exit
|
||||
set-option global lsp_hover_anchor true
|
||||
lsp-inlay-hints-enable global
|
||||
lsp-inlay-diagnostics-enable global
|
||||
}
|
||||
|
||||
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<ret>' -docstring 'lsp mode'
|
||||
# map global user h ': enter-user-mode lsp<ret>h' -docstring 'lsp help'
|
||||
# map global user a ': enter-user-mode lsp<ret>a' -docstring 'lsp code action'
|
||||
# set-option global lsp_hover_anchor false
|
||||
# }
|
||||
|
||||
|
||||
# }
|
||||
|
||||
|
||||
# -----------------
|
||||
# Other Plugins
|
||||
# -----------------
|
||||
|
||||
# fzf file picker
|
||||
map global goto f '<esc>:prompt -shell-script-candidates %{ fd --type f --hidden } file: %{ edit %val{text} }<ret>' -docstring "file"
|
||||
map global goto b '<esc>:prompt -buffer-completion buffer: %{ buffer %val{text} }<ret>' -docstring "buffer"
|
||||
|
||||
# Fzf Plugin
|
||||
plug "andreyorst/fzf.kak" config %{
|
||||
# map global user f ':fzf-mode<ret>v' -docstring 'fzf file in project'
|
||||
map global user b ':fzf-mode<ret>b' -docstring 'fzf current buffers'
|
||||
|
||||
map global user / ':fzf-mode<ret>g' -docstring 'fzf search in project'
|
||||
|
||||
# def fzf_file %{
|
||||
# evaluate-commands %sh{
|
||||
# printf "%s\n" ":fzf-mode<ret><esc>:fzf -items-cmd fd<ret>"
|
||||
# }
|
||||
# }
|
||||
|
||||
# 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 user b ':fzf-mode<ret>b' -docstring 'fzf current buffers'
|
||||
map global user / ':fzf-mode<ret>g' -docstring 'fzf search in project'
|
||||
|
||||
map global normal <c-m> ':surround<ret>'
|
||||
|
||||
# Custom scripts
|
||||
|
||||
# evaluate-commands %sh{
|
||||
# for file in ~/.config/kak/rc/*.kak; do
|
||||
# printf "source %s\n" $file
|
||||
# done
|
||||
# }
|
||||
|
||||
# source "~/.config/kak/rc/"
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
#use evaluate-commands to collapse undo
|
||||
define-command close_tag %{ evaluate-commands %{
|
||||
#revert removing indent after leaving insert mode
|
||||
try %{
|
||||
execute-keys -draft '<a-h>s[^\n]<ret>'
|
||||
} catch %{
|
||||
execute-keys -draft 'K<a-&>'
|
||||
}
|
||||
execute-keys ';Gg<a-;>'
|
||||
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<lt>/$result><esc>"
|
||||
}
|
||||
}}
|
||||
|
||||
map global user c ':close_tag<ret>' -docstring "Close tag"
|
|
@ -15,6 +15,10 @@ 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;
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
dbeaver
|
||||
cargo
|
||||
kakoune
|
||||
# flutter316
|
||||
flutter316
|
||||
docker
|
||||
docker-compose
|
||||
jq
|
||||
|
|
Loading…
Reference in New Issue
Block a user