Add old neovim config for historical reasons

This commit is contained in:
Evie Litherland-Smith 2023-09-27 06:33:08 +01:00
parent db910619e3
commit a33ffd55d6
44 changed files with 1136 additions and 0 deletions

View file

@ -0,0 +1,70 @@
vim.g.mapleader = " "
vim.g.maplocalleader = ","
vim.opt.termguicolors = true
vim.diagnostic.config {
virtual_text = true,
float = { border = "rounded" },
}
require "ui.fillchars"
-- bootstrap lazy.nvim
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 {
spec = "plugins",
install = { colorscheme = { "tokyonight" } },
ui = {
border = "rounded",
icons = { lazy = " " },
},
diff = { cmd = "diffview.nvim" },
checker = { enabled = false },
performance = {
rtp = {
disabled_plugins = {
"gzip",
"matchit",
"matchparen",
"netrwPlugin",
"tarPlugin",
"tohtml",
"tutor",
"zipPlugin",
},
},
},
}
-- Set vim options
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.listchars = { lead = ".", trail = ".", tab = ">-" }
vim.opt.list = true
vim.opt.splitbelow = true
vim.opt.splitright = true
vim.opt.foldlevelstart = 99
vim.g.loaded_perl_provider = 0
vim.notify = require "notify"
require "dressing"
-- Common keymaps
vim.keymap.set("i", "jk", "<esc>")
vim.keymap.set("n", "<leader>l", "<cmd>Lazy<CR>")
-- GUI settings
if vim.g.neovide then require "ui.neovide" end
-- Colorscheme
vim.cmd [[colorscheme tokyonight]]

View file

@ -0,0 +1,61 @@
return {
"goolord/alpha-nvim",
event = "VimEnter",
opts = function()
local dashboard = require "alpha.themes.dashboard"
local logo = [[
Z
Z
z
z
]]
dashboard.section.header.val = vim.split(logo, "\n")
dashboard.section.buttons.val = {
dashboard.button("t", "󰝖 Tasks", '<cmd>lua require("taskwarrior_nvim").browser({"ready"}) <CR>'),
dashboard.button("f", " Find file", "<cmd>Telescope find_files <CR>"),
dashboard.button("r", " Recent files", "<cmd>Telescope oldfiles <CR>"),
dashboard.button("o", " File browser", "<cmd>Oil <CR>"),
dashboard.button("p", "󱞁 Personal notes", "<cmd>Neorg workspace personal<CR>"),
dashboard.button("w", "󱞂 Work notes", "<cmd>Neorg workspace work<CR>"),
dashboard.button("g", "󰊢 Git status", "<cmd>Neogit <CR>"),
dashboard.button("c", " Config", "<cmd>e $HOME/.config/home-manager/flake.nix <CR>"),
dashboard.button("l", "󰒲 Lazy", "<cmd>Lazy<CR>"),
dashboard.button("h", " Help", "<cmd>Telescope help_tags <CR>"),
dashboard.button("q", " Quit", "<cmd>qa<CR>"),
}
for _, button in ipairs(dashboard.section.buttons.val) do
button.opts.hl = "AlphaButtons"
button.opts.hl_shortcut = "AlphaShortcut"
end
dashboard.section.header.opts.hl = "AlphaHeader"
dashboard.section.buttons.opts.hl = "AlphaButtons"
dashboard.section.footer.opts.hl = "AlphaFooter"
dashboard.opts.layout[1].val = 8
return dashboard
end,
config = function(_, dashboard)
-- close Lazy and re-open when the dashboard is ready
if vim.o.filetype == "lazy" then
vim.cmd.close()
vim.api.nvim_create_autocmd("User", {
pattern = "AlphaReady",
callback = function() require("lazy").show() end,
})
end
require("alpha").setup(dashboard.opts)
vim.api.nvim_create_autocmd("User", {
pattern = "LazyVimStarted",
callback = function()
local stats = require("lazy").stats()
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
dashboard.section.footer.val = "⚡ Neovim loaded " .. stats.count .. " plugins in " .. ms .. "ms"
pcall(vim.cmd.AlphaRedraw)
end,
})
end,
}

View file

