init
This commit is contained in:
32
lua/config/blink-cmp.lua
Normal file
32
lua/config/blink-cmp.lua
Normal file
@@ -0,0 +1,32 @@
|
||||
require("blink.cmp").setup {
|
||||
keymap = {
|
||||
preset = "default",
|
||||
["<Tab>"] = { "select_next", "fallback" },
|
||||
["<S-Tab>"] = { "select_prev", "fallback" },
|
||||
["<Enter>"] = { "select_and_accept", "fallback" },
|
||||
["<C-U>"] = { "scroll_documentation_up", "fallback" },
|
||||
["<C-D>"] = { "scroll_documentation_down", "fallback" },
|
||||
},
|
||||
appearance = {
|
||||
nerd_font_variant = "mono",
|
||||
},
|
||||
completion = {
|
||||
documentation = {
|
||||
auto_show = true,
|
||||
},
|
||||
},
|
||||
sources = {
|
||||
default = { "lsp", "path", "buffer" },
|
||||
},
|
||||
fuzzy = { implementation = "prefer_rust_with_warning" },
|
||||
cmdline = {
|
||||
completion = {
|
||||
menu = {
|
||||
auto_show = true,
|
||||
},
|
||||
},
|
||||
keymap = {
|
||||
["<Enter>"] = { "select_and_accept", "fallback" },
|
||||
},
|
||||
},
|
||||
}
|
||||
6
lua/config/bqf.lua
Normal file
6
lua/config/bqf.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
require("bqf").setup {
|
||||
auto_resize_height = false,
|
||||
preview = {
|
||||
auto_preview = false,
|
||||
},
|
||||
}
|
||||
42
lua/config/bufferline.lua
Normal file
42
lua/config/bufferline.lua
Normal file
@@ -0,0 +1,42 @@
|
||||
require("bufferline").setup {
|
||||
options = {
|
||||
numbers = "none",
|
||||
close_command = "bdelete! %d",
|
||||
right_mouse_command = nil,
|
||||
left_mouse_command = "buffer %d",
|
||||
middle_mouse_command = nil,
|
||||
indicator = {
|
||||
icon = "▎",
|
||||
style = "icon",
|
||||
},
|
||||
buffer_close_icon = "",
|
||||
modified_icon = "●",
|
||||
close_icon = "",
|
||||
left_trunc_marker = "",
|
||||
right_trunc_marker = "",
|
||||
max_name_length = 18,
|
||||
max_prefix_length = 15,
|
||||
tab_size = 10,
|
||||
diagnostics = false,
|
||||
custom_filter = function(bufnr)
|
||||
local exclude_ft = { "qf", "fugitive", "git" }
|
||||
local cur_ft = vim.bo[bufnr].filetype
|
||||
local should_filter = vim.tbl_contains(exclude_ft, cur_ft)
|
||||
|
||||
return not should_filter
|
||||
end,
|
||||
show_buffer_icons = false,
|
||||
show_buffer_close_icons = true,
|
||||
show_close_icon = true,
|
||||
show_tab_indicators = true,
|
||||
persist_buffer_sort = true,
|
||||
separator_style = "bar",
|
||||
enforce_regular_tabs = false,
|
||||
always_show_bufferline = true,
|
||||
sort_by = "id",
|
||||
},
|
||||
}
|
||||
|
||||
vim.keymap.set("n", "<space>bp", "<cmd>BufferLinePick<cr>", {
|
||||
desc = "pick a buffer",
|
||||
})
|
||||
75
lua/config/dashboard-nvim.lua
Normal file
75
lua/config/dashboard-nvim.lua
Normal file
@@ -0,0 +1,75 @@
|
||||
local api = vim.api
|
||||
local keymap = vim.keymap
|
||||
local dashboard = require("dashboard")
|
||||
|
||||
local conf = {}
|
||||
conf.header = {
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ███╗ ██╗ ███████╗ ██████╗ ██╗ ██╗ ██╗ ███╗ ███╗",
|
||||
" ████╗ ██║ ██╔════╝██╔═══██╗ ██║ ██║ ██║ ████╗ ████║",
|
||||
" ██╔██╗ ██║ █████╗ ██║ ██║ ██║ ██║ ██║ ██╔████╔██║",
|
||||
" ██║╚██╗██║ ██╔══╝ ██║ ██║ ╚██╗ ██╔╝ ██║ ██║╚██╔╝██║",
|
||||
" ██║ ╚████║ ███████╗╚██████╔╝ ╚████╔╝ ██║ ██║ ╚═╝ ██║",
|
||||
" ╚═╝ ╚═══╝ ╚══════╝ ╚═════╝ ╚═══╝ ╚═╝ ╚═╝ ╚═╝",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
}
|
||||
|
||||
conf.center = {
|
||||
{
|
||||
icon = " ",
|
||||
desc = "Find File ",
|
||||
action = "FzfLua files",
|
||||
key = "<Leader> f f",
|
||||
},
|
||||
{
|
||||
icon = " ",
|
||||
desc = "Recently opened files ",
|
||||
action = "FzfLua oldfiles",
|
||||
key = "<Leader> f r",
|
||||
},
|
||||
{
|
||||
icon = " ",
|
||||
desc = "Project grep ",
|
||||
action = "FzfLua live_grep",
|
||||
key = "<Leader> f g",
|
||||
},
|
||||
{
|
||||
icon = " ",
|
||||
desc = "Open Nvim config ",
|
||||
action = "tabnew $MYVIMRC | tcd %:p:h",
|
||||
key = "<Leader> e v",
|
||||
},
|
||||
{
|
||||
icon = " ",
|
||||
desc = "New file ",
|
||||
action = "enew",
|
||||
key = "e",
|
||||
},
|
||||
{
|
||||
icon = " ",
|
||||
desc = "Quit Nvim ",
|
||||
-- desc = "Quit Nvim ",
|
||||
action = "qa",
|
||||
key = "q",
|
||||
},
|
||||
}
|
||||
|
||||
dashboard.setup {
|
||||
theme = "doom",
|
||||
shortcut_type = "number",
|
||||
config = conf,
|
||||
}
|
||||
|
||||
api.nvim_create_autocmd("FileType", {
|
||||
pattern = "dashboard",
|
||||
group = api.nvim_create_augroup("dashboard_enter", { clear = true }),
|
||||
callback = function()
|
||||
keymap.set("n", "q", ":qa<CR>", { buffer = true, silent = true })
|
||||
keymap.set("n", "e", ":enew<CR>", { buffer = true, silent = true })
|
||||
end,
|
||||
})
|
||||
1
lua/config/fidget-nvim.lua
Normal file
1
lua/config/fidget-nvim.lua
Normal file
@@ -0,0 +1 @@
|
||||
require("fidget").setup {}
|
||||
24
lua/config/fugitive.lua
Normal file
24
lua/config/fugitive.lua
Normal file
@@ -0,0 +1,24 @@
|
||||
local keymap = vim.keymap
|
||||
|
||||
keymap.set("n", "<leader>gs", "<cmd>Git<cr>", { desc = "Git: show status" })
|
||||
keymap.set("n", "<leader>gw", "<cmd>Gwrite<cr>", { desc = "Git: add file" })
|
||||
keymap.set("n", "<leader>gc", "<cmd>Git commit<cr>", { desc = "Git: commit changes" })
|
||||
keymap.set("n", "<leader>gpl", "<cmd>Git pull<cr>", { desc = "Git: pull changes" })
|
||||
keymap.set("n", "<leader>gpu", "<cmd>15 split|term git push<cr>", { desc = "Git: push changes" })
|
||||
keymap.set("v", "<leader>gb", ":Git blame<cr>", { desc = "Git: blame selected line" })
|
||||
|
||||
vim.fn["utils#Cabbrev"]("git", "Git")
|
||||
|
||||
keymap.set("n", "<leader>gbn", function()
|
||||
vim.ui.input({ prompt = "Enter a new branch name" }, function(user_input)
|
||||
if user_input == nil or user_input == "" then
|
||||
return
|
||||
end
|
||||
|
||||
local cmd_str = string.format("G checkout -b %s", user_input)
|
||||
vim.cmd(cmd_str)
|
||||
end)
|
||||
end, { desc = "Git: create new branch" })
|
||||
|
||||
keymap.set("n", "<leader>gf", ":Git fetch ", { desc = "Git: prune branches" })
|
||||
keymap.set("n", "<leader>gbd", ":Git branch -D ", { desc = "Git: delete branch" })
|
||||
18
lua/config/fzf-lua.lua
Normal file
18
lua/config/fzf-lua.lua
Normal file
@@ -0,0 +1,18 @@
|
||||
require("fzf-lua").setup {
|
||||
defaults = {
|
||||
file_icons = "mini",
|
||||
},
|
||||
winopts = {
|
||||
row = 0.5,
|
||||
height = 0.7,
|
||||
},
|
||||
files = {
|
||||
previewer = false,
|
||||
},
|
||||
}
|
||||
|
||||
vim.keymap.set("n", "<leader>ff", "<cmd>FzfLua files<cr>", { desc = "Fuzzy find files" })
|
||||
vim.keymap.set("n", "<leader>fg", "<cmd>FzfLua live_grep<cr>", { desc = "Fuzzy grep files" })
|
||||
vim.keymap.set("n", "<leader>fh", "<cmd>FzfLua helptags<cr>", { desc = "Fuzzy grep tags in help files" })
|
||||
vim.keymap.set("n", "<leader>ft", "<cmd>FzfLua btags<cr>", { desc = "Fuzzy search buffer tags" })
|
||||
vim.keymap.set("n", "<leader>fb", "<cmd>FzfLua buffers<cr>", { desc = "Fuzzy search opened buffers" })
|
||||
9
lua/config/git-conflict.lua
Normal file
9
lua/config/git-conflict.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
require("git-conflict").setup {}
|
||||
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "GitConflictResolved",
|
||||
callback = function()
|
||||
vim.fn.setqflist({}, "r")
|
||||
vim.cmd([[silent! GitConflictListQf]])
|
||||
end,
|
||||
})
|
||||
47
lua/config/git-linker.lua
Normal file
47
lua/config/git-linker.lua
Normal file
@@ -0,0 +1,47 @@
|
||||
local keymap = vim.keymap
|
||||
local gitlinker = require("gitlinker")
|
||||
|
||||
gitlinker.setup {
|
||||
callbacks = {
|
||||
["dev.azure.com"] = function(url_data)
|
||||
vim.print(url_data)
|
||||
local url = require("gitlinker.hosts").get_base_https_url(url_data)
|
||||
|
||||
if url_data.lstart then
|
||||
if url_data.lend == nil then
|
||||
url_data.lend = url_data.lstart
|
||||
end
|
||||
url = url
|
||||
.. "?path=/"
|
||||
.. url_data.file
|
||||
.. "&version=GC"
|
||||
.. url_data.rev
|
||||
.. "&line="
|
||||
.. url_data.lstart
|
||||
"&lineEnd="
|
||||
.. url_data.lend
|
||||
.. "&lineStartColumn=1"
|
||||
.. "&lineEndColumn=120"
|
||||
end
|
||||
return url
|
||||
end,
|
||||
},
|
||||
mappings = nil,
|
||||
}
|
||||
|
||||
keymap.set({ "n", "v" }, "<leader>gl", function()
|
||||
local mode = string.lower(vim.fn.mode())
|
||||
gitlinker.get_buf_range_url(mode)
|
||||
end, {
|
||||
silent = true,
|
||||
desc = "Git: get permlink",
|
||||
})
|
||||
|
||||
keymap.set("n", "<leader>gbr", function()
|
||||
gitlinker.get_repo_url {
|
||||
action_callback = gitlinker.actions.open_in_browser,
|
||||
}
|
||||
end, {
|
||||
silent = true,
|
||||
desc = "Git: browse repo in browser",
|
||||
})
|
||||
55
lua/config/gitsigns.lua
Normal file
55
lua/config/gitsigns.lua
Normal file
@@ -0,0 +1,55 @@
|
||||
local gs = require("gitsigns")
|
||||
|
||||
gs.setup {
|
||||
signs = {
|
||||
add = { text = "+" },
|
||||
change = { text = "~" },
|
||||
delete = { text = "_" },
|
||||
topdelete = { text = "‾" },
|
||||
changedelete = { text = "|" },
|
||||
},
|
||||
word_diff = false,
|
||||
on_attach = function(bufnr)
|
||||
local function map(mode, l, r, opts)
|
||||
opts = opts or {}
|
||||
opts.buffer = bufnr
|
||||
vim.keymap.set(mode, l, r, opts)
|
||||
end
|
||||
|
||||
map("n", "]c", function()
|
||||
if vim.wo.diff then
|
||||
return "]c"
|
||||
end
|
||||
vim.schedule(function()
|
||||
gs.next_hunk()
|
||||
end)
|
||||
return "<Ignore>"
|
||||
end, { expr = true, desc = "next hunk" })
|
||||
|
||||
map("n", "[c", function()
|
||||
if vim.wo.diff then
|
||||
return "[c"
|
||||
end
|
||||
vim.schedule(function()
|
||||
gs.prev_hunk()
|
||||
end)
|
||||
return "<Ignore>"
|
||||
end, { expr = true, desc = "previous hunk" })
|
||||
|
||||
map("n", "<leader>hp", gs.preview_hunk, { desc = "preview hunk" })
|
||||
map("n", "<leader>hb", function()
|
||||
gs.blame_line { full = true }
|
||||
end, { desc = "blame hunk" })
|
||||
end,
|
||||
}
|
||||
|
||||
vim.api.nvim_create_autocmd("ColorScheme", {
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
vim.cmd([[
|
||||
hi GitSignsChangeInline gui=reverse
|
||||
hi GitSignsAddInline gui=reverse
|
||||
hi GitSignsDeleteInline gui=reverse
|
||||
]])
|
||||
end,
|
||||
})
|
||||
12
lua/config/glance.lua
Normal file
12
lua/config/glance.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
local glance = require("glance")
|
||||
|
||||
glance.setup {
|
||||
height = 25,
|
||||
border = {
|
||||
enable = true,
|
||||
},
|
||||
}
|
||||
|
||||
vim.keymap.set("n", "<space>gd", "<cmd>Glance definitions<cr>")
|
||||
vim.keymap.set("n", "<space>gr", "<cmd>Glance reference<cr>")
|
||||
vim.keymap.set("n", "<space>gi", "<cmd>Glance implementations<cr>")
|
||||
75
lua/config/hlslens.lua
Normal file
75
lua/config/hlslens.lua
Normal file
@@ -0,0 +1,75 @@
|
||||
local api = vim.api
|
||||
local keymap = vim.keymap
|
||||
local hlslens = require("hlslens")
|
||||
|
||||
hlslens.setup {
|
||||
calm_down = true,
|
||||
nearest_only = true,
|
||||
}
|
||||
|
||||
local activate_hlslens = function(direction)
|
||||
local cmd = string.format("normal! %s%szzzv", vim.v.count1, direction)
|
||||
local status, msg = pcall(vim.cmd, cmd)
|
||||
|
||||
if not status then
|
||||
local start_idx, _ = string.find(msg, "E486", 1, true)
|
||||
local msg_part = string.sub(msg, start_idx)
|
||||
api.nvim_echo({ { msg_part } }, true, { err = true })
|
||||
return
|
||||
end
|
||||
|
||||
hlslens.start()
|
||||
end
|
||||
|
||||
keymap.set("n", "n", "", {
|
||||
callback = function()
|
||||
activate_hlslens("n")
|
||||
end,
|
||||
})
|
||||
|
||||
keymap.set("n", "N", "", {
|
||||
callback = function()
|
||||
activate_hlslens("N")
|
||||
end,
|
||||
})
|
||||
|
||||
local check_cursor_word = function()
|
||||
local cursor_word = vim.fn.expand("<cword>")
|
||||
local result = cursor_word == ""
|
||||
if result then
|
||||
local msg = "E348: No string under cursor"
|
||||
api.nvim_echo({ { msg } }, true, { err = true })
|
||||
end
|
||||
|
||||
return result, cursor_word
|
||||
end
|
||||
|
||||
keymap.set("n", "*", "", {
|
||||
callback = function()
|
||||
local cursor_word_empty, cursor_word = check_cursor_word()
|
||||
if cursor_word_empty then
|
||||
return
|
||||
end
|
||||
|
||||
local cmd = string.format([[normal! /\v<%s>]], cursor_word)
|
||||
local escaped_enter = vim.api.nvim_replace_termcodes("<CR>", true, false, true)
|
||||
local full_cmd = cmd .. escaped_enter .. "N"
|
||||
vim.fn.execute(full_cmd)
|
||||
hlslens.start()
|
||||
end,
|
||||
})
|
||||
keymap.set("n", "#", "", {
|
||||
callback = function()
|
||||
local cursor_word_empty, cursor_word = check_cursor_word()
|
||||
if cursor_word_empty then
|
||||
return
|
||||
end
|
||||
|
||||
local cmd = string.format([[normal! ?\v<%s>]], cursor_word)
|
||||
local escaped_enter = vim.api.nvim_replace_termcodes("<CR>", true, false, true)
|
||||
|
||||
local full_cmd = cmd .. escaped_enter .. "N"
|
||||
vim.fn.execute(full_cmd)
|
||||
hlslens.start()
|
||||
end,
|
||||
})
|
||||
7
lua/config/iron.lua
Normal file
7
lua/config/iron.lua
Normal file
@@ -0,0 +1,7 @@
|
||||
local lua = require("iron")
|
||||
iron.core.set_config {
|
||||
preferred = {
|
||||
python = "ipython",
|
||||
},
|
||||
repl_open_cmd = "vertical 120 split",
|
||||
}
|
||||
18
lua/config/lightbulb.lua
Normal file
18
lua/config/lightbulb.lua
Normal file
@@ -0,0 +1,18 @@
|
||||
---@diagnostic disable: missing-fields
|
||||
require("nvim-lightbulb").setup {
|
||||
autocmd = {
|
||||
enabled = true,
|
||||
updatetime = -1,
|
||||
},
|
||||
---@diagnostic disable-next-line: unused-local
|
||||
filter = function(client_name, result)
|
||||
-- Ruff always sends these two actions even if there are no actions to take
|
||||
-- so it is better to just ignore these to avoid noise
|
||||
local ignored_kinds = { "source.fixAll.ruff", "source.organizeImports.ruff" }
|
||||
if vim.tbl_contains(ignored_kinds, result.kind) then
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end,
|
||||
}
|
||||
9
lua/config/live-command.lua
Normal file
9
lua/config/live-command.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
require("live-command").setup {
|
||||
enable_highlighting = true,
|
||||
inline_highlighting = true,
|
||||
commands = {
|
||||
Norm = { cmd = "norm" },
|
||||
},
|
||||
}
|
||||
|
||||
vim.cmd("cnoreabbrev norm Norm")
|
||||
127
lua/config/lsp.lua
Normal file
127
lua/config/lsp.lua
Normal file
@@ -0,0 +1,127 @@
|
||||
local utils = require("utils")
|
||||
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("lsp_buf_conf", { clear = true }),
|
||||
callback = function(event_context)
|
||||
local client = vim.lsp.get_client_by_id(event_context.data.client_id)
|
||||
|
||||
if not client then
|
||||
return
|
||||
end
|
||||
|
||||
local bufnr = event_context.buf
|
||||
local map = function(mode, l, r, opts)
|
||||
opts = opts or {}
|
||||
opts.silent = true
|
||||
opts.buffer = bufnr
|
||||
vim.keymap.set(mode, l, r, opts)
|
||||
end
|
||||
|
||||
map("n", "gd", function()
|
||||
vim.lsp.buf.definition {
|
||||
on_list = function(options)
|
||||
local unique_defs = {}
|
||||
local def_loc_hash = {}
|
||||
|
||||
for _, def_location in pairs(options.items) do
|
||||
local hash_key = def_location.filename .. def_location.lnum
|
||||
|
||||
if not def_loc_hash[hash_key] then
|
||||
def_loc_hash[hash_key] = true
|
||||
table.insert(unique_defs, def_location)
|
||||
end
|
||||
end
|
||||
|
||||
options.items = unique_defs
|
||||
|
||||
---@diagnostic disable-next-line: param-type-mismatch
|
||||
vim.fn.setloclist(0, {}, " ", options)
|
||||
|
||||
if #options.items > 1 then
|
||||
vim.cmd.lopen()
|
||||
else
|
||||
vim.cmd([[silent! lfirst]])
|
||||
end
|
||||
end,
|
||||
}
|
||||
end, { desc = "go to definition" })
|
||||
map("n", "<c-]>", vim.lsp.buf.definition)
|
||||
map("n", "K", function()
|
||||
vim.lsp.buf.hover { border = "single", max_height = 25, max_width = 120 }
|
||||
end)
|
||||
map("n", "<c-k>", vim.lsp.buf.signature_help)
|
||||
map("n", "<space>rn", vim.lsp.buf.rename, { desc = "variable rename" })
|
||||
map("n", "<space>ca", vim.lsp.buf.code_action, { desc = "LSP code action" })
|
||||
map("n", "<space>wa", vim.lsp.buf.add_workspace_folder, { desc = "add workspace folder" })
|
||||
map("n", "<space>wr", vim.lsp.buf.remove_workspace_folder, { desc = "remove workspace folder" })
|
||||
map("n", "<space>wl", function()
|
||||
vim.print(vim.lsp.buf.list_workspace_folders())
|
||||
end, { desc = "list workspace folder" })
|
||||
|
||||
if client.name == "ruff" then
|
||||
client.server_capabilities.hoverProvider = false
|
||||
end
|
||||
|
||||
vim.lsp.inlay_hint.enable(true, { buffer = bufnr })
|
||||
|
||||
if client.server_capabilities.documentHighlightProvider then
|
||||
local gid = vim.api.nvim_create_augroup("lsp_document_highlight", { clear = true })
|
||||
vim.api.nvim_create_autocmd("CursorHold", {
|
||||
group = gid,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.document_highlight()
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("CursorMoved", {
|
||||
group = gid,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.clear_references()
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("CursorMoved", {
|
||||
group = gid,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.clear_references()
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
nested = true,
|
||||
desc = "configure buffer keymap and behavior based on LSP",
|
||||
})
|
||||
|
||||
local capabilities = require("lsp_utils").get_default_capabilities()
|
||||
|
||||
vim.lsp.config("*", {
|
||||
capabilities = capabilities,
|
||||
flags = {
|
||||
debounce_text_changes = 500,
|
||||
},
|
||||
})
|
||||
|
||||
local enabled_lsp_servers = {
|
||||
pyright = "delance-langserver",
|
||||
ruff = "ruff",
|
||||
lua_ls = "lua-language-server",
|
||||
vimls = "vim-language-server",
|
||||
bashls = "bash-language-server",
|
||||
yamlls = "yaml-language-server",
|
||||
}
|
||||
|
||||
for server_name, lsp_executable in pairs(enabled_lsp_servers) do
|
||||
if utils.executable(lsp_executable) then
|
||||
vim.lsp.enable(server_name)
|
||||
else
|
||||
local msg = string.format(
|
||||
"Executable '%s' for server '%s' not found! Server will not be enabled",
|
||||
lsp_executable,
|
||||
server_name
|
||||
)
|
||||
vim.notify(msg, vim.log.levels.WARN, { title = "nvim-config" })
|
||||
end
|
||||
end
|
||||
310
lua/config/lualine.lua
Normal file
310
lua/config/lualine.lua
Normal file
@@ -0,0 +1,310 @@
|
||||
local fn = vim.fn
|
||||
|
||||
local git_status_cache = {}
|
||||
|
||||
local on_exit_fetch = function(result)
|
||||
if result.code == 0 then
|
||||
git_status_cache.fetch_success = true
|
||||
end
|
||||
end
|
||||
|
||||
local function handle_numeric_result(cache_key)
|
||||
return function(result)
|
||||
if result.code == 0 then
|
||||
git_status_cache[cache_key] = tonumber(result.stdout:match("(%d+)")) or 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local async_cmd = function(cmd_str, on_exit)
|
||||
local cmd = vim.tbl_filter(function(element)
|
||||
return element ~= ""
|
||||
end, vim.split(cmd_str, " "))
|
||||
|
||||
vim.system(cmd, { text = true }, on_exit)
|
||||
end
|
||||
|
||||
local async_git_status_update = function()
|
||||
-- Fetch the latest changes from the remote repository (replace 'origin' if needed)
|
||||
async_cmd("git fetch origin", on_exit_fetch)
|
||||
if not git_status_cache.fetch_success then
|
||||
return
|
||||
end
|
||||
|
||||
-- Get the number of commits behind
|
||||
-- the @{upstream} notation is inspired by post: https://www.reddit.com/r/neovim/comments/t48x5i/git_branch_aheadbehind_info_status_line_component/
|
||||
-- note that here we should use double dots instead of triple dots
|
||||
local behind_cmd_str = "git rev-list --count HEAD..@{upstream}"
|
||||
async_cmd(behind_cmd_str, handle_numeric_result("behind_count"))
|
||||
|
||||
-- Get the number of commits ahead
|
||||
local ahead_cmd_str = "git rev-list --count @{upstream}..HEAD"
|
||||
async_cmd(ahead_cmd_str, handle_numeric_result("ahead_count"))
|
||||
end
|
||||
|
||||
local function get_git_ahead_behind_info()
|
||||
async_git_status_update()
|
||||
|
||||
local status = git_status_cache
|
||||
if not status then
|
||||
return ""
|
||||
end
|
||||
|
||||
local msg = ""
|
||||
|
||||
if type(status.ahead_count) == "number" and status.ahead_count > 0 then
|
||||
local ahead_str = string.format("↑[%d] ", status.ahead_count)
|
||||
msg = msg .. ahead_str
|
||||
end
|
||||
|
||||
if type(status.behind_count) == "number" and status.behind_count > 0 then
|
||||
local behind_str = string.format("↓[%d] ", status.behind_count)
|
||||
msg = msg .. behind_str
|
||||
end
|
||||
|
||||
return msg
|
||||
end
|
||||
|
||||
local function spell()
|
||||
if vim.o.spell then
|
||||
return string.format("[SPELL]")
|
||||
end
|
||||
|
||||
return ""
|
||||
end
|
||||
|
||||
--- show indicator for Chinese IME
|
||||
local function ime_state()
|
||||
if vim.g.is_mac then
|
||||
-- ref: https://github.com/vim-airline/vim-airline/blob/master/autoload/airline/extensions/xkblayout.vim#L11
|
||||
local layout = fn.libcall(vim.g.XkbSwitchLib, "Xkb_Switch_getXkbLayout", "")
|
||||
|
||||
-- We can use `xkbswitch -g` on the command line to get current mode.
|
||||
-- mode for macOS builtin pinyin IME: com.apple.inputmethod.SCIM.ITABC
|
||||
-- mode for Rime: im.rime.inputmethod.Squirrel.Rime
|
||||
local res = fn.match(layout, [[\v(Squirrel\.Rime|SCIM.ITABC)]])
|
||||
if res ~= -1 then
|
||||
return "[CN]"
|
||||
end
|
||||
end
|
||||
|
||||
return ""
|
||||
end
|
||||
|
||||
local function trailing_space()
|
||||
if not vim.o.modifiable then
|
||||
return ""
|
||||
end
|
||||
|
||||
local line_num = nil
|
||||
|
||||
for i = 1, fn.line("$") do
|
||||
local linetext = fn.getline(i)
|
||||
-- To prevent invalid escape error, we wrap the regex string with `[[]]`.
|
||||
local idx = fn.match(linetext, [[\v\s+$]])
|
||||
|
||||
if idx ~= -1 then
|
||||
line_num = i
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
local msg = ""
|
||||
if line_num ~= nil then
|
||||
msg = string.format("[%d]trailing", line_num)
|
||||
end
|
||||
|
||||
return msg
|
||||
end
|
||||
|
||||
local function mixed_indent()
|
||||
if not vim.o.modifiable then
|
||||
return ""
|
||||
end
|
||||
|
||||
local space_pat = [[\v^ +]]
|
||||
local tab_pat = [[\v^\t+]]
|
||||
local space_indent = fn.search(space_pat, "nwc")
|
||||
local tab_indent = fn.search(tab_pat, "nwc")
|
||||
local mixed = (space_indent > 0 and tab_indent > 0)
|
||||
local mixed_same_line
|
||||
if not mixed then
|
||||
mixed_same_line = fn.search([[\v^(\t+ | +\t)]], "nwc")
|
||||
mixed = mixed_same_line > 0
|
||||
end
|
||||
if not mixed then
|
||||
return ""
|
||||
end
|
||||
if mixed_same_line ~= nil and mixed_same_line > 0 then
|
||||
return "MI:" .. mixed_same_line
|
||||
end
|
||||
local space_indent_cnt = fn.searchcount({ pattern = space_pat, max_count = 1e3 }).total
|
||||
local tab_indent_cnt = fn.searchcount({ pattern = tab_pat, max_count = 1e3 }).total
|
||||
if space_indent_cnt > tab_indent_cnt then
|
||||
return "MI:" .. tab_indent
|
||||
else
|
||||
return "MI:" .. space_indent
|
||||
end
|
||||
end
|
||||
|
||||
local diff = function()
|
||||
local git_status = vim.b.gitsigns_status_dict
|
||||
if git_status == nil then
|
||||
return
|
||||
end
|
||||
|
||||
local modify_num = git_status.changed
|
||||
local remove_num = git_status.removed
|
||||
local add_num = git_status.added
|
||||
|
||||
local info = { added = add_num, modified = modify_num, removed = remove_num }
|
||||
-- vim.print(info)
|
||||
return info
|
||||
end
|
||||
|
||||
local virtual_env = function()
|
||||
-- only show virtual env for Python
|
||||
if vim.bo.filetype ~= "python" then
|
||||
return ""
|
||||
end
|
||||
|
||||
local conda_env = os.getenv("CONDA_DEFAULT_ENV")
|
||||
local venv_path = os.getenv("VIRTUAL_ENV")
|
||||
|
||||
if venv_path == nil then
|
||||
if conda_env == nil then
|
||||
return ""
|
||||
else
|
||||
return string.format(" %s (conda)", conda_env)
|
||||
end
|
||||
else
|
||||
local venv_name = vim.fn.fnamemodify(venv_path, ":t")
|
||||
return string.format(" %s (venv)", venv_name)
|
||||
end
|
||||
end
|
||||
|
||||
local get_active_lsp = function()
|
||||
local msg = "🚫"
|
||||
local buf_ft = vim.api.nvim_get_option_value("filetype", {})
|
||||
local clients = vim.lsp.get_clients { bufnr = 0 }
|
||||
if next(clients) == nil then
|
||||
return msg
|
||||
end
|
||||
|
||||
for _, client in ipairs(clients) do
|
||||
---@diagnostic disable-next-line: undefined-field
|
||||
local filetypes = client.config.filetypes
|
||||
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
|
||||
return client.name
|
||||
end
|
||||
end
|
||||
return msg
|
||||
end
|
||||
|
||||
require("lualine").setup {
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = "auto",
|
||||
component_separators = { left = "⏐", right = "⏐" },
|
||||
section_separators = "",
|
||||
disabled_filetypes = {},
|
||||
always_divide_middle = true,
|
||||
refresh = {
|
||||
statusline = 1000,
|
||||
},
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {
|
||||
{
|
||||
"filename",
|
||||
symbols = {
|
||||
readonly = "[🔒]",
|
||||
},
|
||||
},
|
||||
},
|
||||
lualine_b = {
|
||||
{
|
||||
"branch",
|
||||
fmt = function(name, _)
|
||||
-- truncate branch name in case the name is too long
|
||||
return string.sub(name, 1, 20)
|
||||
end,
|
||||
color = { gui = "italic,bold" },
|
||||
},
|
||||
{
|
||||
get_git_ahead_behind_info,
|
||||
color = { fg = "#E0C479" },
|
||||
},
|
||||
{
|
||||
"diff",
|
||||
source = diff,
|
||||
},
|
||||
{
|
||||
virtual_env,
|
||||
color = { fg = "black", bg = "#F1CA81" },
|
||||
},
|
||||
},
|
||||
lualine_c = {
|
||||
{
|
||||
"%S",
|
||||
color = { gui = "bold", fg = "cyan" },
|
||||
},
|
||||
{
|
||||
spell,
|
||||
color = { fg = "black", bg = "#a7c080" },
|
||||
},
|
||||
},
|
||||
lualine_x = {
|
||||
{
|
||||
get_active_lsp,
|
||||
icon = "📡",
|
||||
},
|
||||
{
|
||||
"diagnostics",
|
||||
sources = { "nvim_diagnostic" },
|
||||
symbols = { error = "🆇 ", warn = "⚠️ ", info = "ℹ️ ", hint = " " },
|
||||
},
|
||||
{
|
||||
trailing_space,
|
||||
color = "WarningMsg",
|
||||
},
|
||||
{
|
||||
mixed_indent,
|
||||
color = "WarningMsg",
|
||||
},
|
||||
},
|
||||
lualine_y = {
|
||||
{
|
||||
"encoding",
|
||||
fmt = string.upper,
|
||||
},
|
||||
{
|
||||
"fileformat",
|
||||
symbols = {
|
||||
unix = "unix",
|
||||
dos = "win",
|
||||
mac = "mac",
|
||||
},
|
||||
},
|
||||
"filetype",
|
||||
{
|
||||
ime_state,
|
||||
color = { fg = "black", bg = "#f46868" },
|
||||
},
|
||||
},
|
||||
lualine_z = {
|
||||
"location",
|
||||
"progress",
|
||||
},
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = { "filename" },
|
||||
lualine_x = { "location" },
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
},
|
||||
tabline = {},
|
||||
extensions = { "quickfix", "fugitive", "nvim-tree" },
|
||||
}
|
||||
106
lua/config/nvim-cmp.lua
Normal file
106
lua/config/nvim-cmp.lua
Normal file
@@ -0,0 +1,106 @@
|
||||
local cmp = require("cmp")
|
||||
|
||||
require("cmp_nvim_lsp")
|
||||
require("cmp_path")
|
||||
require("cmp_buffer")
|
||||
require("cmp_omni")
|
||||
require("cmp_nvim_ultisnips")
|
||||
require("cmp_cmdline")
|
||||
|
||||
local MiniIcons = require("mini.icons")
|
||||
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
vim.fn["UltiSnips#Anon"](args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert {
|
||||
["<Tab>"] = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
["<S-Tab>"] = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
["<CR>"] = cmp.mapping.confirm { select = true },
|
||||
["<C-e>"] = cmp.mapping.abort(),
|
||||
["<Esc>"] = cmp.mapping.close(),
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "ultisnips" },
|
||||
{ name = "path" },
|
||||
{ name = "buffer", keyword_length = 2 },
|
||||
},
|
||||
completion = {
|
||||
keyword_length = 1,
|
||||
completeopt = "menu,noselect",
|
||||
},
|
||||
view = {
|
||||
entries = "custom",
|
||||
},
|
||||
formatting = {
|
||||
format = function(_, vim_item)
|
||||
local icon, hl = MiniIcons.get("lsp", vim_item.kind)
|
||||
vim_item.kind = icon .. " " .. vim_item.kind
|
||||
vim_item.kind_hl_group = hl
|
||||
return vim_item
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
cmp.setup.filetype("tex", {
|
||||
sources = {
|
||||
{ name = "omni" },
|
||||
{ name = "ultisnips" },
|
||||
{ name = "buffer", keyword_length = 2 },
|
||||
{ name = "path" },
|
||||
},
|
||||
})
|
||||
|
||||
cmp.setup.cmdline("/", {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {
|
||||
{ name = "buffer" },
|
||||
},
|
||||
})
|
||||
|
||||
cmp.setup.cmdline(":", {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "path" },
|
||||
}, {
|
||||
{ name = "cmdline" },
|
||||
}),
|
||||
matching = { disallow_symbol_nonprefix_matching = false },
|
||||
})
|
||||
|
||||
vim.cmd([[
|
||||
highlight! link CmpItemMenu Comment
|
||||
" gray
|
||||
highlight! CmpItemAbbrDeprecated guibg=NONE gui=strikethrough guifg=#808080
|
||||
" blue
|
||||
highlight! CmpItemAbbrMatch guibg=NONE guifg=#569CD6
|
||||
highlight! CmpItemAbbrMatchFuzzy guibg=NONE guifg=#569CD6
|
||||
" light blue
|
||||
highlight! CmpItemKindVariable guibg=NONE guifg=#9CDCFE
|
||||
highlight! CmpItemKindInterface guibg=NONE guifg=#9CDCFE
|
||||
highlight! CmpItemKindText guibg=NONE guifg=#9CDCFE
|
||||
" pink
|
||||
highlight! CmpItemKindFunction guibg=NONE guifg=#C586C0
|
||||
highlight! CmpItemKindMethod guibg=NONE guifg=#C586C0
|
||||
" front
|
||||
highlight! CmpItemKindKeyword guibg=NONE guifg=#D4D4D4
|
||||
highlight! CmpItemKindProperty guibg=NONE guifg=#D4D4D4
|
||||
highlight! CmpItemKindUnit guibg=NONE guifg=#D4D4D4
|
||||
]])
|
||||
27
lua/config/nvim-hop.lua
Normal file
27
lua/config/nvim-hop.lua
Normal file
@@ -0,0 +1,27 @@
|
||||
local keymap = vim.keymap
|
||||
local hop = require("hop")
|
||||
hop.setup {
|
||||
case_insensitive = true,
|
||||
char2_fallback_key = "<CR>",
|
||||
quit_key = "<Esc>",
|
||||
}
|
||||
|
||||
keymap.set({ "n", "v", "o" }, "f", "", {
|
||||
silent = true,
|
||||
noremap = true,
|
||||
callback = function()
|
||||
hop.hint_char2()
|
||||
end,
|
||||
desc = "nvim-hop char2",
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("ColorScheme", {
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
vim.cmd([[
|
||||
hi HopNextKey cterm=bold ctermfg=176 gui=bold guibg=#ff00ff guifg=#ffffff
|
||||
hi HopNextKey cterm=bold ctermfg=176 gui=bold guibg=#ff00ff guifg=#ffffff
|
||||
hi HopNextKey cterm=bold ctermfg=176 gui=bold guibg=#ff00ff guifg=#ffffff
|
||||
]])
|
||||
end,
|
||||
})
|
||||
8
lua/config/nvim-notify.lua
Normal file
8
lua/config/nvim-notify.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
local nvim_notify = require("notify")
|
||||
nvim_notify.setup {
|
||||
stages = "fade_in_slide_out",
|
||||
timeout = 1500,
|
||||
background_colour = "#2E3440",
|
||||
}
|
||||
|
||||
vim.notify = nvim_notify
|
||||
22
lua/config/nvim-statuscol.lua
Normal file
22
lua/config/nvim-statuscol.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
local builtin = require("statuscol.builtin")
|
||||
local ffi = require("statuscol.ffidef")
|
||||
local C = ffi.C
|
||||
|
||||
local fold_level_limit = 3
|
||||
local function foldfunc(args)
|
||||
local foldinfo = C.fold_info(args.wp, args.lnum)
|
||||
if foldinfo.level > fold_level_limit then
|
||||
return " "
|
||||
end
|
||||
|
||||
return builtin.foldfunc(args)
|
||||
end
|
||||
|
||||
require("statuscol").setup {
|
||||
relculright = false,
|
||||
segments = {
|
||||
{ text = { "%s" }, click = "v:lua.ScSa" },
|
||||
{ text = { builtin.lnumfunc, " " }, click = "v:lua.ScLa" },
|
||||
{ text = { foldfunc, " " }, condition = { true, builtin.not_empty }, click = "v:lua.ScFa" },
|
||||
},
|
||||
}
|
||||
108
lua/config/nvim-tree.lua
Normal file
108
lua/config/nvim-tree.lua
Normal file
@@ -0,0 +1,108 @@
|
||||
local keymap = vim.keymap
|
||||
local nvim_tree = require("nvim-tree")
|
||||
|
||||
nvim_tree.setup {
|
||||
auto_reload_on_write = true,
|
||||
disable_netrw = false,
|
||||
hijack_netrw = true,
|
||||
hijack_cursor = false,
|
||||
hijack_unnamed_buffer_when_opening = false,
|
||||
open_on_tab = false,
|
||||
sort_by = "name",
|
||||
update_cwd = false,
|
||||
view = {
|
||||
width = 30,
|
||||
side = "left",
|
||||
preserve_window_proportions = false,
|
||||
number = false,
|
||||
relativenumber = false,
|
||||
signcolumn = "yes",
|
||||
},
|
||||
renderer = {
|
||||
indent_markers = {
|
||||
enable = false,
|
||||
icons = {
|
||||
corner = "└ ",
|
||||
edge = "| ",
|
||||
none = " ",
|
||||
},
|
||||
},
|
||||
icons = {
|
||||
webdev_colors = true,
|
||||
},
|
||||
},
|
||||
hijack_directories = {
|
||||
enable = true,
|
||||
auto_open = true,
|
||||
},
|
||||
update_focused_file = {
|
||||
enable = false,
|
||||
update_cwd = false,
|
||||
ignore_list = {},
|
||||
},
|
||||
system_open = {
|
||||
cmd = "",
|
||||
args = {},
|
||||
},
|
||||
diagnostics = {
|
||||
enable = false,
|
||||
show_on_dirs = false,
|
||||
icons = {
|
||||
hint = "",
|
||||
info = "",
|
||||
warning = "",
|
||||
error = "",
|
||||
},
|
||||
},
|
||||
filters = {
|
||||
dotfiles = false,
|
||||
custom = {},
|
||||
exclude = {},
|
||||
},
|
||||
git = {
|
||||
enable = true,
|
||||
ignore = true,
|
||||
timeout = 400,
|
||||
},
|
||||
actions = {
|
||||
use_system_clipboard = true,
|
||||
change_dir = {
|
||||
enable = true,
|
||||
global = false,
|
||||
restrict_above_cwd = false,
|
||||
},
|
||||
open_file = {
|
||||
quit_on_open = false,
|
||||
resize_window = false,
|
||||
window_picker = {
|
||||
enable = true,
|
||||
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
|
||||
exclude = {
|
||||
filetype = { "notify", "qf", "diff", "fugitive", "fugitiveblame" },
|
||||
buftype = { "nofile", "terminal", "help" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
trash = {
|
||||
cmd = "trash",
|
||||
require_confirm = true,
|
||||
},
|
||||
log = {
|
||||
enable = false,
|
||||
truncate = false,
|
||||
types = {
|
||||
all = false,
|
||||
config = false,
|
||||
copy_paste = false,
|
||||
diagnostics = false,
|
||||
git = false,
|
||||
profile = false,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
keymap.set("n", "<space>s", require("nvim-tree.api").tree.toggle, {
|
||||
silent = true,
|
||||
desc = "toggle nvim-tree",
|
||||
})
|
||||
41
lua/config/nvim-ufo.lua
Normal file
41
lua/config/nvim-ufo.lua
Normal file
@@ -0,0 +1,41 @@
|
||||
local handler = function(virtText, lnum, endLnum, width, truncate)
|
||||
local newVirtText = {}
|
||||
local foldedLines = endLnum - lnum
|
||||
local suffix = (" %d"):format(foldedLines)
|
||||
local sufWidth = vim.fn.strdisplaywidth(suffix)
|
||||
local targetWidth = width - sufWidth
|
||||
local curWidth = 0
|
||||
|
||||
for _, chunk in ipairs(virtText) do
|
||||
local chunkText = chunk[1]
|
||||
local chunkWidth = vim.fn.strdisplaywidth(chunkText)
|
||||
if targetWidth > curWidth + chunkWidth then
|
||||
table.insert(newVirtText, chunk)
|
||||
else
|
||||
chunkText = truncate(chunkText, targetWidth - curWidth)
|
||||
local hlGroup = chunk[2]
|
||||
table.insert(newVirtText, { chunkText, hlGroup })
|
||||
chunkWidth = vim.fn.strdisplaywidth(chunkText)
|
||||
if curWidth + chunkWidth < targetWidth then
|
||||
suffix = suffix .. (" "):rep(targetWidth - curWidth - chunkWidth)
|
||||
end
|
||||
break
|
||||
end
|
||||
curWidth = curWidth + chunkWidth
|
||||
end
|
||||
local rAlignAppndx = math.max(math.min(vim.opt.textwidth["_value"], width - 1) - curWidth - sufWidth, 0)
|
||||
suffix = (" "):rep(rAlignAppndx) .. suffix
|
||||
table.insert(newVirtText, { suffix, "MoreMsg" })
|
||||
return newVirtText
|
||||
end
|
||||
|
||||
require("ufo").setup {
|
||||
fold_virt_text_handler = handler,
|
||||
}
|
||||
|
||||
vim.keymap.set("n", "zR", require("ufo").openAllFolds)
|
||||
vim.keymap.set("n", "zM", require("ufo").closeAllFolds)
|
||||
vim.keymap.set("n", "zr", require("ufo").openFoldsExceptKinds)
|
||||
vim.keymap.set("n", "<leader>K", function()
|
||||
local _ = require("ufo").peekFoldedLinesUnderCursor()
|
||||
end, { desc = "Preview folded maps" })
|
||||
23
lua/config/treesitter-textobjects.lua
Normal file
23
lua/config/treesitter-textobjects.lua
Normal file
@@ -0,0 +1,23 @@
|
||||
require("nvim-treesitter.configs").setup {
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
lookahead = true,
|
||||
keymaps = {
|
||||
["af"] = "@function.outer",
|
||||
["if"] = "@function.inner",
|
||||
["ac"] = "@class.outer",
|
||||
["ic"] = { query = "@class.inner", desc = "select inner part of a class region" },
|
||||
},
|
||||
selection_modes = {
|
||||
["@function.inner"] = "V",
|
||||
["@function.outer"] = "V",
|
||||
["@class.outer"] = "V",
|
||||
["@class.inner"] = "V",
|
||||
["@parameter.outer"] = "v",
|
||||
},
|
||||
include_surrounding_whitespace = false,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
8
lua/config/treesitter.lua
Normal file
8
lua/config/treesitter.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
require("nvim-treesitter.configs").setup {
|
||||
ensure_installed = { "python", "cpp", "lua", "vim", "json", "toml" },
|
||||
ignore_install = {},
|
||||
highlight = {
|
||||
enable = true,
|
||||
disable = { "help" },
|
||||
},
|
||||
}
|
||||
6
lua/config/which-key.lua
Normal file
6
lua/config/which-key.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
require("which-key").setup {
|
||||
present = "modern",
|
||||
icons = {
|
||||
mappings = false,
|
||||
},
|
||||
}
|
||||
15
lua/config/yanky.lua
Normal file
15
lua/config/yanky.lua
Normal file
@@ -0,0 +1,15 @@
|
||||
require("yanky").setup {
|
||||
preserve_cursor_position = {
|
||||
enabled = false,
|
||||
},
|
||||
highlight = {
|
||||
on_put = true,
|
||||
on_yank = false,
|
||||
timer = 300,
|
||||
},
|
||||
}
|
||||
|
||||
vim.keymap.set({ "n", "x" }, "p", "<Plug>(YankyPutAfter)")
|
||||
vim.keymap.set({ "n", "x" }, "P", "<Plug>(YankyPutBefore)")
|
||||
vim.keymap.set("n", "[y", "<Plug>(YankyPreviousEntry)")
|
||||
vim.keymap.set("n", "]y", "<Plug>(YankyNextEntry)")
|
||||
Reference in New Issue
Block a user