feat(nvim): steal @backwardspy config

chezmoi
sgoudham 2 years ago
parent a6c1e576dd
commit 22b7110ebd
Signed by: hammy
GPG Key ID: 44E818FD5457EEA4

@ -0,0 +1,61 @@
-- set this early so plugins etc can all use it
vim.g.mapleader = " "
-- disable netrw at the very start of your init.lua (strongly advised)
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
-- bootstrap & set up lazy
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup("plugins", {
install = {
colorscheme = { "catppuccin" },
missing = true,
},
change_detection = {
enabled = true,
notify = false,
},
ui = {
border = "rounded",
icons = {
list = { "" },
},
},
})
-- load remaining config
require("options")
require("binds")
-- highlight yank
vim.api.nvim_create_augroup("highlight_yank", {})
vim.api.nvim_create_autocmd({ "TextYankPost" }, {
group = "highlight_yank",
pattern = { "*" },
callback = function()
vim.highlight.on_yank({
higroup = "Visual",
timeout = 150,
})
end,
})
-- Disable semantic highlights
vim.api.nvim_create_autocmd("LspAttach", {
callback = function(args)
local client = vim.lsp.get_client_by_id(args.data.client_id)
client.server_capabilities.semanticTokensProvider = nil
end,
})

@ -0,0 +1,62 @@
{
"Comment.nvim": { "branch": "master", "commit": "eab2c83a0207369900e92783f56990808082eac2" },
"LuaSnip": { "branch": "master", "commit": "d404ec306bfa4cdb0c3605dbb17e8a93a9597337" },
"actually.nvim": { "branch": "main", "commit": "a735082694b1f06c4d9874f2a7288dba94acdb71" },
"ascii-blocks.nvim": { "branch": "main", "commit": "a8a7d99fc52df30d7c4e7664818542fd44839d97" },
"asciitree.nvim": { "branch": "main", "commit": "a979a0c6987e07eaa9f405d90c086105c0a2d99c" },
"catppuccin": { "branch": "main", "commit": "8769e767f12f5bf0b7d1250ee067088e7054809a" },
"ccc.nvim": { "branch": "main", "commit": "be0a8122fd77efb7b6a0d672bab10417e68fab8b" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "23c51b2a3c00f6abc4e922dbd7c3b9aca6992063" },
"cmp-nvim-lsp": { "branch": "main", "commit": "59224771f91b86d1de12570b4070fe4ad7cd1eeb" },
"cmp-nvim-lua": { "branch": "main", "commit": "f3491638d123cfd2c8048aefaf66d246ff250ca6" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp-under-comparator": { "branch": "master", "commit": "6857f10272c3cfe930cece2afa2406e1385bfef8" },
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
"delaytrain.nvim": { "branch": "main", "commit": "eb8d2157e6a7de1b4f024f7ca5bccc4014d88b05" },
"dressing.nvim": { "branch": "master", "commit": "4436d6f41e2f6b8ada57588acd1a9f8b3d21453c" },
"feline.nvim": { "branch": "master", "commit": "d48b6f92c6ccdd6654c956f437be49ea160b5b0c" },
"haskell-tools.nvim": { "branch": "master", "commit": "03dfa7fa3d08a34cdef09ca05a6da166a1ba22a2" },
"lazy.nvim": { "branch": "main", "commit": "3d2dcb2d5ef99106c5ff412da88c6f59a9f8a693" },
"lsp-format.nvim": { "branch": "master", "commit": "ca0df5c8544e51517209ea7b86ecc522c98d4f0a" },
"lsp_signature.nvim": { "branch": "master", "commit": "6f6252f63b0baf0f2224c4caea33819a27f3f550" },
"lspkind.nvim": { "branch": "master", "commit": "c68b3a003483cf382428a43035079f78474cd11e" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "53f3a8bdcb77d4a95b082fd57e12173f353c6c3e" },
"mason-null-ls.nvim": { "branch": "main", "commit": "13c6ab4a4f810cbbb1799a9cf4d4a27fd862d885" },
"mason-nvim-dap.nvim": { "branch": "main", "commit": "4feb21a598e690f947aa2c97129a469f772b5289" },
"mason.nvim": { "branch": "main", "commit": "24846a00941ec020c8addc7f52040a1b2fc12174" },
"mini.nvim": { "branch": "main", "commit": "4f97a8771a480bcacf1d1d0dbf82e47f682aba2c" },
"neodev.nvim": { "branch": "main", "commit": "d9a8d651501cd2f287742472af4b3103d991cd68" },
"null-ls.nvim": { "branch": "main", "commit": "8f5d730021497233c39d3adbf4b8043d4be163f8" },
"nvim-autopairs": { "branch": "master", "commit": "5a3523ddb573804752de6c021c5cb82e267b79ca" },
"nvim-bqf": { "branch": "main", "commit": "da1cd2557a16386829a213330e0fd46b61db7632" },
"nvim-cmp": { "branch": "main", "commit": "cfafe0a1ca8933f7b7968a287d39904156f2c57d" },
"nvim-coverage": { "branch": "main", "commit": "5c5ab0cc575c483bf3485b9481880b5ea4160ed4" },
"nvim-dap": { "branch": "master", "commit": "0e376f00e7fac143e29e1017d2ac2cc3df13d185" },
"nvim-dap-ui": { "branch": "master", "commit": "885e958ff9de30cfbc359259eccf28cc493ad46b" },
"nvim-dap-virtual-text": { "branch": "master", "commit": "7f7f2af549e72a0b7bddc3b4f827beb027ea8ce3" },
"nvim-lspconfig": { "branch": "master", "commit": "902d6aa31450d26e11bedcbef8af5b6fe2e1ffe8" },
"nvim-navic": { "branch": "master", "commit": "11e08391eeed00effa85ca24ff9d1e0472cbcd6a" },
"nvim-surround": { "branch": "main", "commit": "ad56e6234bf42fb7f7e4dccc7752e25abd5ec80e" },
"nvim-tree.lua": { "branch": "master", "commit": "215b29bfad74518442621b9d0483a621483b066b" },
"nvim-treesitter": { "branch": "master", "commit": "0e6d4b4172f30c4aa44a9adc9ea5719723a1fac3" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "249d90a84df63f3ffff65fcc06a45d58415672de" },
"nvim-web-devicons": { "branch": "master", "commit": "2b96193abe4372e18e4f4533895a42a466d53c17" },
"overseer.nvim": { "branch": "master", "commit": "42c0d69f505314d6994a84da4e3fcbaf308c1a86" },
"plenary.nvim": { "branch": "master", "commit": "9a0d3bf7b832818c042aaf30f692b081ddd58bd9" },
"presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" },
"py_lsp.nvim": { "branch": "main", "commit": "6f160d0e1864b1a46c932c542a132a57abd7f1c1" },
"quick-scope": { "branch": "master", "commit": "428e8698347f254d24b248af9f656194a80081e5" },
"rust-tools.nvim": { "branch": "master", "commit": "b297167d9e01accc9b9afe872ce91e791df2dde0" },
"search-replace.nvim": { "branch": "main", "commit": "b3485c9cd14319c5320bbdd74af0b3c67733490d" },
"smart-open.nvim": { "branch": "main", "commit": "ebf87075af7d193c16800ce682a04eca393ac2a7" },
"sqlite.lua": { "branch": "master", "commit": "93ff5824682ecc874200e338fd8ca9ccd08508f8" },
"telescope-catppuccin.nvim": { "branch": "main", "commit": "92e028a34d917d5b4b891f8f4406c45c8cc6497e" },
"telescope-fzy-native.nvim": { "branch": "master", "commit": "282f069504515eec762ab6d6c89903377252bf5b" },
"telescope.nvim": { "branch": "master", "commit": "203bf5609137600d73e8ed82703d6b0e320a5f36" },
"twilight.nvim": { "branch": "main", "commit": "9410252bed96887ca5a86bf16435a3a51a0e6ce5" },
"vim-textobj-entire": { "branch": "master", "commit": "64a856c9dff3425ed8a863b9ec0a21dbaee6fb3a" },
"vim-textobj-user": { "branch": "master", "commit": "41a675ddbeefd6a93664a4dc52f302fe3086a933" },
"which-key.nvim": { "branch": "main", "commit": "684e96c5e8477f1ee9b3f2e9a12d802fd12c5531" },
"zen-mode.nvim": { "branch": "main", "commit": "136dda65769cee45119f16e4bc3d3f13a7aecb28" }
}