@ -0,0 +1,44 @@
return {
"romgrk/barbar.nvim",
version = "^1.0.0", -- optional: only update when a new 1.x version is released
dependencies = { "lewis6991/gitsigns.nvim", "nvim-tree/nvim-web-devicons" },
event = { "BufReadPre", "BufNewFile" },
init = function()
vim.g.barbar_auto_setup = false
vim.keymap.set("n", "<A-,>", "<Cmd>BufferPrevious<CR>", { noremap = true, silent = true })
vim.keymap.set("n", "<A-.>", "<Cmd>BufferNext<CR>", { noremap = true, silent = true })
vim.keymap.set("n", "<A-<>", "<Cmd>BufferMovePrevious<CR>", { noremap = true, silent = true })
vim.keymap.set("n", "<A->>", "<Cmd>BufferMoveNext<CR>", { noremap = true, silent = true })
vim.keymap.set("n", "<A-p>", "<Cmd>BufferPin<CR>", { noremap = true, silent = true })
vim.keymap.set("n", "<A-c>", "<Cmd>BufferClose<CR>", { noremap = true, silent = true })
vim.keymap.set("n", "<A-C>", "<Cmd>BufferCloseAllButCurrentOrPinned<CR>", { noremap = true, silent = true })
vim.keymap.set("n", "<C-p>", "<Cmd>BufferPick<CR>", { noremap = true, silent = true })
vim.keymap.set("n", "<Space>bb", "<Cmd>BufferOrderByBufferNumber<CR>", { noremap = true, silent = true })
vim.keymap.set("n", "<Space>bd", "<Cmd>BufferOrderByDirectory<CR>", { noremap = true, silent = true })
vim.keymap.set("n", "<Space>bl", "<Cmd>BufferOrderByLanguage<CR>", { noremap = true, silent = true })
vim.keymap.set("n", "<Space>bw", "<Cmd>BufferOrderByWindowNumber<CR>", { noremap = true, silent = true })
end,
config = true,
opts = {
animation = true,
auto_hide = false,
tabpages = true,
hide = { extensions = true },
modified = { button = "" },
pinned = { button = "", filename = true, separator = { right = "" } },
icons = {
separator = { left = "", right = "|" },
button = "",
diagnostics = {
[vim.diagnostic.severity.ERROR] = { enabled = true, icon = require("ui.lsp_icons").Error },
[vim.diagnostic.severity.WARN] = { enabled = true, icon = require("ui.lsp_icons").Warn },
[vim.diagnostic.severity.INFO] = { enabled = true, icon = require("ui.lsp_icons").Hint },
[vim.diagnostic.severity.HINT] = { enabled = true, icon = require("ui.lsp_icons").Info },
},
filetype = {
custom_colors = false,
enabled = true,
},
},
},
}

View file

@ -0,0 +1,15 @@
return {
"utilyre/barbecue.nvim",
name = "barbecue",
version = "*",
event = { "BufReadPre", "BufNewFile" },
dependencies = {
"SmiteshP/nvim-navic",
"nvim-tree/nvim-web-devicons",
-- "catppuccin",
"folke/tokyonight.nvim",
},
opts = {
theme = "tokyonight",
},
}

View file

@ -0,0 +1,7 @@
return {
"numToStr/Comment.nvim",
dependencites = { "nvim-treesitter" },
keys = { "gc", "gb" },
config = true,
opts = { ignore = "^$" },
}

View file

@ -0,0 +1,15 @@
return {
"sindrets/diffview.nvim",
dependencies = { "nvim-lua/plenary.nvim", "nvim-tree/nvim-web-devicons" },
cmd = {
"DiffviewFileHistory",
"DiffviewOpen",
},
config = true,
opts = {
enhanced_diff_hl = true,
file_panel = {
listing_style = "list",
},
},
}

View file

@ -0,0 +1,10 @@
return {
"https://github.com/direnv/direnv.vim.git",
cond = function() return vim.fn.executable("direnv") == 1 end,
name = "direnv.vim",
event = { "DirChangedPre" },
config = function()
vim.g.direnv_auto = 1
vim.g.direnv_silent_load = 1
end,
}

View file

@ -0,0 +1,5 @@
return {
"stevearc/dressing.nvim",
lazy = true,
config = true,
}

View file

