Compare commits

..

3 Commits

6 changed files with 249 additions and 78 deletions

100
kak/.config/kak/kakrc Normal file
View File

@@ -0,0 +1,100 @@
set-option global startup_info_version 20260412
set-option global ui_options terminal_assistant=none
colorscheme lucius
try %{ colorscheme 'one-darker' }
nop %sh{
mkdir -p "$kak_config/autoload"
ln -s "$kak_runtime/autoload" "$kak_config/autoload/stdlib"
}
# LOCAL
add-highlighter global/ number-lines -relative
try %{ declare-user-mode file-mode }
map global -docstring "File" user 'f' ':enter-user-mode file-mode<ret>'
map global -docstring "Open (git)" file-mode 'a' ': file-open-git<ret>'
map global -docstring "Open (fd)" file-mode 'f' ':file-open<ret>'
define-command -override file-open %{
prompt -menu -shell-script-candidates %{ fd -t f } 'File: ' %{ edit -- %val{text} }
}
define-command -override file-open-git %{
prompt -menu -shell-script-candidates %{ git ls-files } 'File (git): ' %{ edit -- %val{text} }
}
# ODIN
hook global BufSetOption filetype=odin %{
set-option buffer formatcmd 'odinfmt -stdin'
}
# LSP
eval %sh{kak-lsp}
lsp-enable
set-option global modelinefmt "%opt{lsp_modeline} %opt{modelinefmt}"
map global user l ':enter-user-mode lsp<ret>' -docstring 'LSP mode'
map global goto d <esc>:lsp-definition<ret> -docstring 'LSP definition'
map global goto r <esc>:lsp-references<ret> -docstring 'LSP references'
map global goto y <esc>:lsp-type-definition<ret> -docstring 'LSP type definition'
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 f '<a-semicolon>lsp-object Function Method<ret>' -docstring 'LSP function or method'
map global object t '<a-semicolon>lsp-object Class Interface Module Namespace Struct<ret>' -docstring 'LSP class or module'
map global object d '<a-semicolon>lsp-diagnostic-object error warning<ret>' -docstring 'LSP errors and warnings'
map global object D '<a-semicolon>lsp-diagnostic-object error<ret>' -docstring 'LSP errors'
# PLUG
source "%val{config}/plugins/plug.kak/rc/plug.kak"
plug "andreyorst/plug.kak" noload
# FZF
plug "andreyorst/fzf.kak"
map global normal <c-p> ': fzf-mode<ret>'
hook global BufCreate [^*].* %{
nop %sh{
mru=~/.cache/kak-mru
echo "$kak_buffile" | awk '!seen[$0]++' - "$mru" | sponge "$mru"
}}
# SURROUND
plug "h-youhei/kakoune-surround"
declare-user-mode surround
map global surround s ':surround<ret>' -docstring 'surround'
map global surround c ':change-surround<ret>' -docstring 'change'
map global surround d ':delete-surround<ret>' -docstring 'delete'
map global surround t ':select-surrounding-tag<ret>' -docstring 'select tag'
map global -docstring 'Surround' user 'S' ':enter-user-mode surround<ret>'
# HARPOON
plug "https://codeberg.org/raiguard/kak-harpoon"
harpoon-add-bindings
# EASYMOTION
plug https://git.sr.ht/~voroskoi/easymotion.kak
require-module easymotion
map global -docstring 'easy j' user <j> ': easymotion-j<ret>'
map global -docstring 'easy k' user <k> ': easymotion-k<ret>'
map global -docstring 'easy w' user <w> ': easymotion-w<ret>'
map global -docstring 'easy b'user <b> ': easymotion-b<ret>'

View File

@@ -17,6 +17,8 @@ open_url_with qutebrowser
action_alias launch_tab_home launch --type tab --cwd=~ action_alias launch_tab_home launch --type tab --cwd=~
kitten_alias hints hints --hints-background-color red --hints-foreground-color white kitten_alias hints hints --hints-background-color red --hints-foreground-color white
allow_remote_control yes
map ctrl+shift+6 no_op map ctrl+shift+6 no_op
map ctrl+shift+0 nth_window -1 map ctrl+shift+0 nth_window -1

View File

@@ -4,6 +4,7 @@ vim.pack.add({
"https://github.com/kepano/flexoki-neovim", "https://github.com/kepano/flexoki-neovim",
"https://github.com/rktjmp/lush.nvim", "https://github.com/rktjmp/lush.nvim",
"https://github.com/zenbones-theme/zenbones.nvim", "https://github.com/zenbones-theme/zenbones.nvim",
"https://github.com/xero/miasma.nvim",
}) })
local cs = require("config.colorscheme") local cs = require("config.colorscheme")

