Muh dotfiles
This commit is contained in:
191
.config/nvim/lua/configs/cmp.lua
Normal file
191
.config/nvim/lua/configs/cmp.lua
Normal file
@ -0,0 +1,191 @@
|
||||
local cmp = require "cmp"
|
||||
local luasnip = require "luasnip"
|
||||
|
||||
|
||||
local kinds = {
|
||||
Enum = " Enum",
|
||||
File = " File",
|
||||
Text = " Text",
|
||||
Unit = " Unit",
|
||||
Class = " Class",
|
||||
Color = " Color",
|
||||
Event = " Event",
|
||||
Field = " Field",
|
||||
Value = " Value",
|
||||
Folder = " Path",
|
||||
Method = " Methd",
|
||||
Module = " Modle",
|
||||
Struct = " Strct",
|
||||
Keyword = " Kword",
|
||||
Snippet = " Snipp",
|
||||
Constant = " Const",
|
||||
Function = " Func",
|
||||
Operator = " Oper",
|
||||
Property = " Prop",
|
||||
Variable = " Var",
|
||||
Interface = " Itrfc",
|
||||
Reference = " Rfrnc",
|
||||
EnumMember = " EnMem",
|
||||
Constructor = "🏗 Cstctr",
|
||||
TypeParameter = " TpPrm",
|
||||
}
|
||||
|
||||
local function format_completion_entries(entry, vim_item) -- :h complete-items
|
||||
vim_item.menu = ({
|
||||
buffer = "[Buf]",
|
||||
luasnip = "[LS]",
|
||||
nvim_lsp = "[LSP]",
|
||||
})[entry.source.name]
|
||||
vim_item.kind = kinds[vim_item.kind] or "?"
|
||||
return vim_item
|
||||
end
|
||||
|
||||
|
||||
-- Close the damn completion window
|
||||
local function exit_completion()
|
||||
vim.api.nvim_feedkeys("gi", "n", false)
|
||||
end
|
||||
|
||||
local function register_oneshots()
|
||||
for _, key in ipairs { "<CR>", "<Tab>", "<Space>", "<Down>", "<Up>", "<Left>", "<Right>" } do
|
||||
vim.keymap.set("i", key, function()
|
||||
exit_completion()
|
||||
vim.keymap.del("i", key, { buffer = 0 })
|
||||
return key
|
||||
end, { buffer = 0, expr = true })
|
||||
end
|
||||
end
|
||||
|
||||
local function get_completion_buffers()
|
||||
local buffers = {}
|
||||
for _, win_id in ipairs(vim.api.nvim_list_wins()) do -- only visible buffers
|
||||
local buf_id = vim.api.nvim_win_get_buf(win_id)
|
||||
local buf_lines = vim.api.nvim_buf_line_count(buf_id)
|
||||
local buf_bytes = vim.api.nvim_buf_get_offset(buf_id, buf_lines)
|
||||
|
||||
if buf_bytes < 196608 then -- 192 KiB
|
||||
table.insert(buffers, buf_id)
|
||||
end
|
||||
end
|
||||
return buffers
|
||||
end
|
||||
|
||||
|
||||
-- TODO use most common instead of just common
|
||||
local function longest_common_completion()
|
||||
cmp.complete { config = { -- should be fast asf
|
||||
sources = {
|
||||
{ name = "buffer", option = {
|
||||
get_bufnrs = get_completion_buffers } },
|
||||
-- { name = "nvim_lsp" }, -- there is other completion for lsp
|
||||
},
|
||||
performance = {
|
||||
throttle = 0,
|
||||
debounce = 15,
|
||||
max_view_entries = 10,
|
||||
fetching_timeout = 100
|
||||
},
|
||||
preselect = cmp.PreselectMode.None, -- not to mess up common_string
|
||||
formatting = { format = false }
|
||||
} }
|
||||
|
||||
return cmp.complete_common_string()
|
||||
end
|
||||
|
||||
|
||||
local mappings = {
|
||||
["<C-n>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-e>"] = cmp.mapping.scroll_docs(-4),
|
||||
-- in my kitty.conf: map shift+space send_text all \033[32;2u
|
||||
["<S-Space>"] = cmp.mapping.select_next_item(),
|
||||
["<C-Space>"] = cmp.mapping.select_prev_item(),
|
||||
["<S-Tab>"] = function()
|
||||
if cmp.visible_docs() then
|
||||
cmp.close_docs()
|
||||
else
|
||||
cmp.open_docs()
|
||||
end
|
||||
end,
|
||||
-- My Caps is BS cuz caps is bs.
|
||||
["<S-BS>"] = cmp.mapping(function()
|
||||
if cmp.visible() then
|
||||
exit_completion()
|
||||
else
|
||||
luasnip.expand_or_jump()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<C-BS>"] = cmp.mapping(function()
|
||||
if cmp.visible() then
|
||||
cmp.abort()
|
||||
exit_completion()
|
||||
else
|
||||
luasnip.jump(-1)
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-CR>"] = function()
|
||||
if cmp.visible() then
|
||||
cmp.confirm { select = true, behavior = cmp.ConfirmBehavior.Replace }
|
||||
elseif cmp.complete() then
|
||||
register_oneshots()
|
||||
end
|
||||
end,
|
||||
["<C-CR>"] = function()
|
||||
if cmp.visible() then
|
||||
cmp.confirm { select = true, behavior = cmp.ConfirmBehavior.Insert }
|
||||
elseif longest_common_completion() then
|
||||
exit_completion()
|
||||
else
|
||||
register_oneshots()
|
||||
end
|
||||
end
|
||||
}
|
||||
|
||||
|
||||
cmp.setup.global { -- = cmp.setup
|
||||
completion = {
|
||||
autocomplete = false,
|
||||
completeopt = "menu,menuone,noselect" -- noselect for complete_common_string
|
||||
},
|
||||
performance = {
|
||||
--debounce = 60,
|
||||
throttle = 15, -- 30
|
||||
--fetching_timeout = 500,
|
||||
max_view_entries = 40, -- 200
|
||||
},
|
||||
mapping = mappings,
|
||||
preselect = cmp.PreselectMode.Item, -- Honour LSP preselect requests
|
||||
--experimental = { ghost_text = true }
|
||||
snippet = {
|
||||
expand = function(args) luasnip.lsp_expand(args.body) end
|
||||
},
|
||||
formatting = {
|
||||
expandable_indicator = true, -- show ~ indicator
|
||||
fields = { "abbr", "kind", "menu" },
|
||||
format = format_completion_entries,
|
||||
},
|
||||
view = {
|
||||
docs = { auto_open = true },
|
||||
entries = { name = "custom", selection_order = "near_cursor" }
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lsp", group_index = 1 },
|
||||
{ name = "luasnip", group_index = 2 },
|
||||
{ name = "buffer", group_index = 2, option = {
|
||||
indexing_interval = 100, -- default 100 ms
|
||||
indexing_batch_size = 500, -- default 1000 lines
|
||||
max_indexed_line_length = 2048, -- default 40*1024 bytes
|
||||
get_bufnrs = get_completion_buffers
|
||||
} }
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered {
|
||||
side_padding = 0,
|
||||
scrollbar = false,
|
||||
border = vim.g.border_bleed
|
||||
},
|
||||
documentation = cmp.config.window.bordered {
|
||||
side_padding = 0,
|
||||
border = vim.g.border_bleed
|
||||
}
|
||||
}
|
||||
}
|
63
.config/nvim/lua/configs/gitsigns.lua
Normal file
63
.config/nvim/lua/configs/gitsigns.lua
Normal file
@ -0,0 +1,63 @@
|
||||
local gs = require "gitsigns"
|
||||
|
||||
gs.setup {
|
||||
auto_attach = true,
|
||||
attach_to_untracked = false, -- use keymap
|
||||
max_file_length = 10000,
|
||||
update_debounce = 500,
|
||||
-- base = "@", -- index by default
|
||||
-- worktrees = {}, -- TODO for dotfiles
|
||||
numhl = true,
|
||||
signcolumn = false,
|
||||
current_line_blame = false,
|
||||
sign_priority = 6,
|
||||
|
||||
diff_opts = {
|
||||
internal = true, -- for linematch
|
||||
linematch = true, -- align lines
|
||||
algorithm = "histogram", -- myers, minimal, patience, histrogram
|
||||
},
|
||||
preview_config = { border = vim.g.border_bleed },
|
||||
}
|
||||
|
||||
-- Normal
|
||||
Lmap("hb", "Blame line", gs.blame_line)
|
||||
Lmap("hB", "Blame full", W(gs.blame_line) { full = true })
|
||||
Lmap("hs", "Stage hunk", gs.stage_hunk)
|
||||
Lmap("hr", "Reset hunk", gs.reset_hunk)
|
||||
Lmap("hS", "Stage buffer", gs.stage_buffer)
|
||||
Lmap("hR", "Reset buffer", gs.reset_buffer)
|
||||
Lmap("hu", "Undo stage hunk", gs.undo_stage_hunk) -- only in current session
|
||||
Lmap("hp", "Preview hunk", gs.preview_hunk)
|
||||
Lmap("hi", "Inline preview", gs.preview_hunk_inline)
|
||||
Lmap("hl", "List hunks", gs.setloclist)
|
||||
Lmap("hq", "Qlist all hunks", W(gs.setqflist) "attached")
|
||||
Lmap("hQ", "Qlist ALL hunks", W(gs.setqflist) "all")
|
||||
Lmap("hs", "x", "Stage region", function() gs.stage_hunk { vim.fn.line ".", vim.fn.line "v" } end)
|
||||
Lmap("hr", "x", "Reset region", function() gs.reset_hunk { vim.fn.line ".", vim.fn.line "v" } end)
|
||||
-- Toggle
|
||||
Lmap("hts", "Signs", gs.toggle_signs)
|
||||
Lmap("htn", "Number hl", gs.toggle_numhl)
|
||||
Lmap("htl", "Line hl", gs.toggle_linehl)
|
||||
Lmap("htd", "Deleted", gs.toggle_deleted)
|
||||
Lmap("htw", "Word diff", gs.toggle_word_diff)
|
||||
Lmap("htb", "Blame", gs.toggle_current_line_blame)
|
||||
-- View file
|
||||
Lmap("hvh", "HEAD", W(gs.show) "@")
|
||||
Lmap("hvp", "HEAD~", W(gs.show) "~")
|
||||
Lmap("hvs", "Staged", gs.show)
|
||||
Lmap("hvH", "Diff HEAD", W(gs.diffthis, "@", { split = "belowright" }))
|
||||
Lmap("hvP", "Diff HEAD~", W(gs.diffthis, "~", { split = "belowright" }))
|
||||
Lmap("hvS", "Diff Staged", W(gs.diffthis, nil, { split = "belowright" }))
|
||||
-- Control
|
||||
Lmap("hca", "Attach", gs.attach)
|
||||
Lmap("hcd", "Detach", gs.detach)
|
||||
Lmap("hcD", "Detach all", gs.detach_all)
|
||||
Lmap("hcr", "Refresh", gs.refresh)
|
||||
Lmap("hcs", "Base->staged", gs.change_base)
|
||||
Lmap("hcS", "Base->staged all", W(gs.change_base, nil, true))
|
||||
Lmap("hch", "Base->HEAD", W(gs.change_base) "@")
|
||||
Lmap("hcH", "Base->HEAD all", W(gs.change_base, "@", true))
|
||||
-- Other
|
||||
vim.keymap.set({"x", "o"}, "ih", gs.select_hunk, { desc = "Select hunk" })
|
||||
MakePair("h", "hunk", gs.next_hunk, gs.prev_hunk)
|
30
.config/nvim/lua/configs/lspconfig.lua
Normal file
30
.config/nvim/lua/configs/lspconfig.lua
Normal file
@ -0,0 +1,30 @@
|
||||
local lspconfig = require "lspconfig"
|
||||
|
||||
vim.diagnostic.config {
|
||||
underline = true,
|
||||
virtual_text = {
|
||||
spacing = 4,
|
||||
source = "if_many",
|
||||
severity = { min = vim.diagnostic.severity.WARN },
|
||||
},
|
||||
-- virtual_lines = true,
|
||||
severity_sort = true,
|
||||
update_in_insert = false,
|
||||
signs = { text = { "⤬", "!", "", "" } }, -- E, W, I, H
|
||||
float = { source = "if_many", border = vim.g.border_bleed },
|
||||
}
|
||||
|
||||
lspconfig.util.default_config = vim.tbl_deep_extend("force", lspconfig.util.default_config, {
|
||||
handlers = {
|
||||
["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
|
||||
border = vim.g.border_bleed, max_width = 80
|
||||
}),
|
||||
["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
|
||||
border = vim.g.border_bleed, max_width = 80
|
||||
})
|
||||
},
|
||||
capabilities = pcall(require, "cmp_nvim_lsp") and
|
||||
package.loaded.cmp_nvim_lsp.default_capabilities() or nil
|
||||
})
|
||||
|
||||
require("lspconfig.ui.windows").default_options.border = vim.g.border -- :LspInfo
|
94
.config/nvim/lua/configs/telescope.lua
Normal file
94
.config/nvim/lua/configs/telescope.lua
Normal file
@ -0,0 +1,94 @@
|
||||
local telescope = require "telescope"
|
||||
local builtin = require "telescope.builtin"
|
||||
local layout = require "telescope.actions.layout"
|
||||
--local actions = require "telescope.actions"
|
||||
|
||||
telescope.setup {
|
||||
defaults = {
|
||||
layout_strategy = "flex",
|
||||
--preview = { hide_on_startup = true, filesize_limit = 0.1 --MB },
|
||||
layout_config = {
|
||||
vertical = { width = 0.9, height = 0.9 },
|
||||
horizontal = { width = 0.9, height = 0.7 },
|
||||
},
|
||||
cycle_layout_list = { "vertical", "horizontal" },
|
||||
-- borderchars = { "▔", "▕", "▁", "▏", "🭽", "🭾", "🭿", "🭼" },
|
||||
path_display = { shorten = { len = 1, exclude = { -1 } } },
|
||||
vimgrep_arguments = { -- live_grep & grep_string
|
||||
"rg", "--color=never", "--no-heading", "--with-filename",
|
||||
"--line-number", "--column", "--smart-case", "--trim" -- trim spaces
|
||||
},
|
||||
mappings = {
|
||||
i = {
|
||||
["<Esc>"] = "close",
|
||||
["<C-d>"] = "delete_buffer", -- for buffers
|
||||
["<C-h>"] = "select_horizontal", -- H| split
|
||||
["<C-p>"] = layout.toggle_preview,
|
||||
["<C-r>"] = layout.cycle_layout_next,
|
||||
["<C-s>"] = "cycle_previewers_next", -- for git commits
|
||||
["<C-a>"] = "cycle_previewers_prev",
|
||||
["<C-n>"] = "preview_scrolling_down",
|
||||
["<C-e>"] = "preview_scrolling_up",
|
||||
["<C-Down>"] = "cycle_history_next",
|
||||
["<C-Up>"] = "cycle_history_prev",
|
||||
},
|
||||
}
|
||||
},
|
||||
extensions = {
|
||||
fzf = {
|
||||
fuzzy = true,
|
||||
override_generic_sorter = true,
|
||||
override_file_sorter = true,
|
||||
case_mode = "smart_case",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
telescope.load_extension("fzf")
|
||||
|
||||
local which_key = package.loaded["which-key"]
|
||||
if which_key then
|
||||
which_key.add({
|
||||
{ "<Leader>s", group = "Search" },
|
||||
{ "<Leader>sh", group = "Git" },
|
||||
{ "<Leader>sl", group = "LSP" },
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
Lmap("f", Try(builtin.git_files, builtin.find_files))
|
||||
Lmap(".", function() builtin.find_files { cwd = vim.fn.expand("%:p:h") } end)
|
||||
Lmap("/", builtin.current_buffer_fuzzy_find)
|
||||
|
||||
Lmap("so", builtin.oldfiles)
|
||||
Lmap("sb", "Buffers", builtin.buffers)
|
||||
Lmap("sf", "Files workdir", builtin.find_files)
|
||||
Lmap("sn", "Nvim dotfiles", W(builtin.find_files) { cwd = vim.fn.expand("~/.config/nvim") })
|
||||
Lmap("s.", "Dotfiles", W(builtin.find_files) { cwd = vim.fn.expand("~/.config/") })
|
||||
Lmap("sd", "Diagnostics", builtin.diagnostics)
|
||||
Lmap("ss", "Str in workdir", builtin.live_grep)
|
||||
Lmap("sk", "Help tags", builtin.help_tags)
|
||||
Lmap("sm", "Man pages", builtin.man_pages)
|
||||
Lmap("s/", "/ history", builtin.search_history)
|
||||
Lmap("sq", "Quickfix hist", builtin.quickfixhistory)
|
||||
Lmap("sc", "nx", "Cursor workdir", builtin.grep_string)
|
||||
Lmap("sp", "Pickers", builtin.pickers)
|
||||
Lmap("sr", "Resume", builtin.resume)
|
||||
Lmap("st", "Treesitter obj", builtin.treesitter)
|
||||
-- Git
|
||||
Lmap("shf", "Files", builtin.git_files)
|
||||
Lmap("shs", "Status", builtin.git_status)
|
||||
Lmap("shc", "Commits", builtin.git_commits)
|
||||
Lmap("shB", "Branches", builtin.git_branches)
|
||||
Lmap("shb", "Buf commits", builtin.git_bcommits)
|
||||
-- LSP
|
||||
Lmap("sld", "Definitions", builtin.lsp_definitions)
|
||||
Lmap("slt", "Type defenitions", builtin.lsp_type_definitions)
|
||||
Lmap("slr", "References", builtin.lsp_references)
|
||||
Lmap("sli", "Incoming calls", builtin.lsp_incoming_calls)
|
||||
Lmap("slo", "Outgoing calls", builtin.lsp_outgoing_calls)
|
||||
Lmap("slm", "Implementations", builtin.lsp_implementations)
|
||||
Lmap("sls", "Buffer symbols", builtin.lsp_document_symbols)
|
||||
Lmap("slW", "Workspace symbols", builtin.lsp_workspace_symbols)
|
||||
Lmap("slw", "Workspace dynamic", builtin.lsp_dynamic_workspace_symbols)
|
||||
-- TODO Lmap("shb", "x", "Buf commits", builtin.git_bcommits_range)
|
147
.config/nvim/lua/configs/treesitter.lua
Normal file
147
.config/nvim/lua/configs/treesitter.lua
Normal file
@ -0,0 +1,147 @@
|
||||
local treesitter_config = {
|
||||
auto_install = true,
|
||||
sync_install = false,
|
||||
ensure_installed = {
|
||||
"arduino",
|
||||
"bash",
|
||||
"c",
|
||||
"cmake",
|
||||
"comment",
|
||||
"cpp",
|
||||
"c_sharp",
|
||||
"diff",
|
||||
"haskell",
|
||||
"html",
|
||||
"javascript",
|
||||
"json",
|
||||
"jsonc",
|
||||
"lua",
|
||||
"luadoc",
|
||||
"luap",
|
||||
"make",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"ninja",
|
||||
"python",
|
||||
"query",
|
||||
"regex",
|
||||
"rust",
|
||||
"toml",
|
||||
"vim",
|
||||
"vimdoc",
|
||||
"yaml",
|
||||
},
|
||||
-- MODULES
|
||||
indent = { enable = true }, -- for the `=` formatting
|
||||
highlight = { enable = true },
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = "<Tab>",
|
||||
node_incremental = "<Tab>",
|
||||
node_decremental = "<S-Tab>",
|
||||
scope_incremental = "<C-Tab>",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
treesitter_config.textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
lookahead = true, -- look for an object further in the file
|
||||
include_surrounding_whitespace = false, -- disabled for Python
|
||||
keymaps = { -- i - invocation, o - object, n - note, a - argument
|
||||
["ai"] = "@call.outer", ["ic"] = "@conditional.inner",
|
||||
["al"] = "@loop.outer", ["ia"] = "@parameter.inner",
|
||||
["ak"] = "@block.outer", ["if"] = "@function.inner",
|
||||
["ao"] = "@class.outer", ["in"] = "@comment.inner",
|
||||
["ar"] = "@return.outer", ["ir"] = "@return.inner",
|
||||
["an"] = "@comment.outer", ["io"] = "@class.inner",
|
||||
["af"] = "@function.outer", ["ik"] = "@block.inner",
|
||||
["aa"] = "@parameter.outer", ["il"] = "@loop.inner",
|
||||
["as"] = "@assignment.outer", -- TODO
|
||||
["ac"] = "@conditional.outer", ["ii"] = "@call.inner",
|
||||
}
|
||||
},
|
||||
swap = {
|
||||
enable = true,
|
||||
swap_next = { -- a bit too much i guess... XD
|
||||
[")i"] = "@call.inner", [")C"] = "@conditional.outer",
|
||||
[")l"] = "@loop.inner", [")A"] = "@parameter.outer",
|
||||
[")k"] = "@block.inner", [")F"] = "@function.outer",
|
||||
[")o"] = "@class.inner", [")N"] = "@comment.outer",
|
||||
[")r"] = "@return.inner", [")R"] = "@return.outer",
|
||||
[")n"] = "@comment.inner", [")O"] = "@class.outer",
|
||||
[")f"] = "@function.inner", [")K"] = "@block.outer",
|
||||
[")a"] = "@parameter.inner", [")L"] = "@loop.outer",
|
||||
[")c"] = "@conditional.inner", [")I"] = "@call.outer",
|
||||
},
|
||||
swap_previous = {
|
||||
["(i"] = "@call.inner", ["(C"] = "@conditional.outer",
|
||||
["(l"] = "@loop.inner", ["(A"] = "@parameter.outer",
|
||||
["(k"] = "@block.inner", ["(F"] = "@function.outer",
|
||||
["(o"] = "@class.inner", ["(N"] = "@comment.outer",
|
||||
["(r"] = "@return.inner", ["(R"] = "@return.outer",
|
||||
["(n"] = "@comment.inner", ["(O"] = "@class.outer",
|
||||
["(f"] = "@function.inner", ["(K"] = "@block.outer",
|
||||
["(a"] = "@parameter.inner", ["(L"] = "@loop.outer",
|
||||
["(c"] = "@conditional.inner", ["(I"] = "@call.outer",
|
||||
},
|
||||
},
|
||||
move = {
|
||||
enable = true,
|
||||
set_jumps = true, -- <C-o> back, <C-i> forward
|
||||
goto_next = {},
|
||||
goto_previous = {},
|
||||
goto_next_start = {
|
||||
["]i"] = "@call.outer", ["]c"] = "@conditional.outer",
|
||||
["]l"] = "@loop.outer", -- ["]s"] = "@assignment.inner",
|
||||
["]k"] = "@block.outer", ["]a"] = "@parameter.outer",
|
||||
["]o"] = "@class.outer", ["]f"] = "@function.outer",
|
||||
["]r"] = "@return.outer", ["]n"] = "@comment.outer",
|
||||
},
|
||||
goto_next_end = {
|
||||
["]I"] = "@call.outer", ["]C"] = "@conditional.outer",
|
||||
["]L"] = "@loop.outer", -- ["]S"] = "@assignment.inner",
|
||||
["]K"] = "@block.outer", ["]A"] = "@parameter.outer",
|
||||
["]O"] = "@class.outer", ["]F"] = "@function.outer",
|
||||
["]R"] = "@return.outer", ["]N"] = "@comment.outer",
|
||||
},
|
||||
goto_previous_start = {
|
||||
["[i"] = "@call.outer", ["[c"] = "@conditional.outer",
|
||||
["[l"] = "@loop.outer", -- ["[s"] = "@assignment.inner",
|
||||
["[k"] = "@block.outer", ["[a"] = "@parameter.outer",
|
||||
["[o"] = "@class.outer", ["[f"] = "@function.outer",
|
||||
["[r"] = "@return.outer", ["[n"] = "@comment.outer",
|
||||
},
|
||||
goto_previous_end = {
|
||||
["[I"] = "@call.outer", ["[C"] = "@conditional.outer",
|
||||
["[L"] = "@loop.outer", -- ["[S"] = "@assignment.inner",
|
||||
["[K"] = "@block.outer", ["[A"] = "@parameter.outer",
|
||||
["[O"] = "@class.outer", ["[F"] = "@function.outer",
|
||||
["[R"] = "@return.outer", ["[N"] = "@comment.outer",
|
||||
},
|
||||
},
|
||||
lsp_interop = {
|
||||
enable = true, -- vim.lsp.util.open_floating_preview
|
||||
floating_preview_opts = { border = vim.g.border_bleed },
|
||||
peek_definition_code = {
|
||||
["<Leader>lpo"] = { query = "@class.outer", desc = "Object" },
|
||||
["<Leader>lpf"] = { query = "@function.outer", desc = "Function" },
|
||||
["<Leader>lpa"] = { query = "@parameter.inner", desc = "Parameter" },
|
||||
["<Leader>lps"] = { query = "@assignment.outer", desc = "Assignment" },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
require("nvim-treesitter.configs").setup(treesitter_config)
|
||||
|
||||
|
||||
local map = vim.keymap.set
|
||||
local ts_repeat_move = require "nvim-treesitter.textobjects.repeatable_move"
|
||||
map({ "n", "x", "o" }, "f", ts_repeat_move.builtin_f_expr, {expr=true})
|
||||
map({ "n", "x", "o" }, "F", ts_repeat_move.builtin_F_expr, {expr=true})
|
||||
map({ "n", "x", "o" }, "t", ts_repeat_move.builtin_t_expr, {expr=true})
|
||||
map({ "n", "x", "o" }, "T", ts_repeat_move.builtin_T_expr, {expr=true})
|
||||
map({ "n", "x", "o" }, ";", ts_repeat_move.repeat_last_move)
|
||||
map({ "n", "x", "o" }, ",", ts_repeat_move.repeat_last_move_opposite)
|
Reference in New Issue
Block a user