@ -0,0 +1,56 @@
return {
"folke/edgy.nvim",
enabled = false,
event = "VeryLazy",
opts = {
bottom = {
-- toggleterm / lazyterm at the bottom with a height of 40% of the screen
{ ft = "toggleterm", size = { height = 0.4 } },
{
ft = "lazyterm",
title = "LazyTerm",
size = { height = 0.4 },
filter = function(buf) return not vim.b[buf].lazyterm_cmd end,
},
"Trouble",
{ ft = "qf", title = "QuickFix" },
{
ft = "help",
size = { height = 20 },
-- only show help buffers
filter = function(buf) return vim.bo[buf].buftype == "help" end,
},
{ ft = "spectre_panel", size = { height = 0.4 } },
},
left = {
-- Neo-tree filesystem always takes half the screen height
{
title = "Neo-Tree",
ft = "neo-tree",
filter = function(buf) return vim.b[buf].neo_tree_source == "filesystem" end,
size = { height = 0.5 },
},
{
title = "Neo-Tree Git",
ft = "neo-tree",
filter = function(buf) return vim.b[buf].neo_tree_source == "git_status" end,
pinned = true,
open = "Neotree position=right git_status",
},
{
title = "Neo-Tree Buffers",
ft = "neo-tree",
filter = function(buf) return vim.b[buf].neo_tree_source == "buffers" end,
pinned = true,
open = "Neotree position=top buffers",
},
{
ft = "Outline",
pinned = true,
open = "SymbolsOutline",
},
-- any other neo-tree windows
"neo-tree",
},
},
}

View file

@ -0,0 +1,19 @@
local opts = {
text = {
spinner = "dots",
done = "",
commenced = "",
completed = "",
},
window = {
blend = 0,
border = "rounded",
},
}
if vim.g.neovide then opts.window.blend = 50 end
return {
"j-hui/fidget.nvim",
tag = "legacy",
opts = opts,
}

View file

@ -0,0 +1,50 @@
return {
"lewis6991/gitsigns.nvim",
event = { "BufReadPre", "BufNewFile" },
config = true,
opts = {
signcolumn = true,
numhl = true,
linehl = false,
current_line_blame = true,
word_diff = false,
on_attach = function(bufnr)
local gs = package.loaded.gitsigns
local function map(mode, l, r, opts)
opts = opts or {}
opts.buffer = bufnr
vim.keymap.set(mode, l, r, opts)
end
-- Navigation
map("n", "]c", function()
if vim.wo.diff then return "]c" end
vim.schedule(function() gs.next_hunk() end)
return "<Ignore>"
end, { expr = true })
map("n", "[c", function()
if vim.wo.diff then return "[c" end
vim.schedule(function() gs.prev_hunk() end)
return "<Ignore>"
end, { expr = true })
-- Actions
map({ "n", "v" }, "<leader>hs", ":Gitsigns stage_hunk<CR>")
map({ "n", "v" }, "<leader>hr", ":Gitsigns reset_hunk<CR>")
map("n", "<leader>hS", gs.stage_buffer)
map("n", "<leader>hu", gs.undo_stage_hunk)
map("n", "<leader>hR", gs.reset_buffer)
map("n", "<leader>hp", gs.preview_hunk)
map("n", "<leader>hb", function() gs.blame_line { full = true } end)
map("n", "<leader>tb", gs.toggle_current_line_blame)
map("n", "<leader>hd", gs.diffthis)
map("n", "<leader>hD", function() gs.diffthis "~" end)
map("n", "<leader>td", gs.toggle_deleted)
-- Text object
map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>")
end,
},
}

View file

@ -0,0 +1,9 @@
return {
"phaazon/hop.nvim",
cmd = { "HopWord", "HopLine" },
init = function()
vim.keymap.set("n", "<leader>hw", "<cmd>HopWord<cr>")
vim.keymap.set("n", "<leader>hl", "<cmd>HopLine<cr>")
end,
config = true,
}

View file

@ -0,0 +1,10 @@
return {
"lukas-reineke/indent-blankline.nvim",
dependencies = {"nvim-treesitter"},
event = { "BufReadPre", "BufNewFile" },
config = true,
opts = {
show_current_context = true,
show_current_context_start = false,
},
}

View file

@ -0,0 +1,3 @@
return {
{ "folke/lazy.nvim", cmd = "Lazy" },
}

View file