View File

@@ -1,7 +1,7 @@
vim.pack.add({ vim.pack.add({
{ {
src = "https://github.com/kylechui/nvim-surround", src = "https://github.com/kylechui/nvim-surround",
version = vim.version.range("^3.0.0"), version = vim.version.range("^4.0.0"),
}, },
}) })

View File

@@ -15,70 +15,134 @@ vim.api.nvim_create_autocmd("PackChanged", {
}) })
vim.pack.add({ vim.pack.add({
{ src = "https://github.com/nvim-treesitter/nvim-treesitter-textobjects", version = "master" }, { src = "https://github.com/nvim-treesitter/nvim-treesitter-textobjects", version = "main" },
{ src = "https://github.com/nvim-treesitter/nvim-treesitter", version = "master" }, { src = "https://github.com/nvim-treesitter/nvim-treesitter", version = "main" },
}) })
local ok, configs = pcall(require, "nvim-treesitter.configs") local ok = pcall(require, "nvim-treesitter")
if ok then if ok then
configs.setup({ vim.api.nvim_create_autocmd('FileType', {
highlight = { pattern = { 'odin', 'go' },
enable = true, callback = function() vim.treesitter.start() end,
},
textobjects = {
select = {
enable = true,
lookahead = true,
keymaps = {
["aa"] = "@parameter.outer",
["ia"] = "@parameter.inner",
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
["al"] = "@call.outer",
["il"] = "@call.inner",
["ao"] = "@loop.outer",
["io"] = "@loop.inner",
["ad"] = "@conditional.outer",
["id"] = "@conditional.inner",
["ar"] = "@return.outer",
["ir"] = "@return.inner",
["as"] = "@statement.outer",
["ag"] = "@assignment.outer",
["ig"] = "@assignment.inner",
},
},
move = {
enable = true,
set_jumps = true,
goto_next_start = {
["]m"] = "@function.outer",
["]]"] = "@class.outer",
},
goto_next_end = {
["]M"] = "@function.outer",
["]["] = "@class.outer",
},
goto_previous_start = {
["[m"] = "@function.outer",
["[["] = "@class.outer",
},
goto_previous_end = {
["[M"] = "@function.outer",
["[]"] = "@class.outer",
},
},
swap = {
enable = true,
swap_next = {
["<leader>cp"] = "@parameter.inner",
},
swap_previous = {
["<leader>cP"] = "@parameter.inner",
},
},
},
}) })
else else
print("plugin nvim-treesitter.configs missing") print("plugin nvim-treesitter.configs missing")
end end
local textobjects
ok, textobjects = pcall(require, "nvim-treesitter-textobjects")
if ok then
textobjects.setup {
move = {
set_jumps = true,
},
select = {
-- Automatically jump forward to textobj, similar to targets.vim
lookahead = true,
-- You can choose the select mode (default is charwise 'v')
--
-- Can also be a function which gets passed a table with the keys
-- * query_string: eg '@function.inner'
-- * method: eg 'v' or 'o'
-- and should return the mode ('v', 'V', or '<c-v>') or a table
-- mapping query_strings to modes.
selection_modes = {
['@parameter.outer'] = 'v', -- charwise
['@function.outer'] = 'V', -- linewise
-- ['@class.outer'] = '<c-v>', -- blockwise
},
-- If you set this to `true` (default is `false`) then any textobject is
-- extended to include preceding or succeeding whitespace. Succeeding
-- whitespace has priority in order to act similarly to eg the built-in
-- `ap`.
--
-- Can also be a function which gets passed a table with the keys
-- * query_string: eg '@function.inner'
-- * selection_mode: eg 'v'
-- and should return true of false
include_surrounding_whitespace = false,
},
}
local function key_select(key, object)
vim.keymap.set({ "x", "o" }, key, function()
require "nvim-treesitter-textobjects.select".select_textobject(object, "textobjects")
end)
end
key_select("aa", "@parameter.outer")
key_select("ia", "@parameter.inner")
key_select("af", "@function.outer")
key_select("if", "@function.inner")
key_select("ac", "@class.outer")
key_select("ic", "@class.inner")
key_select("al", "@call.outer")
key_select("il", "@call.inner")
key_select("ao", "@loop.outer")
key_select("io", "@loop.inner")
key_select("ad", "@conditional.outer")
key_select("id", "@conditional.inner")
key_select("ar", "@return.outer")
key_select("ir", "@return.inner")
key_select("as", "@statement.outer")
key_select("ag", "@assignment.outer")
key_select("ig", "@assignment.inner")
vim.keymap.set({ "x", "o" }, "ax", function()
require "nvim-treesitter-textobjects.select".select_textobject("@local.scope", "locals")
end)
vim.keymap.set("n", "<leader>cp", function()
require("nvim-treesitter-textobjects.swap").swap_next "@parameter.inner"
end)
vim.keymap.set("n", "<leader>cP", function()
require("nvim-treesitter-textobjects.swap").swap_previous "@parameter.inner"
end)
vim.keymap.set({ "n", "x", "o" }, "]m", function()
require("nvim-treesitter-textobjects.move").goto_next_start("@function.outer", "textobjects")
end)
vim.keymap.set({ "n", "x", "o" }, "]]", function()
require("nvim-treesitter-textobjects.move").goto_next_start("@class.outer", "textobjects")
end)
-- You can also pass a list to group multiple queries.
vim.keymap.set({ "n", "x", "o" }, "]o", function()
require("nvim-treesitter-textobjects.move").goto_next_start({ "@loop.inner", "@loop.outer" },
"textobjects")
end)
-- You can also use captures from other query groups like `locals.scm` or `folds.scm`
vim.keymap.set({ "n", "x", "o" }, "]s", function()
require("nvim-treesitter-textobjects.move").goto_next_start("@local.scope", "locals")
end)
vim.keymap.set({ "n", "x", "o" }, "]z", function()
require("nvim-treesitter-textobjects.move").goto_next_start("@fold", "folds")
end)
vim.keymap.set({ "n", "x", "o" }, "]M", function()
require("nvim-treesitter-textobjects.move").goto_next_end("@function.outer", "textobjects")
end)
vim.keymap.set({ "n", "x", "o" }, "][", function()
require("nvim-treesitter-textobjects.move").goto_next_end("@class.outer", "textobjects")
end)
vim.keymap.set({ "n", "x", "o" }, "[m", function()
require("nvim-treesitter-textobjects.move").goto_previous_start("@function.outer", "textobjects")
end)
vim.keymap.set({ "n", "x", "o" }, "[[", function()
require("nvim-treesitter-textobjects.move").goto_previous_start("@class.outer", "textobjects")
end)
vim.keymap.set({ "n", "x", "o" }, "[M", function()
require("nvim-treesitter-textobjects.move").goto_previous_end("@function.outer", "textobjects")
end)
vim.keymap.set({ "n", "x", "o" }, "[]", function()
require("nvim-treesitter-textobjects.move").goto_previous_end("@class.outer", "textobjects")
end)
-- Go to either the start or the end, whichever is closer.
-- Use if you want more granular movements
vim.keymap.set({ "n", "x", "o" }, "]d", function()
require("nvim-treesitter-textobjects.move").goto_next("@conditional.outer", "textobjects")
end)
vim.keymap.set({ "n", "x", "o" }, "[d", function()
require("nvim-treesitter-textobjects.move").goto_previous("@conditional.outer", "textobjects")
end)
else
print("plugin nvim-treesitter-textobjects missing")
end

