Adds nvim config as home manager module

This commit is contained in:
Dennis Schoepf 2025-01-24 21:49:07 +01:00
parent 5a9ad9bbd1
commit 98f4a6679e
34 changed files with 1260 additions and 0 deletions

View file

@ -0,0 +1,5 @@
setlocal expandtab
setlocal smartindent
setlocal tabstop=2
setlocal shiftwidth=2
setlocal conceallevel=2

View file

@ -0,0 +1,16 @@
--[[
Config Author: Dennis Schoepf
Version: 1.0.0
]]
--
require("dnsc.lazy")
require("dnsc.utils")
require("dnsc.keymaps")

View file

@ -0,0 +1,48 @@
{
"LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" },
"barbar.nvim": { "branch": "master", "commit": "53b5a2f34b68875898f0531032fbf090e3952ad7" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
"cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
"gitlinker.nvim": { "branch": "master", "commit": "296ad98061ca31706a7d890a0f13baed6e137c79" },
"gitsigns.nvim": { "branch": "main", "commit": "d8918f06624dd53b9a82bd0e29c31bcfd541b40d" },
"go.nvim": { "branch": "master", "commit": "6e5a74b866aa4a112ed85a1169befff2ef82c027" },
"guihua.lua": { "branch": "master", "commit": "d783191eaa75215beae0c80319fcce5e6b3beeda" },
"harpoon": { "branch": "harpoon2", "commit": "a84ab829eaf3678b586609888ef52f7779102263" },
"indent-blankline.nvim": { "branch": "master", "commit": "e10626f7fcd51ccd56d7ffc00883ba7e0aa28f78" },
"lazy.nvim": { "branch": "main", "commit": "d8f26efd456190241afd1b0f5235fe6fdba13d4a" },
"lazygit.nvim": { "branch": "main", "commit": "77a0d42943d8265271e6e6beaed72da54eeb17e7" },
"lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "e942edf5c85b6a2ab74059ea566cac5b3e1514a4" },
"mason-null-ls.nvim": { "branch": "main", "commit": "de19726de7260c68d94691afb057fa73d3cc53e7" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"mini.pairs": { "branch": "main", "commit": "7e834c5937d95364cc1740e20d673afe2d034cdb" },
"none-ls-extras.nvim": { "branch": "main", "commit": "6557f20e631d2e9b2a9fd27a5c045d701a3a292c" },
"none-ls.nvim": { "branch": "main", "commit": "ed8f80849ef1ad31c2f74679fafdef7801091247" },
"nvim-cmp": { "branch": "main", "commit": "12509903a5723a876abd65953109f926f4634c30" },
"nvim-lspconfig": { "branch": "master", "commit": "0ef64599b8aa0187ee5f6d92cb39c951f348f041" },
"nvim-surround": { "branch": "main", "commit": "ae298105122c87bbe0a36b1ad20b06d417c0433e" },
"nvim-treesitter": { "branch": "master", "commit": "51562d44fc6280f92bb9a3d87e7b3cb327377ca5" },
"nvim-web-devicons": { "branch": "master", "commit": "aafa5c187a15701a7299a392b907ec15d9a7075f" },
"obsidian.nvim": { "branch": "main", "commit": "ae1f76a75c7ce36866e1d9342a8f6f5b9c2caf9b" },
"oil.nvim": { "branch": "master", "commit": "52f1683c7664819508e1d2fc85051d4a20c5d643" },
"orgmode": { "branch": "master", "commit": "056c21762df23e4f2263aca0c717a064fd2095ff" },
"plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" },
"rose-pine": { "branch": "main", "commit": "42f0724e0bca9f57f0bcfa688787c37b8d4befe8" },
"schemastore.nvim": { "branch": "main", "commit": "bb52c530698654355bbddb9f0035dc35cea401a5" },
"substitute.nvim": { "branch": "main", "commit": "97f49d16f8eea7967d41db4f657dd63af53eeba1" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "dae2eac9d91464448b584c7949a31df8faefec56" },
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
"todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" },
"vim-cool": { "branch": "master", "commit": "662e7b11064cbeedad17c45d2fe926e78d3cd0b6" },
"vim-dadbod": { "branch": "master", "commit": "96997dac981d50717a63d4dbd48d4a43e09ecf57" },
"vim-dadbod-completion": { "branch": "master", "commit": "95cbcf21ea7a5c8c025f387280c2e261b8cb3a89" },
"vim-dadbod-ssh": { "branch": "master", "commit": "9bce775ee76c3dd6d7508dcd9eb276b36133d710" },
"vim-dadbod-ui": { "branch": "master", "commit": "65454e2011c029922c2c972d63f8bf04282de033" },
"vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" },
"which-key.nvim": { "branch": "main", "commit": "6cebd86917df559a88de0f806b2989799c6e6423" },
"zen-mode.nvim": { "branch": "main", "commit": "863f150ca321b3dd8aa1a2b69b5f411a220e144f" }
}

