diff --git a/.dotter/global.toml b/.dotter/global.toml index 4b5c9bd..d674d32 100644 --- a/.dotter/global.toml +++ b/.dotter/global.toml @@ -40,6 +40,11 @@ ssh = "~" [terminal.files] "terminal/.config/vifm" = "~/.config/vifm" +"terminal/.config/bash/bashrc" = "~/.bashrc" +"terminal/.config/bash/bash_profile" = "~/.bash_profile" +"terminal/.config/zsh/zshrc" = "~/.config/zsh/.zshrc" +"terminal/.config/zsh/zprofile" = "~/.config/zsh/.zprofile" +"terminal/.config/zsh/zshenv" = "~/.config/zsh/.zshenv" terminal = "~" [linux] diff --git a/nvim/.config/nvim/lua/core/lazy.lua b/nvim/.config/nvim/lua/core/lazy.lua index cf7bdd1..3873b94 100644 --- a/nvim/.config/nvim/lua/core/lazy.lua +++ b/nvim/.config/nvim/lua/core/lazy.lua @@ -32,9 +32,10 @@ end vim.opt.rtp:prepend(lazypath) -- ensure plugins specs exist before loading into lazy -local spec_dir = vim.fn.stdpath("config") .. "/lua/plugins" -local spec_exist = (vim.fn.isdirectory(spec_dir) ~= 0) and (#vim.fn.glob(spec_dir .. "/*.lua", nil, true) ~= 0) -local spec = spec_exist and { import = "plugins" } or {} +local spec_dir_basename = "modules" +local spec_dir_path = vim.fn.stdpath("config") .. "/lua/" .. spec_dir_basename +local spec_exist = (vim.fn.isdirectory(spec_dir_path) ~= 0) and (#vim.fn.glob(spec_dir_path .. "/*.lua", nil, true) ~= 0) +local spec = spec_exist and { import = spec_dir_basename } or {} vim.g.lazy_events_config = { simple = { diff --git a/nvim/.config/nvim/lua/plugins/base.lua b/nvim/.config/nvim/lua/modules/base.lua similarity index 100% rename from nvim/.config/nvim/lua/plugins/base.lua rename to nvim/.config/nvim/lua/modules/base.lua diff --git a/nvim/.config/nvim/lua/plugins/completion.lua b/nvim/.config/nvim/lua/modules/completion.lua similarity index 100% rename from nvim/.config/nvim/lua/plugins/completion.lua rename to nvim/.config/nvim/lua/modules/completion.lua diff --git a/nvim/.config/nvim/lua/plugins/data_analysis.lua b/nvim/.config/nvim/lua/modules/data_analysis.lua similarity index 100% rename from nvim/.config/nvim/lua/plugins/data_analysis.lua rename to nvim/.config/nvim/lua/modules/data_analysis.lua diff --git a/nvim/.config/nvim/lua/plugins/debug.lua b/nvim/.config/nvim/lua/modules/debug.lua similarity index 100% rename from nvim/.config/nvim/lua/plugins/debug.lua rename to nvim/.config/nvim/lua/modules/debug.lua diff --git a/nvim/.config/nvim/lua/plugins/editing.lua b/nvim/.config/nvim/lua/modules/editing.lua similarity index 100% rename from nvim/.config/nvim/lua/plugins/editing.lua rename to nvim/.config/nvim/lua/modules/editing.lua diff --git a/nvim/.config/nvim/lua/plugins/formatting.lua b/nvim/.config/nvim/lua/modules/formatting.lua similarity index 100% rename from nvim/.config/nvim/lua/plugins/formatting.lua rename to nvim/.config/nvim/lua/modules/formatting.lua diff --git a/nvim/.config/nvim/lua/plugins/git.lua b/nvim/.config/nvim/lua/modules/git.lua similarity index 100% rename from nvim/.config/nvim/lua/plugins/git.lua rename to nvim/.config/nvim/lua/modules/git.lua diff --git a/nvim/.config/nvim/lua/plugins/languages.lua b/nvim/.config/nvim/lua/modules/languages.lua similarity index 100% rename from nvim/.config/nvim/lua/plugins/languages.lua rename to nvim/.config/nvim/lua/modules/languages.lua diff --git a/nvim/.config/nvim/lua/plugins/linting.lua b/nvim/.config/nvim/lua/modules/linting.lua similarity index 100% rename from nvim/.config/nvim/lua/plugins/linting.lua rename to nvim/.config/nvim/lua/modules/linting.lua diff --git a/nvim/.config/nvim/lua/plugins/llm.lua b/nvim/.config/nvim/lua/modules/llm.lua similarity index 99% rename from nvim/.config/nvim/lua/plugins/llm.lua rename to nvim/.config/nvim/lua/modules/llm.lua index 7d90eaa..f02f5e6 100644 --- a/nvim/.config/nvim/lua/plugins/llm.lua +++ b/nvim/.config/nvim/lua/modules/llm.lua @@ -111,6 +111,7 @@ return { if require("core.util").is_available("which-key") then require("which-key").add({ "a", group = "codecompanion" }) end + require("personal.ccp-fidget"):init() end, opts = { strategies = { diff --git a/nvim/.config/nvim/lua/plugins/lsp.lua b/nvim/.config/nvim/lua/modules/lsp.lua similarity index 100% rename from nvim/.config/nvim/lua/plugins/lsp.lua rename to nvim/.config/nvim/lua/modules/lsp.lua diff --git a/nvim/.config/nvim/lua/plugins/outliners.lua b/nvim/.config/nvim/lua/modules/outliners.lua similarity index 100% rename from nvim/.config/nvim/lua/plugins/outliners.lua rename to nvim/.config/nvim/lua/modules/outliners.lua diff --git a/nvim/.config/nvim/lua/plugins/pickers.lua b/nvim/.config/nvim/lua/modules/pickers.lua similarity index 100% rename from nvim/.config/nvim/lua/plugins/pickers.lua rename to nvim/.config/nvim/lua/modules/pickers.lua diff --git a/nvim/.config/nvim/lua/plugins/prose.lua b/nvim/.config/nvim/lua/modules/prose.lua similarity index 100% rename from nvim/.config/nvim/lua/plugins/prose.lua rename to nvim/.config/nvim/lua/modules/prose.lua diff --git a/nvim/.config/nvim/lua/plugins/statusline.lua b/nvim/.config/nvim/lua/modules/statusline.lua similarity index 100% rename from nvim/.config/nvim/lua/plugins/statusline.lua rename to nvim/.config/nvim/lua/modules/statusline.lua diff --git a/nvim/.config/nvim/lua/plugins/task.lua b/nvim/.config/nvim/lua/modules/task.lua similarity index 100% rename from nvim/.config/nvim/lua/plugins/task.lua rename to nvim/.config/nvim/lua/modules/task.lua diff --git a/nvim/.config/nvim/lua/plugins/terminal.lua b/nvim/.config/nvim/lua/modules/terminal.lua similarity index 100% rename from nvim/.config/nvim/lua/plugins/terminal.lua rename to nvim/.config/nvim/lua/modules/terminal.lua diff --git a/nvim/.config/nvim/lua/plugins/testing.lua b/nvim/.config/nvim/lua/modules/testing.lua similarity index 100% rename from nvim/.config/nvim/lua/plugins/testing.lua rename to nvim/.config/nvim/lua/modules/testing.lua diff --git a/nvim/.config/nvim/lua/plugins/treesitter.lua b/nvim/.config/nvim/lua/modules/treesitter.lua similarity index 100% rename from nvim/.config/nvim/lua/plugins/treesitter.lua rename to nvim/.config/nvim/lua/modules/treesitter.lua diff --git a/nvim/.config/nvim/lua/plugins/ui.lua b/nvim/.config/nvim/lua/modules/ui.lua similarity index 100% rename from nvim/.config/nvim/lua/plugins/ui.lua rename to nvim/.config/nvim/lua/modules/ui.lua diff --git a/nvim/.config/nvim/lua/personal/ccp-fidget.lua b/nvim/.config/nvim/lua/personal/ccp-fidget.lua new file mode 100644 index 0000000..28f2882 --- /dev/null +++ b/nvim/.config/nvim/lua/personal/ccp-fidget.lua @@ -0,0 +1,74 @@ +-- taken from https://github.com/olimorris/codecompanion.nvim/discussions/813#discussioncomment-12031954 +-- many thanks to @jessevdp! + +local progress = require("fidget.progress") + +local M = {} + +function M:init() + local group = vim.api.nvim_create_augroup("CodeCompanionFidgetHooks", {}) + + vim.api.nvim_create_autocmd({ "User" }, { + pattern = "CodeCompanionRequestStarted", + group = group, + callback = function(request) + local handle = M:create_progress_handle(request) + M:store_progress_handle(request.data.id, handle) + end, + }) + + vim.api.nvim_create_autocmd({ "User" }, { + pattern = "CodeCompanionRequestFinished", + group = group, + callback = function(request) + local handle = M:pop_progress_handle(request.data.id) + if handle then + M:report_exit_status(handle, request) + handle:finish() + end + end, + }) +end + +M.handles = {} + +function M:store_progress_handle(id, handle) + M.handles[id] = handle +end + +function M:pop_progress_handle(id) + local handle = M.handles[id] + M.handles[id] = nil + return handle +end + +function M:create_progress_handle(request) + return progress.handle.create({ + title = " Running (" .. request.data.strategy .. ")", + message = "In progress...", + lsp_client = { + name = M:llm_role_title(request.data.adapter), + }, + }) +end + +function M:llm_role_title(adapter) + local parts = {} + table.insert(parts, adapter.formatted_name) + if adapter.model and adapter.model ~= "" then + table.insert(parts, "(" .. adapter.model .. ")") + end + return table.concat(parts, " ") +end + +function M:report_exit_status(handle, request) + if request.data.status == "success" then + handle.message = "Completed" + elseif request.data.status == "error" then + handle.message = " Error" + else + handle.message = "󰜺 Cancelled" + end +end + +return M diff --git a/nvim/.config/nvim/snippets/mdx.json b/nvim/.config/nvim/snippets/mdx.json new file mode 100644 index 0000000..dd1c908 --- /dev/null +++ b/nvim/.config/nvim/snippets/mdx.json @@ -0,0 +1,425 @@ +{ + "header 1": { + "prefix": "h1", + "body": ["# ${0}"], + "description": "Add header level 1" + }, + "header 2": { + "prefix": "h2", + "body": ["## ${0}"], + "description": "Add header level 2" + }, + "header 3": { + "prefix": "h3", + "body": ["### ${0}"], + "description": "Add header level 3" + }, + "header 4": { + "prefix": "h4", + "body": ["#### ${0}"], + "description": "Add header level 4" + }, + "header 5": { + "prefix": "h5", + "body": ["##### ${0}"], + "description": "Add header level 5" + }, + "header 6": { + "prefix": "h6", + "body": ["###### ${0}"], + "description": "Add header level 6" + }, + "Links": { + "prefix": ["l", "link"], + "body": ["[${1:text}](${2:url}) ${0}"], + "description": "Add links" + }, + "URLS": { + "prefix": ["u", "url"], + "body": ["<${1}> ${0}"], + "description": "Add urls" + }, + "Images": { + "prefix": "img", + "body": ["![${1:alt text}](${2:path}) ${0}"], + "description": "Add images" + }, + "Insert strikethrough": { + "prefix": "strikethrough", + "body": "~~${1}~~ ${0}", + "description": "Insert strikethrough" + }, + "Insert bold text": { + "prefix": ["bold", "b"], + "body": "**${1}** $0", + "description": "Insert bold text" + }, + "Insert italic text": { + "prefix": ["i", "italic"], + "body": "*${1}* $0", + "description": "Insert italic text" + }, + "Insert bold and italic text": { + "prefix": ["bold and italic", "bi"], + "body": "***${1}*** $0", + "description": "Insert bold and italic text" + }, + "Insert quoted text": { + "prefix": "quote", + "body": "> ${1}", + "description": "Insert quoted text" + }, + "Insert code": { + "prefix": "code", + "body": "`${1}` $0", + "description": "Insert code" + }, + "Insert code block": { + "prefix": "codeblock", + "body": ["```${1:language}", "$0", "```"], + "description": "Insert fenced code block" + }, + "Insert todo item": { + "prefix": "todo", + "body": ["- [ ] ${1:first}", "$0"], + "description": "Insert a single todo list item" + }, + "Insert todo list": { + "prefix": "todo list", + "body": ["- [ ] ${1:first}", "- [ ] ${2:second}", "- [ ] ${3:third}", "$0"], + "description": "Insert multiple todo list items" + }, + "Insert unordered list": { + "prefix": "unordered list", + "body": ["- ${1:first}", "- ${2:second}", "- ${3:third}", "$0"], + "description": "Insert unordered list" + }, + "Insert ordered list": { + "prefix": "ordered list", + "body": ["1. ${1:first}", "2. ${2:second}", "3. ${3:third}", "$0"], + "description": "Insert ordered list" + }, + "Insert horizontal rule": { + "prefix": "horizontal rule", + "body": "----------\n", + "description": "Insert horizontal rule" + }, + "Insert task list": { + "prefix": "task", + "body": ["- [${1| ,x|}] ${2:text}", "${0}"], + "description": "Insert task list" + }, + "Insert task list 2": { + "prefix": "task2", + "body": ["- [${1| ,x|}] ${2:text}", "- [${3| ,x|}] ${4:text}", "${0}"], + "description": "Insert task list with 2 tasks" + }, + "Insert task list 3": { + "prefix": "task3", + "body": [ + "- [${1| ,x|}] ${2:text}", + "- [${3| ,x|}] ${4:text}", + "- [${5| ,x|}] ${6:text}", + "${0}" + ], + "description": "Insert task list with 3 tasks" + }, + "Insert task list 4": { + "prefix": "task4", + "body": [ + "- [${1| ,x|}] ${2:text}", + "- [${3| ,x|}] ${4:text}", + "- [${5| ,x|}] ${6:text}", + "- [${7| ,x|}] ${8:text}", + "${0}" + ], + "description": "Insert task list with 4 tasks" + }, + "Insert task list 5": { + "prefix": "task5", + "body": [ + "- [${1| ,x|}] ${2:text}", + "- [${3| ,x|}] ${4:text}", + "- [${5| ,x|}] ${6:text}", + "- [${7| ,x|}] ${8:text}", + "- [${9| ,x|}] ${10:text}", + "${0}" + ], + "description": "Insert task list with 5 tasks" + }, + "Insert table": { + "prefix": "table", + "body": [ + "| ${1:Column1} | ${2:Column2} | ${3:Column3} |", + "| ------------- | -------------- | -------------- |", + "| ${4:Item1} | ${5:Item1} | ${6:Item1} |", + "${0}" + ], + "description": "Insert table with 2 rows and 3 columns. First row is heading." + }, + "Insert 2x1 table": { + "prefix": "2x1table", + "body": [ + "| ${1:Column1} |", + "| ------------- |", + "| ${2:Item1} |", + "${0}" + ], + "description": "Insert table with 2 rows and 1 column. First row is heading." + }, + "Insert 3x1 table": { + "prefix": "3x1table", + "body": [ + "| ${1:Column1} |", + "| ------------- |", + "| ${2:Item1} |", + "| ${3:Item2} |", + "${0}" + ], + "description": "Insert table with 3 rows and 1 column. First row is heading." + }, + "Insert 4x1 table": { + "prefix": "4x1table", + "body": [ + "| ${1:Column1} |", + "| ------------- |", + "| ${2:Item1} |", + "| ${3:Item2} |", + "| ${4:Item3} |", + "${0}" + ], + "description": "Insert table with 4 rows and 1 column. First row is heading." + }, + "Insert 5x1 table": { + "prefix": "5x1table", + "body": [ + "| ${1:Column1} |", + "| ------------- |", + "| ${2:Item1} |", + "| ${3:Item2} |", + "| ${4:Item3} |", + "| ${5:Item4} |", + "${0}" + ], + "description": "Insert table with 5 rows and 1 column. First row is heading." + }, + "Insert 2x2 table": { + "prefix": "2x2table", + "body": [ + "| ${1:Column1} | ${2:Column2} |", + "| -------------- | --------------- |", + "| ${3:Item1.1} | ${4:Item2.1} |", + "${0}" + ], + "description": "Insert table with 2 rows and 2 columns. First row is heading." + }, + "Insert 3x2 table": { + "prefix": "3x2table", + "body": [ + "| ${1:Column1} | ${2:Column2} |", + "| -------------- | --------------- |", + "| ${3:Item1.1} | ${4:Item2.1} |", + "| ${5:Item1.2} | ${6:Item2.2} |", + "${0}" + ], + "description": "Insert table with 3 rows and 2 columns. First row is heading." + }, + "Insert 4x2 table": { + "prefix": "4x2table", + "body": [ + "| ${1:Column1} | ${2:Column2} |", + "| -------------- | --------------- |", + "| ${3:Item1.1} | ${4:Item2.1} |", + "| ${5:Item1.2} | ${6:Item2.2} |", + "| ${7:Item1.3} | ${8:Item2.3} |", + "${0}" + ], + "description": "Insert table with 4 rows and 2 columns. First row is heading." + }, + "Insert 5x2 table": { + "prefix": "5x2table", + "body": [ + "| ${1:Column1} | ${2:Column2} |", + "|--------------- | --------------- |", + "| ${3:Item1.1} | ${4:Item2.1} |", + "| ${5:Item1.2} | ${6:Item2.2} |", + "| ${7:Item1.3} | ${8:Item2.3} |", + "| ${9:Item1.4} | ${10:Item2.4} |", + "${0}" + ], + "description": "Insert table with 5 rows and 2 columns. First row is heading." + }, + "Insert 2x3 table": { + "prefix": "2x3table", + "body": [ + "| ${1:Column1} | ${2:Column2} | ${3:Column3} |", + "| --------------- | --------------- | --------------- |", + "| ${4:Item1.1} | ${5:Item2.1} | ${6:Item3.1} |", + "${0}" + ], + "description": "Insert table with 2 rows and 3 columns. First row is heading." + }, + "Insert 3x3 table": { + "prefix": "3x3table", + "body": [ + "| ${1:Column1} | ${2:Column2} | ${3:Column3} |", + "| --------------- | --------------- | --------------- |", + "| ${4:Item1.1} | ${5:Item2.1} | ${6:Item3.1} |", + "| ${7:Item1.2} | ${8:Item2.2} | ${9:Item3.2} |", + "${0}" + ], + "description": "Insert table with 3 rows and 3 columns. First row is heading." + }, + "Insert 4x3 table": { + "prefix": "4x3table", + "body": [ + "| ${1:Column1} | ${2:Column2} | ${3:Column3} |", + "| --------------- | --------------- | --------------- |", + "| ${4:Item1.1} | ${5:Item2.1} | ${6:Item3.1} |", + "| ${7:Item1.2} | ${8:Item2.2} | ${9:Item3.2} |", + "| ${10:Item1.3} | ${11:Item2.3} | ${12:Item3.3} |", + "${0}" + ], + "description": "Insert table with 4 rows and 3 columns. First row is heading." + }, + "Insert 5x3 table": { + "prefix": "5x3table", + "body": [ + "| ${1:Column1} | ${2:Column2} | ${3:Column3} |", + "| --------------- | --------------- | --------------- |", + "| ${4:Item1.1} | ${5:Item2.1} | ${6:Item3.1} |", + "| ${7:Item1.2} | ${8:Item2.2} | ${9:Item3.2} |", + "| ${10:Item1.3} | ${11:Item2.3} | ${12:Item3.3} |", + "| ${13:Item1.4} | ${14:Item2.4} | ${15:Item3.4} |", + "${0}" + ], + "description": "Insert table with 5 rows and 3 columns. First row is heading." + }, + "Insert 2x4 table": { + "prefix": "2x4table", + "body": [ + "| ${1:Column1} | ${2:Column2} | ${3:Column3} | ${4:Column4} |", + "| --------------- | --------------- | --------------- | --------------- |", + "| ${5:Item1.1} | ${6:Item2.1} | ${7:Item3.1} | ${8:Item4.1} |", + "${0}" + ], + "description": "Insert table with 2 rows and 4 columns. First row is heading." + }, + "Insert 3x4 table": { + "prefix": "3x4table", + "body": [ + "| ${1:Column1} | ${2:Column2} | ${3:Column3} | ${4:Column4} |", + "| --------------- | --------------- | --------------- | --------------- |", + "| ${5:Item1.1} | ${6:Item2.1} | ${7:Item3.1} | ${8:Item4.1} |", + "| ${9:Item1.2} | ${10:Item2.2} | ${11:Item3.2} | ${12:Item4.2} |", + "${0}" + ], + "description": "Insert table with 3 rows and 4 columns. First row is heading." + }, + "Insert 4x4 table": { + "prefix": "4x4table", + "body": [ + "| ${1:Column1} | ${2:Column2} | ${3:Column3} | ${4:Column4} |", + "| --------------- | --------------- | --------------- | --------------- |", + "| ${5:Item1.1} | ${6:Item2.1} | ${7:Item3.1} | ${8:Item4.1} |", + "| ${9:Item1.2} | ${10:Item2.2} | ${11:Item3.2} | ${12:Item4.2} |", + "| ${13:Item1.3} | ${14:Item2.3} | ${15:Item3.3} | ${16:Item4.3} |", + "${0}" + ], + "description": "Insert table with 4 rows and 4 columns. First row is heading." + }, + "Insert 5x4 table": { + "prefix": "5x4table", + "body": [ + "| ${1:Column1} | ${2:Column2} | ${3:Column3} | ${4:Column4} |", + "| --------------- | --------------- | --------------- | --------------- |", + "| ${5:Item1.1} | ${6:Item2.1} | ${7:Item3.1} | ${8:Item4.1} |", + "| ${9:Item1.2} | ${10:Item2.2} | ${11:Item3.2} | ${12:Item4.2} |", + "| ${13:Item1.3} | ${14:Item2.3} | ${15:Item3.3} | ${16:Item4.3} |", + "| ${17:Item1.4} | ${18:Item2.4} | ${19:Item3.4} | ${20:Item4.4} |", + "${0}" + ], + "description": "Insert table with 5 rows and 4 columns. First row is heading." + }, + "Insert 2x5 table": { + "prefix": "2x5table", + "body": [ + "| ${1:Column1} | ${2:Column2} | ${3:Column3} | ${4:Column4} | ${5:Column5} |", + "| --------------- | --------------- | --------------- | --------------- | --------------- |", + "| ${6:Item1.1} | ${7:Item2.1} | ${8:Item3.1} | ${9:Item4.1} | ${10:Item5.1} |", + "${0}" + ], + "description": "Insert table with 2 rows and 5 columns. First row is heading." + }, + "Insert 3x5 table": { + "prefix": "3x5table", + "body": [ + "| ${1:Column1} | ${2:Column2} | ${3:Column3} | ${4:Column4} | ${5:Column5} |", + "| --------------- | --------------- | --------------- | --------------- | --------------- |", + "| ${6:Item1.1} | ${7:Item2.1} | ${8:Item3.1} | ${9:Item4.1} | ${10:Item5.1} |", + "| ${11:Item1.2} | ${12:Item2.2} | ${13:Item3.2} | ${14:Item4.2} | ${15:Item5.2} |", + "${0}" + ], + "description": "Insert table with 3 rows and 5 columns. First row is heading." + }, + "Insert 4x5 table": { + "prefix": "4x5table", + "body": [ + "| ${1:Column1} | ${2:Column2} | ${3:Column3} | ${4:Column4} | ${5:Column5} |", + "| --------------- | --------------- | --------------- | --------------- | --------------- |", + "| ${6:Item1.1} | ${7:Item2.1} | ${8:Item3.1} | ${9:Item4.1} | ${10:Item5.1} |", + "| ${11:Item1.2} | ${12:Item2.2} | ${13:Item3.2} | ${14:Item4.2} | ${15:Item5.2} |", + "| ${16:Item1.3} | ${17:Item2.3} | ${18:Item3.3} | ${19:Item4.3} | ${20:Item5.3} |", + "${0}" + ], + "description": "Insert table with 4 rows and 5 columns. First row is heading." + }, + "Insert 5x5 table": { + "prefix": "5x5table", + "body": [ + "| ${1:Column1} | ${2:Column2} | ${3:Column3} | ${4:Column4} | ${5:Column5} |", + "| --------------- | --------------- | --------------- | --------------- | --------------- |", + "| ${6:Item1.1} | ${7:Item2.1} | ${8:Item3.1} | ${9:Item4.1} | ${10:Item5.1} |", + "| ${11:Item1.2} | ${12:Item2.2} | ${13:Item3.2} | ${14:Item4.2} | ${15:Item5.2} |", + "| ${16:Item1.3} | ${17:Item2.3} | ${18:Item3.3} | ${19:Item4.3} | ${20:Item5.3} |", + "| ${21:Item1.4} | ${22:Item2.4} | ${23:Item3.4} | ${24:Item4.4} | ${25:Item5.4} |", + "${0}" + ], + "description": "Insert table with 5 rows and 5 columns. First row is heading." + }, + "Insert subscript": { + "prefix": "sub", + "body": ["${1}${0}"], + "description": "Create a subscript." + }, + "Insert superscript": { + "prefix": "sup", + "body": ["${1}${0}"], + "description": "Create a superscript." + }, + "Insert Note": { + "prefix": ["note", "n"], + "body": "> [!NOTE]\n> ", + "description": "Insert Note" + }, + "Insert Tip": { + "prefix": ["tip", "t"], + "body": "> [!TIP]\n> ", + "description": "Insert Tip" + }, + "Insert Important": { + "prefix": ["important", "imp"], + "body": "> [!IMPORTANT]\n> ", + "description": "Insert Important" + }, + "Insert Warning": { + "prefix": ["warning", "w"], + "body": "> [!WARNING]\n> ", + "description": "Insert Warning" + }, + "Insert Caution": { + "prefix": ["caution", "c"], + "body": "> [!CAUTION]\n> ", + "description": "Insert Caution" + } +} diff --git a/terminal/.bashrc b/terminal/.bashrc deleted file mode 100644 index cea3f14..0000000 --- a/terminal/.bashrc +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env bash -# -# ~/.bashrc -# -# shellcheck disable=SC1090 - -CONFDIR="${XDG_CONFIG_HOME:-$HOME/.config}" - -# If not running interactively, don't do anything -[[ $- != *i* ]] && return - -[ -f "$CONFDIR/sh/alias" ] && source "$CONFDIR/sh/alias" -# load additional aliases -if [ -d "$CONFDIR/sh/alias.d" ]; then - for _alias in "$CONFDIR/sh/alias.d"/*.sh; do - . "$_alias" - done - unset _alias -fi -if [ -d "$CONFDIR/bash/alias.d" ]; then - for _alias in "$CONFDIR/bash/alias.d"/*.sh; do - . "$_alias" - done - unset _alias -fi - -alias ls='ls --color=auto' - -eval "$(starship init bash)" -eval "$(zoxide init bash)" -export CARAPACE_BRIDGES='zsh,fish,bash,inshellisense' # optional -source <(carapace _carapace) - -set -o vi -stty time 0 -bind 'set keyseq-timeout 1' - -eval "$(atuin init bash)" diff --git a/terminal/.bash_profile b/terminal/.config/bash/bash_profile similarity index 100% rename from terminal/.bash_profile rename to terminal/.config/bash/bash_profile diff --git a/terminal/.config/bash/bashrc b/terminal/.config/bash/bashrc new file mode 100644 index 0000000..9a03b5a --- /dev/null +++ b/terminal/.config/bash/bashrc @@ -0,0 +1,64 @@ +#!/usr/bin/env bash +# +# ~/.bashrc +# +# shellcheck disable=SC1090 + +CONFDIR="${XDG_CONFIG_HOME:-$HOME/.config}" + +# If not running interactively, don't do anything +[[ $- != *i* ]] && return + +[ -f "$CONFDIR/sh/alias" ] && source "$CONFDIR/sh/alias" +# load additional aliases +if [ -d "$CONFDIR/sh/alias.d" ]; then + for _alias in "$CONFDIR/sh/alias.d"/*.sh; do + . "$_alias" + done + unset _alias +fi +if [ -d "$CONFDIR/bash/alias.d" ]; then + for _alias in "$CONFDIR/bash/alias.d"/*.sh; do + . "$_alias" + done + unset _alias +fi + +alias ls='ls --color=auto' + +eval "$(starship init bash)" +eval "$(zoxide init bash)" +export CARAPACE_BRIDGES='zsh,fish,bash,inshellisense' # optional +source <(carapace _carapace) + +set -o vi +stty time 0 +bind 'set keyseq-timeout 1' + +# insert files with c-t or T in vicmd mode +FZF_CTRL_R_COMMAND="" FZF_ALT_C_COMMAND="" eval "$(fzf --bash)" +builtin bind -m vi-command '"T": "\C-z\C-t\C-z"' + +_run-cdi() { + # Get the directory from zoxide query + local dir=$(zoxide query -i) + + # If no directory is found, clear the line + if [[ -z "$dir" ]]; then + echo '' + return + fi + + # Call cd with the directory + cd -- "$dir" + + # Return the exit status of cd + return $? +} +# Make the function _run-cdi available +# shellcheck disable=SC2016 +bind -x '"\ec": "`_run-cdi`"' +# shellcheck disable=SC2016 +bind -m vi-command -x '"C": "`_run-cdi`"' + +eval "$(atuin init bash)" diff --git a/terminal/.config/nushell/config.nu b/terminal/.config/nushell/config.nu index d7a0390..ebfefae 100644 --- a/terminal/.config/nushell/config.nu +++ b/terminal/.config/nushell/config.nu @@ -38,18 +38,18 @@ zoxide init nushell | save -f ($nu.data-dir | path join "vendor/autoload/zoxide. # load carapace completions source ~/.cache/carapace/init.nu - # keybinds $env.config.keybindings = [ { modifier: control keycode: char_o mode: [emacs, vi_normal, vi_insert] event: null }, { name: clear_screen - modifier: control - keycode: char_t + modifier: alt + keycode: char_l mode: ["emacs", "vi_normal", "vi_insert"] - event: { - send: ClearScreen - } + event: [ + {edit: Clear} + {send: Enter} + ] } { name: open_editor @@ -60,6 +60,41 @@ $env.config.keybindings = [ send: OpenEditor } } + { + name: run_zoxide + modifier: alt + keycode: char_c + mode: ["emacs", "vi_normal", "vi_insert"] + event: { + send: executehostcommand + cmd: "zoxide query --interactive" + } + } + { + name: run_zoxide_vicmd + modifier: shift + keycode: char_c + mode: [ "vi_normal"] + event: { + send: executehostcommand + cmd: "zoxide query --interactive" + } + } + { + name: insert_file_fzf + modifier: control + keycode: char_t + mode: ["emacs", "vi_normal", "vi_insert"] + event: { + send: executehostcommand + cmd: " + let fzf_ctrl_t_command = \$\"fd --type file --hidden | fzf --preview 'bat --color=always --style=full --line-range=:500 {}' \"; + let result = nu -l -i -c $fzf_ctrl_t_command; + commandline edit --append $result; + commandline set-cursor --end + " + } + } ] alias l = ls diff --git a/terminal/.config/zsh/.zprofile b/terminal/.config/zsh/zprofile similarity index 100% rename from terminal/.config/zsh/.zprofile rename to terminal/.config/zsh/zprofile diff --git a/terminal/.config/zsh/.zshenv b/terminal/.config/zsh/zshenv similarity index 100% rename from terminal/.config/zsh/.zshenv rename to terminal/.config/zsh/zshenv diff --git a/terminal/.config/zsh/.zshrc b/terminal/.config/zsh/zshrc similarity index 93% rename from terminal/.config/zsh/.zshrc rename to terminal/.config/zsh/zshrc index 4bea925..40561b5 100644 --- a/terminal/.config/zsh/.zshrc +++ b/terminal/.config/zsh/zshrc @@ -49,6 +49,9 @@ unset PLUG_FOLDER # simple fzf-tab settings zstyle ":fzf-tab:*" fzf-flags "--ansi" "--expect='$continuous_trigger,$print_query'" "--color=hl:$(($#headers == 0 ? 108 : 255))" "--nth=2,3" "--layout=reverse" "--height=${FZF_TMUX_HEIGHT:-75%}" "--tiebreak=begin" "-m" "--bind=tab:down,btab:up,change:top,ctrl-space:toggle" "--cycle" "--query=$query" "--header-lines=$#headers" "--print-query" +# enable inserting files or dirs using fzf with ctrl-t +FZF_CTRL_R_COMMAND="" FZF_ALT_C_COMMAND="" source <(fzf --zsh) + zstyle ':fzf-tab:*' fzf-command fzf # format colorful groups for different completion actions zstyle ':completion:*:descriptions' format '[%d]' @@ -208,6 +211,29 @@ _fix_cursor() { } precmd_functions+=(_fix_cursor) +_run-cdi() { + local dir="$(eval "zoxide query -i")" + if [[ -z "$dir" ]]; then + zle redisplay + return 0 + fi + zle push-line + BUFFER="builtin cd -- ${(q)dir}" + zle accept-line + local ret=$? + unset dir + zle reset-prompt + return $ret +} +zle -N _run-cdi + +# use alt-c or C in cmd mode to change dir using zoxide +bindkey '\ec' _run-cdi +bindkey -M vicmd 'C' _run-cdi +# add file insertion with fzf to T in cmd mode (c-t in insert) +# insert-mode keybind is above, using regular fzf sourcing +bindkey -M vicmd 'T' fzf-file-widget + # space puts a space, even in cmd mode bindkey -a ' ' magic-space # always allow backspace/delete to remove letters