@ -0,0 +1,98 @@
local on_attach = function(client, bufnr)
-- Mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions
local bufopts = { noremap = true, silent = true, buffer = bufnr }
vim.keymap.set("n", "gd", "<cmd>TroubleToggle lsp_definitions<cr>")
vim.keymap.set("n", "gr", "<cmd>TroubleToggle lsp_references<cr>")
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, bufopts)
vim.keymap.set("n", "K", function() vim.lsp.buf.hover { popup_opts = { border = "rounded" } } end, bufopts)
vim.keymap.set("n", "<leader>D", "<cmd>TroubleToggle lsp_type_definitions<cr>")
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, bufopts)
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, bufopts)
vim.keymap.set(
"n",
"<leader>i",
function() vim.lsp.buf.format { bufnr = bufnr, timeout_ms = 2000, async = true } end,
bufopts
)
-- specific client tweaks
if client.name ~= "null-ls" then client.server_capabilities.documentFormattingProvider = false end
if client.name == "ruff_lsp" then client.server_capabilities.hoverProvider = false end
-- Attach navic and navbuddy if applicable
if client.server_capabilities.documentSymbolProvider then
require("nvim-navic").attach(client, bufnr)
require("nvim-navbuddy").attach(client, bufnr)
end
end
local config = function()
require("neodev").setup()
-- Mappings.
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
local opts = { noremap = true, silent = true }
vim.keymap.set("n", "<leader>e", vim.diagnostic.open_float, opts)
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts)
vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts)
vim.keymap.set("n", "<leader>q", vim.diagnostic.setloclist, opts)
local signs = require "ui.lsp_icons"
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
end
local lsp_config = {
on_attach = on_attach,
flags = { debounce_text_changes = 150 },
capabilities = require("cmp_nvim_lsp").default_capabilities(),
}
local lsp = require "lspconfig"
if vim.fn.executable "pyright" == 1 then
lsp["pyright"].setup(lsp_config)
elseif vim.fn.executable "pyslp" == 1 then
lsp["pylsp"].setup(lsp_config)
end
if vim.fn.executable "ruff-lsp" == 1 then lsp["ruff_lsp"].setup(lsp_config) end
if vim.fn.executable "lua-language-server" == 1 then
lsp["lua_ls"].setup {
on_attach = lsp_config.on_attach,
flags = lsp_config.flags,
capabilities = lsp_config.capabilities,
settings = { Lua = { workspace = { checkThirdParty = false } } },
}
end
if vim.fn.executable "nil" == 1 then lsp["nil_ls"].setup(lsp_config) end
if vim.fn.executable "fortls" == 1 then lsp["fortls"].setup(lsp_config) end
if vim.fn.executable "yaml-language-server" == 1 then lsp["yamlls"].setup(lsp_config) end
if vim.fn.executable "vim-language-server" == 1 then lsp["vimls"].setup(lsp_config) end
if vim.fn.executable "bash-language-server" == 1 then lsp["bashls"].setup(lsp_config) end
local builtins = require "null-ls.builtins"
require("null-ls").setup {
sources = {
builtins.code_actions.gitsigns,
builtins.formatting.alejandra,
builtins.formatting.beautysh,
builtins.formatting.black,
builtins.formatting.fixjson,
builtins.formatting.isort,
builtins.formatting.mdformat,
builtins.formatting.shellharden,
builtins.formatting.stylua,
builtins.hover.dictionary,
},
on_attach = lsp_config.on_attach,
flags = lsp_config.flags,
capabilities = lsp_config.capabilities,
}
end
return {
"neovim/nvim-lspconfig",
event = { "BufReadPre", "BufNewFile" },
dependencies = { "cmp-nvim-lsp", "folke/trouble.nvim", "folke/neodev.nvim", "jose-elias-alvarez/null-ls.nvim" },
config = config,
}

View file

@ -0,0 +1,37 @@
return {
"nvim-lualine/lualine.nvim",
dependencies = { "nvim-tree/nvim-web-devicons", "folke/tokyonight.nvim" },
event = { "VeryLazy" },
config = true,
opts = function()
return {
options = {
theme = "tokyonight",
component_separators = "|",
section_separators = { left = "", right = "" },
globalstatus = true,
},
sections = {
lualine_a = { "mode" },
lualine_b = { "filename", { "branch", icon = "󰊢" }, "diff" },
lualine_c = {
{
"diagnostics",
symbols = {
error = require("ui.lsp_icons").Error,
warn = require("ui.lsp_icons").Warn,
info = require("ui.lsp_icons").Info,
hint = require("ui.lsp_icons").Hint,
},
},
},
lualine_x = { "filetype", "fileformat", "encoding" },
lualine_y = { "progress" },
lualine_z = { "selectioncount", "location" },
},
tabline = {},
winbar = {},
extensions = { "aerial", "fzf", "lazy", "neo-tree", "toggleterm", "trouble" },
}
end,
}

View file

@ -0,0 +1,9 @@
return {
"L3MON4D3/LuaSnip",
lazy = true,
dependencies = {
"rafamadriz/friendly-snippets",
config = function() require("luasnip.loaders.from_vscode").lazy_load() end,
},
-- build = "make install_jsregexp",
}

View file

@ -0,0 +1,8 @@
return {
"jbyuki/nabla.nvim",
lazy = true,
init = function()
vim.keymap.set("n", "<leader>p", "<cmd>lua require('nabla').popup()<cr>")
vim.keymap.set("n", "<leader>m", "<cmd>lua require('nabla').toggle_virt()<cr>")
end,
}

View file

@ -0,0 +1,15 @@
return {
"NeogitOrg/neogit",
dependencies = {
"nvim-lua/plenary.nvim",
"sindrets/diffview.nvim",
},
cmd = "Neogit",
init = function() vim.keymap.set("n", "<leader>g", "<cmd>Neogit<CR>") end,
config = true,
opts = {
disable_commit_confirmation = true,
disable_builtin_notifications = true,
integrations = { diffview = true },
},
}

View file

@ -0,0 +1,10 @@
return {
"rcarriga/nvim-notify",
lazy = true,
config = true,
opts = {
background_colour = "#000000",
fps = 60,
render = "default",
},
}

View file

@ -0,0 +1,69 @@
local config = function()
local cmp = require "cmp"
local luasnip = require "luasnip"
local cmp_autopairs = require "nvim-autopairs.completion.cmp"
cmp.setup {
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body) -- For `luasnip` users.
end,
},
mapping = cmp.mapping.preset.insert {
["<C-u>"] = cmp.mapping.scroll_docs(-4), -- Up
["<C-d>"] = cmp.mapping.scroll_docs(4), -- Down
["<C-Space>"] = cmp.mapping.complete(),
["<CR>"] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
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()
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 = { { name = "nvim_lsp" }, { name = "luasnip" }, { name = "neorg" } },
}
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
end
return {
"hrsh7th/nvim-cmp",
event = "InsertEnter",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
{
"windwp/nvim-autopairs",
cond = not vim.g.vscode,
lazy = true,
dependencies = {
"nvim-treesitter/nvim-treesitter",
"hrsh7th/nvim-cmp",
},
config = true,
opts = {
disable_in_macro = true,
disable_in_visualblock = true,
check_ts = true,
},
},
"saadparwaiz1/cmp_luasnip",
"L3MON4D3/LuaSnip",
},
config = config,
}

View file

@ -0,0 +1,33 @@
return {
"SmiteshP/nvim-navbuddy",
dependencies = {
"SmiteshP/nvim-navic",
"MunifTanjim/nui.nvim",
"neovim/nvim-lspconfig",
"numToStr/Comment.nvim",
"nvim-telescope/telescope.nvim",
},
cmd = { "Navbuddy" },
init = function() vim.keymap.set("n", "<leader>na", "<cmd>Navbuddy<cr>") end,
config = true,
opts = {
icons = require "ui.navic_icons",
window = {
border = "rounded",
size = "80%",
sections = {
left = { border = "rounded" },
mid = { border = "rounded" },
right = { border = "rounded", preview = "leaf" },
},
},
node_markers = {
enabled = true,
icons = {
leaf = "󰅀 ",
leaf_selected = "󰄼 ",
branch = "󰅂 ",
},
},
},
}

View file

@ -0,0 +1,11 @@
return {
"SmiteshP/nvim-navic",
dependencies = "neovim/nvim-lspconfig",
lazy = true,
config = true,
opts = {
safe_output = true,
click = true,
icons = require "ui.navic_icons",
},
}

View file

@ -0,0 +1,46 @@
return {
"nvim-neorg/neorg",
cond = function() return vim.fn.executable "nix" == 1 end,
build = ":Neorg sync-parsers",
ft = "norg",
cmd = "Neorg",
lazy = true,
dependencies = { "plenary.nvim", "nvim-treesitter", "nvim-cmp", "nabla.nvim" },
init = function()
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
pattern = { "*.norg" },
command = "Neorg update-metadata",
})
vim.api.nvim_create_autocmd({ "BufReadPre", "BufNewFile" }, {
pattern = { "*.norg" },
command = "setlocal spell spelllang=en_gb",
})
vim.api.nvim_create_autocmd({ "BufReadPre", "BufNewFile" }, {
pattern = { "*.norg" },
command = "setlocal textwidth=79",
})
vim.api.nvim_create_autocmd({ "BufReadPost", "BufNewFile" }, {
pattern = { "*.norg" },
command = "lua require('nabla').enable_virt()",
})
vim.keymap.set("n", "<leader>wp", "<cmd>Neorg workspace personal <cr>")
vim.keymap.set("n", "<leader>ww", "<cmd>Neorg workspace work <cr>")
vim.keymap.set("n", "<leader>wr", "<cmd>Neorg return <cr>")
vim.keymap.set("n", "<leader>jo", "<cmd>Neorg journal today <cr>")
vim.keymap.set("n", "<leader>jc", "<cmd>Neorg journal custom <cr>")
vim.keymap.set("n", "<leader>jn", "<cmd>Neorg journal tomorrow <cr>")
vim.keymap.set("n", "<leader>jp", "<cmd>Neorg journal yesterday <cr>")
vim.keymap.set("n", "<leader>jt", "<cmd>Neorg journal template <cr>")
end,
opts = {
load = {
["core.defaults"] = {},
["core.concealer"] = { config = { icon_preset = "diamond" } },
["core.dirman"] = { config = { workspaces = { personal = "~/notes/personal", work = "~/notes/work" } } },
["core.completion"] = { config = { engine = "nvim-cmp" } },
["core.journal"] = {},
["core.presenter"] = { config = { zen_mode = "zen-mode" } },
["core.ui.calendar"] = {},
},
},
}

View file

@ -0,0 +1,12 @@
return {
"nvim-neotest/neotest",
lazy = true,
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter",
-- "antoinemadec/FixCursorHold.nvim",
"nvim-neotest/neotest-python",
},
config = true,
opts = function() return { adapters = { require "neotest-python" } } end,
}

View file

@ -0,0 +1,17 @@
return {
"stevearc/oil.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
cmd = "Oil",
init = function()
vim.keymap.set("n", "<leader>o", "<cmd>Oil<cr>")
if vim.fn.argc() == 1 then
local stat = vim.loop.fs_stat(vim.fn.argv(0))
if stat and stat.type == "directory" then require "oil" end
end
end,
config = true,
opts = {
columns = { "icon", "permissions" },
view_options = { show_hidden = true },
},
}

View file

@ -0,0 +1,13 @@
return {
"ahmedkhalf/project.nvim",
name = "project_nvim",
event = { "BufReadPre", "BufNewFile" },
config = true,
opts = {
detection_methods = { "lsp", "pattern" },
patterns = { ".git", "_darcs", ".hg", ".bzr", ".svn", "Makefile", "package.json", "index.norg" },
ignore_lsp = { "null-ls" },
show_hidden = true,
silent_chdir = true,
},
}

View file

@ -0,0 +1,27 @@
return {
"nvim-pack/nvim-spectre",
cmd = "Spectre",
dependencies = { "nvim-lua/plenary.nvim" },
init = function()
vim.keymap.set("n", "<leader>so", '<cmd>lua require("spectre").open()<CR>', { desc = "Open Spectre" })
vim.keymap.set(
"n",
"<leader>sw",
'<cmd>lua require("spectre").open_visual({select_word=true})<CR>',
{ desc = "Search current word" }
)
vim.keymap.set(
"v",
"<leader>sw",
'<esc><cmd>lua require("spectre").open_visual()<CR>',
{ desc = "Search current word" }
)
vim.keymap.set(
"n",
"<leader>sp",
'<cmd>lua require("spectre").open_file_search({select_word=true})<CR>',
{ desc = "Search on current file" }
)
end,
config = true,
}

View file

@ -0,0 +1,7 @@
return {
"simrat39/symbols-outline.nvim",
cmd = "SymbolsOutline",
dependencies = { "neovim/nvim-lspconfig" },
init = function() vim.keymap.set("n", "<leader>no", "<cmd>SymbolsOutline <cr>") end,
config = true,
}

View file

@ -0,0 +1,18 @@
local browser = function(report)
-- Return function to call taskwarrior browser with given report
return function() require("taskwarrior_nvim").browser { report } end
end
return {
"ColonQExclamationMark/taskwarrior.nvim",
branch = "1-Issues-initializing", -- Temp until PR is merged upstream
dependencies = { "nvim-telescope/telescope.nvim" },
cmd = "Task",
init = function()
vim.keymap.set("n", "<leader>tr", browser "ready")
vim.keymap.set("n", "<leader>ta", browser "active")
vim.keymap.set("n", "<leader>tn", browser "next")
end,
opts = {},
config = function() require("taskwarrior_nvim").setup() end,
}

View file