View file

@ -0,0 +1,8 @@
local opts = { noremap = true, silent = true, expr = true }
vim.keymap.set("n", "k", "v:count == 0 ? 'gk' : 'k'", opts)
vim.keymap.set("n", "j", "v:count == 0 ? 'gj' : 'j'", opts)
vim.keymap.set("n", "<C-d>", "<C-d>zz")
vim.keymap.set("n", "<C-u>", "<C-u>zz")
vim.keymap.set("n", "n", "nzzzv")
vim.keymap.set("n", "N", "Nzzzv")

View file

@ -0,0 +1,79 @@
-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
local opts = { noremap = true, silent = true, expr = true }
vim.g.mapleader = " "
vim.g.maplocalleader = " "
vim.keymap.set("", "<Space>", "<Nop>", opts)
local options = {
backup = false, -- creates a backup file
clipboard = "unnamedplus", -- allows neovim to access the system clipboard
cmdheight = 1, -- more space in the neovim command line for displaying messages
completeopt = { "menu", "menuone", "noselect" }, -- mostly just for cmp
conceallevel = 0, -- so that `` is visible in markdown files
fileencoding = "utf-8", -- the encoding written to a file
hlsearch = true, -- highlight all matches on previous search pattern
ignorecase = true, -- ignore case in search patterns
mouse = "a", -- allow the mouse to be used in neovim
pumheight = 10, -- pop up menu height
showmode = false, -- we don't need to see things like -- INSERT -- anymore
smartindent = true,
breakindent = true,
showtabline = 0, -- always show tabs
smartcase = true, -- smart case
splitbelow = true, -- force all horizontal splits to go below current window
splitright = true, -- force all vertical splits to go to the right of current window
swapfile = false, -- creates a swapfile
termguicolors = true, -- set term gui colors (most terminals support this)
timeoutlen = 200, -- time to wait for a mapped sequence to complete (in milliseconds)
undofile = true, -- enable persistent undo
updatetime = 230, -- faster completion (4000ms default)
writebackup = false, -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited
expandtab = true, -- convert tabs to spaces
shiftwidth = 2, -- the number of spaces inserted for each indentation
tabstop = 2, -- insert 2 spaces for a tab
cursorline = true, -- highlight the current line
number = true, -- set numbered lines
relativenumber = true, -- set relative numbered lines
numberwidth = 4, -- set number column width to 2 {default 4}
signcolumn = "yes", -- always show the sign column, otherwise it would shift the text each time
linebreak = true,
breakat = " ^I!@*-+;:,./?",
scrolloff = 6, -- is one of my fav
sidescrolloff = 4,
winbar = nil,
}
vim.opt.shortmess:append("c")
for k, v in pairs(options) do
vim.opt[k] = v
end
-- Setup lazy.nvim
require("lazy").setup({
spec = {
{ import = "plugins" },
},
-- Configure any other settings here. See the documentation for more details.
-- colorscheme that will be used when installing plugins.
install = { colorscheme = { "rose-pine" } },
-- automatically check for plugin updates
checker = { enabled = true },
})

View file

@ -0,0 +1,5 @@
local opts = { noremap = true, silent = true, expr = true }
vim.g.mapleader = " "
vim.g.maplocalleader = " "
vim.keymap.set("", "<Space>", "<Nop>", opts)

View file