View File

@@ -1,7 +1,7 @@
{ {
"plugins": { "plugins": {
"LuaSnip": { "LuaSnip": {
"rev": "5a1e39223db9a0498024a77b8441169d260c8c25", "rev": "642b0c595e11608b4c18219e93b88d7637af27bc",
"src": "https://github.com/L3MON4D3/LuaSnip", "src": "https://github.com/L3MON4D3/LuaSnip",
"version": "2.0.0 - 3.0.0" "version": "2.0.0 - 3.0.0"
}, },
@@ -14,7 +14,7 @@
"src": "https://github.com/rmagatti/auto-session" "src": "https://github.com/rmagatti/auto-session"
}, },
"conform.nvim": { "conform.nvim": {
"rev": "c2526f1cde528a66e086ab1668e996d162c75f4f", "rev": "dca1a190aa85f9065979ef35802fb77131911106",
"src": "https://github.com/stevearc/conform.nvim" "src": "https://github.com/stevearc/conform.nvim"
}, },
"flash.nvim": { "flash.nvim": {
@@ -26,7 +26,7 @@
"src": "https://github.com/kepano/flexoki-neovim" "src": "https://github.com/kepano/flexoki-neovim"
}, },
"fzf-lua": { "fzf-lua": {
"rev": "d9908fd0a5474994f00526ed17f0b77339dc0152", "rev": "2e29d5f233defe3c5587df0e4dd29af2bd95a5a7",
"src": "https://github.com/ibhagwan/fzf-lua" "src": "https://github.com/ibhagwan/fzf-lua"
}, },
"fzf-lua-frecency.nvim": { "fzf-lua-frecency.nvim": {
@@ -38,15 +38,19 @@
"src": "https://github.com/NMAC427/guess-indent.nvim" "src": "https://github.com/NMAC427/guess-indent.nvim"
}, },
"kanagawa.nvim": { "kanagawa.nvim": {
"rev": "aef7f5cec0a40dbe7f3304214850c472e2264b10", "rev": "8ad3b4cdcc804b332c32db8f9743667e1bb82b99",
"src": "https://github.com/rebelot/kanagawa.nvim" "src": "https://github.com/rebelot/kanagawa.nvim"
}, },
"lush.nvim": { "lush.nvim": {
"rev": "9c60ec2279d62487d942ce095e49006af28eed6e", "rev": "9c60ec2279d62487d942ce095e49006af28eed6e",
"src": "https://github.com/rktjmp/lush.nvim" "src": "https://github.com/rktjmp/lush.nvim"
}, },
"miasma.nvim": {
"rev": "627f2e1cac91de0d1d4dd7472b506a30f41b2b7d",
"src": "https://github.com/xero/miasma.nvim"
},
"multicursor.nvim": { "multicursor.nvim": {
"rev": "630dd29dd696bc977cb81d7dd2fa6bb280f60fc4", "rev": "704b99f10a72cc05d370cfeb294ff83412a8ab55",
"src": "https://github.com/jake-stewart/multicursor.nvim", "src": "https://github.com/jake-stewart/multicursor.nvim",
"version": "'1.0'" "version": "'1.0'"
}, },
@@ -55,34 +59,34 @@
"src": "https://github.com/EdenEast/nightfox.nvim" "src": "https://github.com/EdenEast/nightfox.nvim"
}, },
"nvim-surround": { "nvim-surround": {
"rev": "1098d7b3c34adcfa7feb3289ee434529abd4afd1", "rev": "61319d4bd1c5e336e197defa15bd104c51f0fb29",
"src": "https://github.com/kylechui/nvim-surround", "src": "https://github.com/kylechui/nvim-surround",
"version": "3.0.0 - 4.0.0" "version": "4.0.0 - 5.0.0"
}, },
"nvim-treesitter": { "nvim-treesitter": {
"rev": "42fc28ba918343ebfd5565147a42a26580579482", "rev": "4916d6592ede8c07973490d9322f187e07dfefac",
"src": "https://github.com/nvim-treesitter/nvim-treesitter", "src": "https://github.com/nvim-treesitter/nvim-treesitter",
"version": "'master'" "version": "'main'"
}, },
"nvim-treesitter-textobjects": { "nvim-treesitter-textobjects": {
"rev": "5ca4aaa6efdcc59be46b95a3e876300cfead05ef", "rev": "851e865342e5a4cb1ae23d31caf6e991e1c99f1e",
"src": "https://github.com/nvim-treesitter/nvim-treesitter-textobjects", "src": "https://github.com/nvim-treesitter/nvim-treesitter-textobjects",
"version": "'master'" "version": "'main'"
}, },
"nvim-various-textobjs": { "nvim-various-textobjs": {
"rev": "34ca4f6b54cf167554c5792cacc69c930b654136", "rev": "ad78e9d925c95d675b32dd7ba6d253f96ce063fe",
"src": "https://github.com/chrisgrieser/nvim-various-textobjs" "src": "https://github.com/chrisgrieser/nvim-various-textobjs"
}, },
"oil.nvim": { "oil.nvim": {
"rev": "f55b25e493a7df76371cfadd0ded5004cb9cd48a", "rev": "0fcc83805ad11cf714a949c98c605ed717e0b83e",
"src": "https://github.com/stevearc/oil.nvim" "src": "https://github.com/stevearc/oil.nvim"
}, },
"slimline.nvim": { "slimline.nvim": {
"rev": "6b1f20780a26813ba3c2f248c6c6f61e7281bb7b", "rev": "6e1387e69e222957ff87e5ddc61470d4e04ac683",
"src": "https://github.com/sschleemilch/slimline.nvim" "src": "https://github.com/sschleemilch/slimline.nvim"
}, },
"snacks.nvim": { "snacks.nvim": {
"rev": "fe7cfe9800a182274d0f868a74b7263b8c0c020b", "rev": "ad9ede6a9cddf16cedbd31b8932d6dcdee9b716e",
"src": "https://github.com/folke/snacks.nvim" "src": "https://github.com/folke/snacks.nvim"
}, },
"which-key.nvim": { "which-key.nvim": {
@@ -94,4 +98,4 @@
"src": "https://github.com/zenbones-theme/zenbones.nvim" "src": "https://github.com/zenbones-theme/zenbones.nvim"
} }
} }
} }