@ -0,0 +1,45 @@
return {
"nvim-telescope/telescope.nvim",
branch = "0.1.x",
dependencies = {
{
{ "nvim-lua/plenary.nvim" },
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
{ "tsakirist/telescope-lazy.nvim", dependencies = { "folke/lazy.nvim" } },
{ "benfowler/telescope-luasnip.nvim", dependencies = { "L3MON4D3/LuaSnip" } },
},
},
cmd = "Telescope",
init = function()
vim.keymap.set("n", "<leader>ff", "<cmd>Telescope find_files<cr>")
vim.keymap.set("n", "<leader>fh", "<cmd>Telescope help_tags<cr>")
vim.keymap.set("n", "<leader>fr", "<cmd>Telescope oldfiles<cr>")
vim.keymap.set("n", "<leader>fg", "<cmd>Telescope live_grep<cr>")
vim.keymap.set("n", "<leader>fs", "<cmd>Telescope lsp_document_symbols<cr>")
vim.keymap.set("n", "<leader>ft", "<cmd>Telescope treesitter<cr>")
vim.keymap.set("n", "<leader>fz", "<cmd>Telescope current_buffer_fuzzy_find<cr>")
vim.keymap.set("n", "<leader>fl", "<cmd>Telescope lazy<cr>")
end,
config = function()
local trouble = require "trouble.providers.telescope"
require("telescope").setup {
defaults = {
layout_strategy = "flex",
mappings = {
i = { ["<c-t>"] = trouble.open_with_trouble },
n = { ["<c-t>"] = trouble.open_with_trouble },
},
winblend = vim.o.winblend,
},
extensions = {
fzf = {
fuzzy = true, -- false will only do exact matching
override_generic_sorter = true, -- override the generic sorter
override_file_sorter = true, -- override the file sorter
},
},
}
require("telescope").load_extension "fzf"
require("telescope").load_extension "lazy"
end,
}

View file

@ -0,0 +1,7 @@
return {
"akinsho/toggleterm.nvim",
version = "*",
cmd = { "ToggleTerm" },
init = function() vim.keymap.set("n", "<leader>tt", "<cmd>ToggleTerm<CR>") end,
opts = { direction = "horizontal" },
}

View file

@ -0,0 +1,11 @@
return {
"folke/tokyonight.nvim",
lazy = true,
config = true,
opts = {
style = "night",
transparent = not vim.g.neovide,
terminal_colors = true,
styles = { sidebars = "transparent", floats = "transparent" },
},
}

View file

@ -0,0 +1,60 @@
local options = {
highlight = {
enable = true,
disable = { "fortran" },
additional_vim_regex_highlighting = false,
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "gnn",
node_incremental = "gnr",
scope_incremental = "gnc",
node_decremental = "gnm",
},
},
indent = {
enable = true,
},
refactor = {
smart_rename = {
enable = true,
keymaps = {
smart_rename = "grr",
},
},
navigation = {
enable = true,
keymaps = {
goto_definition_lsp_fallback = "gnd",
},
},
},
}
if vim.fn.executable "nix" == 1 then
options.auto_install = true
options.ensure_installed = "all"
end
return {
"nvim-treesitter/nvim-treesitter",
version = false,
build = ":TSUpdate",
cmd = { "TSUpdate", "TSInstall" },
event = { "BufReadPre", "BufNewFile" },
dependencies = "nvim-treesitter/nvim-treesitter-refactor",
config = function(_, opts)
if type(opts.ensure_installed) == "table" then
-- @type table<string, boolean>
local added = {}
opts.ensure_installed = vim.tbl_filter(function(lang)
if added[lang] then return false end
added[lang] = true
return true
end, opts.ensure_installed)
end
require("nvim-treesitter.configs").setup(opts)
end,
opts = options,
}

View file

@ -0,0 +1,15 @@
return {
"folke/trouble.nvim",
dependencies = "nvim-tree/nvim-web-devicons",
cmd = "TroubleToggle",
init = function() vim.keymap.set("n", "<leader>xx", "<cmd>TroubleToggle<cr>") end,
config = true,
opts = {
mode = "workspace_diagnostics",
auto_open = false,
auto_close = true,
auto_preview = true,
auto_jump = { "lsp_definitions" },
use_diagnostic_signs = true,
},
}

View file

@ -0,0 +1,7 @@
return {
"folke/twilight.nvim",
dependencies = { "nvim-treesitter" },
cmd = "Twilight",
config = true,
opts = { context = 10, treesitter = true },
}

View file