@ -0,0 +1,44 @@
local options = {
backup = false, -- creates a backup file
clipboard = "unnamedplus", -- allows neovim to access the system clipboard
cmdheight = 1, -- more space in the neovim command line for displaying messages
completeopt = { "menu", "menuone", "noselect" }, -- mostly just for cmp
conceallevel = 0, -- so that `` is visible in markdown files
fileencoding = "utf-8", -- the encoding written to a file
hlsearch = true, -- highlight all matches on previous search pattern
ignorecase = true, -- ignore case in search patterns
mouse = "a", -- allow the mouse to be used in neovim
pumheight = 10, -- pop up menu height
showmode = false, -- we don't need to see things like -- INSERT -- anymore
smartindent = true,
breakindent = true,
showtabline = 0, -- always show tabs
smartcase = true, -- smart case
splitbelow = true, -- force all horizontal splits to go below current window
splitright = true, -- force all vertical splits to go to the right of current window
swapfile = false, -- creates a swapfile
termguicolors = true, -- set term gui colors (most terminals support this)
timeoutlen = 200, -- time to wait for a mapped sequence to complete (in milliseconds)
undofile = true, -- enable persistent undo
updatetime = 230, -- faster completion (4000ms default)
writebackup = false, -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited
expandtab = true, -- convert tabs to spaces
shiftwidth = 2, -- the number of spaces inserted for each indentation
tabstop = 2, -- insert 2 spaces for a tab
cursorline = true, -- highlight the current line
number = true, -- set numbered lines
relativenumber = true, -- set relative numbered lines
numberwidth = 4, -- set number column width to 2 {default 4}
signcolumn = "yes", -- always show the sign column, otherwise it would shift the text each time
linebreak = true,
breakat = " ^I!@*-+;:,./?",
scrolloff = 6, -- is one of my fav
sidescrolloff = 4,
winbar = nil,
}
vim.opt.shortmess:append("c")
for k, v in pairs(options) do
vim.opt[k] = v
end

View file

@ -0,0 +1,39 @@
-- Highlight on yank
local highlight_group = vim.api.nvim_create_augroup("YankHighlight", { clear = true })
vim.api.nvim_create_autocmd("TextYankPost", {
callback = function()
vim.highlight.on_yank()
end,
group = highlight_group,
pattern = "*",
})
local function filter(arr, fn)
if type(arr) ~= "table" then
return arr
end
local filtered = {}
for k, v in pairs(arr) do
if fn(v, k, arr) then
table.insert(filtered, v)
end
end
return filtered
end
local function filterReactDTS(value)
-- Depending on typescript version either uri or targetUri is returned
if value.uri then
return string.match(value.uri, "%.d.ts") == nil
elseif value.targetUri then
return string.match(value.targetUri, "%.d.ts") == nil
end
end
return {
filter = filter,
filterReactDTS = filterReactDTS,
}

View file

@ -0,0 +1,18 @@
return {
"romgrk/barbar.nvim",
dependencies = {
"lewis6991/gitsigns.nvim", -- OPTIONAL: for git status
"nvim-tree/nvim-web-devicons", -- OPTIONAL: for file icons
},
init = function()
vim.g.barbar_auto_setup = false
end,
opts = {
animation = false,
auto_hide = false,
maximum_length = 35,
icons = { filetype = { enabled = false }, button = "", modified = { button = "m" } },
highlight_visible = false,
},
version = "^1.0.0", -- optional: only update when a new 1.x version is released
}

View file

@ -0,0 +1,4 @@
return {
"sindrets/diffview.nvim",
opts = {},
}

View file

@ -0,0 +1,5 @@
return {
"linrongbin16/gitlinker.nvim",
cmd = "GitLink",
opts = {},
}

View file

@ -0,0 +1,42 @@
return {
"lewis6991/gitsigns.nvim",
opts = {
signs = {
add = { text = "" },
change = { text = "" },
delete = { text = "_" },
topdelete = { text = "" },
changedelete = { text = "~" },
untracked = { text = "" },
},
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
watch_gitdir = {
interval = 1000,
follow_files = true,
},
attach_to_untracked = true,
current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
current_line_blame_opts = {
virt_text = true,
virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align'
delay = 1000,
ignore_whitespace = false,
},
current_line_blame_formatter = "<author>, <author_time:%Y-%m-%d> - <summary>",
sign_priority = 6,
update_debounce = 100,
status_formatter = nil, -- Use default
max_file_length = 40000, -- Disable if file is longer than this (in lines)
preview_config = {
-- Options passed to nvim_open_win
border = "single",
style = "minimal",
relative = "cursor",
row = 0,
col = 1,
},
},
}

View file

@ -0,0 +1,22 @@
return {
"ray-x/go.nvim",
dependencies = { -- optional packages
"ray-x/guihua.lua",
"neovim/nvim-lspconfig",
"nvim-treesitter/nvim-treesitter",
},
event = { "CmdlineEnter" },
ft = { "go", "gomod" },
build = ':lua require("go.install").update_all_sync()', -- if you need to install/update all binaries
opts = {},
init = function()
local format_sync_grp = vim.api.nvim_create_augroup("goimports", {})
vim.api.nvim_create_autocmd("BufWritePre", {
pattern = "*.go",
callback = function()
require("go.format").goimports()
end,
group = format_sync_grp,
})
end,
}

View file

@ -0,0 +1,39 @@
return {
"ThePrimeagen/harpoon",
branch = "harpoon2",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
local harpoon = require("harpoon")
harpoon:setup()
vim.keymap.set("n", "<leader>ha", function()
harpoon:list():add()
end)
vim.keymap.set("n", "<leader>hx", function()
harpoon:list():select(1)
end)
vim.keymap.set("n", "<leader>hc", function()
harpoon:list():select(2)
end)
vim.keymap.set("n", "<leader>hv", function()
harpoon:list():select(3)
end)
vim.keymap.set("n", "<leader>hs", function()
harpoon:list():select(4)
end)
vim.keymap.set("n", "<leader>hp", function()
harpoon:list():prev()
end)
vim.keymap.set("n", "<leader>hn", function()
harpoon:list():next()
end)
vim.keymap.set("n", "<leader>hh", function()
harpoon.ui:toggle_quick_menu(harpoon:list())
end)
end,
}

View file

@ -0,0 +1,4 @@
return {
"romainl/vim-cool",
"tpope/vim-sleuth",
}

View file

@ -0,0 +1,16 @@
return {
"lukas-reineke/indent-blankline.nvim",
main = "ibl",
---@module "ibl"
---@type ibl.config
opts = {
indent = {
smart_indent_cap = false,
char = "",
},
scope = {
show_start = false,
show_end = false,
},
},
}

View file

@ -0,0 +1,19 @@
return {
"kdheepak/lazygit.nvim",
cmd = {
"LazyGit",
"LazyGitConfig",
"LazyGitCurrentFile",
"LazyGitFilter",
"LazyGitFilterCurrentFile",
},
-- optional for floating window border decoration
dependencies = {
"nvim-lua/plenary.nvim",
},
-- setting the keybinding for LazyGit with 'keys' is recommended in
-- order to load the plugin when the command is run for the first time
keys = {
{ "<leader>lg", "<cmd>LazyGit<cr>", desc = "LazyGit" },
},
}

View file

@ -0,0 +1,268 @@
return {
"neovim/nvim-lspconfig",
version = "0.1.9",
dependencies = {
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/nvim-cmp",
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
"b0o/schemastore.nvim",
},
config = function()
local lspconfig = require("lspconfig")
local luasnip = require("luasnip")
local dnscUtils = require("dnsc.utils")
local lspUtils = require("lspconfig.util")
local cmp = require("cmp")
local capabilities = require("cmp_nvim_lsp").default_capabilities()
local servers = {
"angularls",
"ts_ls",
"lua_ls",
"jsonls",
"html",
"cssls",
"tailwindcss",
"gopls",
"astro",
"tinymist",
}
require("mason").setup()
-- Automatic Server Installation with Mason
require("mason-lspconfig").setup({
ensure_installed = servers,
automatic_installation = true,
})
-- LANGUAGE SERVERS
-- Lua
lspconfig.lua_ls.setup({
capabilities = capabilities,
settings = {
Lua = {
diagnostics = {
globals = { "vim" },
},
telemetry = {
enable = false,
},
},
},
})
-- Typescript
lspconfig.tsserver.setup({
capabilities = capabilities,
root_dir = lspUtils.root_pattern("package.json"),
init_options = {
preferences = {
importModuleSpecifierPreference = "relative",
importModuleSpecifierEnding = "minimal",
},
},
handlers = {
["textDocument/definition"] = function(err, result, method, ...)
if vim.tbl_islist(result) and #result > 1 then
local filtered_result = dnscUtils.filter(result, dnscUtils.filterReactDTS)
return vim.lsp.handlers["textDocument/definition"](err, filtered_result, method, ...)
end
vim.lsp.handlers["textDocument/definition"](err, result, method, ...)
end,
},
})
-- JSON
lspconfig.jsonls.setup({
capabilities = capabilities,
settings = {
json = {
schemas = require("schemastore").json.schemas(),
validate = { enable = true },
},
},
})
-- HTML
lspconfig.html.setup({
capabilities = capabilities,
})
-- Astro
lspconfig.astro.setup({})
-- Tailwind
lspconfig.tailwindcss.setup({})
-- Typst
lspconfig.tinymist.setup({
single_file_support = true,
root_dir = function()
return vim.fn.getcwd()
end,
settings = {},
})
-- CSS
lspconfig.cssls.setup({})
-- Angular
lspconfig.angularls.setup({})
-- Go
lspconfig.gopls.setup({
capabilities = capabilities,
})
-- Run gofmt + goimports on save
local format_sync_grp = vim.api.nvim_create_augroup("goimports", {})
vim.api.nvim_create_autocmd("BufWritePre", {
pattern = "*.go",
callback = function()
require("go.format").goimports()
end,
group = format_sync_grp,
})
-- LSP Keybindings
-- Global mappings.
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
vim.keymap.set("n", "<space>e", vim.diagnostic.open_float)
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev)
vim.keymap.set("n", "]d", vim.diagnostic.goto_next)
vim.keymap.set("n", "<space>q", vim.diagnostic.setloclist)
-- Use LspAttach autocommand to only map the following keys
-- after the language server attaches to the current buffer
vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
callback = function(ev)
-- Enable completion triggered by <c-x><c-o>
vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc"
-- Buffer local mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions
local opts = { buffer = ev.buf }
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts)
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts)
vim.keymap.set("n", "<C-k>", vim.lsp.buf.signature_help, opts)
vim.keymap.set("n", "<space>D", vim.lsp.buf.type_definition, opts)
vim.keymap.set("n", "<space>rn", vim.lsp.buf.rename, opts)
vim.keymap.set({ "n", "v" }, "<space>ca", vim.lsp.buf.code_action, opts)
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
vim.keymap.set("n", "<space>f", function()
vim.lsp.buf.format({ async = true })
end, opts)
end,
})
cmp.setup({
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body) -- For `luasnip` users.
end,
},
formatting = {
format = function(entry, vim_item)
-- Kind icons
vim_item.kind = string.format("%s ", vim_item.kind) -- This concatenates the icons with the name of the item kind
-- Source
vim_item.menu = ({
buffer = "[Buffer]",
nvim_lsp = "[LSP]",
luasnip = "[Snip]",
nvim_lua = "[Lua]",
})[entry.source.name]
return vim_item
end,
},
mapping = cmp.mapping.preset.insert({
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping(function(fallback)
if cmp.visible() then
if luasnip.expandable() then
luasnip.expand()
else
cmp.confirm({
select = true,
})
end
else
fallback()
end
end),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.locally_jumpable(1) then
luasnip.jump(1)
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
}),
sources = cmp.config.sources({
{ name = "nvim_lsp", keyword_length = 1 },
{ name = "path" },
{ name = "buffer", keyword_length = 3 },
{ name = "luasnip" }, -- For luasnip users.
}),
})
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline({ "/", "?" }, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = "buffer" },
},
})
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "path" },
}, {
{ name = "cmdline" },
}),
})
-- Set up vim-dadbod completions
cmp.setup.filetype({ "sql", "mysql", "psql" }, {
sources = {
{ name = "vim-dadbod-completion" },
{ name = "buffer" },
},
})
-- Set up org mode
cmp.setup.filetype({ "org" }, {
sources = {
{ name = "orgmode" },
},
})
end,
}

View file

@ -0,0 +1,19 @@
return {
"nvim-lualine/lualine.nvim",
opts = {
options = {
icons_enabled = false,
-- globalstatus = true
component_separators = { left = "|", right = "|" },
section_separators = { left = "", right = "" },
},
sections = {
lualine_a = { "mode" },
lualine_b = {},
lualine_c = { "branch", "diff", "diagnostics" },
lualine_x = { "filetype", "encoding" },
lualine_y = {},
lualine_z = { "location" },
},
},
}

View file

@ -0,0 +1,4 @@
return {
"echasnovski/mini.pairs",
opts = {},
}

View file

