lint
This commit is contained in:
parent
677125cbe1
commit
bcee7e3b07
38 changed files with 2330 additions and 1772 deletions
.config/nvim/lua
|
|
@ -3,62 +3,62 @@ local autocmds = {
|
|||
{ "BufEnter", "FocusGained", "InsertLeave", "WinEnter" },
|
||||
{
|
||||
pattern = "*",
|
||||
command = "if &nu && mode() != \"i\" | set rnu | endif"
|
||||
}
|
||||
command = 'if &nu && mode() != "i" | set rnu | endif',
|
||||
},
|
||||
},
|
||||
{ -- Handles the automatic line numeration changes
|
||||
{ "BufLeave", "FocusLost", "InsertEnter", "WinLeave" },
|
||||
{
|
||||
pattern = "*",
|
||||
command = "if &nu | set nornu | endif"
|
||||
}
|
||||
command = "if &nu | set nornu | endif",
|
||||
},
|
||||
},
|
||||
{ -- Use 'q' to quit from common plugins
|
||||
'FileType',
|
||||
"FileType",
|
||||
{
|
||||
pattern = { "qf", "help", "man", "lspinfo", "spectre_panel", "lir" },
|
||||
callback = function()
|
||||
vim.cmd [[
|
||||
vim.cmd([[
|
||||
nnoremap <silent> <buffer> q :close<CR>
|
||||
set nobuflisted
|
||||
]]
|
||||
end
|
||||
}
|
||||
]])
|
||||
end,
|
||||
},
|
||||
},
|
||||
{
|
||||
'Filetype',
|
||||
"Filetype",
|
||||
{
|
||||
pattern = { "gitcommit", "markdown" },
|
||||
callback = function()
|
||||
vim.opt_local.spell = true
|
||||
end,
|
||||
}
|
||||
},
|
||||
},
|
||||
{ -- Fix auto comment
|
||||
'BufWinEnter',
|
||||
"BufWinEnter",
|
||||
{
|
||||
command = "set formatoptions-=cro"
|
||||
}
|
||||
command = "set formatoptions-=cro",
|
||||
},
|
||||
},
|
||||
{ -- Highlight yanked text
|
||||
'TextYankPost',
|
||||
"TextYankPost",
|
||||
{
|
||||
callback = function()
|
||||
vim.highlight.on_yank({ higroup = "Visual", timeout = 200 })
|
||||
end
|
||||
}
|
||||
}
|
||||
end,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
vim.api.nvim_create_augroup('user_config', { clear = true })
|
||||
vim.api.nvim_create_augroup("user_config", { clear = true })
|
||||
for _, entry in ipairs(autocmds) do
|
||||
local event = entry[1]
|
||||
local opts = entry[2]
|
||||
if type(opts.group) == "string" and opts.group ~= "" then
|
||||
local event = entry[1]
|
||||
local opts = entry[2]
|
||||
if type(opts.group) == "string" and opts.group ~= "" then
|
||||
local exists, _ = pcall(vim.api.nvim_get_autocmds, { group = opts.group })
|
||||
if not exists then
|
||||
vim.api.nvim_create_augroup(opts.group, {})
|
||||
end
|
||||
end
|
||||
vim.api.nvim_create_autocmd(event, opts)
|
||||
end
|
||||
vim.api.nvim_create_autocmd(event, opts)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
local ansible_test = function(path, bufnr)
|
||||
local find = { 'tasks', 'roles', 'handlers', 'group_vars', 'host_vars', 'ansible.cfg', '.ansible-lint' }
|
||||
local find = { "tasks", "roles", "handlers", "group_vars", "host_vars", "ansible.cfg", ".ansible-lint" }
|
||||
local opts = { stop = os.getenv("HOME"), upward = true, limit = 1, path = path }
|
||||
if (next(vim.fs.find(find, opts)) ~= nil) then
|
||||
return 'yaml.ansible'
|
||||
if next(vim.fs.find(find, opts)) ~= nil then
|
||||
return "yaml.ansible"
|
||||
else
|
||||
return 'yaml'
|
||||
return "yaml"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -48,24 +48,30 @@ if f.is_available("zk-nvim") then
|
|||
maps.n["<Leader>n"] = M.sections.n
|
||||
maps.v["<Leader>n"] = maps.n["<Leader>n"]
|
||||
maps.n["<Leader>nn"] = {
|
||||
function() require("zk").new({ notebook_path = vim.g.wikidir, title = vim.fn.input('Title: ') }) end,
|
||||
desc = "New Note"
|
||||
function()
|
||||
require("zk").new({ notebook_path = vim.g.wikidir, title = vim.fn.input("Title: ") })
|
||||
end,
|
||||
desc = "New Note",
|
||||
}
|
||||
maps.v["<Leader>nnt"] = {
|
||||
":ZkNewFromTitleSelection { notebook_path = vim.g.wikidir }<CR>",
|
||||
desc = "New Note (Selection as title)"
|
||||
desc = "New Note (Selection as title)",
|
||||
}
|
||||
maps.v["<Leader>nnc"] = {
|
||||
":ZkNewFromContentSelection { notebook_path = vim.g.wikidir, title = vim.fn.input('Title: ') }<CR>",
|
||||
desc = "New Note (Selection as content)"
|
||||
desc = "New Note (Selection as content)",
|
||||
}
|
||||
maps.n["<Leader>no"] = {
|
||||
function() require("zk").edit({ notebook_path = vim.g.wikidir }) end,
|
||||
desc = "Open Note"
|
||||
function()
|
||||
require("zk").edit({ notebook_path = vim.g.wikidir })
|
||||
end,
|
||||
desc = "Open Note",
|
||||
}
|
||||
maps.n["<Leader>ni"] = {
|
||||
function() require("zk").index({ notebook_path = vim.g.wikidir }) end,
|
||||
desc = "Index Notes"
|
||||
function()
|
||||
require("zk").index({ notebook_path = vim.g.wikidir })
|
||||
end,
|
||||
desc = "Index Notes",
|
||||
}
|
||||
end
|
||||
|
||||
|
|
@ -85,46 +91,149 @@ maps.t["<C-l>"] = { "<Cmd>wincmd l<cr>", desc = "Terminal right window navigatio
|
|||
|
||||
-- Plugin Manager --
|
||||
maps.n["<Leader>p"] = M.sections.p
|
||||
maps.n["<Leader>ph"] = { function() require("lazy").home() end, desc = "Home" }
|
||||
maps.n["<Leader>pi"] = { function() require("lazy").install() end, desc = "Install" }
|
||||
maps.n["<Leader>pu"] = { function() require("lazy").update() end, desc = "Update" }
|
||||
maps.n["<Leader>ps"] = { function() require("lazy").sync() end, desc = "Sync" }
|
||||
maps.n["<Leader>px"] = { function() require("lazy").clean() end, desc = "Clean" }
|
||||
maps.n["<Leader>pc"] = { function() require("lazy").check() end, desc = "Check" }
|
||||
maps.n["<Leader>pl"] = { function() require("lazy").log() end, desc = "Log" }
|
||||
maps.n["<Leader>pr"] = { function() require("lazy").restore() end, desc = "Restore" }
|
||||
maps.n["<Leader>pp"] = { function() require("lazy").profile() end, desc = "Profile" }
|
||||
maps.n["<Leader>pd"] = { function() require("lazy").debug() end, desc = "Debug" }
|
||||
maps.n["<Leader>p?"] = { function() require("lazy").help() end, desc = "Help" }
|
||||
maps.n["<Leader>ph"] = {
|
||||
function()
|
||||
require("lazy").home()
|
||||
end,
|
||||
desc = "Home",
|
||||
}
|
||||
maps.n["<Leader>pi"] = {
|
||||
function()
|
||||
require("lazy").install()
|
||||
end,
|
||||
desc = "Install",
|
||||
}
|
||||
maps.n["<Leader>pu"] = {
|
||||
function()
|
||||
require("lazy").update()
|
||||
end,
|
||||
desc = "Update",
|
||||
}
|
||||
maps.n["<Leader>ps"] = {
|
||||
function()
|
||||
require("lazy").sync()
|
||||
end,
|
||||
desc = "Sync",
|
||||
}
|
||||
maps.n["<Leader>px"] = {
|
||||
function()
|
||||
require("lazy").clean()
|
||||
end,
|
||||
desc = "Clean",
|
||||
}
|
||||
maps.n["<Leader>pc"] = {
|
||||
function()
|
||||
require("lazy").check()
|
||||
end,
|
||||
desc = "Check",
|
||||
}
|
||||
maps.n["<Leader>pl"] = {
|
||||
function()
|
||||
require("lazy").log()
|
||||
end,
|
||||
desc = "Log",
|
||||
}
|
||||
maps.n["<Leader>pr"] = {
|
||||
function()
|
||||
require("lazy").restore()
|
||||
end,
|
||||
desc = "Restore",
|
||||
}
|
||||
maps.n["<Leader>pp"] = {
|
||||
function()
|
||||
require("lazy").profile()
|
||||
end,
|
||||
desc = "Profile",
|
||||
}
|
||||
maps.n["<Leader>pd"] = {
|
||||
function()
|
||||
require("lazy").debug()
|
||||
end,
|
||||
desc = "Debug",
|
||||
}
|
||||
maps.n["<Leader>p?"] = {
|
||||
function()
|
||||
require("lazy").help()
|
||||
end,
|
||||
desc = "Help",
|
||||
}
|
||||
|
||||
if f.is_available("bufferline.nvim") then
|
||||
maps.n["<S-l>"] = { function() require("bufferline").cycle(1) end, desc = "Switch to next buffer" }
|
||||
maps.n["<S-h>"] = { function() require("bufferline").cycle(-1) end, desc = "Switch to previous buffer" }
|
||||
maps.n["<A-l>"] = { function() require("bufferline").move(1) end, desc = "Move buffer to next" }
|
||||
maps.n["<A-h>"] = { function() require("bufferline").move(-1) end, desc = "Move buffer to previous" }
|
||||
maps.n["<S-l>"] = {
|
||||
function()
|
||||
require("bufferline").cycle(1)
|
||||
end,
|
||||
desc = "Switch to next buffer",
|
||||
}
|
||||
maps.n["<S-h>"] = {
|
||||
function()
|
||||
require("bufferline").cycle(-1)
|
||||
end,
|
||||
desc = "Switch to previous buffer",
|
||||
}
|
||||
maps.n["<A-l>"] = {
|
||||
function()
|
||||
require("bufferline").move(1)
|
||||
end,
|
||||
desc = "Move buffer to next",
|
||||
}
|
||||
maps.n["<A-h>"] = {
|
||||
function()
|
||||
require("bufferline").move(-1)
|
||||
end,
|
||||
desc = "Move buffer to previous",
|
||||
}
|
||||
maps.n["<Leader>b"] = M.sections.b
|
||||
maps.n["<Leader>bc"] = { function() require("bufferline").close_others() end, desc = "Close other buffers" }
|
||||
maps.n["<Leader>bc"] = {
|
||||
function()
|
||||
require("bufferline").close_others()
|
||||
end,
|
||||
desc = "Close other buffers",
|
||||
}
|
||||
maps.n["<Leader>bl"] = {
|
||||
function() require("bufferline").close_in_direction("left") end,
|
||||
desc = "Close lefthand buffers"
|
||||
function()
|
||||
require("bufferline").close_in_direction("left")
|
||||
end,
|
||||
desc = "Close lefthand buffers",
|
||||
}
|
||||
maps.n["<Leader>br"] = {
|
||||
function() require("bufferline").close_in_direction("right") end,
|
||||
desc = "Close righthand buffers"
|
||||
function()
|
||||
require("bufferline").close_in_direction("right")
|
||||
end,
|
||||
desc = "Close righthand buffers",
|
||||
}
|
||||
maps.n["<Leader>bs"] = M.sections.bs
|
||||
maps.n["<Leader>bse"] = { function() require("bufferline").sort_by("extension") end, desc = "By extension" }
|
||||
maps.n["<Leader>bsd"] = { function() require("bufferline").sort_by("directory") end, desc = "By directory" }
|
||||
maps.n["<Leader>bsr"] = {
|
||||
function() require("bufferline").sort_by("relative_directory") end,
|
||||
desc = "By relative directory"
|
||||
maps.n["<Leader>bse"] = {
|
||||
function()
|
||||
require("bufferline").sort_by("extension")
|
||||
end,
|
||||
desc = "By extension",
|
||||
}
|
||||
maps.n["<Leader>bsd"] = {
|
||||
function()
|
||||
require("bufferline").sort_by("directory")
|
||||
end,
|
||||
desc = "By directory",
|
||||
}
|
||||
maps.n["<Leader>bsr"] = {
|
||||
function()
|
||||
require("bufferline").sort_by("relative_directory")
|
||||
end,
|
||||
desc = "By relative directory",
|
||||
}
|
||||
maps.n["<Leader>bst"] = {
|
||||
function()
|
||||
require("bufferline").sort_by("tabs")
|
||||
end,
|
||||
desc = "By tabs",
|
||||
}
|
||||
maps.n["<Leader>bst"] = { function() require("bufferline").sort_by("tabs") end, desc = "By tabs" }
|
||||
end
|
||||
|
||||
if f.is_available("Comment.nvim") then
|
||||
maps.n["<Leader>/"] = {
|
||||
function() require("Comment.api").toggle.linewise.count(vim.v.count > 0 and vim.v.count or 1) end,
|
||||
function()
|
||||
require("Comment.api").toggle.linewise.count(vim.v.count > 0 and vim.v.count or 1)
|
||||
end,
|
||||
desc = "Toggle comment line",
|
||||
}
|
||||
maps.v["<Leader>/"] = {
|
||||
|
|
@ -135,85 +244,235 @@ end
|
|||
|
||||
if f.is_available("gitsigns.nvim") then
|
||||
maps.n["<Leader>g"] = M.sections.g
|
||||
maps.n["]g"] = { function() require("gitsigns").next_hunk() end, desc = "Next Git hunk" }
|
||||
maps.n["[g"] = { function() require("gitsigns").prev_hunk() end, desc = "Previous Git hunk" }
|
||||
maps.n["<Leader>gl"] = { function() require("gitsigns").blame_line() end, desc = "View Git blame" }
|
||||
maps.n["<Leader>gL"] = { function() require("gitsigns").blame_line { full = true } end, desc = "View full Git blame" }
|
||||
maps.n["<Leader>gp"] = { function() require("gitsigns").preview_hunk() end, desc = "Preview Git hunk" }
|
||||
maps.n["<Leader>gh"] = { function() require("gitsigns").reset_hunk() end, desc = "Reset Git hunk" }
|
||||
maps.n["<Leader>gr"] = { function() require("gitsigns").reset_buffer() end, desc = "Reset Git buffer" }
|
||||
maps.n["<Leader>gs"] = { function() require("gitsigns").stage_hunk() end, desc = "Stage Git hunk" }
|
||||
maps.n["<Leader>gS"] = { function() require("gitsigns").stage_buffer() end, desc = "Stage Git buffer" }
|
||||
maps.n["<Leader>gu"] = { function() require("gitsigns").undo_stage_hunk() end, desc = "Unstage Git hunk" }
|
||||
maps.n["<Leader>gd"] = { function() require("gitsigns").diffthis() end, desc = "View Git diff" }
|
||||
maps.n["]g"] = {
|
||||
function()
|
||||
require("gitsigns").next_hunk()
|
||||
end,
|
||||
desc = "Next Git hunk",
|
||||
}
|
||||
maps.n["[g"] = {
|
||||
function()
|
||||
require("gitsigns").prev_hunk()
|
||||
end,
|
||||
desc = "Previous Git hunk",
|
||||
}
|
||||
maps.n["<Leader>gl"] = {
|
||||
function()
|
||||
require("gitsigns").blame_line()
|
||||
end,
|
||||
desc = "View Git blame",
|
||||
}
|
||||
maps.n["<Leader>gL"] = {
|
||||
function()
|
||||
require("gitsigns").blame_line({ full = true })
|
||||
end,
|
||||
desc = "View full Git blame",
|
||||
}
|
||||
maps.n["<Leader>gp"] = {
|
||||
function()
|
||||
require("gitsigns").preview_hunk()
|
||||
end,
|
||||
desc = "Preview Git hunk",
|
||||
}
|
||||
maps.n["<Leader>gh"] = {
|
||||
function()
|
||||
require("gitsigns").reset_hunk()
|
||||
end,
|
||||
desc = "Reset Git hunk",
|
||||
}
|
||||
maps.n["<Leader>gr"] = {
|
||||
function()
|
||||
require("gitsigns").reset_buffer()
|
||||
end,
|
||||
desc = "Reset Git buffer",
|
||||
}
|
||||
maps.n["<Leader>gs"] = {
|
||||
function()
|
||||
require("gitsigns").stage_hunk()
|
||||
end,
|
||||
desc = "Stage Git hunk",
|
||||
}
|
||||
maps.n["<Leader>gS"] = {
|
||||
function()
|
||||
require("gitsigns").stage_buffer()
|
||||
end,
|
||||
desc = "Stage Git buffer",
|
||||
}
|
||||
maps.n["<Leader>gu"] = {
|
||||
function()
|
||||
require("gitsigns").undo_stage_hunk()
|
||||
end,
|
||||
desc = "Unstage Git hunk",
|
||||
}
|
||||
maps.n["<Leader>gd"] = {
|
||||
function()
|
||||
require("gitsigns").diffthis()
|
||||
end,
|
||||
desc = "View Git diff",
|
||||
}
|
||||
end
|
||||
|
||||
if f.is_available("taolf") then
|
||||
maps.n["<Leader>e"] = M.sections.e
|
||||
maps.n["E"] = { function() require("taolf").start({ dir = "fd" }) end, desc = "File manager" }
|
||||
maps.n["E"] = {
|
||||
function()
|
||||
require("taolf").start({ dir = "fd" })
|
||||
end,
|
||||
desc = "File manager",
|
||||
}
|
||||
maps.n["gE"] = { "<Noop>" }
|
||||
maps.n["<Leader>ee"] = { function() require("taolf").start() end, desc = "File manager" }
|
||||
maps.n["<Leader>eg"] = { function() require("taolf").start({ dir = "gwd" }) end, desc = "File manager in git working directory" }
|
||||
maps.n["<Leader>ef"] = { function() require("taolf").start({ dir = "fd" }) end, desc = "File manager in open file's working directory" }
|
||||
maps.n["<Leader>ee"] = {
|
||||
function()
|
||||
require("taolf").start()
|
||||
end,
|
||||
desc = "File manager",
|
||||
}
|
||||
maps.n["<Leader>eg"] = {
|
||||
function()
|
||||
require("taolf").start({ dir = "gwd" })
|
||||
end,
|
||||
desc = "File manager in git working directory",
|
||||
}
|
||||
maps.n["<Leader>ef"] = {
|
||||
function()
|
||||
require("taolf").start({ dir = "fd" })
|
||||
end,
|
||||
desc = "File manager in open file's working directory",
|
||||
}
|
||||
end
|
||||
|
||||
if f.is_available("mason.nvim") then
|
||||
maps.n["<Leader>pm"] = { "<Cmd>Mason<cr>", desc = "Mason" }
|
||||
end
|
||||
|
||||
if f.is_available "aerial.nvim" then
|
||||
if f.is_available("aerial.nvim") then
|
||||
maps.n["<leader>l"] = M.sections.l
|
||||
maps.n["<leader>lS"] = { function() require("aerial").toggle() end, desc = "Symbols outline" }
|
||||
maps.n["<leader>lS"] = {
|
||||
function()
|
||||
require("aerial").toggle()
|
||||
end,
|
||||
desc = "Symbols outline",
|
||||
}
|
||||
end
|
||||
|
||||
if f.is_available("telescope.nvim") then
|
||||
maps.n["<Leader>f"] = M.sections.f
|
||||
maps.n["<Leader>g"] = M.sections.g
|
||||
maps.n["<Leader>gb"] = {
|
||||
function() require("telescope.builtin").git_branches { use_file_path = true } end,
|
||||
desc = "Git branches"
|
||||
function()
|
||||
require("telescope.builtin").git_branches({ use_file_path = true })
|
||||
end,
|
||||
desc = "Git branches",
|
||||
}
|
||||
maps.n["<Leader>gc"] = {
|
||||
function() require("telescope.builtin").git_commits { use_file_path = true } end,
|
||||
function()
|
||||
require("telescope.builtin").git_commits({ use_file_path = true })
|
||||
end,
|
||||
desc = "Git commits (repository)",
|
||||
}
|
||||
maps.n["<Leader>gC"] = {
|
||||
function() require("telescope.builtin").git_bcommits { use_file_path = true } end,
|
||||
function()
|
||||
require("telescope.builtin").git_bcommits({ use_file_path = true })
|
||||
end,
|
||||
desc = "Git commits (current file)",
|
||||
}
|
||||
maps.n["<Leader>gt"] = {
|
||||
function() require("telescope.builtin").git_status { use_file_path = true } end,
|
||||
desc = "Git status"
|
||||
function()
|
||||
require("telescope.builtin").git_status({ use_file_path = true })
|
||||
end,
|
||||
desc = "Git status",
|
||||
}
|
||||
maps.n["<Leader>f<CR>"] = {
|
||||
function()
|
||||
require("telescope.builtin").resume()
|
||||
end,
|
||||
desc = "Resume previous search",
|
||||
}
|
||||
maps.n["<Leader>f'"] = {
|
||||
function()
|
||||
require("telescope.builtin").marks()
|
||||
end,
|
||||
desc = "Find marks",
|
||||
}
|
||||
maps.n["<Leader>f<CR>"] = { function() require("telescope.builtin").resume() end, desc = "Resume previous search" }
|
||||
maps.n["<Leader>f'"] = { function() require("telescope.builtin").marks() end, desc = "Find marks" }
|
||||
maps.n["<Leader>f/"] = {
|
||||
function() require("telescope.builtin").current_buffer_fuzzy_find() end,
|
||||
desc = "Find words in current buffer"
|
||||
function()
|
||||
require("telescope.builtin").current_buffer_fuzzy_find()
|
||||
end,
|
||||
desc = "Find words in current buffer",
|
||||
}
|
||||
maps.n["<Leader>fc"] = {
|
||||
function()
|
||||
require("telescope.builtin").grep_string()
|
||||
end,
|
||||
desc = "Find word under cursor",
|
||||
}
|
||||
maps.n["<Leader>fC"] = {
|
||||
function()
|
||||
require("telescope.builtin").commands()
|
||||
end,
|
||||
desc = "Find commands",
|
||||
}
|
||||
maps.n["<Leader>ff"] = {
|
||||
function()
|
||||
require("telescope.builtin").find_files()
|
||||
end,
|
||||
desc = "Find files",
|
||||
}
|
||||
maps.n["<Leader>fc"] = { function() require("telescope.builtin").grep_string() end, desc = "Find word under cursor" }
|
||||
maps.n["<Leader>fC"] = { function() require("telescope.builtin").commands() end, desc = "Find commands" }
|
||||
maps.n["<Leader>ff"] = { function() require("telescope.builtin").find_files() end, desc = "Find files" }
|
||||
maps.n["<Leader>fF"] = {
|
||||
function() require("telescope.builtin").find_files({ hidden = true, no_ignore = true }) end,
|
||||
function()
|
||||
require("telescope.builtin").find_files({ hidden = true, no_ignore = true })
|
||||
end,
|
||||
desc = "Find all files",
|
||||
}
|
||||
maps.n["<Leader>fh"] = { function() require("telescope.builtin").help_tags() end, desc = "Find help" }
|
||||
maps.n["<Leader>fk"] = { function() require("telescope.builtin").keymaps() end, desc = "Find keymaps" }
|
||||
maps.n["<Leader>fm"] = { function() require("telescope.builtin").man_pages() end, desc = "Find man" }
|
||||
maps.n["<Leader>fo"] = { function() require("telescope.builtin").oldfiles() end, desc = "Find history" }
|
||||
maps.n["<Leader>fr"] = { function() require("telescope.builtin").registers() end, desc = "Find registers" }
|
||||
maps.n["<Leader>fw"] = { function() require("telescope.builtin").live_grep() end, desc = "Find words" }
|
||||
maps.n["<Leader>fh"] = {
|
||||
function()
|
||||
require("telescope.builtin").help_tags()
|
||||
end,
|
||||
desc = "Find help",
|
||||
}
|
||||
maps.n["<Leader>fk"] = {
|
||||
function()
|
||||
require("telescope.builtin").keymaps()
|
||||
end,
|
||||
desc = "Find keymaps",
|
||||
}
|
||||
maps.n["<Leader>fm"] = {
|
||||
function()
|
||||
require("telescope.builtin").man_pages()
|
||||
end,
|
||||
desc = "Find man",
|
||||
}
|
||||
maps.n["<Leader>fo"] = {
|
||||
function()
|
||||
require("telescope.builtin").oldfiles()
|
||||
end,
|
||||
desc = "Find history",
|
||||
}
|
||||
maps.n["<Leader>fr"] = {
|
||||
function()
|
||||
require("telescope.builtin").registers()
|
||||
end,
|
||||
desc = "Find registers",
|
||||
}
|
||||
maps.n["<Leader>fw"] = {
|
||||
function()
|
||||
require("telescope.builtin").live_grep()
|
||||
end,
|
||||
desc = "Find words",
|
||||
}
|
||||
-- maps.n["<Leader>fb"] = { function() require("telescope.builtin").buffers() end, desc = "Find buffers" }
|
||||
maps.n["<Leader>ft"] = {
|
||||
function() require("telescope").extensions["todo-comments"].todo() end,
|
||||
desc =
|
||||
"Find buffers"
|
||||
function()
|
||||
require("telescope").extensions["todo-comments"].todo()
|
||||
end,
|
||||
desc = "Find buffers",
|
||||
}
|
||||
maps.n["<Leader>fW"] = {
|
||||
function()
|
||||
require("telescope.builtin").live_grep({
|
||||
additional_args = function(args) return vim.list_extend(args, { "--hidden", "--no-ignore" }) end,
|
||||
additional_args = function(args)
|
||||
return vim.list_extend(args, { "--hidden", "--no-ignore" })
|
||||
end,
|
||||
})
|
||||
end,
|
||||
desc = "Find words in all files",
|
||||
|
|
@ -234,13 +493,12 @@ end
|
|||
|
||||
if f.is_available("toggleterm.nvim") then
|
||||
maps.n["<leader>t"] = M.sections.t
|
||||
if vim.fn.executable "lazygit" == 1 then
|
||||
if vim.fn.executable("lazygit") == 1 then
|
||||
maps.n["<leader>g"] = M.sections.g
|
||||
maps.n["<leader>gg"] = {
|
||||
function()
|
||||
local worktree = f.file_worktree()
|
||||
local flags = worktree
|
||||
and (" --work-tree=%s --git-dir=%s"):format(worktree.toplevel, worktree.gitdir)
|
||||
local flags = worktree and (" --work-tree=%s --git-dir=%s"):format(worktree.toplevel, worktree.gitdir)
|
||||
or ""
|
||||
f.toggle_term_cmd("lazygit " .. flags)
|
||||
end,
|
||||
|
|
@ -248,75 +506,241 @@ if f.is_available("toggleterm.nvim") then
|
|||
}
|
||||
maps.n["<leader>tl"] = maps.n["<leader>gg"]
|
||||
end
|
||||
if vim.fn.executable "node" == 1 then
|
||||
maps.n["<leader>tn"] = { function() f.toggle_term_cmd "node" end, desc = "ToggleTerm node" }
|
||||
if vim.fn.executable("node") == 1 then
|
||||
maps.n["<leader>tn"] = {
|
||||
function()
|
||||
f.toggle_term_cmd("node")
|
||||
end,
|
||||
desc = "ToggleTerm node",
|
||||
}
|
||||
end
|
||||
if vim.fn.executable("gdu") == 1 then
|
||||
maps.n["<leader>tu"] = { function() f.toggle_term_cmd("gdu") end, desc = "ToggleTerm gdu" }
|
||||
maps.n["<leader>tu"] = {
|
||||
function()
|
||||
f.toggle_term_cmd("gdu")
|
||||
end,
|
||||
desc = "ToggleTerm gdu",
|
||||
}
|
||||
end
|
||||
if vim.fn.executable "btm" == 1 then
|
||||
maps.n["<leader>tt"] = { function() f.toggle_term_cmd "btm" end, desc = "ToggleTerm btm" }
|
||||
if vim.fn.executable("btm") == 1 then
|
||||
maps.n["<leader>tt"] = {
|
||||
function()
|
||||
f.toggle_term_cmd("btm")
|
||||
end,
|
||||
desc = "ToggleTerm btm",
|
||||
}
|
||||
end
|
||||
local python = vim.fn.executable("python") == 1 and "python" or vim.fn.executable("python3") == 1 and "python3"
|
||||
if python then
|
||||
maps.n["<leader>tp"] = {
|
||||
function()
|
||||
f.toggle_term_cmd(python)
|
||||
end,
|
||||
desc = "ToggleTerm python",
|
||||
}
|
||||
end
|
||||
local python = vim.fn.executable "python" == 1 and "python" or vim.fn.executable "python3" == 1 and "python3"
|
||||
if python then maps.n["<leader>tp"] = { function() f.toggle_term_cmd(python) end, desc = "ToggleTerm python" } end
|
||||
maps.n["<leader>tf"] = { "<Cmd>ToggleTerm direction=float<cr>", desc = "ToggleTerm float" }
|
||||
maps.n["<leader>th"] = { "<Cmd>ToggleTerm direction=horizontal<cr>", desc = "ToggleTerm horizontal split" }
|
||||
maps.n["<C-z>"] = { "<Cmd>ToggleTerm<cr>", desc = "Toggle terminal" }
|
||||
maps.t["<C-z>"] = maps.n["<F7>"]
|
||||
end
|
||||
|
||||
if f.is_available "nvim-dap" then
|
||||
if f.is_available("nvim-dap") then
|
||||
local conditional_breakpoint = function()
|
||||
vim.ui.input({ prompt = "Condition: " }, function(condition)
|
||||
if condition then require("dap").set_breakpoint(condition) end
|
||||
if condition then
|
||||
require("dap").set_breakpoint(condition)
|
||||
end
|
||||
end)
|
||||
end
|
||||
maps.n["<leader>d"] = M.sections.d
|
||||
maps.v["<leader>d"] = M.sections.d
|
||||
maps.n["<F5>"] = { function() require("dap").continue() end, desc = "Debugger: Start" }
|
||||
maps.n["<S-F5>"] = { function() require("dap").terminate() end, desc = "Debugger: Stop" }
|
||||
maps.n["<F5>"] = {
|
||||
function()
|
||||
require("dap").continue()
|
||||
end,
|
||||
desc = "Debugger: Start",
|
||||
}
|
||||
maps.n["<S-F5>"] = {
|
||||
function()
|
||||
require("dap").terminate()
|
||||
end,
|
||||
desc = "Debugger: Stop",
|
||||
}
|
||||
maps.n["<S-F9>"] = { conditional_breakpoint, desc = "Debugger: Conditional Breakpoint" }
|
||||
maps.n["<C-F5>"] = { function() require("dap").restart_frame() end, desc = "Debugger: Restart" }
|
||||
maps.n["<F6>"] = { function() require("dap").pause() end, desc = "Debugger: Pause" }
|
||||
maps.n["<F9>"] = { function() require("dap").toggle_breakpoint() end, desc = "Debugger: Toggle Breakpoint" }
|
||||
maps.n["<F10>"] = { function() require("dap").step_over() end, desc = "Debugger: Step Over" }
|
||||
maps.n["<F11>"] = { function() require("dap").step_into() end, desc = "Debugger: Step Into" }
|
||||
maps.n["<S-F11>"] = { function() require("dap").step_out() end, desc = "Debugger: Step Out" }
|
||||
maps.n["<leader>db"] = { function() require("dap").toggle_breakpoint() end, desc = "Toggle Breakpoint (F9)" }
|
||||
maps.n["<leader>dB"] = { function() require("dap").clear_breakpoints() end, desc = "Clear Breakpoints" }
|
||||
maps.n["<leader>dc"] = { function() require("dap").continue() end, desc = "Start/Continue (F5)" }
|
||||
maps.n["<C-F5>"] = {
|
||||
function()
|
||||
require("dap").restart_frame()
|
||||
end,
|
||||
desc = "Debugger: Restart",
|
||||
}
|
||||
maps.n["<F6>"] = {
|
||||
function()
|
||||
require("dap").pause()
|
||||
end,
|
||||
desc = "Debugger: Pause",
|
||||
}
|
||||
maps.n["<F9>"] = {
|
||||
function()
|
||||
require("dap").toggle_breakpoint()
|
||||
end,
|
||||
desc = "Debugger: Toggle Breakpoint",
|
||||
}
|
||||
maps.n["<F10>"] = {
|
||||
function()
|
||||
require("dap").step_over()
|
||||
end,
|
||||
desc = "Debugger: Step Over",
|
||||
}
|
||||
maps.n["<F11>"] = {
|
||||
function()
|
||||
require("dap").step_into()
|
||||
end,
|
||||
desc = "Debugger: Step Into",
|
||||
}
|
||||
maps.n["<S-F11>"] = {
|
||||
function()
|
||||
require("dap").step_out()
|
||||
end,
|
||||
desc = "Debugger: Step Out",
|
||||
}
|
||||
maps.n["<leader>db"] = {
|
||||
function()
|
||||
require("dap").toggle_breakpoint()
|
||||
end,
|
||||
desc = "Toggle Breakpoint (F9)",
|
||||
}
|
||||
maps.n["<leader>dB"] = {
|
||||
function()
|
||||
require("dap").clear_breakpoints()
|
||||
end,
|
||||
desc = "Clear Breakpoints",
|
||||
}
|
||||
maps.n["<leader>dc"] = {
|
||||
function()
|
||||
require("dap").continue()
|
||||
end,
|
||||
desc = "Start/Continue (F5)",
|
||||
}
|
||||
maps.n["<leader>dC"] = { conditional_breakpoint, desc = "Conditional Breakpoint (S-F9)" }
|
||||
maps.n["<leader>di"] = { function() require("dap").step_into() end, desc = "Step Into (F11)" }
|
||||
maps.n["<leader>do"] = { function() require("dap").step_over() end, desc = "Step Over (F10)" }
|
||||
maps.n["<leader>dO"] = { function() require("dap").step_out() end, desc = "Step Out (S-F11)" }
|
||||
maps.n["<leader>dq"] = { function() require("dap").close() end, desc = "Close Session" }
|
||||
maps.n["<leader>dQ"] = { function() require("dap").terminate() end, desc = "Terminate Session (S-F5)" }
|
||||
maps.n["<leader>dp"] = { function() require("dap").pause() end, desc = "Pause (F6)" }
|
||||
maps.n["<leader>dr"] = { function() require("dap").restart_frame() end, desc = "Restart (C-F5)" }
|
||||
maps.n["<leader>dR"] = { function() require("dap").repl.toggle() end, desc = "Toggle REPL" }
|
||||
maps.n["<leader>ds"] = { function() require("dap").run_to_cursor() end, desc = "Run To Cursor" }
|
||||
maps.n["<leader>di"] = {
|
||||
function()
|
||||
require("dap").step_into()
|
||||
end,
|
||||
desc = "Step Into (F11)",
|
||||
}
|
||||
maps.n["<leader>do"] = {
|
||||
function()
|
||||
require("dap").step_over()
|
||||
end,
|
||||
desc = "Step Over (F10)",
|
||||
}
|
||||
maps.n["<leader>dO"] = {
|
||||
function()
|
||||
require("dap").step_out()
|
||||
end,
|
||||
desc = "Step Out (S-F11)",
|
||||
}
|
||||
maps.n["<leader>dq"] = {
|
||||
function()
|
||||
require("dap").close()
|
||||
end,
|
||||
desc = "Close Session",
|
||||
}
|
||||
maps.n["<leader>dQ"] = {
|
||||
function()
|
||||
require("dap").terminate()
|
||||
end,
|
||||
desc = "Terminate Session (S-F5)",
|
||||
}
|
||||
maps.n["<leader>dp"] = {
|
||||
function()
|
||||
require("dap").pause()
|
||||
end,
|
||||
desc = "Pause (F6)",
|
||||
}
|
||||
maps.n["<leader>dr"] = {
|
||||
function()
|
||||
require("dap").restart_frame()
|
||||
end,
|
||||
desc = "Restart (C-F5)",
|
||||
}
|
||||
maps.n["<leader>dR"] = {
|
||||
function()
|
||||
require("dap").repl.toggle()
|
||||
end,
|
||||
desc = "Toggle REPL",
|
||||
}
|
||||
maps.n["<leader>ds"] = {
|
||||
function()
|
||||
require("dap").run_to_cursor()
|
||||
end,
|
||||
desc = "Run To Cursor",
|
||||
}
|
||||
|
||||
if f.is_available "nvim-dap-ui" then
|
||||
if f.is_available("nvim-dap-ui") then
|
||||
maps.n["<leader>dE"] = {
|
||||
function()
|
||||
vim.ui.input({ prompt = "Expression: " }, function(expr)
|
||||
if expr then require("dapui").eval(expr, { enter = true }) end
|
||||
if expr then
|
||||
require("dapui").eval(expr, { enter = true })
|
||||
end
|
||||
end)
|
||||
end,
|
||||
desc = "Evaluate Input",
|
||||
}
|
||||
maps.v["<leader>dE"] = { function() require("dapui").eval() end, desc = "Evaluate Input" }
|
||||
maps.n["<leader>du"] = { function() require("dapui").toggle() end, desc = "Toggle Debugger UI" }
|
||||
maps.n["<leader>dh"] = { function() require("dap.ui.widgets").hover() end, desc = "Debugger Hover" }
|
||||
maps.v["<leader>dE"] = {
|
||||
function()
|
||||
require("dapui").eval()
|
||||
end,
|
||||
desc = "Evaluate Input",
|
||||
}
|
||||
maps.n["<leader>du"] = {
|
||||
function()
|
||||
require("dapui").toggle()
|
||||
end,
|
||||
desc = "Toggle Debugger UI",
|
||||
}
|
||||
maps.n["<leader>dh"] = {
|
||||
function()
|
||||
require("dap.ui.widgets").hover()
|
||||
end,
|
||||
desc = "Debugger Hover",
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
if f.is_available "nvim-ufo" then
|
||||
maps.n["zR"] = { function() require("ufo").openAllFolds() end, desc = "Open all folds" }
|
||||
maps.n["zM"] = { function() require("ufo").closeAllFolds() end, desc = "Close all folds" }
|
||||
maps.n["zr"] = { function() require("ufo").openFoldsExceptKinds() end, desc = "Fold less" }
|
||||
maps.n["zm"] = { function() require("ufo").closeFoldsWith() end, desc = "Fold more" }
|
||||
maps.n["zp"] = { function() require("ufo").peekFoldedLinesUnderCursor() end, desc = "Peek fold" }
|
||||
if f.is_available("nvim-ufo") then
|
||||
maps.n["zR"] = {
|
||||
function()
|
||||
require("ufo").openAllFolds()
|
||||
end,
|
||||
desc = "Open all folds",
|
||||
}
|
||||
maps.n["zM"] = {
|
||||
function()
|
||||
require("ufo").closeAllFolds()
|
||||
end,
|
||||
desc = "Close all folds",
|
||||
}
|
||||
maps.n["zr"] = {
|
||||
function()
|
||||
require("ufo").openFoldsExceptKinds()
|
||||
end,
|
||||
desc = "Fold less",
|
||||
}
|
||||
maps.n["zm"] = {
|
||||
function()
|
||||
require("ufo").closeFoldsWith()
|
||||
end,
|
||||
desc = "Fold more",
|
||||
}
|
||||
maps.n["zp"] = {
|
||||
function()
|
||||
require("ufo").peekFoldedLinesUnderCursor()
|
||||
end,
|
||||
desc = "Peek fold",
|
||||
}
|
||||
end
|
||||
|
||||
M.maps = maps
|
||||
|
|
|
|||
|
|
@ -2,21 +2,21 @@ local conf = { handlers = {}, required = {} }
|
|||
|
||||
conf.handlers["intelephense"] = {
|
||||
init_options = {
|
||||
storagePath = os.getenv('XDG_CACHE_HOME') .. '/intelephense',
|
||||
globalStoragePath = os.getenv('XDG_CONFIG_HOME') .. '/intelephense',
|
||||
licenceKey = os.getenv('XDG_CONFIG_HOME') .. '/intelephense/license.txt',
|
||||
}
|
||||
storagePath = os.getenv("XDG_CACHE_HOME") .. "/intelephense",
|
||||
globalStoragePath = os.getenv("XDG_CONFIG_HOME") .. "/intelephense",
|
||||
licenceKey = os.getenv("XDG_CONFIG_HOME") .. "/intelephense/license.txt",
|
||||
},
|
||||
}
|
||||
|
||||
conf.handlers["bashls"] = {
|
||||
settings = {
|
||||
bashIde = {
|
||||
shellcheckPath = vim.fn.stdpath "data" .. "mason/bin/shellcheck"
|
||||
}
|
||||
}
|
||||
shellcheckPath = vim.fn.stdpath("data") .. "mason/bin/shellcheck",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
conf.required = { "lua_ls", "zk" }
|
||||
conf.required = { "lua_ls", "zk", "bashls" }
|
||||
|
||||
conf.ignore = { "rust_analyzer" } -- This will be setup by rustacean.nvim
|
||||
return conf
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ g.git_worktrees = {
|
|||
g.max_lines = 1000
|
||||
g.max_size = 1024 * 100
|
||||
|
||||
o.undodir = vim.fn.stdpath "cache" .. "/undo"
|
||||
o.undodir = vim.fn.stdpath("cache") .. "/undo"
|
||||
o.clipboard = "unnamedplus"
|
||||
o.conceallevel = 0
|
||||
o.numberwidth = 3
|
||||
|
|
|
|||
|
|
@ -39,9 +39,13 @@ function M.buf_close(bufnr, force)
|
|||
vim.ui.input({
|
||||
prompt = string.format([[%s. Close it anyway? [y]es or [n]o (default: no): ]], warning),
|
||||
}, function(choice)
|
||||
if choice:match "ye?s?" then force = true end
|
||||
if choice:match("ye?s?") then
|
||||
force = true
|
||||
end
|
||||
end)
|
||||
if not force then return end
|
||||
if not force then
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -50,7 +54,9 @@ function M.buf_close(bufnr, force)
|
|||
return api.nvim_win_get_buf(win) == bufnr
|
||||
end, api.nvim_list_wins())
|
||||
|
||||
if #windows == 0 then return end
|
||||
if #windows == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
if force then
|
||||
kill_command = kill_command .. "!"
|
||||
|
|
@ -75,7 +81,7 @@ function M.buf_close(bufnr, force)
|
|||
end
|
||||
end
|
||||
else
|
||||
vim.cmd('q!')
|
||||
vim.cmd("q!")
|
||||
end
|
||||
|
||||
-- Check if buffer still exists, to ensure the target buffer wasn't killed
|
||||
|
|
@ -92,12 +98,12 @@ end
|
|||
|
||||
function M.empty_map_table()
|
||||
local maps = {}
|
||||
for _, mode in ipairs { "", "n", "v", "x", "s", "o", "!", "i", "l", "c", "t" } do
|
||||
for _, mode in ipairs({ "", "n", "v", "x", "s", "o", "!", "i", "l", "c", "t" }) do
|
||||
maps[mode] = {}
|
||||
end
|
||||
-- TODO: Check this on 0.10.0 release
|
||||
if vim.fn.has "nvim-0.10.0" == 1 then
|
||||
for _, abbr_mode in ipairs { "ia", "ca", "!a" } do
|
||||
if vim.fn.has("nvim-0.10.0") == 1 then
|
||||
for _, abbr_mode in ipairs({ "ia", "ca", "!a" }) do
|
||||
maps[abbr_mode] = {}
|
||||
end
|
||||
end
|
||||
|
|
@ -109,30 +115,44 @@ function M.toggle_term_cmd(opts)
|
|||
vim.g.user_terminals = {}
|
||||
end
|
||||
local terms = vim.g.user_terminals
|
||||
if type(opts) == "string" then opts = { cmd = opts, hidden = true } end
|
||||
if type(opts) == "string" then
|
||||
opts = { cmd = opts, hidden = true }
|
||||
end
|
||||
local num = vim.v.count > 0 and vim.v.count or 1
|
||||
if not terms[opts.cmd] then terms[opts.cmd] = {} end
|
||||
if not terms[opts.cmd] then
|
||||
terms[opts.cmd] = {}
|
||||
end
|
||||
if not terms[opts.cmd][num] then
|
||||
if not opts.count then opts.count = vim.tbl_count(terms) * 100 + num end
|
||||
if not opts.on_exit then opts.on_exit = function() terms[opts.cmd][num] = nil end end
|
||||
if not opts.count then
|
||||
opts.count = vim.tbl_count(terms) * 100 + num
|
||||
end
|
||||
if not opts.on_exit then
|
||||
opts.on_exit = function()
|
||||
terms[opts.cmd][num] = nil
|
||||
end
|
||||
end
|
||||
terms[opts.cmd][num] = require("toggleterm.terminal").Terminal:new(opts)
|
||||
end
|
||||
terms[opts.cmd][num]:toggle()
|
||||
end
|
||||
|
||||
function M.cmd(cmd, show_error)
|
||||
if type(cmd) == "string" then cmd = { cmd } end
|
||||
if type(cmd) == "string" then
|
||||
cmd = { cmd }
|
||||
end
|
||||
local result = vim.fn.system(cmd)
|
||||
local success = vim.api.nvim_get_vvar "shell_error" == 0
|
||||
local success = vim.api.nvim_get_vvar("shell_error") == 0
|
||||
if not success and (show_error == nil or show_error) then
|
||||
vim.api.nvim_err_writeln(("Error running command %s\nError message:\n%s"):format(table.concat(cmd, " "), result))
|
||||
vim.api.nvim_err_writeln(
|
||||
("Error running command %s\nError message:\n%s"):format(table.concat(cmd, " "), result)
|
||||
)
|
||||
end
|
||||
return success and result:gsub("[\27\155][][()#;?%d]*[A-PRZcf-ntqry=><~]", "") or nil
|
||||
end
|
||||
|
||||
function M.file_worktree(file, worktrees)
|
||||
worktrees = worktrees or vim.g.git_worktrees
|
||||
file = file or vim.fn.expand "%"
|
||||
file = file or vim.fn.expand("%")
|
||||
for _, worktree in ipairs(worktrees) do
|
||||
if
|
||||
M.cmd({
|
||||
|
|
@ -176,9 +196,15 @@ function M.set_maps(map_table, base)
|
|||
keymap_opts[1] = nil
|
||||
end
|
||||
if not cmd or keymap_opts.name then -- which-key mapping
|
||||
if not keymap_opts.name then keymap_opts.name = keymap_opts.desc end
|
||||
if not M.which_key_queue then M.which_key_queue = {} end
|
||||
if not M.which_key_queue[mode] then M.which_key_queue[mode] = {} end
|
||||
if not keymap_opts.name then
|
||||
keymap_opts.name = keymap_opts.desc
|
||||
end
|
||||
if not M.which_key_queue then
|
||||
M.which_key_queue = {}
|
||||
end
|
||||
if not M.which_key_queue[mode] then
|
||||
M.which_key_queue[mode] = {}
|
||||
end
|
||||
M.which_key_queue[mode][keymap] = keymap_opts
|
||||
else -- not which-key mapping
|
||||
vim.keymap.set(mode, keymap, cmd, keymap_opts)
|
||||
|
|
@ -186,16 +212,24 @@ function M.set_maps(map_table, base)
|
|||
end
|
||||
end
|
||||
end
|
||||
if package.loaded["which-key"] then M.which_key_register() end
|
||||
if package.loaded["which-key"] then
|
||||
M.which_key_register()
|
||||
end
|
||||
end
|
||||
|
||||
local function del_buffer_autocmd(augroup, bufnr)
|
||||
local cmds_found, cmds = pcall(vim.api.nvim_get_autocmds, { group = augroup, buffer = bufnr })
|
||||
if cmds_found then vim.tbl_map(function(cmd) vim.api.nvim_del_autocmd(cmd.id) end, cmds) end
|
||||
if cmds_found then
|
||||
vim.tbl_map(function(cmd)
|
||||
vim.api.nvim_del_autocmd(cmd.id)
|
||||
end, cmds)
|
||||
end
|
||||
end
|
||||
|
||||
local function add_buffer_autocmd(augroup, bufnr, autocmds)
|
||||
if not vim.tbl_islist(autocmds) then autocmds = { autocmds } end
|
||||
if not vim.tbl_islist(autocmds) then
|
||||
autocmds = { autocmds }
|
||||
end
|
||||
local cmds_found, cmds = pcall(vim.api.nvim_get_autocmds, { group = augroup, buffer = bufnr })
|
||||
if not cmds_found or vim.tbl_isempty(cmds) then
|
||||
vim.api.nvim_create_augroup(augroup, { clear = false })
|
||||
|
|
@ -211,7 +245,9 @@ end
|
|||
|
||||
local function has_capability(capability, filter)
|
||||
for _, client in ipairs(vim.lsp.get_active_clients(filter)) do
|
||||
if client.supports_method(capability) then return true end
|
||||
if client.supports_method(capability) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
|
@ -220,14 +256,36 @@ end
|
|||
function M.lsp_on_attach(client, bufnr)
|
||||
local lsp_mappings = M.empty_map_table()
|
||||
|
||||
lsp_mappings.n["<Leader>ld"] = { function() vim.diagnostic.open_float() end, desc = "Hover diagnostics" }
|
||||
lsp_mappings.n["[d"] = { function() vim.diagnostic.goto_prev() end, desc = "Previous diagnostic" }
|
||||
lsp_mappings.n["]d"] = { function() vim.diagnostic.goto_next() end, desc = "Next diagnostic" }
|
||||
lsp_mappings.n["gl"] = { function() vim.diagnostic.open_float() end, desc = "Hover diagnostics" }
|
||||
lsp_mappings.n["<Leader>ld"] = {
|
||||
function()
|
||||
vim.diagnostic.open_float()
|
||||
end,
|
||||
desc = "Hover diagnostics",
|
||||
}
|
||||
lsp_mappings.n["[d"] = {
|
||||
function()
|
||||
vim.diagnostic.goto_prev()
|
||||
end,
|
||||
desc = "Previous diagnostic",
|
||||
}
|
||||
lsp_mappings.n["]d"] = {
|
||||
function()
|
||||
vim.diagnostic.goto_next()
|
||||
end,
|
||||
desc = "Next diagnostic",
|
||||
}
|
||||
lsp_mappings.n["gl"] = {
|
||||
function()
|
||||
vim.diagnostic.open_float()
|
||||
end,
|
||||
desc = "Hover diagnostics",
|
||||
}
|
||||
|
||||
if M.is_available("telescope.nvim") then
|
||||
lsp_mappings.n["<Leader>lD"] = {
|
||||
function() require("telescope.builtin").diagnostics() end,
|
||||
function()
|
||||
require("telescope.builtin").diagnostics()
|
||||
end,
|
||||
desc = "Search diagnostics",
|
||||
}
|
||||
end
|
||||
|
|
@ -242,7 +300,9 @@ function M.lsp_on_attach(client, bufnr)
|
|||
|
||||
if client.supports_method("textDocument/codeAction") then
|
||||
lsp_mappings.n["<Leader>la"] = {
|
||||
function() vim.lsp.buf.code_action() end,
|
||||
function()
|
||||
vim.lsp.buf.code_action()
|
||||
end,
|
||||
desc = "Code action",
|
||||
}
|
||||
lsp_mappings.v["<Leader>la"] = lsp_mappings.n["<Leader>la"]
|
||||
|
|
@ -251,80 +311,102 @@ function M.lsp_on_attach(client, bufnr)
|
|||
if client.supports_method("textDocument/codeLens") then
|
||||
vim.lsp.codelens.refresh()
|
||||
lsp_mappings.n["<Leader>ll"] = {
|
||||
function() vim.lsp.codelens.refresh() end,
|
||||
function()
|
||||
vim.lsp.codelens.refresh()
|
||||
end,
|
||||
desc = "Refresh CodeLens",
|
||||
}
|
||||
lsp_mappings.n["<Leader>lL"] = {
|
||||
function() vim.lsp.codelens.run() end,
|
||||
function()
|
||||
vim.lsp.codelens.run()
|
||||
end,
|
||||
desc = "Run CodeLens",
|
||||
}
|
||||
lsp_mappings.n["<Leader>u"] = { desc = icons.Gear .. " Utility" }
|
||||
lsp_mappings.n["<Leader>uL"] = {
|
||||
function() vim.lsp.codelens.clear() end,
|
||||
desc = "Toggle CodeLens"
|
||||
function()
|
||||
vim.lsp.codelens.clear()
|
||||
end,
|
||||
desc = "Toggle CodeLens",
|
||||
}
|
||||
end
|
||||
|
||||
if client.supports_method("textDocument/definition") then
|
||||
lsp_mappings.n["gd"] = {
|
||||
function() vim.lsp.buf.definition() end,
|
||||
function()
|
||||
vim.lsp.buf.definition()
|
||||
end,
|
||||
desc = "Go to definition",
|
||||
}
|
||||
end
|
||||
|
||||
if client.supports_method "textDocument/typeDefinition" then
|
||||
if client.supports_method("textDocument/typeDefinition") then
|
||||
lsp_mappings.n["gy"] = {
|
||||
function() vim.lsp.buf.type_definition() end,
|
||||
function()
|
||||
vim.lsp.buf.type_definition()
|
||||
end,
|
||||
desc = "Go to type definition",
|
||||
}
|
||||
end
|
||||
|
||||
if client.supports_method("textDocument/declaration") then
|
||||
lsp_mappings.n["gD"] = {
|
||||
function() vim.lsp.buf.declaration() end,
|
||||
function()
|
||||
vim.lsp.buf.declaration()
|
||||
end,
|
||||
desc = "Go to declaration",
|
||||
}
|
||||
end
|
||||
|
||||
if client.supports_method("textDocument/implementation") then
|
||||
lsp_mappings.n["gI"] = {
|
||||
function() vim.lsp.buf.implementation() end,
|
||||
function()
|
||||
vim.lsp.buf.implementation()
|
||||
end,
|
||||
desc = "List implementations",
|
||||
}
|
||||
end
|
||||
|
||||
if client.supports_method("textDocument/references") then
|
||||
lsp_mappings.n["gr"] = {
|
||||
function() vim.lsp.buf.references() end,
|
||||
function()
|
||||
vim.lsp.buf.references()
|
||||
end,
|
||||
desc = "List references",
|
||||
}
|
||||
end
|
||||
|
||||
if client.supports_method "workspace/symbol" then
|
||||
if client.supports_method("workspace/symbol") then
|
||||
lsp_mappings.n["<Leader>lG"] = {
|
||||
function() vim.lsp.buf.workspace_symbol() end,
|
||||
desc = "List symbols"
|
||||
function()
|
||||
vim.lsp.buf.workspace_symbol()
|
||||
end,
|
||||
desc = "List symbols",
|
||||
}
|
||||
end
|
||||
|
||||
if client.supports_method "textDocument/rename" then
|
||||
if client.supports_method("textDocument/rename") then
|
||||
lsp_mappings.n["<Leader>lr"] = {
|
||||
function() vim.lsp.buf.rename() end,
|
||||
function()
|
||||
vim.lsp.buf.rename()
|
||||
end,
|
||||
desc = "Rename symbol",
|
||||
}
|
||||
end
|
||||
|
||||
-- TODO: Check this on 0.10.0 release
|
||||
if client.supports_method "textDocument/semanticTokens/full" and vim.lsp.semantic_tokens then
|
||||
if client.supports_method("textDocument/semanticTokens/full") and vim.lsp.semantic_tokens then
|
||||
vim.b[bufnr].semantic_tokens_enabled = true
|
||||
lsp_mappings.n["<Leader>u"] = { desc = icons.Gear .. " Utility" }
|
||||
lsp_mappings.n["<Leader>uY"] = {
|
||||
function()
|
||||
vim.b[bufnr].semantic_tokens_enabled = not vim.b[bufnr].semantic_tokens_enabled
|
||||
for _, active_client in ipairs(vim.lsp.get_active_clients { bufnr = bufnr }) do
|
||||
for _, active_client in ipairs(vim.lsp.get_active_clients({ bufnr = bufnr })) do
|
||||
if active_client.server_capabilities.semanticTokensProvider then
|
||||
vim.lsp.semantic_tokens[vim.b[bufnr].semantic_tokens_enabled and "start" or "stop"](bufnr,
|
||||
active_client.id)
|
||||
vim.lsp.semantic_tokens[vim.b[bufnr].semantic_tokens_enabled and "start" or "stop"](
|
||||
bufnr,
|
||||
active_client.id
|
||||
)
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
|
@ -338,15 +420,15 @@ function M.lsp_on_attach(client, bufnr)
|
|||
vim.lsp.buf.format({
|
||||
filter = function(c)
|
||||
local filetype = vim.bo.filetype
|
||||
local n = require "null-ls"
|
||||
local s = require "null-ls.sources"
|
||||
local n = require("null-ls")
|
||||
local s = require("null-ls.sources")
|
||||
local method = n.methods.FORMATTING
|
||||
local available_formatters = s.get_available(filetype, method)
|
||||
if #available_formatters > 0 then
|
||||
return c.name == "null-ls"
|
||||
end
|
||||
return true
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
desc = "Format buffer",
|
||||
|
|
@ -370,26 +452,34 @@ function M.lsp_on_attach(client, bufnr)
|
|||
{
|
||||
events = { "CursorMoved", "CursorMovedI", "BufLeave" },
|
||||
desc = "clear references when cursor moves",
|
||||
callback = function() vim.lsp.buf.clear_references() end,
|
||||
callback = function()
|
||||
vim.lsp.buf.clear_references()
|
||||
end,
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
if client.supports_method("textDocument/hover") then
|
||||
-- TODO: Check this on 0.10.0 release
|
||||
if vim.fn.has "nvim-0.10" == 0 then
|
||||
if vim.fn.has("nvim-0.10") == 0 then
|
||||
lsp_mappings.n["K"] = {
|
||||
function() vim.lsp.buf.hover() end,
|
||||
function()
|
||||
vim.lsp.buf.hover()
|
||||
end,
|
||||
desc = "Hover symbol",
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
if client.supports_method("textDocument/inlayHint") then
|
||||
if vim.b.inlay_hints_enabled == nil then vim.b.inlay_hints_enabled = true end
|
||||
if vim.b.inlay_hints_enabled == nil then
|
||||
vim.b.inlay_hints_enabled = true
|
||||
end
|
||||
-- TODO: Check this on 0.10.0 release
|
||||
if vim.lsp.inlay_hint then
|
||||
if vim.b.inlay_hints_enabled then vim.lsp.inlay_hint.enable(bufnr, true) end
|
||||
if vim.b.inlay_hints_enabled then
|
||||
vim.lsp.inlay_hint.enable(bufnr, true)
|
||||
end
|
||||
lsp_mappings.n["<Leader>u"] = { desc = icons.Gear .. " Utility" }
|
||||
lsp_mappings.n["<Leader>uH"] = {
|
||||
function()
|
||||
|
|
@ -403,39 +493,53 @@ function M.lsp_on_attach(client, bufnr)
|
|||
end
|
||||
end
|
||||
|
||||
if client.supports_method "textDocument/signatureHelp" then
|
||||
if client.supports_method("textDocument/signatureHelp") then
|
||||
lsp_mappings.n["<Leader>lh"] = {
|
||||
function() vim.lsp.buf.signature_help() end,
|
||||
function()
|
||||
vim.lsp.buf.signature_help()
|
||||
end,
|
||||
desc = "Signature help",
|
||||
}
|
||||
end
|
||||
|
||||
if M.is_available "telescope.nvim" then
|
||||
if M.is_available("telescope.nvim") then
|
||||
if lsp_mappings.n.gd then
|
||||
lsp_mappings.n.gd[1] = function() require("telescope.builtin").lsp_definitions() end
|
||||
lsp_mappings.n.gd[1] = function()
|
||||
require("telescope.builtin").lsp_definitions()
|
||||
end
|
||||
end
|
||||
if lsp_mappings.n.gI then
|
||||
lsp_mappings.n.gI[1] = function() require("telescope.builtin").lsp_implementations() end
|
||||
lsp_mappings.n.gI[1] = function()
|
||||
require("telescope.builtin").lsp_implementations()
|
||||
end
|
||||
end
|
||||
if lsp_mappings.n.gr then
|
||||
lsp_mappings.n.gr[1] = function() require("telescope.builtin").lsp_references() end
|
||||
lsp_mappings.n.gr[1] = function()
|
||||
require("telescope.builtin").lsp_references()
|
||||
end
|
||||
end
|
||||
if lsp_mappings.n["<Leader>lR"] then
|
||||
lsp_mappings.n["<Leader>lR"][1] = function() require("telescope.builtin").lsp_references() end
|
||||
lsp_mappings.n["<Leader>lR"][1] = function()
|
||||
require("telescope.builtin").lsp_references()
|
||||
end
|
||||
end
|
||||
if lsp_mappings.n.gy then
|
||||
lsp_mappings.n.gy[1] = function() require("telescope.builtin").lsp_type_definitions() end
|
||||
lsp_mappings.n.gy[1] = function()
|
||||
require("telescope.builtin").lsp_type_definitions()
|
||||
end
|
||||
end
|
||||
if lsp_mappings.n["<Leader>lG"] then
|
||||
lsp_mappings.n["<Leader>lG"][1] = function()
|
||||
vim.ui.input({ prompt = "Symbol Query: (leave empty for word under cursor)" }, function(query)
|
||||
if query then
|
||||
-- word under cursor if given query is empty
|
||||
if query == "" then query = vim.fn.expand "<cword>" end
|
||||
require("telescope.builtin").lsp_workspace_symbols {
|
||||
if query == "" then
|
||||
query = vim.fn.expand("<cword>")
|
||||
end
|
||||
require("telescope.builtin").lsp_workspace_symbols({
|
||||
query = query,
|
||||
prompt_title = ("Find word (%s)"):format(query),
|
||||
}
|
||||
})
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
|
@ -443,8 +547,12 @@ function M.lsp_on_attach(client, bufnr)
|
|||
end
|
||||
|
||||
if not vim.tbl_isempty(lsp_mappings.v) then
|
||||
if lsp_mappings.v["<Leader>l"] then lsp_mappings.v["<Leader>l"] = { desc = icons.Code .. " LSP" } end
|
||||
if lsp_mappings.v["<Leader>u"] then lsp_mappings.v["<Leader>u"] = { desc = icons.Code .. " LSP" } end
|
||||
if lsp_mappings.v["<Leader>l"] then
|
||||
lsp_mappings.v["<Leader>l"] = { desc = icons.Code .. " LSP" }
|
||||
end
|
||||
if lsp_mappings.v["<Leader>u"] then
|
||||
lsp_mappings.v["<Leader>u"] = { desc = icons.Code .. " LSP" }
|
||||
end
|
||||
end
|
||||
|
||||
M.set_maps(lsp_mappings, { buffer = bufnr })
|
||||
|
|
|
|||
|
|
@ -10,10 +10,12 @@ M.dependencies = {
|
|||
M.event = "InsertEnter"
|
||||
|
||||
M.opts = function()
|
||||
local cmp = require "cmp"
|
||||
local cmp = require("cmp")
|
||||
local snip_status_ok, luasnip = pcall(require, "luasnip")
|
||||
local lspkind_status_ok, lspkind = pcall(require, "lspkind")
|
||||
if not snip_status_ok then return end
|
||||
if not snip_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local border_opts = {
|
||||
border = "rounded",
|
||||
|
|
@ -22,14 +24,16 @@ M.opts = function()
|
|||
|
||||
local function has_words_before()
|
||||
local line, col = (unpack or table.unpack)(vim.api.nvim_win_get_cursor(0))
|
||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match "%s" == nil
|
||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
||||
end
|
||||
|
||||
return {
|
||||
enabled = function()
|
||||
local dap_prompt = require("funcs").is_available("cmp-dap")
|
||||
and vim.tbl_contains({ "dap-repl", "dapui_watches", "dapui_hover" },
|
||||
vim.api.nvim_get_option_value("filetype", { buf = 0 }))
|
||||
and vim.tbl_contains(
|
||||
{ "dap-repl", "dapui_watches", "dapui_hover" },
|
||||
vim.api.nvim_get_option_value("filetype", { buf = 0 })
|
||||
)
|
||||
if vim.api.nvim_get_option_value("buftype", { buf = 0 }) == "prompt" and not dap_prompt then
|
||||
return false
|
||||
end
|
||||
|
|
@ -41,7 +45,9 @@ M.opts = function()
|
|||
format = lspkind_status_ok and lspkind.cmp_format(require("plugins.misc.lspkind").opts) or nil,
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args) luasnip.lsp_expand(args.body) end,
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
duplicates = {
|
||||
nvim_lsp = 1,
|
||||
|
|
@ -59,18 +65,18 @@ M.opts = function()
|
|||
documentation = cmp.config.window.bordered(border_opts),
|
||||
},
|
||||
mapping = {
|
||||
["<Up>"] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Select },
|
||||
["<Down>"] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Select },
|
||||
["<C-p>"] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Insert },
|
||||
["<C-n>"] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Insert },
|
||||
["<C-k>"] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Insert },
|
||||
["<C-j>"] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Insert },
|
||||
["<Up>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }),
|
||||
["<Down>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }),
|
||||
["<C-p>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||
["<C-n>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||
["<C-k>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||
["<C-j>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||
["<C-u>"] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }),
|
||||
["<C-d>"] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }),
|
||||
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
|
||||
["<C-y>"] = cmp.config.disable,
|
||||
["<C-e>"] = cmp.mapping { i = cmp.mapping.abort(), c = cmp.mapping.close() },
|
||||
["<CR>"] = cmp.mapping.confirm { select = false },
|
||||
["<C-e>"] = cmp.mapping({ i = cmp.mapping.abort(), c = cmp.mapping.close() }),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = false }),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
|
|
@ -92,12 +98,12 @@ M.opts = function()
|
|||
end
|
||||
end, { "i", "s" }),
|
||||
},
|
||||
sources = cmp.config.sources {
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp", priority = 1000 },
|
||||
{ name = "luasnip", priority = 750 },
|
||||
{ name = "buffer", priority = 500 },
|
||||
{ name = "path", priority = 250 },
|
||||
},
|
||||
}),
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
return {
|
||||
require('plugins.cmp.cmp'),
|
||||
require('plugins.cmp.dap'),
|
||||
require('plugins.cmp.luasnip'),
|
||||
require("plugins.cmp.cmp"),
|
||||
require("plugins.cmp.dap"),
|
||||
require("plugins.cmp.luasnip"),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,9 @@ M.opts = {
|
|||
|
||||
M.config = function(_, opts)
|
||||
require("luasnip").config.setup(opts)
|
||||
vim.tbl_map(function(type) require("luasnip.loaders.from_" .. type).lazy_load() end, { "vscode", "snipmate", "lua" })
|
||||
vim.tbl_map(function(type)
|
||||
require("luasnip.loaders.from_" .. type).lazy_load()
|
||||
end, { "vscode", "snipmate", "lua" })
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
|||
|
|
@ -7,10 +7,16 @@ M.opts = {
|
|||
}
|
||||
|
||||
M.config = function(_, opts)
|
||||
local dap, dapui = require "dap", require "dapui"
|
||||
dap.listeners.after.event_initialized["dapui_config"] = function() dapui.open() end
|
||||
dap.listeners.before.event_terminated["dapui_config"] = function() dapui.close() end
|
||||
dap.listeners.before.event_exited["dapui_config"] = function() dapui.close() end
|
||||
local dap, dapui = require("dap"), require("dapui")
|
||||
dap.listeners.after.event_initialized["dapui_config"] = function()
|
||||
dapui.open()
|
||||
end
|
||||
dap.listeners.before.event_terminated["dapui_config"] = function()
|
||||
dapui.close()
|
||||
end
|
||||
dap.listeners.before.event_exited["dapui_config"] = function()
|
||||
dapui.close()
|
||||
end
|
||||
dapui.setup(opts)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
return {
|
||||
require('plugins.dap.dap'),
|
||||
require('plugins.dap.dap-ui'),
|
||||
require('plugins.dap.mason-dap'),
|
||||
require("plugins.dap.dap"),
|
||||
require("plugins.dap.dap-ui"),
|
||||
require("plugins.dap.mason-dap"),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
local M = { "folke/lazy.nvim" }
|
||||
local icons = require('config.icons')
|
||||
local icons = require("config.icons")
|
||||
|
||||
M.opts = {
|
||||
dev = {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
return {
|
||||
{ "folke/neoconf.nvim", config = true },
|
||||
{ "folke/neodev.nvim", config = true },
|
||||
require('plugins.lsp.lspconfig'),
|
||||
require('plugins.lsp.mason'),
|
||||
require('plugins.lsp.mason-lspconfig'),
|
||||
require('plugins.lsp.mason-null-ls'),
|
||||
require('plugins.lsp.null-ls'),
|
||||
require('plugins.lsp.aerial'),
|
||||
require("plugins.lsp.lspconfig"),
|
||||
require("plugins.lsp.mason"),
|
||||
require("plugins.lsp.mason-lspconfig"),
|
||||
require("plugins.lsp.mason-null-ls"),
|
||||
require("plugins.lsp.null-ls"),
|
||||
require("plugins.lsp.aerial"),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ capabilities.textDocument.completion.completionItem.deprecatedSupport = true
|
|||
capabilities.textDocument.completion.completionItem.commitCharactersSupport = true
|
||||
capabilities.textDocument.completion.completionItem.tagSupport = { valueSet = { 1 } }
|
||||
capabilities.textDocument.completion.completionItem.resolveSupport = {
|
||||
properties = { "documentation", "detail", "additionalTextEdits" }
|
||||
properties = { "documentation", "detail", "additionalTextEdits" },
|
||||
}
|
||||
capabilities.textDocument.foldingRange = { dynamicRegistration = false, lineFoldingOnly = true }
|
||||
|
||||
|
|
@ -25,7 +25,6 @@ M.dependencies = { "mason.nvim", "neoconf.nvim", "neodev.nvim" }
|
|||
|
||||
M.cmd = { "LspInstall", "LspUninstall" }
|
||||
|
||||
|
||||
M.config = function()
|
||||
local icons = require("config.icons")
|
||||
local signs = {
|
||||
|
|
@ -68,12 +67,10 @@ M.config = function()
|
|||
})
|
||||
|
||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = "rounded", silent = true })
|
||||
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(
|
||||
vim.lsp.handlers.signature_help,
|
||||
{ border = "rounded", silent = true }
|
||||
)
|
||||
vim.lsp.handlers["textDocument/signatureHelp"] =
|
||||
vim.lsp.with(vim.lsp.handlers.signature_help, { border = "rounded", silent = true })
|
||||
|
||||
local mlsp = require('mason-lspconfig')
|
||||
local mlsp = require("mason-lspconfig")
|
||||
mlsp.setup({ ensure_installed = serverconf.required })
|
||||
|
||||
mlsp.setup_handlers({
|
||||
|
|
@ -84,7 +81,7 @@ M.config = function()
|
|||
local opts = merge(ls_opts, serverconf.handlers[server])
|
||||
require("lspconfig")[server].setup(opts)
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
local M = { "williamboman/mason.nvim" }
|
||||
|
||||
local icons = require('config.icons')
|
||||
local icons = require("config.icons")
|
||||
|
||||
M.cmd = {
|
||||
"Mason",
|
||||
|
|
|
|||
|
|
@ -117,16 +117,23 @@ M.opts = function()
|
|||
dashboard.section.buttons.val = {
|
||||
dashboard.button("n", icons.File .. " New file", "<Cmd>ene<CR>"),
|
||||
dashboard.button("f", icons.Search .. " Find file", "<Cmd>lua require('telescope.builtin').find_files()<CR>"),
|
||||
dashboard.button("e", icons.FileTree .. " Browse files", "<Cmd>lua require('taolf').start({ dir = 'gwd' })<CR>"),
|
||||
dashboard.button("t", icons.Task .. " Find todo",
|
||||
"<Cmd>:lua require('telescope').extensions['todo-comments'].todo()<CR>"),
|
||||
dashboard.button(
|
||||
"e",
|
||||
icons.FileTree .. " Browse files",
|
||||
"<Cmd>lua require('taolf').start({ dir = 'gwd' })<CR>"
|
||||
),
|
||||
dashboard.button(
|
||||
"t",
|
||||
icons.Task .. " Find todo",
|
||||
"<Cmd>:lua require('telescope').extensions['todo-comments'].todo()<CR>"
|
||||
),
|
||||
dashboard.button("q", icons.Leave .. " Quit", "<Cmd>qa<CR>"),
|
||||
}
|
||||
|
||||
dashboard.section.footer.val = "Behold: a Snail's Vim"
|
||||
|
||||
dashboard.config.layout = {
|
||||
{ type = "padding", val = vim.fn.max { 2, vim.fn.floor(vim.fn.winheight(0) * 0.2) } },
|
||||
{ type = "padding", val = vim.fn.max({ 2, vim.fn.floor(vim.fn.winheight(0) * 0.2) }) },
|
||||
dashboard.section.header,
|
||||
{ type = "padding", val = 5 },
|
||||
dashboard.section.buttons,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ local M = { "akinsho/bufferline.nvim" }
|
|||
M.event = { "BufReadPost", "BufNewFile" }
|
||||
|
||||
M.opts = function()
|
||||
local icons = require('config.icons')
|
||||
local icons = require("config.icons")
|
||||
|
||||
local function diagnostics_indicator(_, _, diagnostics, _)
|
||||
local result = {}
|
||||
|
|
@ -46,7 +46,7 @@ M.opts = function()
|
|||
offsets = {},
|
||||
show_buffer_close_icons = false,
|
||||
show_close_icon = false,
|
||||
separator_style = { '', '' },
|
||||
separator_style = { "", "" },
|
||||
move_wraps_at_ends = true,
|
||||
always_show_bufferline = false,
|
||||
sort_by = "id",
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ M.event = { "BufReadPost", "BufNewFile" }
|
|||
M.opts = {
|
||||
mappings = {
|
||||
basic = false,
|
||||
extra = false
|
||||
}
|
||||
extra = false,
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ local M = { "lewis6991/gitsigns.nvim" }
|
|||
|
||||
M.event = { "BufReadPost", "BufNewFile" }
|
||||
|
||||
local icons = require('config.icons')
|
||||
local icons = require("config.icons")
|
||||
|
||||
M.opts = {
|
||||
signs = {
|
||||
|
|
|
|||
|
|
@ -4,25 +4,25 @@ return {
|
|||
{ "zk-org/zk-nvim", opts = { picker = "telescope" }, main = "zk" },
|
||||
{ "NMAC427/guess-indent.nvim" },
|
||||
{ "JoosepAlviste/nvim-ts-context-commentstring" },
|
||||
require('plugins.misc.alpha'),
|
||||
require('plugins.misc.autopairs'),
|
||||
require('plugins.misc.bufferline'),
|
||||
require('plugins.misc.colorizer'),
|
||||
require('plugins.misc.comment'),
|
||||
require('plugins.misc.gitsigns'),
|
||||
require('plugins.misc.indent-blankline'),
|
||||
require('plugins.misc.taolf'),
|
||||
require('plugins.misc.lspkind'),
|
||||
require('plugins.misc.lualine'),
|
||||
require('plugins.misc.rustacean'),
|
||||
require('plugins.misc.surround'),
|
||||
require('plugins.misc.telescope'),
|
||||
require('plugins.misc.telescope-fzf-native'),
|
||||
require('plugins.misc.todo-comments'),
|
||||
require('plugins.misc.toggleterm'),
|
||||
require('plugins.misc.tokyonight'),
|
||||
require('plugins.misc.treesitter'),
|
||||
require('plugins.misc.ufo'),
|
||||
require('plugins.misc.vimtex'),
|
||||
require('plugins.misc.which-key'),
|
||||
require("plugins.misc.alpha"),
|
||||
require("plugins.misc.autopairs"),
|
||||
require("plugins.misc.bufferline"),
|
||||
require("plugins.misc.colorizer"),
|
||||
require("plugins.misc.comment"),
|
||||
require("plugins.misc.gitsigns"),
|
||||
require("plugins.misc.indent-blankline"),
|
||||
require("plugins.misc.taolf"),
|
||||
require("plugins.misc.lspkind"),
|
||||
require("plugins.misc.lualine"),
|
||||
require("plugins.misc.rustacean"),
|
||||
require("plugins.misc.surround"),
|
||||
require("plugins.misc.telescope"),
|
||||
require("plugins.misc.telescope-fzf-native"),
|
||||
require("plugins.misc.todo-comments"),
|
||||
require("plugins.misc.toggleterm"),
|
||||
require("plugins.misc.tokyonight"),
|
||||
require("plugins.misc.treesitter"),
|
||||
require("plugins.misc.ufo"),
|
||||
require("plugins.misc.vimtex"),
|
||||
require("plugins.misc.which-key"),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,46 +1,46 @@
|
|||
local M = { "nvim-lualine/lualine.nvim" }
|
||||
|
||||
M.opts = function()
|
||||
local colors = require('tokyonight.colors').setup({ transform = true })
|
||||
local icons = require('config.icons')
|
||||
local colors = require("tokyonight.colors").setup({ transform = true })
|
||||
local icons = require("config.icons")
|
||||
local conditions = {
|
||||
buffer_not_empty = function()
|
||||
return vim.fn.empty(vim.fn.expand('%:t')) ~= 1
|
||||
return vim.fn.empty(vim.fn.expand("%:t")) ~= 1
|
||||
end,
|
||||
hide_in_width = function()
|
||||
return vim.fn.winwidth(0) > 80
|
||||
end,
|
||||
check_git_workspace = function()
|
||||
local filepath = vim.fn.expand('%:p:h')
|
||||
local gitdir = vim.fn.finddir('.git', filepath .. ';')
|
||||
local filepath = vim.fn.expand("%:p:h")
|
||||
local gitdir = vim.fn.finddir(".git", filepath .. ";")
|
||||
return gitdir and #gitdir > 0 and #gitdir < #filepath
|
||||
end,
|
||||
}
|
||||
|
||||
local function search_result()
|
||||
if vim.v.hlsearch == 0 then
|
||||
return ''
|
||||
return ""
|
||||
end
|
||||
local last_search = vim.fn.getreg('/')
|
||||
if not last_search or last_search == '' then
|
||||
return ''
|
||||
local last_search = vim.fn.getreg("/")
|
||||
if not last_search or last_search == "" then
|
||||
return ""
|
||||
end
|
||||
local searchcount = vim.fn.searchcount { maxcount = 9999 }
|
||||
return last_search .. '(' .. searchcount.current .. '/' .. searchcount.total .. ')'
|
||||
local searchcount = vim.fn.searchcount({ maxcount = 9999 })
|
||||
return last_search .. "(" .. searchcount.current .. "/" .. searchcount.total .. ")"
|
||||
end
|
||||
|
||||
local config = {
|
||||
options = {
|
||||
component_separators = '',
|
||||
section_separators = '',
|
||||
component_separators = "",
|
||||
section_separators = "",
|
||||
-- theme = {
|
||||
-- normal = { c = { fg = colors.fg, bg = colors.bg } },
|
||||
-- inactive = { c = { fg = colors.fg, bg = colors.bg } },
|
||||
-- },
|
||||
disabled_filetypes = {
|
||||
statusline = { 'alpha' }
|
||||
statusline = { "alpha" },
|
||||
},
|
||||
ignore_focus = { 'toggleterm', 'NvimTree' },
|
||||
ignore_focus = { "toggleterm", "NvimTree" },
|
||||
globalstatus = true,
|
||||
},
|
||||
sections = {
|
||||
|
|
@ -58,7 +58,7 @@ M.opts = function()
|
|||
lualine_z = {},
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
local function ins_left(component)
|
||||
|
|
@ -88,53 +88,53 @@ M.opts = function()
|
|||
ce = colors.red,
|
||||
r = colors.cyan,
|
||||
rm = colors.cyan,
|
||||
['r?'] = colors.cyan,
|
||||
['!'] = colors.red,
|
||||
["r?"] = colors.cyan,
|
||||
["!"] = colors.red,
|
||||
t = colors.red,
|
||||
}
|
||||
return { fg = color[vim.fn.mode()] }
|
||||
end
|
||||
|
||||
ins_left {
|
||||
ins_left({
|
||||
function()
|
||||
return '▊'
|
||||
return "▊"
|
||||
end,
|
||||
color = function()
|
||||
return mode_color()
|
||||
end,
|
||||
padding = { right = 1 },
|
||||
}
|
||||
})
|
||||
|
||||
ins_left {
|
||||
'filename',
|
||||
ins_left({
|
||||
"filename",
|
||||
cond = conditions.buffer_not_empty,
|
||||
color = { fg = colors.magenta, gui = 'bold' },
|
||||
}
|
||||
color = { fg = colors.magenta, gui = "bold" },
|
||||
})
|
||||
|
||||
ins_left {
|
||||
'fileformat',
|
||||
ins_left({
|
||||
"fileformat",
|
||||
fmt = string.upper,
|
||||
icons_enabled = false,
|
||||
color = { fg = colors.green },
|
||||
}
|
||||
})
|
||||
|
||||
ins_left {
|
||||
'o:encoding',
|
||||
ins_left({
|
||||
"o:encoding",
|
||||
fmt = string.upper,
|
||||
cond = conditions.hide_in_width,
|
||||
color = { fg = colors.green },
|
||||
}
|
||||
})
|
||||
|
||||
ins_left {
|
||||
'filesize',
|
||||
ins_left({
|
||||
"filesize",
|
||||
fmt = string.upper,
|
||||
icons_enabled = false,
|
||||
color = { fg = colors.green },
|
||||
}
|
||||
})
|
||||
|
||||
ins_left {
|
||||
'%04l:%04c',
|
||||
}
|
||||
ins_left({
|
||||
"%04l:%04c",
|
||||
})
|
||||
|
||||
-- NOTE: My beloved :(
|
||||
|
||||
|
|
@ -150,19 +150,19 @@ M.opts = function()
|
|||
-- color = { fg = colors.yellow }
|
||||
-- }
|
||||
|
||||
ins_right {
|
||||
ins_right({
|
||||
search_result,
|
||||
color = { fg = colors.white },
|
||||
padding = { left = 1 },
|
||||
}
|
||||
})
|
||||
|
||||
ins_right {
|
||||
ins_right({
|
||||
function()
|
||||
local msg = ''
|
||||
local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype')
|
||||
local msg = ""
|
||||
local buf_ft = vim.api.nvim_buf_get_option(0, "filetype")
|
||||
local clients = vim.lsp.get_active_clients()
|
||||
if next(clients) == nil then
|
||||
return 'No LSP'
|
||||
return "No LSP"
|
||||
end
|
||||
for _, client in ipairs(clients) do
|
||||
local filetypes = client.config.filetypes
|
||||
|
|
@ -172,39 +172,39 @@ M.opts = function()
|
|||
end
|
||||
return msg:sub(3)
|
||||
end,
|
||||
color = { fg = colors.blue, gui = 'bold' },
|
||||
}
|
||||
color = { fg = colors.blue, gui = "bold" },
|
||||
})
|
||||
|
||||
ins_right {
|
||||
'diagnostics',
|
||||
sources = { 'nvim_diagnostic' },
|
||||
ins_right({
|
||||
"diagnostics",
|
||||
sources = { "nvim_diagnostic" },
|
||||
symbols = {
|
||||
error = icons.Error .. ' ',
|
||||
warn = icons.Warn .. ' ',
|
||||
info = icons.Info .. ' ',
|
||||
error = icons.Error .. " ",
|
||||
warn = icons.Warn .. " ",
|
||||
info = icons.Info .. " ",
|
||||
},
|
||||
diagnostics_color = {
|
||||
color_error = { fg = colors.red },
|
||||
color_warn = { fg = colors.yellow },
|
||||
color_info = { fg = colors.cyan },
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
ins_right {
|
||||
'filetype',
|
||||
color = { fg = colors.green, gui = 'bold' },
|
||||
ins_right({
|
||||
"filetype",
|
||||
color = { fg = colors.green, gui = "bold" },
|
||||
padding = { left = 1 },
|
||||
}
|
||||
})
|
||||
|
||||
ins_right {
|
||||
ins_right({
|
||||
function()
|
||||
return '▊'
|
||||
return "▊"
|
||||
end,
|
||||
color = function()
|
||||
return mode_color()
|
||||
end,
|
||||
padding = { left = 1 },
|
||||
}
|
||||
})
|
||||
|
||||
return config
|
||||
end
|
||||
|
|
|
|||
|
|
@ -12,10 +12,10 @@ M.init = function()
|
|||
vim.g.rustaceanvim = function()
|
||||
return {
|
||||
dap = {
|
||||
adapter = adapter
|
||||
adapter = adapter,
|
||||
},
|
||||
server = {
|
||||
on_attach = require("funcs").lsp_on_attach
|
||||
on_attach = require("funcs").lsp_on_attach,
|
||||
},
|
||||
}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
local M = { "folke/todo-comments.nvim" }
|
||||
local icons = require('config.icons')
|
||||
local icons = require("config.icons")
|
||||
|
||||
M.event = { "BufReadPost", "BufNewFile" }
|
||||
|
||||
|
|
|
|||
|
|
@ -25,8 +25,12 @@ M.opts = {
|
|||
float_opts = {
|
||||
border = "curved",
|
||||
winblend = 5,
|
||||
width = function() return math.ceil(math.min(vim.o.columns, math.max(80, vim.o.columns - 20))) end,
|
||||
height = function() return math.ceil(math.min(vim.o.lines, math.max(20, vim.o.lines - 10))) end,
|
||||
width = function()
|
||||
return math.ceil(math.min(vim.o.columns, math.max(80, vim.o.columns - 20)))
|
||||
end,
|
||||
height = function()
|
||||
return math.ceil(math.min(vim.o.lines, math.max(20, vim.o.lines - 10)))
|
||||
end,
|
||||
},
|
||||
on_create = function()
|
||||
vim.opt.foldcolumn = "0"
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@ local opts = {
|
|||
transparent = true,
|
||||
on_highlights = function(hl, _)
|
||||
hl.CurSearch = nil
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
M.config = function()
|
||||
require('tokyonight').setup(opts)
|
||||
require("tokyonight").setup(opts)
|
||||
vim.cmd("colorscheme tokyonight")
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ M.opts = {
|
|||
},
|
||||
provider_selector = function(_, filetype, buftype)
|
||||
local function handleFallbackException(bufnr, err, providerName)
|
||||
if type(err) == "string" and err:match "UfoFallbackException" then
|
||||
if type(err) == "string" and err:match("UfoFallbackException") then
|
||||
return require("ufo").getFolds(bufnr, providerName)
|
||||
else
|
||||
return require("promise").reject(err)
|
||||
|
|
@ -26,8 +26,12 @@ M.opts = {
|
|||
or function(bufnr)
|
||||
return require("ufo")
|
||||
.getFolds(bufnr, "lsp")
|
||||
:catch(function(err) return handleFallbackException(bufnr, err, "treesitter") end)
|
||||
:catch(function(err) return handleFallbackException(bufnr, err, "indent") end)
|
||||
:catch(function(err)
|
||||
return handleFallbackException(bufnr, err, "treesitter")
|
||||
end)
|
||||
:catch(function(err)
|
||||
return handleFallbackException(bufnr, err, "indent")
|
||||
end)
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ M.init = function()
|
|||
vim.g.tex_flavor = "latex"
|
||||
vim.g.vimtex_quickfix_mode = 0
|
||||
vim.o.conceallevel = 1
|
||||
vim.g.tex_conceal = 'abdmg'
|
||||
vim.g.tex_conceal = "abdmg"
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
local M = { "folke/which-key.nvim" }
|
||||
|
||||
local icons = require('config.icons')
|
||||
local icons = require("config.icons")
|
||||
|
||||
M.event = "VeryLazy"
|
||||
|
||||
|
|
@ -14,7 +14,7 @@ M.opts = {
|
|||
presets = {
|
||||
operators = false,
|
||||
motions = false,
|
||||
}
|
||||
},
|
||||
},
|
||||
icons = {
|
||||
breadcrumb = icons.Selected,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue