refactor(nvim): reformat with stylua

chezmoi
sgoudham 2 years ago
parent dcd88bf26c
commit 4c00a4bea6
Signed by: hammy
GPG Key ID: 44E818FD5457EEA4

@ -7,32 +7,32 @@ vim.g.loaded_netrwPlugin = 1
-- bootstrap & set up lazy -- bootstrap & set up lazy
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then if not vim.loop.fs_stat(lazypath) then
vim.fn.system({ vim.fn.system({
"git", "git",
"clone", "clone",
"--filter=blob:none", "--filter=blob:none",
"https://github.com/folke/lazy.nvim.git", "https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release "--branch=stable", -- latest stable release
lazypath, lazypath,
}) })
end end
vim.opt.rtp:prepend(lazypath) vim.opt.rtp:prepend(lazypath)
require("lazy").setup("plugins", { require("lazy").setup("plugins", {
install = { install = {
colorscheme = { "catppuccin" }, colorscheme = { "catppuccin" },
missing = true, missing = true,
}, },
change_detection = { change_detection = {
enabled = true, enabled = true,
notify = false, notify = false,
}, },
ui = { ui = {
border = "rounded", border = "rounded",
icons = { icons = {
list = { "" }, list = { "" },
},
}, },
},
}) })
-- load remaining config -- load remaining config
@ -42,29 +42,29 @@ require("binds")
-- highlight yank -- highlight yank
vim.api.nvim_create_augroup("highlight_yank", {}) vim.api.nvim_create_augroup("highlight_yank", {})
vim.api.nvim_create_autocmd({ "TextYankPost" }, { vim.api.nvim_create_autocmd({ "TextYankPost" }, {
group = "highlight_yank", group = "highlight_yank",
pattern = { "*" }, pattern = { "*" },
callback = function() callback = function()
vim.highlight.on_yank({ vim.highlight.on_yank({
higroup = "Visual", higroup = "Visual",
timeout = 150, timeout = 150,
}) })
end, end,
}) })
-- Disable semantic highlights -- Disable semantic highlights
vim.api.nvim_create_autocmd("LspAttach", { vim.api.nvim_create_autocmd("LspAttach", {
callback = function(args) callback = function(args)
local client = vim.lsp.get_client_by_id(args.data.client_id) local client = vim.lsp.get_client_by_id(args.data.client_id)
client.server_capabilities.semanticTokensProvider = nil client.server_capabilities.semanticTokensProvider = nil
end, end,
}) })
-- Stop comments on new lines when pressing 'o' -- Stop comments on new lines when pressing 'o'
vim.api.nvim_create_augroup("stop_comments_on_o", {}) vim.api.nvim_create_augroup("stop_comments_on_o", {})
vim.api.nvim_create_autocmd("BufEnter", { vim.api.nvim_create_autocmd("BufEnter", {
group = "stop_comments_on_o", group = "stop_comments_on_o",
callback = function(_) callback = function(_)
vim.opt.formatoptions:remove("o") vim.opt.formatoptions:remove("o")
end, end,
}) })

@ -4,55 +4,55 @@ local wk = require("which-key")
-- https://github.com/wez/wezterm/discussions/2426 -- https://github.com/wez/wezterm/discussions/2426
-- https://github.com/neovim/neovim/issues/2252 -- https://github.com/neovim/neovim/issues/2252
wk.register({ wk.register({
["<A-N>"] = { "<cmd>lua io.popen('wezterm cli split-pane --right --cwd .')<cr>", "All my homies hate OSC 7" }, ["<A-N>"] = { "<cmd>lua io.popen('wezterm cli split-pane --right --cwd .')<cr>", "All my homies hate OSC 7" },
["<A-M>"] = { "<cmd>lua io.popen('wezterm cli split-pane --bottom --cwd .')<cr>", "All my homies hate OSC 7" }, ["<A-M>"] = { "<cmd>lua io.popen('wezterm cli split-pane --bottom --cwd .')<cr>", "All my homies hate OSC 7" },
}, { mode = { "n", "i", "v", "t" } }) }, { mode = { "n", "i", "v", "t" } })
-- normal binds -- normal binds
wk.register({ wk.register({
["0"] = { "0^", "Start of Line" }, ["0"] = { "0^", "Start of Line" },
["<CR>"] = { "o<ESC>", "New Line Without Insert" }, ["<CR>"] = { "o<ESC>", "New Line Without Insert" },
["<C-s>"] = { "<cmd>write<cr>", "Save" }, ["<C-s>"] = { "<cmd>write<cr>", "Save" },
["<C-d>"] = { "<C-d>zz", "Half page down" }, ["<C-d>"] = { "<C-d>zz", "Half page down" },
["<C-u>"] = { "<C-u>zz", "Half page up" }, ["<C-u>"] = { "<C-u>zz", "Half page up" },
n = { "nzzzv", "Next result (centered)" }, n = { "nzzzv", "Next result (centered)" },
N = { "Nzzzv", "Previous result (centered)" }, N = { "Nzzzv", "Previous result (centered)" },
J = { "mzJ`z", "Join lines (stable)" }, J = { "mzJ`z", "Join lines (stable)" },
}) })
-- visual binds -- visual binds
wk.register({ wk.register({
J = { ":m '>+1<CR>gv=gv", "Move line down" }, J = { ":m '>+1<CR>gv=gv", "Move line down" },
K = { ":m '<-2<CR>gv=gv", "Move line up" }, K = { ":m '<-2<CR>gv=gv", "Move line up" },
}, { mode = "v" }) }, { mode = "v" })
-- terminal binds -- terminal binds
wk.register({ wk.register({
["<A-Esc>"] = { [[<C-\><C-n>]], "Normal mode" }, ["<A-Esc>"] = { [[<C-\><C-n>]], "Normal mode" },
}, { mode = "t" }) }, { mode = "t" })
-- normal + terminal binds -- normal + terminal binds
wk.register({ wk.register({
["<A-h>"] = { "<cmd>wincmd h<cr>", "Go to the left window" }, ["<A-h>"] = { "<cmd>wincmd h<cr>", "Go to the left window" },
["<A-j>"] = { "<cmd>wincmd j<cr>", "Go to the down window" }, ["<A-j>"] = { "<cmd>wincmd j<cr>", "Go to the down window" },
["<A-k>"] = { "<cmd>wincmd k<cr>", "Go to the up window" }, ["<A-k>"] = { "<cmd>wincmd k<cr>", "Go to the up window" },
["<A-l>"] = { "<cmd>wincmd l<cr>", "Go to the right window" }, ["<A-l>"] = { "<cmd>wincmd l<cr>", "Go to the right window" },
}, { mode = { "n", "t" } }) }, { mode = { "n", "t" } })
-- leader binds -- leader binds
wk.register({ wk.register({
p = { [["+p]], "Put from clipboard" }, p = { [["+p]], "Put from clipboard" },
w = { [[:w<CR>]], "Quick Save" }, w = { [[:w<CR>]], "Quick Save" },
q = { [[:q<CR>]], "Quick Exit" }, q = { [[:q<CR>]], "Quick Exit" },
}, { prefix = "<leader>" }) }, { prefix = "<leader>" })
-- nv leader binds -- nv leader binds
wk.register({ wk.register({
d = { [["_d]], "Delete w/o yank" }, d = { [["_d]], "Delete w/o yank" },
y = { [["+y]], "Yank to clipboard" }, y = { [["+y]], "Yank to clipboard" },
}, { prefix = "<leader>", mode = { "n", "v" } }) }, { prefix = "<leader>", mode = { "n", "v" } })
-- x leader binds -- x leader binds
wk.register({ wk.register({
p = { [["_dP"]], "Put w/o yank" }, p = { [["_dP"]], "Put w/o yank" },
}, { prefix = "<leader>", mode = "x" }) }, { prefix = "<leader>", mode = "x" })

