nvim 0.12 wip
This commit is contained in:
@@ -1,17 +0,0 @@
|
||||
return {
|
||||
"catppuccin/nvim",
|
||||
name = "catppuccin",
|
||||
priority = 1000,
|
||||
config = function()
|
||||
local config = require("catppuccin")
|
||||
config.setup({
|
||||
auto_integrations = true,
|
||||
flavour = "mocha",
|
||||
background = {
|
||||
light = "mocha",
|
||||
dark = "mocha",
|
||||
},
|
||||
})
|
||||
vim.cmd.colorscheme "catppuccin-mocha"
|
||||
end
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
return {
|
||||
-- {
|
||||
-- 'milanglacier/minuet-ai.nvim',
|
||||
-- dependencies = {
|
||||
-- 'nvim-lua/plenary.nvim',
|
||||
-- 'Saghen/blink.cmp'
|
||||
-- },
|
||||
-- config = function()
|
||||
-- require('minuet').setup {
|
||||
-- provider = 'openai_fim_compatible',
|
||||
-- n_completions = 1, -- recommend for local model for resource saving
|
||||
-- -- I recommend beginning with a small context window size and incrementally
|
||||
-- -- expanding it, depending on your local computing power. A context window
|
||||
-- -- of 512, serves as an good starting point to estimate your computing
|
||||
-- -- power. Once you have a reliable estimate of your local computing power,
|
||||
-- -- you should adjust the context window to a larger value.
|
||||
-- context_window = 512,
|
||||
-- provider_options = {
|
||||
-- openai_fim_compatible = {
|
||||
-- -- For Windows users, TERM may not be present in environment variables.
|
||||
-- -- Consider using APPDATA instead.
|
||||
-- api_key = 'TERM',
|
||||
-- name = 'Llama.cpp',
|
||||
-- end_point = 'http://localhost:1234/v1/completions',
|
||||
-- model = 'qwen2.5-coder-7b-instruct',
|
||||
---- template = {
|
||||
---- prompt = function(context_before_cursor, context_after_cursor, _)
|
||||
---- return '<|fim_prefix|>'
|
||||
---- .. context_before_cursor
|
||||
---- .. '<|fim_suffix|>'
|
||||
---- .. context_after_cursor
|
||||
---- .. '<|fim_middle|>'
|
||||
---- end,
|
||||
---- suffix = false,
|
||||
---- },
|
||||
-- },
|
||||
-- },
|
||||
-- }
|
||||
-- end,
|
||||
-- },
|
||||
{
|
||||
'saghen/blink.cmp',
|
||||
-- optional: provides snippets for the snippet source
|
||||
dependencies = { 'rafamadriz/friendly-snippets' },
|
||||
|
||||
-- use a release tag to download pre-built binaries
|
||||
version = '1.*',
|
||||
-- AND/OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust
|
||||
-- build = 'cargo build --release',
|
||||
-- If you use nix, you can build from source using latest nightly rust with:
|
||||
-- build = 'nix run .#build-plugin',
|
||||
|
||||
---@module 'blink.cmp'
|
||||
---@type blink.cmp.Config
|
||||
opts = {
|
||||
-- 'default' (recommended) for mappings similar to built-in completions (C-y to accept)
|
||||
-- 'super-tab' for mappings similar to vscode (tab to accept)
|
||||
-- 'enter' for enter to accept
|
||||
-- 'none' for no mappings
|
||||
--
|
||||
-- All presets have the following mappings:
|
||||
-- C-space: Open menu or open docs if already open
|
||||
-- C-n/C-p or Up/Down: Select next/previous item
|
||||
-- C-e: Hide menu
|
||||
-- C-k: Toggle signature help (if signature.enabled = true)
|
||||
--
|
||||
-- See :h blink-cmp-config-keymap for defining your own keymap
|
||||
keymap = { preset = 'default' },
|
||||
|
||||
appearance = {
|
||||
-- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
|
||||
-- Adjusts spacing to ensure icons are aligned
|
||||
nerd_font_variant = 'mono'
|
||||
},
|
||||
|
||||
completion = { trigger = { prefetch_on_insert = false }, documentation = { auto_show = false } },
|
||||
|
||||
-- Default list of enabled providers defined so that you can extend it
|
||||
-- elsewhere in your config, without redefining it, due to `opts_extend`
|
||||
sources = {
|
||||
default = { 'lsp', 'path', 'snippets', 'buffer' },
|
||||
},
|
||||
-- (Default) Rust fuzzy matcher for typo resistance and significantly better performance
|
||||
-- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation,
|
||||
-- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"`
|
||||
--
|
||||
-- See the fuzzy documentation for more information
|
||||
fuzzy = { implementation = "prefer_rust_with_warning" }
|
||||
},
|
||||
-- config = function()
|
||||
-- require('blink-cmp').setup {
|
||||
-- sources = {
|
||||
-- default = { 'lsp', 'path', 'buffer', 'snippets', 'minuet' },
|
||||
-- providers = {
|
||||
-- minuet = {
|
||||
-- name = 'minuet',
|
||||
-- module = 'minuet.blink',
|
||||
-- async = true,
|
||||
-- -- Should match minuet.config.request_timeout * 1000,
|
||||
-- -- since minuet.config.request_timeout is in seconds
|
||||
-- timeout_ms = 3000,
|
||||
-- score_offset = 50, -- Gives minuet higher priority among suggestions
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
-- }
|
||||
-- end
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
return {
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
config = function()
|
||||
local dap = require('dap')
|
||||
dap.adapters.codelldb = {
|
||||
type = "executable",
|
||||
command = "codelldb"
|
||||
}
|
||||
|
||||
dap.configurations.cpp = {
|
||||
{
|
||||
name = "Launch file",
|
||||
type = "codelldb",
|
||||
request = "launch",
|
||||
program = function()
|
||||
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
|
||||
end,
|
||||
cwd = '${workspaceFolder}',
|
||||
stopOnEntry = false,
|
||||
},
|
||||
}
|
||||
|
||||
dap.configurations.c = dap.configurations.cpp
|
||||
dap.configurations.rust = dap.configurations.cpp
|
||||
dap.configurations.zig = dap.configurations.cpp
|
||||
|
||||
vim.keymap.set("n", "<leader>dt", ":DapToggleBreakpoint<CR>")
|
||||
vim.keymap.set("n", "<leader>dc", ":DapContinue<CR>")
|
||||
vim.keymap.set("n", "<leader>dx", ":DapTerminate<CR>")
|
||||
vim.keymap.set("n", "<leader>do", ":DapStepOver<CR>")
|
||||
end
|
||||
},
|
||||
{
|
||||
"rcarriga/nvim-dap-ui",
|
||||
dependencies = {
|
||||
"mfussenegger/nvim-dap",
|
||||
"nvim-neotest/nvim-nio"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
return {
|
||||
"sindrets/diffview.nvim"
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
return {
|
||||
{
|
||||
"tpope/vim-fugitive"
|
||||
},
|
||||
{
|
||||
"lewis6991/gitsigns.nvim"
|
||||
},
|
||||
}
|
||||
5
.config/nvim/lua/plugins/init.lua
Normal file
5
.config/nvim/lua/plugins/init.lua
Normal file
@@ -0,0 +1,5 @@
|
||||
require("plugins.whichkey")
|
||||
require("plugins.treesitter")
|
||||
require("plugins.neotree")
|
||||
require("plugins.telescope")
|
||||
require("plugins.theme")
|
||||
@@ -1,4 +0,0 @@
|
||||
return {
|
||||
"fei6409/log-highlight.nvim",
|
||||
opts = {},
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
return {
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
lazy = false,
|
||||
config = function()
|
||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, {})
|
||||
vim.keymap.set("n", "<leader>gd", vim.lsp.buf.definition, {})
|
||||
vim.keymap.set("n", "<leader>gr", vim.lsp.buf.references, {})
|
||||
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, {})
|
||||
vim.keymap.set("n", '<leader>rn', vim.lsp.buf.rename, {})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
lazy = false,
|
||||
config = function()
|
||||
require("mason").setup({
|
||||
registries = {
|
||||
"github:mason-org/mason-registry",
|
||||
"github:Crashdummyy/mason-registry",
|
||||
},
|
||||
})
|
||||
end
|
||||
},
|
||||
{
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
lazy = false,
|
||||
opts = {
|
||||
auto_install = true,
|
||||
},
|
||||
},
|
||||
{
|
||||
"seblyng/roslyn.nvim",
|
||||
---@module 'roslyn.config'
|
||||
---@type RoslynNvimConfig
|
||||
opts = {
|
||||
-- your configuration comes here; leave empty for default settings
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
return {
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
branch = "v3.x",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
"MunifTanjim/nui.nvim",
|
||||
},
|
||||
config = function()
|
||||
vim.keymap.set('n', '<C-n>', ':Neotree filesystem reveal float<CR>')
|
||||
end
|
||||
}
|
||||
11
.config/nvim/lua/plugins/neotree.lua
Normal file
11
.config/nvim/lua/plugins/neotree.lua
Normal file
@@ -0,0 +1,11 @@
|
||||
vim.pack.add({
|
||||
{
|
||||
src = 'https://github.com/nvim-neo-tree/neo-tree.nvim',
|
||||
version = vim.version.range('3')
|
||||
},
|
||||
-- dependencies
|
||||
"https://github.com/nvim-lua/plenary.nvim",
|
||||
"https://github.com/MunifTanjim/nui.nvim",
|
||||
-- optional, but recommended
|
||||
"https://github.com/nvim-tree/nvim-web-devicons",
|
||||
})
|
||||
@@ -1,19 +0,0 @@
|
||||
return {
|
||||
'NickvanDyke/opencode.nvim',
|
||||
dependencies = { 'folke/snacks.nvim', },
|
||||
---@type opencode.Config
|
||||
opts = {
|
||||
-- Your configuration, if any
|
||||
},
|
||||
-- stylua: ignore
|
||||
keys = {
|
||||
{ '<leader>ot', function() require('opencode').toggle() end, desc = 'Toggle embedded opencode', },
|
||||
{ '<leader>oa', function() require('opencode').ask() end, desc = 'Ask opencode', mode = 'n', },
|
||||
{ '<leader>oa', function() require('opencode').ask('@selection: ') end, desc = 'Ask opencode about selection', mode = 'v', },
|
||||
{ '<leader>op', function() require('opencode').select_prompt() end, desc = 'Select prompt', mode = { 'n', 'v', }, },
|
||||
{ '<leader>on', function() require('opencode').command('session_new') end, desc = 'New session', },
|
||||
{ '<leader>oy', function() require('opencode').command('messages_copy') end, desc = 'Copy last message', },
|
||||
{ '<S-C-u>', function() require('opencode').command('messages_half_page_up') end, desc = 'Scroll messages up', },
|
||||
{ '<S-C-d>', function() require('opencode').command('messages_half_page_down') end, desc = 'Scroll messages down', },
|
||||
},
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
return {
|
||||
"mtth/scratch.vim"
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
return {
|
||||
'nvim-lualine/lualine.nvim',
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||
config = function()
|
||||
require('lualine').setup {
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = 'auto',
|
||||
component_separators = { left = '', right = ''},
|
||||
section_separators = { left = '', right = ''},
|
||||
disabled_filetypes = {
|
||||
statusline = {},
|
||||
winbar = {},
|
||||
},
|
||||
ignore_focus = {},
|
||||
always_divide_middle = true,
|
||||
always_show_tabline = true,
|
||||
globalstatus = false,
|
||||
refresh = {
|
||||
statusline = 1000,
|
||||
tabline = 1000,
|
||||
winbar = 1000,
|
||||
refresh_time = 16, -- ~60fps
|
||||
events = {
|
||||
'WinEnter',
|
||||
'BufEnter',
|
||||
'BufWritePost',
|
||||
'SessionLoadPost',
|
||||
'FileChangedShellPost',
|
||||
'VimResized',
|
||||
'Filetype',
|
||||
'CursorMoved',
|
||||
'CursorMovedI',
|
||||
'ModeChanged',
|
||||
},
|
||||
}
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {'mode'},
|
||||
lualine_b = {'branch', 'diff', 'diagnostics'},
|
||||
lualine_c = {'filename'},
|
||||
lualine_x = {'encoding', 'fileformat', 'filetype'},
|
||||
lualine_y = {'progress'},
|
||||
lualine_z = {'location'}
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = {'filename'},
|
||||
lualine_x = {'location'},
|
||||
lualine_y = {},
|
||||
lualine_z = {}
|
||||
},
|
||||
tabline = {},
|
||||
winbar = {},
|
||||
inactive_winbar = {},
|
||||
extensions = {}
|
||||
}
|
||||
end
|
||||
}
|
||||
@@ -1,10 +1,13 @@
|
||||
return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
tag = "0.1.8",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
config = function()
|
||||
local builtin = require("telescope.builtin")
|
||||
vim.keymap.set("n", "<C-p>", builtin.find_files, {})
|
||||
vim.keymap.set("n", "<leader>fg", builtin.live_grep, {})
|
||||
end
|
||||
}
|
||||
vim.pack.add({"https://github.com/nvim-telescope/telescope.nvim",
|
||||
"https://github.com/nvim-lua/plenary.nvim",
|
||||
"https://github.com/BurntSushi/ripgrep",
|
||||
"https://github.com/nvim-telescope/telescope-fzf-native.nvim",
|
||||
"https://github.com/sharkdp/fd",
|
||||
"https://github.com/nvim-tree/nvim-web-devicons"}
|
||||
)
|
||||
|
||||
local builtin = require('telescope.builtin')
|
||||
vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc = 'Telescope find files' })
|
||||
vim.keymap.set('n', '<leader>fg', builtin.live_grep, { desc = 'Telescope live grep' })
|
||||
vim.keymap.set('n', '<leader>fb', builtin.buffers, { desc = 'Telescope buffers' })
|
||||
vim.keymap.set('n', '<leader>fh', builtin.help_tags, { desc = 'Telescope help tags' })
|
||||
|
||||
3
.config/nvim/lua/plugins/theme.lua
Normal file
3
.config/nvim/lua/plugins/theme.lua
Normal file
@@ -0,0 +1,3 @@
|
||||
vim.pack.add({"https://github.com/catppuccin/nvim"})
|
||||
|
||||
vim.cmd("colorscheme catppuccin")
|
||||
@@ -1,7 +1,144 @@
|
||||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
config = function()
|
||||
require('nvim-treesitter').install({ 'zig', 'c', 'vim', 'rasi', 'cpp', 'javascript', 'markdown', 'markdown_inline', 'lua' }):wait(300000) -- wait max. 5 minutes
|
||||
end
|
||||
}
|
||||
vim.pack.add({
|
||||
{
|
||||
src = "https://github.com/nvim-treesitter/nvim-treesitter",
|
||||
version = "main",
|
||||
},
|
||||
{
|
||||
src = "https://github.com/nvim-treesitter/nvim-treesitter-textobjects",
|
||||
version = "main",
|
||||
},
|
||||
})
|
||||
|
||||
require("nvim-treesitter").setup({})
|
||||
require("nvim-treesitter").install({
|
||||
"bash",
|
||||
"blade",
|
||||
"c",
|
||||
"comment",
|
||||
"css",
|
||||
"diff",
|
||||
"dockerfile",
|
||||
"fish",
|
||||
"gitcommit",
|
||||
"gitignore",
|
||||
"go",
|
||||
"gomod",
|
||||
"gosum",
|
||||
"gowork",
|
||||
"html",
|
||||
"ini",
|
||||
"javascript",
|
||||
"jsdoc",
|
||||
"json",
|
||||
"lua",
|
||||
"luadoc",
|
||||
"luap",
|
||||
"make",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"nginx",
|
||||
"nix",
|
||||
"proto",
|
||||
"python",
|
||||
"query",
|
||||
"regex",
|
||||
"rust",
|
||||
"scss",
|
||||
"sql",
|
||||
"terraform",
|
||||
"toml",
|
||||
"tsx",
|
||||
"typescript",
|
||||
"vim",
|
||||
"vimdoc",
|
||||
"xml",
|
||||
"yaml",
|
||||
"zig",
|
||||
})
|
||||
|
||||
require("nvim-treesitter-textobjects").setup({
|
||||
select = {
|
||||
enable = true,
|
||||
lookahead = true,
|
||||
selection_modes = {
|
||||
["@parameter.outer"] = "v", -- charwise
|
||||
["@function.outer"] = "V", -- linewise
|
||||
["@class.outer"] = "<c-v>", -- blockwise
|
||||
},
|
||||
include_surrounding_whitespace = false,
|
||||
},
|
||||
move = {
|
||||
enable = true,
|
||||
set_jumps = true,
|
||||
},
|
||||
})
|
||||
|
||||
-- SELECT keymaps
|
||||
local sel = require("nvim-treesitter-textobjects.select")
|
||||
for _, map in ipairs({
|
||||
{ { "x", "o" }, "af", "@function.outer" },
|
||||
{ { "x", "o" }, "if", "@function.inner" },
|
||||
{ { "x", "o" }, "ac", "@class.outer" },
|
||||
{ { "x", "o" }, "ic", "@class.inner" },
|
||||
{ { "x", "o" }, "aa", "@parameter.outer" },
|
||||
{ { "x", "o" }, "ia", "@parameter.inner" },
|
||||
{ { "x", "o" }, "ad", "@comment.outer" },
|
||||
{ { "x", "o" }, "as", "@statement.outer" },
|
||||
}) do
|
||||
vim.keymap.set(map[1], map[2], function()
|
||||
sel.select_textobject(map[3], "textobjects")
|
||||
end, { desc = "Select " .. map[3] })
|
||||
end
|
||||
|
||||
-- MOVE keymaps
|
||||
local mv = require("nvim-treesitter-textobjects.move")
|
||||
for _, map in ipairs({
|
||||
{ { "n", "x", "o" }, "]m", mv.goto_next_start, "@function.outer" },
|
||||
{ { "n", "x", "o" }, "[m", mv.goto_previous_start, "@function.outer" },
|
||||
{ { "n", "x", "o" }, "]]", mv.goto_next_start, "@class.outer" },
|
||||
{ { "n", "x", "o" }, "[[", mv.goto_previous_start, "@class.outer" },
|
||||
{ { "n", "x", "o" }, "]M", mv.goto_next_end, "@function.outer" },
|
||||
{ { "n", "x", "o" }, "[M", mv.goto_previous_end, "@function.outer" },
|
||||
{ { "n", "x", "o" }, "]o", mv.goto_next_start, { "@loop.inner", "@loop.outer" } },
|
||||
{ { "n", "x", "o" }, "[o", mv.goto_previous_start, { "@loop.inner", "@loop.outer" } },
|
||||
}) do
|
||||
local modes, lhs, fn, query = map[1], map[2], map[3], map[4]
|
||||
-- build a human-readable desc
|
||||
local qstr = (type(query) == "table") and table.concat(query, ",") or query
|
||||
vim.keymap.set(modes, lhs, function()
|
||||
fn(query, "textobjects")
|
||||
end, { desc = "Move to " .. qstr })
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd("PackChanged", {
|
||||
desc = "Handle nvim-treesitter updates",
|
||||
group = vim.api.nvim_create_augroup("nvim-treesitter-pack-changed-update-handler", { clear = true }),
|
||||
callback = function(event)
|
||||
if event.data.kind == "update" then
|
||||
local ok = pcall(vim.cmd, "TSUpdate")
|
||||
if ok then
|
||||
vim.notify("TSUpdate completed successfully!", vim.log.levels.INFO)
|
||||
else
|
||||
vim.notify("TSUpdate command not available yet, skipping", vim.log.levels.WARN)
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
vim.wo.foldexpr = "v:lua.vim.treesitter.foldexpr()"
|
||||
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "*" },
|
||||
callback = function()
|
||||
local filetype = vim.bo.filetype
|
||||
if filetype and filetype ~= "" then
|
||||
local success = pcall(function()
|
||||
vim.treesitter.start()
|
||||
end)
|
||||
if not success then
|
||||
return
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
98
.config/nvim/lua/plugins/whichkey.lua
Normal file
98
.config/nvim/lua/plugins/whichkey.lua
Normal file
@@ -0,0 +1,98 @@
|
||||
vim.pack.add({
|
||||
"https://github.com/folke/which-key.nvim",
|
||||
})
|
||||
|
||||
local wk = require("which-key")
|
||||
wk.setup({
|
||||
preset = "helix",
|
||||
})
|
||||
wk.add({
|
||||
{ "<leader><tab>", group = "tabs" },
|
||||
{ "<leader>c", group = "code" },
|
||||
{ "<leader>d", group = "debug" },
|
||||
{ "<leader>D", group = "Diffview", icon = { icon = "", color = "orange" } },
|
||||
{ "<leader>p", group = "Yanky", icon = { icon = " ", color = "yellow" } },
|
||||
{ "<leader>dp", group = "profiler" },
|
||||
{ "<leader>f", group = "file/find" },
|
||||
{ "<leader>g", group = "git" },
|
||||
{ "<leader>gh", group = "hunks" },
|
||||
{ "<leader>q", group = "quit/session" },
|
||||
{ "<leader>s", group = "search" },
|
||||
{ "<leader>u", group = "ui", icon = { icon = " ", color = "cyan" } },
|
||||
{ "<leader>x", group = "diagnostics/quickfix", icon = { icon = " ", color = "green" } },
|
||||
{ "[", group = "prev" },
|
||||
{ "]", group = "next" },
|
||||
{ "g", group = "goto" },
|
||||
{ "gs", group = "surround" },
|
||||
{ "z", group = "fold" },
|
||||
{
|
||||
"<leader>b",
|
||||
group = "buffer",
|
||||
expand = function()
|
||||
return require("which-key.extras").expand.buf()
|
||||
end,
|
||||
},
|
||||
{
|
||||
"<leader>w",
|
||||
group = "windows",
|
||||
proxy = "<c-w>",
|
||||
expand = function()
|
||||
return require("which-key.extras").expand.win()
|
||||
end,
|
||||
},
|
||||
-- better descriptions
|
||||
{ "gx", desc = "Open with system app" },
|
||||
{
|
||||
"<leader>fC",
|
||||
group = "Copy Path",
|
||||
{
|
||||
"<leader>fCf",
|
||||
function()
|
||||
vim.fn.setreg("+", vim.fn.expand("%:p")) -- Copy full file path to clipboard
|
||||
vim.notify("Copied full file path: " .. vim.fn.expand("%:p"))
|
||||
end,
|
||||
desc = "Copy full file path",
|
||||
},
|
||||
{
|
||||
"<leader>fCn",
|
||||
function()
|
||||
vim.fn.setreg("+", vim.fn.expand("%:t")) -- Copy file name to clipboard
|
||||
vim.notify("Copied file name: " .. vim.fn.expand("%:t"))
|
||||
end,
|
||||
desc = "Copy file name",
|
||||
},
|
||||
{
|
||||
"<leader>fCr",
|
||||
function()
|
||||
local cwd = vim.fn.getcwd() -- Current working directory
|
||||
local full_path = vim.fn.expand("%:p") -- Full file path
|
||||
local rel_path = full_path:sub(#cwd + 2) -- Remove cwd prefix and leading slash
|
||||
vim.fn.setreg("+", rel_path) -- Copy relative file path to clipboard
|
||||
vim.notify("Copied relative file path: " .. rel_path)
|
||||
end,
|
||||
desc = "Copy relative file path",
|
||||
},
|
||||
{
|
||||
"<leader>?",
|
||||
function()
|
||||
require("which-key").show({ global = false })
|
||||
end,
|
||||
desc = "Buffer Keymaps (which-key)",
|
||||
},
|
||||
{
|
||||
"<c-w><space>",
|
||||
function()
|
||||
require("which-key").show({ keys = "<c-w>", loop = true })
|
||||
end,
|
||||
desc = "Window Hydra Mode (which-key)",
|
||||
},
|
||||
},
|
||||
{
|
||||
-- Nested mappings are allowed and can be added in any order
|
||||
-- Most attributes can be inherited or overridden on any level
|
||||
-- There's no limit to the depth of nesting
|
||||
mode = { "n", "v" }, -- NORMAL and VISUAL mode
|
||||
{ "<leader>q", "<cmd>q<cr>", desc = "Quit" }, -- no need to specify mode since it's inherited
|
||||
{ "<leader>w", "<cmd>w<cr>", desc = "Write" },
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user