@ -0,0 +1,93 @@
return {
"jay-babu/mason-null-ls.nvim",
event = { "BufReadPre", "BufNewFile" },
dependencies = {
"williamboman/mason.nvim",
"nvimtools/none-ls.nvim",
"nvimtools/none-ls-extras.nvim",
"neovim/nvim-lspconfig",
},
config = function()
local lsp = require("lspconfig")
local null_ls = require("null-ls")
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
local string_starts_with = function(str, start)
return string.sub(str, 1, #start) == start
end
local create_runtime_condition = function(config_names)
local bufnr_cache = {}
local config_path_cache = {}
return function(params)
if bufnr_cache[params.bufnr] ~= nil then
return bufnr_cache[params.bufnr]
else
for _, cached_config_path in ipairs(config_path_cache) do
if string_starts_with(params.bufname, cached_config_path) then
bufnr_cache[params.bufnr] = true
return true
end
end
end
local config_path = lsp.util.root_pattern(config_names)(params.bufname)
local has_config = config_path ~= nil
if has_config then
table.insert(config_path_cache, config_path)
end
bufnr_cache[params.bufnr] = has_config
return has_config
end
end
local eslint_runtime_condition = create_runtime_condition({
".eslintrc.cjs",
".eslintrc.js",
".eslintrc.json",
".eslintrc.yaml",
".eslintrc.yml",
})
require("null-ls").setup({
root_dir = require("null-ls.utils").root_pattern(".null-ls-root", "package.json", ".git"),
sources = {
-- null_ls.builtins.diagnostics.markdownlint,
null_ls.builtins.formatting.prettierd,
require("none-ls.code_actions.eslint_d"),
require("none-ls.diagnostics.eslint_d").with({
runtime_condition = eslint_runtime_condition,
}),
require("none-ls.formatting.eslint_d").with({
runtime_condition = eslint_runtime_condition,
}),
null_ls.builtins.formatting.stylua,
},
on_attach = function(current_client, bufnr)
if current_client.supports_method("textDocument/formatting") then
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
vim.api.nvim_create_autocmd("BufWritePre", {
group = augroup,
buffer = bufnr,
callback = function()
vim.lsp.buf.format({
bufnr = bufnr,
filter = function(client)
return client.name == "null-ls"
end,
})
end,
})
end
end,
})
require("mason-null-ls").setup({
ensure_installed = nil,
automatic_installation = true,
})
end,
}

View file

@ -0,0 +1,6 @@
return {
"kylechui/nvim-surround",
version = "*", -- Use for stability; omit to use `main` branch for the latest features
event = "VeryLazy",
opts = {},
}

View file

@ -0,0 +1,28 @@
return {
"epwalsh/obsidian.nvim",
version = "*", -- recommended, use latest release instead of latest commit
lazy = true,
ft = "markdown",
event = {
"BufReadPre /home/dennis/notes/**.md",
"BufNewFile /home/dennis/notes/**.md",
},
opts = {
workspaces = {
{
name = "notes",
path = "~/notes",
},
},
daily_notes = {
-- Optional, if you keep daily notes in a separate directory.
folder = "~/notes/001_dailies",
-- Optional, if you want to change the date format for the ID of daily notes.
date_format = "%Y-%m-%d",
-- Optional, if you want to change the date format of the default alias of daily notes.
alias_format = "%B %-d, %Y",
-- Optional, if you want to automatically insert a template from your template directory like 'daily.md'
template = nil,
},
},
}

View file

@ -0,0 +1,8 @@
return {
"stevearc/oil.nvim",
opts = {
keymaps = {
["q"] = "actions.close",
},
},
}

View file

@ -0,0 +1,16 @@
return {
"gbprod/substitute.nvim",
opts = {
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
},
config = function()
require("substitute").setup({})
vim.keymap.set("n", "s", require("substitute").operator, { noremap = true })
vim.keymap.set("n", "ss", require("substitute").line, { noremap = true })
vim.keymap.set("n", "S", require("substitute").eol, { noremap = true })
vim.keymap.set("x", "s", require("substitute").visual, { noremap = true })
end,
}

View file

@ -0,0 +1,20 @@
return {
"nvim-telescope/telescope.nvim",
tag = "0.1.8",
dependencies = {
"nvim-lua/plenary.nvim",
{
"nvim-telescope/telescope-fzf-native.nvim",
build = "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build",
},
},
opts = {
pickers = {},
extensions = {
fzf = {},
},
},
init = function()
require("telescope").load_extension("fzf")
end,
}

View file

@ -0,0 +1,58 @@
return {
{
"rose-pine/neovim",
name = "rose-pine",
config = function()
require("rose-pine").setup({
variant = "auto", -- auto, main, moon, or dawn
dark_variant = "main", -- main, moon, or dawn
dim_inactive_windows = false,
extend_background_behind_borders = true,
enable = {
terminal = true,
migrations = true,
},
styles = {
bold = true,
italic = false,
transparency = true,
},
groups = {
border = "muted",
link = "iris",
panel = "surface",
error = "love",
hint = "iris",
info = "foam",
note = "pine",
todo = "rose",
warn = "gold",
git_add = "foam",
git_change = "rose",
git_delete = "love",
git_dirty = "rose",
git_ignore = "muted",
git_merge = "iris",
git_rename = "pine",
git_stage = "iris",
git_text = "rose",
git_untracked = "subtle",
h1 = "iris",
h2 = "foam",
h3 = "rose",
h4 = "gold",
h5 = "pine",
h6 = "foam",
},
})
vim.cmd("colorscheme rose-pine")
end,
},
}

View file

@ -0,0 +1,7 @@
return {
"folke/todo-comments.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
opts = {
signs = false,
},
}

View file

@ -0,0 +1,97 @@
return {
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function()
local configs = require("nvim-treesitter.configs")
configs.setup({
ensure_installed = {
"angular",
"bash",
"c",
"css",
"diff",
"html",
"javascript",
"jsdoc",
"json",
"jsonc",
"lua",
"luadoc",
"luap",
"markdown",
"markdown_inline",
"printf",
"python",
"query",
"regex",
"toml",
"tsx",
"typescript",
"vim",
"vimdoc",
"xml",
"yaml",
},
auto_install = true,
sync_install = false,
ignore_install = {},
modules = {},
highlight = { enable = true },
indent = { enable = true },
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<c-space>",
node_incremental = "<c-space>",
scope_incremental = "<c-s>",
node_decremental = "<M-space>",
},
},
textobjects = {
select = {
enable = true,
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
keymaps = {
-- You can use the capture groups defined in textobjects.scm
["aa"] = "@parameter.outer",
["ia"] = "@parameter.inner",
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
},
},
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
["]m"] = "@function.outer",
["]]"] = "@class.outer",
},
goto_next_end = {
["]M"] = "@function.outer",
["]["] = "@class.outer",
},
goto_previous_start = {
["[m"] = "@function.outer",
["[["] = "@class.outer",
},
goto_previous_end = {
["[M"] = "@function.outer",
["[]"] = "@class.outer",
},
},
swap = {
enable = true,
swap_next = {
["<leader>a"] = "@parameter.inner",
},
swap_previous = {
["<leader>A"] = "@parameter.inner",
},
},
},
})
end,
}