@ -1,3 +1,3 @@
return { return {
{ "superhawk610/ascii-blocks.nvim", cmd = "AsciiBlockify" }, { "superhawk610/ascii-blocks.nvim", cmd = "AsciiBlockify" },
} }

@ -1,3 +1,3 @@
return { return {
{ "cloudysake/asciitree.nvim", cmd = "AsciiTree" }, { "cloudysake/asciitree.nvim", cmd = "AsciiTree" },
} }

@ -1,16 +1,13 @@
return { return {
{ {
"windwp/nvim-autopairs", "windwp/nvim-autopairs",
config = function() config = function()
require("nvim-autopairs").setup({ require("nvim-autopairs").setup({
disable_in_macro = true, disable_in_macro = true,
}) })
local cmp_autopairs = require('nvim-autopairs.completion.cmp') local cmp_autopairs = require("nvim-autopairs.completion.cmp")
local cmp = require('cmp') local cmp = require("cmp")
cmp.event:on( cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
'confirm_done', end,
cmp_autopairs.on_confirm_done() },
)
end,
},
} }

@ -1,59 +1,59 @@
return { return {
{ {
"catppuccin/nvim", "catppuccin/nvim",
name = "catppuccin", name = "catppuccin",
lazy = false, lazy = false,
priority = 1000, priority = 1000,
config = function() config = function()
local cp = require("catppuccin.palettes").get_palette() local cp = require("catppuccin.palettes").get_palette()
require("catppuccin").setup({ require("catppuccin").setup({
flavour = "mocha", flavour = "mocha",
transparent_background = true, transparent_background = true,
term_colors = true, term_colors = true,
no_italic = true, no_italic = true,
integrations = { integrations = {
mason = true, mason = true,
native_lsp = { enabled = true }, native_lsp = { enabled = true },
navic = { navic = {
enabled = true, enabled = true,
custom_bg = "NONE", custom_bg = "NONE",
}, },
noice = true, noice = true,
notify = true, notify = true,
dap = { dap = {
enabled = true, enabled = true,
enable_ui = true, enable_ui = true,
}, },
cmp = true, cmp = true,
treesitter = true, treesitter = true,
overseer = true, overseer = true,
telescope = true, telescope = true,
which_key = true, which_key = true,
}, },
color_overrides = { color_overrides = {
mocha = { mocha = {
base = "#000000", base = "#000000",
mantle = "#000000", mantle = "#000000",
surface2 = cp.subtext0, surface2 = cp.subtext0,
overlay0 = cp.subtext0, overlay0 = cp.subtext0,
}, },
}, },
custom_highlights = { custom_highlights = {
ErrorMsg = { fg = cp.red, style = { "bold" } }, ErrorMsg = { fg = cp.red, style = { "bold" } },
LspInfoBorder = { link = "FloatBorder" }, LspInfoBorder = { link = "FloatBorder" },
PmenuSel = { bg = cp.surface0 }, PmenuSel = { bg = cp.surface0 },
FloatBorder = { fg = cp.overlay0, bg = "NONE" }, FloatBorder = { fg = cp.overlay0, bg = "NONE" },
TelescopeBorder = { link = "FloatBorder" }, TelescopeBorder = { link = "FloatBorder" },
TelescopeMatching = { link = "TelescopeNormal" }, TelescopeMatching = { link = "TelescopeNormal" },
TelescopeSelection = { fg = "NONE", bg = cp.surface0 }, TelescopeSelection = { fg = "NONE", bg = cp.surface0 },
TelescopeTitle = { fg = cp.subtext0 }, TelescopeTitle = { fg = cp.subtext0 },
QuickScopePrimary = { fg = cp.maroon }, QuickScopePrimary = { fg = cp.red },
QuickScopeSecondary = { fg = cp.peach }, QuickScopeSecondary = { fg = cp.peach },
-- MiniIndentscopeSymbol = { fg = cp.blue }, -- MiniIndentscopeSymbol = { fg = cp.blue },
}, },
}) })
vim.cmd.colorscheme("catppuccin") vim.cmd.colorscheme("catppuccin")
end, end,
}, },
} }

@ -1,3 +1,3 @@
return { return {
{ "uga-rosa/ccc.nvim", config = { highlighter = { auto_enable = true } } }, { "uga-rosa/ccc.nvim", config = { highlighter = { auto_enable = true } } },
} }

@ -1,110 +1,110 @@
local has_words_before = function() local has_words_before = function()
local line, col = unpack(vim.api.nvim_win_get_cursor(0)) local line, col = 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 end
return { return {
{ {
"hrsh7th/nvim-cmp", "hrsh7th/nvim-cmp",
config = function() config = function()
local cmp = require("cmp") local cmp = require("cmp")
local cmp_under_comparator = require("cmp-under-comparator") local cmp_under_comparator = require("cmp-under-comparator")
local lspkind = require("lspkind") local lspkind = require("lspkind")
local luasnip = require("luasnip") local luasnip = require("luasnip")
cmp.setup({ cmp.setup({
snippet = { snippet = {
expand = function(args) expand = function(args)
luasnip.lsp_expand(args.body) luasnip.lsp_expand(args.body)
end, end,
}, },
window = { window = {
completion = cmp.config.window.bordered(), completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(), documentation = cmp.config.window.bordered(),
}, },
mapping = cmp.mapping.preset.insert({ mapping = cmp.mapping.preset.insert({
["<A-k>"] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }), ["<A-k>"] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }),
["<A-j>"] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "c" }), ["<A-j>"] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "c" }),
["<A-p>"] = cmp.mapping.scroll_docs(-4), ["<A-p>"] = cmp.mapping.scroll_docs(-4),
["<A-n>"] = cmp.mapping.scroll_docs(4), ["<A-n>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete({}), ["<C-Space>"] = cmp.mapping.complete({}),
["<C-e>"] = cmp.mapping.abort(), ["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = true }), ["<CR>"] = cmp.mapping.confirm({ select = true }),
["<Tab>"] = cmp.mapping(function(fallback) ["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.select_next_item() cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump() luasnip.expand_or_jump()
elseif has_words_before() then elseif has_words_before() then
cmp.complete() cmp.complete()
else else
fallback() fallback()
end end
end, { "i", "s" }), end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "luasnip" },
}, {
{ name = "buffer" },
{ name = "path" },
}),
sorting = {
comparators = {
cmp.config.compare.offset,
cmp.config.compare.exact,
cmp.config.compare.score,
cmp_under_comparator.under,
cmp.config.compare.kind,
cmp.config.compare.sort_text,
cmp.config.compare.length,
cmp.config.compare.order,
},
},
formatting = {
format = lspkind.cmp_format({
mode = "symbol",
maxwidth = 30,
ellipsis_char = "",
}),
},
})
cmp.setup.cmdline({ "/", "?" }, { ["<S-Tab>"] = cmp.mapping(function(fallback)
mapping = cmp.mapping.preset.cmdline(), if cmp.visible() then
sources = { cmp.select_prev_item()
{ name = "buffer" }, elseif luasnip.jumpable(-1) then
}, luasnip.jump(-1)
}) else
fallback()
end
end, { "i", "s" }),
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "luasnip" },
}, {
{ name = "buffer" },
{ name = "path" },
}),
sorting = {
comparators = {
cmp.config.compare.offset,
cmp.config.compare.exact,
cmp.config.compare.score,
cmp_under_comparator.under,
cmp.config.compare.kind,
cmp.config.compare.sort_text,
cmp.config.compare.length,
cmp.config.compare.order,
},
},
formatting = {
format = lspkind.cmp_format({
mode = "symbol",
maxwidth = 30,
ellipsis_char = "",
}),
},
})
cmp.setup.cmdline(":", { cmp.setup.cmdline({ "/", "?" }, {
mapping = cmp.mapping.preset.cmdline(), mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({ sources = {
{ name = "path" }, { name = "buffer" },
}, {
{ name = "cmdline" },
}),
})
end,
dependencies = {
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-nvim-lua",
"hrsh7th/cmp-cmdline",
"saadparwaiz1/cmp_luasnip",
"L3MON4D3/LuaSnip",
"lukas-reineke/cmp-under-comparator",
}, },
})
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "path" },
}, {
{ name = "cmdline" },
}),
})
end,
dependencies = {
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-nvim-lua",
"hrsh7th/cmp-cmdline",
"saadparwaiz1/cmp_luasnip",
"L3MON4D3/LuaSnip",
"lukas-reineke/cmp-under-comparator",
}, },
},
} }

@ -1,7 +1,7 @@
return { return {
{ {
"andythigpen/nvim-coverage", "andythigpen/nvim-coverage",
config = true, config = true,
dependencies = { "nvim-lua/plenary.nvim" }, dependencies = { "nvim-lua/plenary.nvim" },
}, },
} }