@ -0,0 +1,9 @@
return {
"folke/which-key.nvim",
keys = { "<leader>" },
init = function()
vim.o.timeout = true
vim.o.timeoutlen = 300
end,
config = true,
}

View file

@ -0,0 +1,42 @@
return {
"gelguy/wilder.nvim",
dependencies = {
"romgrk/fzy-lua-native",
},
config = function()
local wilder = require "wilder"
wilder.setup { modes = { "/", "?", ":" } }
-- Disable Python remote plugin
wilder.set_option("use_python_remote_plugin", 0)
wilder.set_option("pipeline", {
wilder.branch(
wilder.cmdline_pipeline {
fuzzy = 1,
fuzzy_filter = wilder.lua_fzy_filter(),
},
wilder.vim_search_pipeline()
),
})
wilder.set_option(
"renderer",
wilder.renderer_mux {
[":"] = wilder.popupmenu_renderer(wilder.popupmenu_border_theme {
highlighter = wilder.lua_fzy_highlighter(),
left = {
" ",
wilder.popupmenu_devicons(),
},
right = {
" ",
wilder.popupmenu_scrollbar(),
},
border = "rounded",
min_width = "50%",
}),
["/"] = wilder.wildmenu_renderer {
highlighter = wilder.lua_fzy_highlighter(),
},
}
)
end,
}

View file

@ -0,0 +1,36 @@
return {
"folke/zen-mode.nvim",
dependencies = { "folke/twilight.nvim" },
cmd = { "ZenMode" },
init = function() vim.keymap.set("n", "<leader>z", "<cmd>ZenMode<CR>") end,
config = true,
opts = {
window = {
width = 80,
options = {
signcolumn = "no", -- disable signcolumn
number = false, -- disable number column
relativenumber = false, -- disable relative numbers
cursorline = false, -- disable cursorline
cursorcolumn = false, -- disable cursor column
foldcolumn = "0", -- disable fold column
list = false, -- disable whitespace characters
},
},
plugins = {
options = {
enabled = true,
ruler = false,
showcmd = false,
},
twilight = { enabled = true },
gitsigns = { enabled = true },
wezterm = {
enabled = false,
font = "+4", -- (10% increase per step)
},
},
on_open = function(win) vim.wo.scrolloff = 999 end,
on_close = function(win) vim.wo.scrolloff = -1 end,
},
}

View file

@ -0,0 +1,9 @@
vim.opt.fillchars:append {
horiz = "",
horizup = "",
horizdown = "",
vert = "",
vertleft = "",
vertright = "",
verthoriz = "",
}

View file

@ -0,0 +1 @@
return { Error = "", Warn = "", Info = "", Hint = "" }

View file

@ -0,0 +1,28 @@
return {
File = "",
Module = "",
Namespace = "",
Package = "",
Class = "",
Method = "",
Property = "",
Field = "",
Constructor = "",
Enum = "",
Interface = "",
Function = "",
Variable = "",
Constant = "",
String = "",
Number = "",
Boolean = "",
Array = "",
Object = "",
Key = "",
Null = "",
EnumMember = "",
Struct = "",
Event = "",
Operator = "",
TypeParameter = "",
}

View file

@ -0,0 +1,14 @@
vim.opt.winblend = 20
vim.opt.pumblend = 20
vim.g.neovide_padding_top = 5
vim.g.neovide_padding_bottom = 5
vim.g.neovide_padding_left = 5
vim.g.neovide_padding_right = 5
vim.g.neovide_transparency = 0.8
vim.g.neovide_floating_blur_amount_x = 2.0
vim.g.neovide_floating_blur_amount_y = 2.0
vim.g.neovide_hide_mouse_when_typing = false
vim.g.neovide_remember_window_size = false

48
home/neovim/default.nix Normal file
View file

@ -0,0 +1,48 @@
{ pkgs, ... }: {
xdg.configFile.nvim = {
source = ./config;
recursive = true;
};
programs.neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
withNodeJs = true;
withRuby = true;
withPython3 = true;
extraPackages = with pkgs; [
# Misc utils
curl
fzf
git
gnutar
gnumake
gnused
gcc
ripgrep
tree-sitter
# Language servers
nil
lua-language-server
fortls
nodePackages.pyright
nodePackages.yaml-language-server
nodePackages.vim-language-server
nodePackages.bash-language-server
# Null LSP formatters
alejandra
beautysh
black
nodePackages.fixjson
fprettify
isort
python3Packages.mdformat
shellharden
stylua
];
};
}