View file

@ -0,0 +1,20 @@
return {
"kristijanhusak/vim-dadbod-ui",
dependencies = {
"pbogut/vim-dadbod-ssh",
{ "tpope/vim-dadbod", lazy = true },
{ "kristijanhusak/vim-dadbod-completion", ft = { "sql", "mysql", "plsql" }, lazy = true },
},
cmd = {
"DBUI",
"DBUIToggle",
"DBUIAddConnection",
"DBUIFindBuffer",
},
init = function()
vim.g.db_ui_use_nerd_fonts = 1
vim.g.dbs = {
{ name = "freed_dev", url = "sqlite:./freed.db" },
}
end,
}

View file

@ -0,0 +1,185 @@
return {
"folke/which-key.nvim",
event = "VeryLazy",
opts = {
icons = { mappings = false },
},
keys = {
{ "<leader>.", "<cmd>Telescope find_files<cr>", desc = "Find file in dir", mode = "n" },
{ "<leader><leader>", "<cmd>Telescope git_files<cr>", desc = "Find git file", mode = "n" },
{ "<leader>B", "<cmd>Telescope buffers<cr>", desc = "Opens buffers", mode = "n" },
{ "<leader>b", group = "buffer", mode = "n" },
{ "<leader>b,", "<Cmd>BufferMovePrevious<CR>", desc = "Move buffer back", mode = "n" },
{
"<leader>b.",
"<Cmd>BufferMoveNext<CR>",
desc = "Move buffer forward",
mode = "n",
},
{
"<leader>bD",
"<cmd>BufferCloseAllButCurrent<cr>",
desc = "Delete all buffers but current",
mode = "n",
},
{
"<leader>bd",
"<Cmd>BufferClose<CR>",
desc = "Delete current buffer",
mode = "n",
},
{
"<leader>bh",
"<Cmd>BufferPrevious<CR>",
desc = "Go to previous buffer",
mode = "n",
},
{
"<leader>bl",
"<Cmd>BufferNext<CR>",
desc = "Go to next buffer",
mode = "n",
},
{ "<leader>bp", "<cmd>BufferPick<cr>", desc = "Pick a buffer", mode = "n" },
{
"<leader>bx",
"<cmd>BufferCloseAllButPinned<cr>",
desc = "Delete all buffers",
mode = "n",
},
{ "<leader>c", group = "code", mode = "n" },
{ "<leader>ca", ":lua vim.lsp.buf.code_action()<cr>", desc = "Code actions", mode = "n" },
{ "<leader>cd", ":lua require'telescope.builtin'.diagnostics{}<cr>", desc = "Show diagnostics", mode = "n" },
{
"<leader>cf",
":lua require'telescope.builtin'.builtin.lsp_references{}<cr>",
desc = "Show references",
mode = "n",
},
{
"<leader>q",
"<cmd>wq<cr>",
desc = "Close window and buffer",
mode = "n",
},
{ "<leader>f", group = "file", mode = "n" },
{
"<leader>fn",
"<cmd>enew<cr>",
desc = "Create a new file",
mode = "n",
},
{ "<leader>fr", "<cmd>Telescope oldfiles<cr>", desc = "Open Recent File", mode = "n" },
{
"<leader>fs",
"<cmd>w<cr>",
desc = "Save currently opened file",
mode = "n",
},
{ "<leader>g", group = "git", mode = "n" },
{
"<leader>gb",
"<cmd>Gitsigns toggle_current_line_blame<cr>",
desc = "Toggle git line blame",
mode = "n",
},
{ "<leader>gg", "<cmd>LazyGit<CR>", desc = "Opens lazygit", mode = "n" },
{
"<leader>glo",
"<cmd>GitLink!<cr>",
desc = "Open permalink in browser",
mode = "n",
},
{ "<leader>gly", "<cmd>GitLink<cr>", desc = "Copy permalink", mode = "n" },
{
"<leader>n",
"<cmd>Oil --float<cr>",
desc = "Open file browser",
mode = "n",
},
{ "<leader>q", "<cmd>qa!<cr>", desc = "Leave neovim", mode = "n" },
{ "<leader>s", group = "search", mode = "n" },
{ "<leader>sb", ":lua require'telescope.builtin'.buffers{}<cr>", desc = "Find buffer", mode = "n" },
{ "<leader>ss", "<cmd>Telescope live_grep<CR>", desc = "Live Grep", mode = "n" },
{
"<leader>sw",
"<cmd>Telescope grep_string<cr>",
desc = "Search current word",
mode = "n",
},
{ "<leader>t", group = "diagnostics (lsp)", mode = "n" },
{
"<leader>td",
"<cmd>Telescope diagnostics<cr>",
desc = "Show LSP diagnostics",
mode = "n",
},
{ "<leader>ta", "<cmd>TodoQuickFix<cr>", desc = "Show all todo comments", mode = "n" },
{ "<leader>tt", "<cmd>TodoTelescope<cr>", desc = "Show all todo comments (Telescope)", mode = "n" },
{ "<leader>w", group = "window", mode = "n" },
{
"<leader>w+",
":vertical resize +4<CR>",
desc = "Increase window size",
mode = "n",
},
{
"<leader>w-",
":vertical resize -4<CR>",
desc = "Decrease window size",
mode = "n",
},
{
"<leader>wd",
"<C-W>q",
desc = "Close active window",
mode = "n",
},
{
"<leader>wh",
"<C-W>h",
desc = "Move to window on left",
mode = "n",
},
{
"<leader>wj",
"<C-W>j",
desc = "Move to window on bottom",
mode = "n",
},
{
"<leader>wk",
"<C-W>k",
desc = "Move to window on top",
mode = "n",
},
{
"<leader>wl",
"<C-W>l",
desc = "Move to window on right",
mode = "n",
},
{
"<leader>ws",
"<cmd>sp<cr>",
desc = "Split windows horizontally",
mode = "n",
},
{
"<leader>wv",
"<cmd>vsp<cr>",
desc = "Split windows vertically",
mode = "n",
},
{ "<leader>x", group = "config", mode = "n" },
{
"<leader>xn",
"<cmd>set number relativenumber<cr>",
desc = "Show relative numbers",
mode = "n",
},
{ "<leader>xr", "<cmd>source $MYVIMRC<cr>", desc = "Reload config", mode = "n" },
{ "<leader>do", "<cmd>DiffviewOpen<cr>", desc = "Open diff view", mode = "n" },
{ "<leader>dh", "<cmd>DiffviewFileHistory<cr>", desc = "Open file history diff", mode = "n" },
},
}

View file

@ -0,0 +1,4 @@
return {
"folke/zen-mode.nvim",
opts = {},
}

View file

@ -0,0 +1,9 @@
column_width = 120
indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferDouble"
call_parentheses = "Always"
collapse_simple_statement = "Never"
[sort_requires]
enabled = false

View file

@ -0,0 +1,5 @@
{
home.file.".config/nvim" = {
source = ./config;
};
}