@ -1,90 +1,90 @@
local get_python_path = function() local get_python_path = function()
for _, client in pairs(vim.lsp.buf_get_clients()) do for _, client in pairs(vim.lsp.buf_get_clients()) do
if client.name == "pyright" then if client.name == "pyright" then
local path = client.config.settings.python.pythonPath local path = client.config.settings.python.pythonPath
if path ~= nil then if path ~= nil then
return path return path
else else
return "python" return "python"
end end
end
end end
end
end end
return { return {
{ {
"jayp0521/mason-nvim-dap.nvim", "jayp0521/mason-nvim-dap.nvim",
config = function() config = function()
local dap = require("dap") local dap = require("dap")
local mason_dap = require("mason-nvim-dap") local mason_dap = require("mason-nvim-dap")
mason_dap.setup({ mason_dap.setup({
ensure_installed = { "python", "codelldb" }, ensure_installed = { "python", "codelldb" },
automatic_setup = true, automatic_setup = true,
}) })
mason_dap.setup_handlers({ mason_dap.setup_handlers({
-- default handler -- default handler
function(source) function(source)
require("mason-nvim-dap.automatic_setup")(source) require("mason-nvim-dap.automatic_setup")(source)
end, end,
-- custom handlers
python = function(_)
dap.adapters.python = {
type = "executable",
command = "debugpy-adapter",
}
dap.configurations.python = {
{
name = "Launch current file",
type = "python",
request = "launch",
program = "${file}",
pythonPath = get_python_path,
},
{
name = "Launch pytest",
type = "python",
request = "launch",
module = "pytest",
pythonPath = get_python_path,
},
}
end,
})
-- apply suggestions from catppuccin theme -- custom handlers
local sign = vim.fn.sign_define python = function(_)
dap.adapters.python = {
type = "executable",
command = "debugpy-adapter",
}
sign("DapBreakpoint", { text = "", texthl = "DapBreakpoint", linehl = "", numhl = "" }) dap.configurations.python = {
sign("DapBreakpointCondition", { text = "", texthl = "DapBreakpointCondition", linehl = "", numhl = "" })
sign("DapLogPoint", { text = "", texthl = "DapLogPoint", linehl = "", numhl = "" })
end,
keys = {
{
"<leader>db",
vim.cmd.DapToggleBreakpoint,
desc = "Toggle breakpoint",
},
{ {
"<leader>du", name = "Launch current file",
function() type = "python",
require("dapui").toggle({}) request = "launch",
end, program = "${file}",
desc = "Toggle UI", pythonPath = get_python_path,
}, },
{ {
"<leader>dx", name = "Launch pytest",
vim.cmd.DapContinue, type = "python",
desc = "Start / Continue", request = "launch",
module = "pytest",
pythonPath = get_python_path,
}, },
}, }
dependencies = { end,
"williamboman/mason.nvim", })
"mfussenegger/nvim-dap",
{ "rcarriga/nvim-dap-ui", config = true }, -- apply suggestions from catppuccin theme
{ "theHamsta/nvim-dap-virtual-text", config = true }, local sign = vim.fn.sign_define
},
sign("DapBreakpoint", { text = "", texthl = "DapBreakpoint", linehl = "", numhl = "" })
sign("DapBreakpointCondition", { text = "", texthl = "DapBreakpointCondition", linehl = "", numhl = "" })
sign("DapLogPoint", { text = "", texthl = "DapLogPoint", linehl = "", numhl = "" })
end,
keys = {
{
"<leader>db",
vim.cmd.DapToggleBreakpoint,
desc = "Toggle breakpoint",
},
{
"<leader>du",
function()
require("dapui").toggle({})
end,
desc = "Toggle UI",
},
{
"<leader>dx",
vim.cmd.DapContinue,
desc = "Start / Continue",
},
},
dependencies = {
"williamboman/mason.nvim",
"mfussenegger/nvim-dap",
{ "rcarriga/nvim-dap-ui", config = true },
{ "theHamsta/nvim-dap-virtual-text", config = true },
}, },
},
} }

@ -1,9 +1,9 @@
return { return {
{ {
"ja-ford/delaytrain.nvim", "ja-ford/delaytrain.nvim",
config = { config = {
grace_period = 3, grace_period = 3,
ignore_filetypes = { "help", "NvimTr*", "lazy", "mason" }, ignore_filetypes = { "help", "NvimTr*", "lazy", "mason" },
},
}, },
},
} }

@ -1,27 +1,27 @@
return { return {
{ {
"feline-nvim/feline.nvim", "feline-nvim/feline.nvim",
config = function() config = function()
local feline = require("feline") local feline = require("feline")
local ctp_feline = require("catppuccin.groups.integrations.feline") local ctp_feline = require("catppuccin.groups.integrations.feline")
feline.setup({ feline.setup({
components = ctp_feline.get(), components = ctp_feline.get(),
force_inactive = { force_inactive = {
filetypes = { filetypes = {
-- "^NvimTree$", -- "^NvimTree$",
"^packer$", "^packer$",
"^startify$", "^startify$",
"^fugitive$", "^fugitive$",
"^fugitiveblame$", "^fugitiveblame$",
"^qf$", "^qf$",
"^help$", "^help$",
}, },
}, },
}) })
-- catppuccin statusline -- catppuccin statusline
ctp_feline.setup({}) ctp_feline.setup({})
end, end,
dependencies = { "nvim-tree/nvim-web-devicons" }, dependencies = { "nvim-tree/nvim-web-devicons" },
}, },
} }