@ -0,0 +1,52 @@
local wk = require("which-key")
wk.register({
["0"] = { "0^", "" }
})
-- normal binds
wk.register({
["<C-s>"] = { "<cmd>write<cr>", "Save" },
["<C-d>"] = { "<C-d>zz", "Half page down" },
["<C-u>"] = { "<C-u>zz", "Half page up" },
n = { "nzzzv", "Next result (centered)" },
N = { "Nzzzv", "Previous result (centered)" },
J = { "mzJ`z", "Join lines (stable)" },
})
-- visual binds
wk.register({
J = { ":m '>+1<CR>gv=gv", "Move line down" },
K = { ":m '<-2<CR>gv=gv", "Move line up" },
}, { mode = "v" })
-- terminal binds
wk.register({
["<A-Esc>"] = { [[<C-\><C-n>]], "Normal mode" },
}, { mode = "t" })
-- normal + terminal binds
wk.register({
["<A-h>"] = { "<cmd>wincmd h<cr>", "Go to the left window" },
["<A-j>"] = { "<cmd>wincmd j<cr>", "Go to the down window" },
["<A-k>"] = { "<cmd>wincmd k<cr>", "Go to the up window" },
["<A-l>"] = { "<cmd>wincmd l<cr>", "Go to the right window" },
}, { mode = { "n", "t" } })
-- leader binds
wk.register({
p = { [["+p]], "Put from clipboard" },
w = { [[:w<CR>]], "Quick Save" },
q = { [[:q<CR>]], "Quick Exit" },
}, { prefix = "<leader>" })
-- nv leader binds
wk.register({
d = { [["_d]], "Delete w/o yank" },
y = { [["+y]], "Yank to clipboard" },
}, { prefix = "<leader>", mode = { "n", "v" } })
-- x leader binds
wk.register({
p = { [["_dP"]], "Put w/o yank" },
}, { prefix = "<leader>", mode = "x" })

@ -0,0 +1,54 @@
-- puts current line number on current line
-- relative line numbers on everything else
vim.opt.number = true
vim.opt.relativenumber = true
-- default to 4 spaces for indentation
vim.opt.shiftwidth = 4
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.expandtab = true
-- keep some lines at the top/bottom of the window
vim.opt.scrolloff = 8
-- smarter smartindent
vim.opt.cindent = true
-- global statusline
vim.opt.laststatus = 3
-- apparently this makes cmp work
vim.opt.completeopt = "menu,menuone,noselect"
-- no more jumping around when signs arrive
vim.opt.signcolumn = "yes"
-- live life dangerously
vim.opt.swapfile = true
vim.opt.backup = true
vim.opt.undofile = true
vim.opt.undodir = vim.fn.stdpath("data") .. "/undo/"
vim.opt.backupdir = vim.fn.stdpath("data") .. "/backup/"
vim.opt.directory = vim.fn.stdpath("data") .. "/swap/"
-- no more noh and incremental search highlighting
vim.opt.hlsearch = false
vim.opt.incsearch = true
-- make cursorhold happen faster
vim.opt.updatetime = 100
-- make which key show up faster
vim.opt.timeoutlen = 500
-- 24bit tui colours
vim.opt.termguicolors = true
-- gui/neovide stuff
vim.opt.guifont = "Fantasque Sans Mono:h13"
if vim.g.neovide then
vim.g.neovide_cursor_vfx_mode = "pixiedust"
vim.g.neovide_cursor_vfx_particle_density = 50
end

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

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

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

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

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

@ -0,0 +1,110 @@
local has_words_before = function()
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
end
return {
{
"hrsh7th/nvim-cmp",
config = function()
local cmp = require("cmp")
local cmp_under_comparator = require("cmp-under-comparator")
local lspkind = require("lspkind")
local luasnip = require("luasnip")
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert({
["<A-k>"] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }),
["<A-j>"] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "c" }),
["<A-p>"] = cmp.mapping.scroll_docs(-4),
["<A-n>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete({}),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = true }),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
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({ "/", "?" }, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = "buffer" },
},
})
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",
},
},
}

@ -0,0 +1,95 @@
local has_words_before = function()
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
end
return {
{
"hrsh7th/nvim-cmp",
config = function()
local cmp = require("cmp")
local cmp_under_comparator = require("cmp-under-comparator")
local lspkind = require("lspkind")
local luasnip = require("luasnip")
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert({
["<A-p>"] = cmp.mapping.scroll_docs(-4),
["<A-n>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete({}),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = true }),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
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" },
}),
formatting = {
format = lspkind.cmp_format({
mode = "symbol",
maxwidth = 30,
ellipsis_char = "",
}),
},
})
cmp.setup.cmdline({ "/", "?" }, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = "buffer" },
},
})
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "path" },
}, {
{ name = "cmdline" },
}),
})
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",
},
},
}