@ -1,8 +1,8 @@
-- misc plugins -- misc plugins
return { return {
{ "kana/vim-textobj-entire", dependencies = { "kana/vim-textobj-user" } }, { "kana/vim-textobj-entire", dependencies = { "kana/vim-textobj-user" } },
"kevinhwang91/nvim-bqf", "kevinhwang91/nvim-bqf",
"stevearc/dressing.nvim", "stevearc/dressing.nvim",
"mong8se/actually.nvim", "mong8se/actually.nvim",
"andweeb/presence.nvim", "andweeb/presence.nvim",
} }

@ -1,188 +1,196 @@
local signs = { Error = "", Warn = "", Hint = "", Info = "" } local signs = { Error = "", Warn = "", Hint = "", Info = "" }
for type, icon in pairs(signs) do for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
end end
vim.diagnostic.config({ vim.diagnostic.config({
float = { border = "rounded" }, float = { border = "rounded" },
update_in_insert = true, update_in_insert = true,
}) })
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = "rounded" }) vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = "rounded" })
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = "rounded" }) vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = "rounded" })
local default_config = { local default_config = {
on_attach = function(client, bufnr) on_attach = function(client, bufnr)
require("lsp-format").on_attach(client) require("lsp-format").on_attach(client)
-- add lsp-only keybinds -- add lsp-only keybinds
local map = function(sequence, cmd, desc) local map = function(sequence, cmd, desc)
vim.keymap.set("n", sequence, cmd, { buffer = bufnr, desc = desc }) vim.keymap.set("n", sequence, cmd, { buffer = bufnr, desc = desc })
end end
map("gd", function() map("K", vim.lsp.buf.hover, "Hover")
require("telescope.builtin").lsp_definitions() map("]d", vim.diagnostic.goto_next, "Next diagnostic")
end, "LSP Definitions") map("[d", vim.diagnostic.goto_prev, "Previous diagnostic")
map("gr", function()
require("telescope.builtin").lsp_references()
end, "LSP References")
map("gI", function()
require("telescope.builtin").lsp_implementations()
end, "LSP Implementations")
map("K", vim.lsp.buf.hover, "Hover")
map("]d", vim.diagnostic.goto_next, "Next diagnostic")
map("[d", vim.diagnostic.goto_prev, "Previous diagnostic")
map("<leader>la", vim.lsp.buf.code_action, "Code Action") map("gs", vim.lsp.buf.signature_help, "LSP Signature Help")
map("<leader>lr", vim.lsp.buf.rename, "Rename") map("gD", vim.lsp.buf.declaration, "LSP Declarations")
map("<leader>lf", vim.lsp.buf.format, "Format") map("gd", function()
map("<leader>li", "<cmd>LspInfo<cr>", "LSP Info") require("telescope.builtin").lsp_definitions()
map("<leader>lI", "<cmd>Mason<cr>", "Mason Info") end, "LSP Definitions")
map("<leader>lw", function() map("gr", function()
require("telescope.builtin").diagnostics() require("telescope.builtin").lsp_references()
end, "LSP Workplace Diagnostics") end, "LSP References")
map("<leader>ld", function() map("gI", function()
require("telescope.builtin").diagnostics({ bufnr = 0 }) require("telescope.builtin").lsp_implementations()
end, "LSP Buffer Diagnostics") end, "LSP Implementations")
map("<leader>ls", function() map("gl", function()
require("telescope.builtin").lsp_document_symbols() vim.diagnostic.open_float(0, {
end, "LSP Document Symbols") scope = "line",
map("<leader>lS", function() })
require("telescope.builtin").lsp_workspace_symbols() end)
end, "LSP Workplace Symbols")
end, map("<leader>la", vim.lsp.buf.code_action, "Code Action")
map("<leader>lr", vim.lsp.buf.rename, "Rename")
map("<leader>lf", vim.lsp.buf.format, "Format")
map("<leader>li", "<cmd>LspInfo<cr>", "LSP Info")
map("<leader>lI", "<cmd>Mason<cr>", "Mason Info")
map("<leader>lw", function()
require("telescope.builtin").diagnostics()
end, "LSP Workplace Diagnostics")
map("<leader>ld", function()
require("telescope.builtin").diagnostics({ bufnr = 0 })
end, "LSP Buffer Diagnostics")
map("<leader>ls", function()
require("telescope.builtin").lsp_document_symbols()
end, "LSP Document Symbols")
map("<leader>lS", function()
require("telescope.builtin").lsp_workspace_symbols()
end, "LSP Workplace Symbols")
end,
} }
local custom_config = function(config) local custom_config = function(config)
local merged_config = vim.deepcopy(default_config) local merged_config = vim.deepcopy(default_config)
merged_config = vim.tbl_extend("force", merged_config, config) merged_config = vim.tbl_extend("force", merged_config, config)
return merged_config return merged_config
end end
return { return {
{ {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
config = function()
require("lspconfig.ui.windows").default_options.border = "rounded"
end,
dependencies = {
{
"williamboman/mason-lspconfig.nvim",
config = function() config = function()
require("lspconfig.ui.windows").default_options.border = "rounded" require("mason-lspconfig").setup({
end, ensure_installed = { "rust_analyzer", "pyright", "sumneko_lua" },
dependencies = { })
{ require("mason-lspconfig").setup_handlers({
"williamboman/mason-lspconfig.nvim", -- default handler
config = function() function(server_name)
require("mason-lspconfig").setup({ require("lspconfig")[server_name].setup(default_config)
ensure_installed = { "rust_analyzer", "pyright", "sumneko_lua" }, end,
}) ["rust_analyzer"] = function()
require("mason-lspconfig").setup_handlers({ -- https://github.com/simrat39/rust-tools.nvim/issues/300
-- default handler local config = custom_config({
function(server_name) settings = {
require("lspconfig")[server_name].setup(default_config) ["rust-analyzer"] = {
end, inlayHints = { locationLinks = false },
["rust_analyzer"] = function() },
-- https://github.com/simrat39/rust-tools.nvim/issues/300
local config = custom_config({
settings = {
["rust-analyzer"] = {
inlayHints = { locationLinks = false },
},
},
})
require("rust-tools").setup({
server = config,
dap = {
adapter = {
type = "server",
port = "${port}",
host = "127.0.0.1",
executable = {
command = "codelldb",
args = { "--port", "${port}" },
},
},
},
})
end,
["pyright"] = function()
require("py_lsp").setup(default_config)
end,
["hls"] = function()
local ht = require("haskell-tools")
local def_opts = { noremap = true, silent = true }
ht.setup({
hls = {
on_attach = function(client, bufnr)
local opts = vim.tbl_extend("keep", def_opts, { buffer = bufnr })
-- haskell-language-server relies heavily on codeLenses,
-- so auto-refresh (see advanced configuration) is enabled by default
-- vim.keymap.set("n", "<space>ca", vim.lsp.codelens.run, opts)
-- vim.keymap.set("n", "<space>hs", ht.hoogle.hoogle_signature, opts)
end,
},
})
-- Suggested keymaps that do not depend on haskell-language-server
-- Toggle a GHCi repl for the current package
vim.keymap.set("n", "<leader>rr", ht.repl.toggle, def_opts)
-- Toggle a GHCi repl for the current buffer
vim.keymap.set("n", "<leader>rf", function()
ht.repl.toggle(vim.api.nvim_buf_get_name(0))
end, def_opts)
vim.keymap.set("n", "<leader>rq", ht.repl.quit, def_opts)
end,
["sumneko_lua"] = function()
require("lspconfig")["sumneko_lua"].setup(custom_config({
settings = {
Lua = {
format = {
enable = false,
},
workspace = {
checkThirdParty = false,
},
telemetry = {
enable = false,
},
},
},
}))
end,
})
end,
dependencies = {
"williamboman/mason.nvim",
{ "folke/neodev.nvim", config = true },
}, },
}, })
"simrat39/rust-tools.nvim", require("rust-tools").setup({
"mrcjkb/haskell-tools.nvim", server = config,
"HallerPatrick/py_lsp.nvim", dap = {
{ "SmiteshP/nvim-navic", config = { highlight = true } }, adapter = {
"onsails/lspkind.nvim", type = "server",
{ "lukas-reineke/lsp-format.nvim", config = true }, port = "${port}",
"folke/neodev.nvim", host = "127.0.0.1",
"ray-x/lsp_signature.nvim", executable = {
}, command = "codelldb",
}, args = { "--port", "${port}" },
{ },
"jose-elias-alvarez/null-ls.nvim", },
config = function() },
local null_ls = require("null-ls") })
null_ls.setup({ end,
sources = { ["pyright"] = function()
null_ls.builtins.formatting.stylua.with({ require("py_lsp").setup(default_config)
extra_args = { "--indent-type", "spaces" }, end,
}), ["hls"] = function()
-- null_ls.builtins.formatting.black, local ht = require("haskell-tools")
-- null_ls.builtins.formatting.isort.with({ local def_opts = { noremap = true, silent = true }
-- extra_args = { "--profile", "black" }, ht.setup({
-- }), hls = {
on_attach = function(client, bufnr)
local opts = vim.tbl_extend("keep", def_opts, { buffer = bufnr })
-- haskell-language-server relies heavily on codeLenses,
-- so auto-refresh (see advanced configuration) is enabled by default
-- vim.keymap.set("n", "<space>ca", vim.lsp.codelens.run, opts)
-- vim.keymap.set("n", "<space>hs", ht.hoogle.hoogle_signature, opts)
end,
},
})
-- Suggested keymaps that do not depend on haskell-language-server
-- Toggle a GHCi repl for the current package
vim.keymap.set("n", "<leader>rr", ht.repl.toggle, def_opts)
-- Toggle a GHCi repl for the current buffer
vim.keymap.set("n", "<leader>rf", function()
ht.repl.toggle(vim.api.nvim_buf_get_name(0))
end, def_opts)
vim.keymap.set("n", "<leader>rq", ht.repl.quit, def_opts)
end,
["sumneko_lua"] = function()
require("lspconfig")["sumneko_lua"].setup(custom_config({
settings = {
Lua = {
format = {
enable = false,
},
workspace = {
checkThirdParty = false,
},
telemetry = {
enable = false,
},
},
}, },
}) }))
end,
})
end, end,
dependencies = { "nvim-lua/plenary.nvim" }, dependencies = {
"williamboman/mason.nvim",
{ "folke/neodev.nvim", config = true },
},
},
"simrat39/rust-tools.nvim",
"mrcjkb/haskell-tools.nvim",
"HallerPatrick/py_lsp.nvim",
{ "SmiteshP/nvim-navic", config = { highlight = true } },
"onsails/lspkind.nvim",
{ "lukas-reineke/lsp-format.nvim", config = true },
"folke/neodev.nvim",
"ray-x/lsp_signature.nvim",
}, },
{ },
"jay-babu/mason-null-ls.nvim", {
config = { "jose-elias-alvarez/null-ls.nvim",
ensure_installed = { "stylua" }, config = function()
local null_ls = require("null-ls")
null_ls.setup({
sources = {
null_ls.builtins.formatting.stylua.with({
extra_args = { "--indent-type", "spaces" },
}),
-- null_ls.builtins.formatting.black,
-- null_ls.builtins.formatting.isort.with({
-- extra_args = { "--profile", "black" },
-- }),
}, },
})
end,
dependencies = { "nvim-lua/plenary.nvim" },
},
{
"jay-babu/mason-null-ls.nvim",
config = {
ensure_installed = { "stylua" },
}, },
},
} }

@ -1,8 +1,8 @@
return { return {
{ {
"williamboman/mason.nvim", "williamboman/mason.nvim",
config = { config = {
ui = { border = "rounded" }, ui = { border = "rounded" },
},
}, },
},
} }

@ -1,22 +1,22 @@
return { return {
{ {
"echasnovski/mini.nvim", "echasnovski/mini.nvim",
config = function() config = function()
-- add gc/gcc actions, gc textobject -- add gc/gcc actions, gc textobject
require("mini.comment").setup({}) require("mini.comment").setup({})
-- autochange dir -- autochange dir
-- require("mini.misc").setup({}) -- require("mini.misc").setup({})
-- MiniMisc.setup_auto_root() -- MiniMisc.setup_auto_root()
-- highlight word under cursor -- highlight word under cursor
require("mini.cursorword").setup({ delay = 0 }) require("mini.cursorword").setup({ delay = 0 })
-- indent lines, `i` textobject, `]i`/`[i` motions -- indent lines, `i` textobject, `]i`/`[i` motions
require("mini.indentscope").setup({ require("mini.indentscope").setup({
draw = { delay = 0 }, draw = { delay = 0 },
symbol = "", symbol = "",
}) })
end, end,
}, },
} }

@ -1,35 +1,35 @@
return { return {
-- disabled until https://github.com/folke/noice.nvim/issues/298 is fixed -- disabled until https://github.com/folke/noice.nvim/issues/298 is fixed
-- { -- {
-- "folke/noice.nvim", -- "folke/noice.nvim",
-- config = { -- config = {
-- lsp = { -- lsp = {
-- progress = { enabled = false }, -- progress = { enabled = false },
-- --
-- -- override markdown rendering so that **cmp** and other plugins use **Treesitter** -- -- override markdown rendering so that **cmp** and other plugins use **Treesitter**
-- override = { -- override = {
-- ["vim.lsp.util.convert_input_to_markdown_lines"] = true, -- ["vim.lsp.util.convert_input_to_markdown_lines"] = true,
-- ["vim.lsp.util.stylize_markdown"] = true, -- ["vim.lsp.util.stylize_markdown"] = true,
-- ["cmp.entry.get_documentation"] = true, -- ["cmp.entry.get_documentation"] = true,
-- }, -- },
-- }, -- },
-- -- you can enable a preset for easier configuration -- -- you can enable a preset for easier configuration
-- presets = { -- presets = {
-- bottom_search = true, -- bottom_search = true,
-- long_message_to_split = true, -- long_message_to_split = true,
-- lsp_doc_border = true, -- lsp_doc_border = true,
-- }, -- },
-- }, -- },
-- dependencies = { -- dependencies = {
-- "MunifTanjim/nui.nvim", -- "MunifTanjim/nui.nvim",
-- { -- {
-- "rcarriga/nvim-notify", -- "rcarriga/nvim-notify",
-- config = { -- config = {
-- background_colour = require("catppuccin.palettes").get_palette("mocha").base, -- background_colour = require("catppuccin.palettes").get_palette("mocha").base,
-- render = "minimal", -- render = "minimal",
-- top_down = false, -- top_down = false,
-- }, -- },
-- }, -- },
-- }, -- },
-- }, -- },
} }