@ -0,0 +1,3 @@
return {
{ "numToStr/Comment.nvim", config = true },
}

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

@ -0,0 +1,82 @@
local get_python_path = function()
for _, client in pairs(vim.lsp.buf_get_clients()) do
if client.name == "pyright" then
local path = client.config.settings.python.pythonPath
if path ~= nil then
return path
else
return "python"
end
end
end
end
return {
{
"jayp0521/mason-nvim-dap.nvim",
config = function()
local dap = require("dap")
local mason_dap = require("mason-nvim-dap")
mason_dap.setup({
ensure_installed = { "python", "codelldb" },
automatic_setup = true,
})
mason_dap.setup_handlers({
-- default handler
function(source)
require("mason-nvim-dap.automatic_setup")(source)
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
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>xb", vim.cmd.DapToggleBreakpoint, desc = "Toggle breakpoint" },
{
"<leader>xu",
function()
require("dapui").toggle({})
end,
desc = "Toggle UI",
},
{ "<leader>xx", 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 },
},
},
}

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

@ -0,0 +1,14 @@
return {
{
"feline-nvim/feline.nvim",
config = function()
local feline = require("feline")
local ctp_feline = require("catppuccin.groups.integrations.feline")
-- catppuccin statusline
ctp_feline.setup({})
feline.setup({ components = ctp_feline.get() })
end,
dependencies = { "nvim-tree/nvim-web-devicons" },
},
}

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

@ -0,0 +1,189 @@
local signs = { Error = "", Warn = "", Hint = "", Info = "" }
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
end
vim.diagnostic.config({
float = { border = "rounded" },
update_in_insert = true,
})
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" })
local default_config = {
on_attach = function(client, bufnr)
require("lsp-format").on_attach(client)
-- add lsp-only keybinds
local map = function(sequence, cmd, desc)
vim.keymap.set("n", sequence, cmd, { buffer = bufnr, desc = desc })
end
map("gd", function()
require("telescope.builtin").lsp_definitions()
end, "LSP Definitions")
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")
-- add git signs later
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>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 merged_config = vim.deepcopy(default_config)
merged_config = vim.tbl_extend("force", merged_config, config)
return merged_config
end
return {
{
"neovim/nvim-lspconfig",
config = function()
require("lspconfig.ui.windows").default_options.border = "rounded"
end,
dependencies = {
{
"williamboman/mason-lspconfig.nvim",
config = function()
require("mason-lspconfig").setup({
ensure_installed = { "rust_analyzer", "pyright", "sumneko_lua" },
})
require("mason-lspconfig").setup_handlers({
-- default handler
function(server_name)
require("lspconfig")[server_name].setup(default_config)
end,
["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",
"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",
},
},
{
"jose-elias-alvarez/null-ls.nvim",
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" },
},
},
}

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

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

@ -0,0 +1,3 @@
return {
{ "prichrd/netrw.nvim", config = true },
}

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

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

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

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

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

@ -0,0 +1,28 @@
return {
{
"nvim-telescope/telescope.nvim",
config = function()
require("telescope").load_extension("fzy_native")
require("telescope").load_extension("catppuccin")
require("telescope").load_extension("smart_open")
end,
keys = {
-- { "<leader>fg", "<cmd>Telescope git_files<cr>", "Git files" },
{ "<leader>ff", "<cmd>Telescope smart_open<cr>", "Find files" },
{ "<leader>fr", "<cmd>Telescope oldfiles<cr>", "Recent Files" },
{ "<leader>fg", "<cmd>Telescope live_grep<cr>", "Live grep" },
{ "<leader>fc", "<cmd>Telescope catppuccin<cr>", "Catppuccin Colours" },
{ "<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",
},
},
}

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

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

@ -0,0 +1,20 @@
local extremely_zen = function()
require("zen-mode").toggle({ plugins = { twilight = { enabled = true } } })
end
return {
{
"folke/zen-mode.nvim",
opts = {
plugins = {
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" },
},
}
Loading…
Cancel
Save