@ -1,11 +1,11 @@
return { return {
{ {
"stevearc/overseer.nvim", "stevearc/overseer.nvim",
config = true, config = true,
cmd = { "OverseerRun", "OverseerToggle" }, cmd = { "OverseerRun", "OverseerToggle" },
keys = { keys = {
{ "<leader>tr", vim.cmd.OverseerRun, desc = "Run Task" }, { "<leader>tr", vim.cmd.OverseerRun, desc = "Run Task" },
{ "<leader>tt", vim.cmd.OverseerToggle, desc = "Toggle task results" }, { "<leader>tt", vim.cmd.OverseerToggle, desc = "Toggle task results" },
},
}, },
},
} }

@ -1,8 +1,8 @@
return { return {
{ {
"unblevable/quick-scope", "unblevable/quick-scope",
init = function() init = function()
vim.g.qs_highlight_on_keys = { "f", "F", "t", "T" } vim.g.qs_highlight_on_keys = { "f", "F", "t", "T" }
end, end,
}, },
} }

@ -1,8 +1,8 @@
return { return {
{ {
"roobert/search-replace.nvim", "roobert/search-replace.nvim",
config = function() config = function()
require("search-replace").setup({}) require("search-replace").setup({})
end, end,
}, },
} }

@ -1,3 +1,3 @@
return { return {
{ "kylechui/nvim-surround", config = true }, { "kylechui/nvim-surround", config = true },
} }

@ -1,29 +1,29 @@
return { return {
{ {
"nvim-telescope/telescope.nvim", "nvim-telescope/telescope.nvim",
config = function() config = function()
require("telescope").load_extension("projects") require("telescope").load_extension("projects")
require("telescope").load_extension("fzy_native") require("telescope").load_extension("fzy_native")
require("telescope").load_extension("catppuccin") require("telescope").load_extension("catppuccin")
require("telescope").load_extension("smart_open") require("telescope").load_extension("smart_open")
end, end,
keys = { keys = {
{ "<leader>ff", "<cmd>Telescope smart_open<cr>", "Find files" }, { "<leader>ff", "<cmd>Telescope smart_open<cr>", "Find files" },
{ "<leader>fp", "<cmd>Telescope projects<cr>", "All Projects" }, { "<leader>fp", "<cmd>Telescope projects<cr>", "All Projects" },
{ "<leader>fr", "<cmd>Telescope oldfiles<cr>", "Recent Files" }, { "<leader>fr", "<cmd>Telescope oldfiles<cr>", "Recent Files" },
{ "<leader>fg", "<cmd>Telescope live_grep<cr>", "Live grep" }, { "<leader>fg", "<cmd>Telescope live_grep<cr>", "Live grep" },
{ "<leader>fc", "<cmd>Telescope catppuccin<cr>", "Catppuccin Colours" }, { "<leader>fc", "<cmd>Telescope catppuccin<cr>", "Catppuccin Colours" },
{ "<leader>fj", "<cmd>Telescope jumplist<cr>", "Jumplist" }, { "<leader>fj", "<cmd>Telescope jumplist<cr>", "Jumplist" },
},
cmd = "Telescope",
dependencies = {
"backwardspy/telescope-catppuccin.nvim",
{
"nvim-telescope/telescope-fzy-native.nvim",
dependencies = { "kkharji/sqlite.lua" },
},
"danielfalk/smart-open.nvim",
"backwardspy/telescope-catppuccin.nvim",
},
}, },
cmd = "Telescope",
dependencies = {
"backwardspy/telescope-catppuccin.nvim",
{
"nvim-telescope/telescope-fzy-native.nvim",
dependencies = { "kkharji/sqlite.lua" },
},
"danielfalk/smart-open.nvim",
"backwardspy/telescope-catppuccin.nvim",
},
},
} }

@ -1,31 +1,31 @@
return { return {
{ {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
build = function() build = function()
local ts_update = require("nvim-treesitter.install").update({ with_sync = true }) local ts_update = require("nvim-treesitter.install").update({ with_sync = true })
ts_update() ts_update()
end, end,
config = function() config = function()
require("nvim-treesitter.configs").setup({ require("nvim-treesitter.configs").setup({
ensure_installed = "all", ensure_installed = "all",
highlight = { enable = true }, highlight = { enable = true },
indent = { enable = false }, indent = { enable = false },
textobjects = { textobjects = {
select = { select = {
enable = true, enable = true,
lookahead = true, lookahead = true,
keymaps = { keymaps = {
["af"] = "@function.outer", ["af"] = "@function.outer",
["if"] = "@function.inner", ["if"] = "@function.inner",
["ac"] = "@class.outer", ["ac"] = "@class.outer",
["ic"] = "@class.inner", ["ic"] = "@class.inner",
["aa"] = "@parameter.outer", ["aa"] = "@parameter.outer",
["ia"] = "@parameter.inner", ["ia"] = "@parameter.inner",
}, },
}, },
}, },
}) })
end, end,
dependencies = { "nvim-treesitter/nvim-treesitter-textobjects" }, dependencies = { "nvim-treesitter/nvim-treesitter-textobjects" },
}, },
} }

@ -1,29 +1,29 @@
return { return {
{ {
"folke/which-key.nvim", "folke/which-key.nvim",
config = function() config = function()
local wk = require("which-key") local wk = require("which-key")
wk.setup({ wk.setup({
window = { window = {
border = "rounded", border = "rounded",
}, },
}) })
wk.register({ wk.register({
g = { name = "Go to" }, g = { name = "Go to" },
["]"] = { name = "Next" }, ["]"] = { name = "Next" },
["["] = { name = "Previous" }, ["["] = { name = "Previous" },
}) })
wk.register({ wk.register({
f = { name = "Find" }, f = { name = "Find" },
g = { name = "Git" }, g = { name = "Git" },
-- j = { name = "Jump" }, -- j = { name = "Jump" },
l = { name = "LSP" }, l = { name = "LSP" },
-- o = { name = "Open" }, -- o = { name = "Open" },
t = { name = "Tasks" }, t = { name = "Tasks" },
d = { name = "Debug" }, d = { name = "Debug" },
}, { prefix = "<leader>" }) }, { prefix = "<leader>" })
end, end,
}, },
} }

@ -1,20 +1,20 @@
local extremely_zen = function() local extremely_zen = function()
require("zen-mode").toggle({ plugins = { twilight = { enabled = true } } }) require("zen-mode").toggle({ plugins = { twilight = { enabled = true } } })
end end
return { return {
{ {
"folke/zen-mode.nvim", "folke/zen-mode.nvim",
opts = { opts = {
plugins = { plugins = {
twilight = { enabled = false }, twilight = { enabled = false },
}, },
},
cmd = { "ZenMode" },
keys = {
{ "<leader>zz", "<cmd>ZenMode<cr>", desc = "Zen Mode" },
{ "<leader>Z", extremely_zen, desc = "Extremely Zen Mode" },
},
dependencies = { "folke/twilight.nvim" },
}, },
cmd = { "ZenMode" },
keys = {
{ "<leader>zz", "<cmd>ZenMode<cr>", desc = "Zen Mode" },
{ "<leader>Z", extremely_zen, desc = "Extremely Zen Mode" },
},
dependencies = { "folke/twilight.nvim" },
},
} }

@ -0,0 +1,7 @@
column_width = 120
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferDouble"
call_parentheses = "Always"
collapse_simple_statement = "Never"
Loading…
Cancel
Save