Integrate neovim config into home-manager, separate external configs under config/

This commit is contained in:
2026-04-07 18:28:22 +02:00
parent d9ef3b056e
commit 5403b4988e
49 changed files with 7286 additions and 50 deletions

6
config/nvim/.stylua.toml Normal file
View File

@@ -0,0 +1,6 @@
column_width = 160
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferSingle"
call_parentheses = "None"

1
config/nvim/init.lua Normal file
View File

@@ -0,0 +1 @@
require 'eliaskohout'

View File

@@ -0,0 +1,26 @@
-- cmp
local cmp = require('cmp')
cmp.setup({
snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args)
vim.snippet.expand(args.body) -- For native neovim snippets (Neovim v0.10+)
end,
},
mapping = cmp.mapping.preset.insert({
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
["<C-j>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }),
["<C-k>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }),
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' }, },
{ { name = 'buffer' }, }
)
})

View File

@@ -0,0 +1,30 @@
local dap = require('dap')
local dap_python = require('dap-python')
dap_python.setup('uv') -- or wherever your debugpy-enabled python is
dap.adapters.python = {
type = 'server',
host = '127.0.0.1',
port = 5678,
}
dap.configurations.python = {
{
type = 'python',
request = 'attach',
name = "Attach to remote",
connect = {
host = "127.0.0.1",
port = 5678,
},
mode = "remote",
pathMappings = {
{
localRoot = vim.fn.getcwd(),
remoteRoot = "/home/mmc-user/fair-psgg"
}
},
},
}

View File

@@ -0,0 +1,26 @@
-- nvim-dap
vim.keymap.set('n', '<Leader>dc', function() require('dap').continue() end)
vim.keymap.set('n', '<Leader>dn', function() require('dap').step_over() end)
vim.keymap.set('n', '<Leader>di', function() require('dap').step_into() end)
vim.keymap.set('n', '<Leader>do', function() require('dap').step_out() end)
vim.keymap.set('n', '<Leader>db', function() require('dap').toggle_breakpoint() end)
--vim.keymap.set('n', '<Leader>dB', function() require('dap').set_breakpoint() end)
--vim.keymap.set('n', '<Leader>lp', function() require('dap').set_breakpoint(nil, nil, vim.fn.input('Log point message: ')) end)
vim.keymap.set('n', '<Leader>dr', function() require('dap').repl.open() end)
--vim.keymap.set('n', '<Leader>dl', function() require('dap').run_last() end)
vim.keymap.set({'n', 'v'}, '<Leader>dh', function()
require('dap.ui.widgets').hover()
end)
vim.keymap.set({'n', 'v'}, '<Leader>dp', function()
require('dap.ui.widgets').preview()
end)
vim.keymap.set('n', '<Leader>df', function()
local widgets = require('dap.ui.widgets')
widgets.centered_float(widgets.frames)
end)
vim.keymap.set('n', '<Leader>ds', function()
local widgets = require('dap.ui.widgets')
widgets.centered_float(widgets.scopes)
end)

View File

@@ -0,0 +1,15 @@
local dap = require("dap")
local dapui = require("dapui")
dapui.setup() -- Use defaults, or customize below
-- Auto-open and close UI with debugger
dap.listeners.after.event_initialized["dapui_config"] = function()
dapui.open()
end
dap.listeners.before.event_terminated["dapui_config"] = function()
dapui.close()
end
dap.listeners.before.event_exited["dapui_config"] = function()
dapui.close()
end

View File

@@ -0,0 +1,3 @@
-- vim-fugitive
vim.keymap.set("n", "<leader>g", vim.cmd.Git)

View File

@@ -0,0 +1,6 @@
-- gruvbox theme
vim.g.gruvbox_improved_strings = 1
vim.g.gruvbox_improved_warnings = 1
vim.cmd("silent! colorscheme gruvbox")

View File

@@ -0,0 +1,12 @@
-- harpoon
local mark = require("harpoon.mark")
local ui = require("harpoon.ui")
vim.keymap.set("n", "<leader>a", mark.add_file)
vim.keymap.set("n", "<C-e>", ui.toggle_quick_menu)
vim.keymap.set("n", "<C-j>", function() ui.nav_file(1) end)
vim.keymap.set("n", "<C-k>", function() ui.nav_file(2) end)
vim.keymap.set("n", "<C-l>", function() ui.nav_file(3) end)
vim.keymap.set("n", "<C-ö>", function() ui.nav_file(4) end)

View File

@@ -0,0 +1,46 @@
vim.api.nvim_create_autocmd('LspAttach', {
desc = 'LSP actions',
callback = function()
local bufmap = function(mode, lhs, rhs)
local opts = {buffer = true}
vim.keymap.set(mode, lhs, rhs, opts)
end
-- Displays hover information about the symbol under the cursor
bufmap('n', 'K', vim.lsp.buf.hover)
-- Jump to the definition
bufmap('n', 'gd', vim.lsp.buf.definition)
-- Jump to declaration
bufmap('n', 'gD', vim.lsp.buf.declaration)
-- Lists all the implementations for the symbol under the cursor
bufmap('n', 'gi', vim.lsp.buf.implementation)
-- Jumps to the definition of the type symbol
bufmap('n', 'go', vim.lsp.buf.type_definition)
-- Lists all the references
bufmap('n', 'gr', vim.lsp.buf.references)
-- Displays a function's signature information
bufmap('n', 'gs', vim.lsp.buf.signature_help)
-- Renames all references to the symbol under the cursor
bufmap('n', '<F2>', vim.lsp.buf.rename)
-- Selects a code action available at the current cursor position
bufmap('n', '<F4>', vim.lsp.buf.code_action)
-- Show diagnostics in a floating window
bufmap('n', 'gl', vim.diagnostic.open_float)
-- Move to the previous diagnostic
bufmap('n', '[d', vim.diagnostic.goto_prev)
-- Move to the next diagnostic
bufmap('n', ']d', vim.diagnostic.goto_next)
end
})

View File

@@ -0,0 +1,46 @@
-- nvim-lspconfig
local lspconfig = require("lspconfig")
-- set capabilities
local lsp_capabilities = require('cmp_nvim_lsp').default_capabilities()
-- lua --
local on_init_lua_ls = function(client)
local path = client.workspace_folders[1].name
if vim.loop.fs_stat(path..'/.luarc.json') or vim.loop.fs_stat(path..'/.luarc.jsonc') then
return
end
client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, {
runtime = {
version = 'LuaJIT'
},
-- Make the server aware of Neovim runtime files
workspace = {
checkThirdParty = false,
library = {
vim.env.VIMRUNTIME
}
-- or pull in all of 'runtimepath'. NOTE: this is a lot slower
-- library = vim.api.nvim_get_runtime_file("", true)
}
})
end
lspconfig.lua_ls.setup({
on_init = on_init_lua_ls,
settings = { Lua = {} },
capabilities = lsp_capabilities,
})
-- python --
lspconfig.pyright.setup({
capabilities = lsp_capabilities,
})
lspconfig.ruff.setup({ init_options = { settings = {} } })
-- golang --
lspconfig.gopls.setup({
capabilities = lsp_capabilities,
})

View File

@@ -0,0 +1,9 @@
-- telescope.nvim
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
vim.keymap.set('n', '<C-p>', builtin.git_files, {})
vim.keymap.set('n', '<leader>fb', builtin.buffers, {})
vim.keymap.set('n', '<leader>fh', builtin.help_tags, {})
vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})

View File

@@ -0,0 +1,7 @@
-- nvim-treesitter.lua
local treesitter_configs = require('nvim-treesitter.configs')
treesitter_configs.setup({
ensure_installed = { "bash", "c", "lua", "vim", "vimdoc", "markdown", "markdown_inline", "html", "python", "css" },
})

View File

@@ -0,0 +1,5 @@
-- vimwiki
--vim.keymap.set("n", "<leader>ww", ":e ~/Documents/notes/index.wiki<CR>")
vim.cmd("let g:vimwiki_list = [{'path': '~/Documents/notes/', 'syntax': 'markdown', 'ext': '.md'}]")
vim.cmd("eval g:vimwiki#vars#init()")

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,5 @@
require("custom.run")
require("plug")
require("set")
require("remap")

View File

@@ -0,0 +1,105 @@
vim.g.run__cmd = function(cmd, opts)
-- Runs a command either locally on a server using ssh. For running on a server define the 'server' option. The
-- 'server_cwd' option might be set as well to define the working directory on the server.
--@param cmd table
--@param opt table
opts = opts or {};
opts.server_cwd = (opts.server_cwd or "~");
if opts.server ~= nil then
local cmdstr = table.concat(cmd, " ");
cmd = { "ssh", opts.server, "cd " .. opts.server_cwd .. " && " .. cmdstr };
end
local result = vim.system(cmd, { text = true }):wait();
if result.code ~= 0 then
error("\n" .. result.code .. "\n" .. result.stdout .. "\n" .. result.stderr);
end
vim.print(result.stdout);
end
vim.g.run__gen_path = function(identifier)
-- Generates a path in /tmp/ based on the identifier and a hash function.
--@param identifier string
local hash = vim.fn.sha256(identifier);
return "/tmp/rsyncrun/" .. string.sub(hash, 1, 12) .. "/";
end
vim.g.run__file = function(filename, opts)
-- Executes a file based on the vim file type and predefined commands. Options might be set that will be parsed
-- to the vim.g.run__cmd function.
--@param filename string
--@param opts table
local cmd = {
python = function() vim.g.run__cmd({ "python3", filename }, opts) end,
go = function() vim.g.run__cmd({ "go", "run", filename }, opts) end,
lua = function()
vim.cmd("source " .. filename); vim.print("Sourced current file.");
end,
};
local ft = vim.filetype.match({ filename = filename })
if cmd[ft] == nil
then
print("No run command defined for filetype '" .. vim.bo.filetype .. "'.");
else
cmd[vim.bo.filetype]();
end
end
vim.g.run__current_file = function(opts)
-- Executes the currently opened file based on the vim file type and predefined commands. Options might be set
-- that will be parsed to the vim.g.run__cmd function.
--@param opts table
local filename = vim.api.nvim_buf_get_name(vim.api.nvim_get_current_buf());
if filename == "" then return; end;
vim.cmd.write();
vim.g.run__file(filename, opts);
end
vim.g.run__file_on_server = function(filename, opts)
-- Runs a given file on a server after rsyncing the current directory to the server. The cmd is executed in the
-- rsync directory on the server. Use the 'rsync_dst_host' option to define the server. The command to run is
-- defined by the vim.g.run__file function.
--@param filename string
--@param opts table
local rsync_opts = {};
opts = opts or {};
rsync_opts.rsync_src_dir = (opts.rsync_src_dir or vim.loop.cwd());
rsync_opts.rsync_dst_dir = (opts.rsync_dst_dir or vim.g.run__gen_path(rsync_opts.rsync_src_dir));
rsync_opts.rsync_dst_host = (opts.rsync_dst_host or error("rsync_dst_host option is required"));
vim.print("syncing to server...");
vim.g.run__cmd({ "mkdir", "-p", rsync_opts.rsync_dst_dir }, { server = rsync_opts.rsync_dst_host });
vim.g.run__cmd(
{ "rsync", "-r", rsync_opts.rsync_src_dir .. "/", rsync_opts.rsync_dst_host ..
":" .. rsync_opts.rsync_dst_dir .. "/" }, {});
vim.print("...done.");
vim.g.run__file(filename, { server = rsync_opts.rsync_dst_host, server_cwd = rsync_opts.rsync_dst_dir });
end
vim.g.run__current_file_on_server = function(opts)
-- Runs the currently opened file on a server after rsyncing the current directory to the server. The cmd is
-- executed in the rsync directory on the server. Use the 'rsync_dst_host' option to define the server. The
-- command to run is defined by the vim.g.run__file function.
--@param opts table
local filename = vim.api.nvim_buf_get_name(vim.api.nvim_get_current_buf());
if filename == "" then return; end;
vim.cmd.write();
filename = filename:match("^.+/(.+)$") or filename
vim.g.run__file_on_server(filename, opts);
end

View File

@@ -0,0 +1,33 @@
local vim = vim
local Plug = vim.fn["plug#"]
vim.call("plug#begin")
---------
Plug("morhetz/gruvbox") -- Theme
Plug("vimwiki/vimwiki")
Plug("tpope/vim-fugitive") -- Git support
Plug("ThePrimeagen/harpoon")
Plug("nvim-lua/plenary.nvim") -- required for telescope
Plug("nvim-telescope/telescope.nvim")
Plug("junegunn/goyo.vim")
Plug("nvim-treesitter/nvim-treesitter", { ["do"] = ":TSUpdate" })
-- LSP
Plug("neovim/nvim-lspconfig")
Plug("hrsh7th/cmp-nvim-lsp")
Plug("hrsh7th/cmp-buffer")
Plug("hrsh7th/cmp-path")
Plug("hrsh7th/cmp-cmdline")
Plug("hrsh7th/nvim-cmp")
-- Debugger
Plug("mfussenegger/nvim-dap")
Plug("mfussenegger/nvim-dap-python")
Plug("nvim-neotest/nvim-nio") -- required by dap-ui
Plug("rcarriga/nvim-dap-ui")
---------
vim.call("plug#end")

View File

@@ -0,0 +1,22 @@
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
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")
vim.keymap.set("n", "<leader>d", "\"_d")
vim.keymap.set("v", "<leader>d", "\"_d")
vim.keymap.set("n", "<leader>f", vim.lsp.buf.format)
vim.keymap.set("n", "<leader>s", ":%s/\\<<C-r><C-w>\\>/<C-r><C-w>/gI<Left><Left><Left>")
vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true })
-- spell checking
vim.keymap.set("n", "<leader>o", "<cmd>setlocal spell! spelllang=de_de<CR>")
vim.keymap.set("n", "<leader>e", "<cmd>setlocal spell! spelllang=en_en<CR>")
vim.keymap.set("n", "<leader>O", "<cmd>setlocal nospell!<CR>")
-- script run command
vim.keymap.set("n", "<leader>r", vim.g.run__current_file, { noremap = true, silent = true })

View File

@@ -0,0 +1,29 @@
vim.opt.nu = true
vim.opt.relativenumber = true
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
vim.opt.smartindent = true
vim.opt.incsearch = true
vim.opt.scrolloff = 8
vim.opt.signcolumn = "yes"
vim.opt.isfname:append("@-@")
vim.opt.updatetime = 50
vim.opt.colorcolumn = "120"
vim.opt.clipboard = "unnamedplus"
vim.g.mapleader = " "
vim.opt.completeopt = {'menu', 'menuone', 'noselect'}
-- Enable filetype detection
vim.cmd('filetype on')
vim.cmd('filetype plugin on')

View File

@@ -0,0 +1,12 @@
-- [[ Basic Autocommands ]]
-- See `:help lua-guide-autocommands`
-- Highlight when yanking (copying) text
-- See `:help vim.hl.on_yank()`
vim.api.nvim_create_autocmd('TextYankPost', {
desc = 'Highlight when yanking (copying) text',
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
callback = function()
vim.hl.on_yank()
end,
})

View File

@@ -0,0 +1,4 @@
require 'eliaskohout.autocmd'
require 'eliaskohout.keymaps'
require 'eliaskohout.options'
require 'eliaskohout.plugins'

View File

@@ -0,0 +1,18 @@
-- [[ Basic Keymaps ]]
-- Clear highlights on search when pressing <Esc> in normal mode
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
-- Diagnostic keymaps
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
-- Keybinds to make split navigation easier.
vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' })
vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' })
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
--vim.keymap.set('n', '<C-H>', '<C-w>H', { desc = 'Move window to the left' })
--vim.keymap.set('n', '<C-L>', '<C-w>L', { desc = 'Move window to the right' })
--vim.keymap.set('n', '<C-J>', '<C-w>J', { desc = 'Move window to the lower' })
--vim.keymap.set('n', '<C-K>', '<C-w>K', { desc = 'Move window to the upper' })

View File

@@ -0,0 +1,70 @@
-- [[ Setting global options ]]
-- Set <space> as the leader key
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
-- Set to true if you have a Nerd Font installed and selected in the terminal
vim.g.have_nerd_font = true
-- [[ Setting options ]]
-- See `:help vim.o`
-- Make line numbers default
vim.o.number = true
vim.o.relativenumber = true
-- Enable mouse mode, can be useful for resizing splits for example!
vim.o.mouse = 'a'
-- Don't show the mode, since it's already in the status line
vim.o.showmode = false
-- Sync clipboard between OS and Neovim.
-- Schedule the setting after `UiEnter` because it can increase startup-time.
vim.schedule(function()
vim.o.clipboard = 'unnamedplus'
end)
-- Enable break indent
vim.o.breakindent = true
-- Save undo history
vim.o.undofile = true
-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
vim.o.ignorecase = true
vim.o.smartcase = true
-- Keep signcolumn on by default
vim.o.signcolumn = 'yes'
-- Decrease update time
vim.o.updatetime = 250
-- Decrease mapped sequence wait time
vim.o.timeoutlen = 300
-- Configure how new splits should be opened
vim.o.splitright = true
vim.o.splitbelow = true
-- Sets how neovim will display certain whitespace characters in the editor.
vim.o.list = true
vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '' }
-- Preview substitutions live, as you type!
vim.o.inccommand = 'split'
-- Show which line your cursor is on
vim.o.cursorline = true
-- Minimal number of screen lines to keep above and below the cursor.
vim.o.scrolloff = 10
-- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`),
-- instead raise a dialog asking if you wish to save the current file(s)
vim.o.confirm = true
-- terminal colors
vim.opt.termguicolors = true

View File

@@ -0,0 +1,71 @@
-- [[ Install `lazy.nvim` plugin manager ]]
-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
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
error('Error cloning lazy.nvim:\n' .. out)
end
end
---@type vim.Option
local rtp = vim.opt.rtp
rtp:prepend(lazypath)
vim.g.lazyvim_json = '~/.cache/lazyvim/lazyvim.json'
-- [[ Configure and install plugins ]]
-- To check the current status of your plugins, run
-- :Lazy
-- To update plugins you can run
-- :Lazy update
require('lazy').setup({
require 'eliaskohout.plugins.telescope',
require 'eliaskohout.plugins.todo-comments',
require 'eliaskohout.plugins.which-key',
require 'eliaskohout.plugins.nvim-treesitter',
require 'eliaskohout.plugins.nvim-lspconfig',
require 'eliaskohout.plugins.blink', -- autocomplete
require 'eliaskohout.plugins.conform', -- formatting
require 'eliaskohout.plugins.lazydev', -- lua nvim setup
require 'eliaskohout.plugins.fugitive', -- git support
-- require 'eliaskohout.plugins.mini',
-- require 'eliaskohout.plugins.debug',
-- require 'eliaskohout.plugins.indent_line',
-- require 'eliaskohout.plugins.lint',
-- require 'eliaskohout.plugins.autopairs',
-- require 'eliaskohout.plugins.neo-tree'
--require 'eliaskohout.plugins.guess-indent',
--require 'eliaskohout.plugins.gitsigns',
require 'eliaskohout.themes.melange',
--require 'eliaskohout.themes.kanagawa',
--require 'eliaskohout.themes.vscode',
--require 'eliaskohout.themes.tokyonight',
--require 'eliaskohout.themes.gruvbox',
}, {
ui = {
-- If you are using a Nerd Font: set icons to an empty table which will use the
-- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table
icons = vim.g.have_nerd_font and {} or {
cmd = '',
config = '🛠',
event = '📅',
ft = '📂',
init = '',
keys = '🗝',
plugin = '🔌',
runtime = '💻',
require = '🌙',
source = '📄',
start = '🚀',
task = '📌',
lazy = '💤 ',
},
},
})

View File

@@ -0,0 +1,8 @@
-- autopairs
-- https://github.com/windwp/nvim-autopairs
return {
'windwp/nvim-autopairs',
event = 'InsertEnter',
opts = {},
}

View File

@@ -0,0 +1,79 @@
-- Autocompletion
return {
'saghen/blink.cmp',
event = 'VimEnter',
version = '1.*',
dependencies = {
-- Snippet Engine
{
'L3MON4D3/LuaSnip',
version = '2.*',
build = (function()
-- Build Step is needed for regex support in snippets.
-- This step is not supported in many windows environments.
-- Remove the below condition to re-enable on windows.
if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then
return
end
return 'make install_jsregexp'
end)(),
dependencies = {
-- `friendly-snippets` contains a variety of premade snippets.
-- See the README about individual language/framework/plugin snippets:
-- https://github.com/rafamadriz/friendly-snippets
{
'rafamadriz/friendly-snippets',
config = function()
require('luasnip.loaders.from_vscode').lazy_load()
end,
},
},
opts = {},
},
'folke/lazydev.nvim',
},
--- @module 'blink.cmp'
--- @type blink.cmp.Config
opts = {
keymap = {
-- 'default' (recommended) for mappings similar to built-in completions
-- <c-y> to accept ([y]es) the completion.
-- This will auto-import if your LSP supports it.
-- This will expand snippets if the LSP sent a snippet.
-- 'super-tab' for tab to accept
-- 'enter' for enter to accept
-- 'none' for no mappings
--
-- For an understanding of why the 'default' preset is recommended,
-- you will need to read `:help ins-completion`
--
-- No, but seriously. Please read `:help ins-completion`, it is really good!
--
-- All presets have the following mappings:
-- <tab>/<s-tab>: move to right/left of your snippet expansion
-- <c-space>: Open menu or open docs if already open
-- <c-n>/<c-p> or <up>/<down>: Select next/previous item
-- <c-e>: Hide menu
-- <c-k>: Toggle signature help
--
-- See :h blink-cmp-config-keymap for defining your own keymap
preset = 'default',
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
},
sources = {
default = { 'lsp', 'path', 'snippets', 'lazydev' },
providers = {
lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 },
},
},
snippets = { preset = 'luasnip' },
-- See :h blink-cmp-config-fuzzy for more information
fuzzy = { implementation = 'prefer_rust_with_warning' },
-- Shows a signature help window while you type arguments for a function
signature = { enabled = true },
},
}

View File

@@ -0,0 +1,34 @@
-- Autoformat
return {
'stevearc/conform.nvim',
event = { 'BufWritePre' },
cmd = { 'ConformInfo' },
keys = {
{
'<leader>f',
function()
require('conform').format { async = true, lsp_format = 'fallback' }
end,
mode = '',
desc = '[F]ormat buffer',
},
},
opts = {
notify_on_error = false,
-- format_on_save = function(bufnr)
-- -- Disable "format_on_save lsp_fallback" for languages that don't
-- -- have a well standardized coding style. You can add additional
-- -- languages here or re-enable it for the disabled ones.
-- local disable_filetypes = { c = true, cpp = true, python = true }
-- if disable_filetypes[vim.bo[bufnr].filetype] then
-- return nil
-- else
-- return {
-- timeout_ms = 500,
-- lsp_format = 'fallback',
-- }
-- end
-- end,
formatters_by_ft = {},
},
}

View File

@@ -0,0 +1,148 @@
-- debug.lua
--
-- Shows how to use the DAP plugin to debug your code.
--
-- Primarily focused on configuring the debugger for Go, but can
-- be extended to other languages as well. That's why it's called
-- kickstart.nvim and not kitchen-sink.nvim ;)
return {
-- NOTE: Yes, you can install new plugins here!
'mfussenegger/nvim-dap',
-- NOTE: And you can specify dependencies as well
dependencies = {
-- Creates a beautiful debugger UI
'rcarriga/nvim-dap-ui',
-- Required dependency for nvim-dap-ui
'nvim-neotest/nvim-nio',
-- Installs the debug adapters for you
'mason-org/mason.nvim',
'jay-babu/mason-nvim-dap.nvim',
-- Add your own debuggers here
'leoluz/nvim-dap-go',
},
keys = {
-- Basic debugging keymaps, feel free to change to your liking!
{
'<F5>',
function()
require('dap').continue()
end,
desc = 'Debug: Start/Continue',
},
{
'<F1>',
function()
require('dap').step_into()
end,
desc = 'Debug: Step Into',
},
{
'<F2>',
function()
require('dap').step_over()
end,
desc = 'Debug: Step Over',
},
{
'<F3>',
function()
require('dap').step_out()
end,
desc = 'Debug: Step Out',
},
{
'<leader>b',
function()
require('dap').toggle_breakpoint()
end,
desc = 'Debug: Toggle Breakpoint',
},
{
'<leader>B',
function()
require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ')
end,
desc = 'Debug: Set Breakpoint',
},
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
{
'<F7>',
function()
require('dapui').toggle()
end,
desc = 'Debug: See last session result.',
},
},
config = function()
local dap = require 'dap'
local dapui = require 'dapui'
require('mason-nvim-dap').setup {
-- Makes a best effort to setup the various debuggers with
-- reasonable debug configurations
automatic_installation = true,
-- You can provide additional configuration to the handlers,
-- see mason-nvim-dap README for more information
handlers = {},
-- You'll need to check that you have the required things installed
-- online, please don't ask me how to install them :)
ensure_installed = {
-- Update this to ensure that you have the debuggers for the langs you want
'delve',
},
}
-- Dap UI setup
-- For more information, see |:help nvim-dap-ui|
dapui.setup {
-- Set icons to characters that are more likely to work in every terminal.
-- Feel free to remove or use ones that you like more! :)
-- Don't feel like these are good choices.
icons = { expanded = '', collapsed = '', current_frame = '*' },
controls = {
icons = {
pause = '',
play = '',
step_into = '',
step_over = '',
step_out = '',
step_back = 'b',
run_last = '▶▶',
terminate = '',
disconnect = '',
},
},
}
-- Change breakpoint icons
-- vim.api.nvim_set_hl(0, 'DapBreak', { fg = '#e51400' })
-- vim.api.nvim_set_hl(0, 'DapStop', { fg = '#ffcc00' })
-- local breakpoint_icons = vim.g.have_nerd_font
-- and { Breakpoint = '', BreakpointCondition = '', BreakpointRejected = '', LogPoint = '', Stopped = '' }
-- or { Breakpoint = '●', BreakpointCondition = '⊜', BreakpointRejected = '⊘', LogPoint = '◆', Stopped = '⭔' }
-- for type, icon in pairs(breakpoint_icons) do
-- local tp = 'Dap' .. type
-- local hl = (type == 'Stopped') and 'DapStop' or 'DapBreak'
-- vim.fn.sign_define(tp, { text = icon, texthl = hl, numhl = hl })
-- end
dap.listeners.after.event_initialized['dapui_config'] = dapui.open
dap.listeners.before.event_terminated['dapui_config'] = dapui.close
dap.listeners.before.event_exited['dapui_config'] = dapui.close
-- Install golang specific config
require('dap-go').setup {
delve = {
-- On Windows delve must be run attached or it crashes.
-- See https://github.com/leoluz/nvim-dap-go/blob/main/README.md#configuring
detached = vim.fn.has 'win32' == 0,
},
}
end,
}

View File

@@ -0,0 +1,5 @@
return {
{
"tpope/vim-fugitive",
},
}

View File

@@ -0,0 +1,58 @@
-- Adds git related signs to the gutter, as well as utilities for managing changes
return {
{
'lewis6991/gitsigns.nvim',
opts = {
on_attach = function(bufnr)
local gitsigns = require '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
vim.cmd.normal { ']c', bang = true }
else
gitsigns.nav_hunk 'next'
end
end, { desc = 'Jump to next git [c]hange' })
map('n', '[c', function()
if vim.wo.diff then
vim.cmd.normal { '[c', bang = true }
else
gitsigns.nav_hunk 'prev'
end
end, { desc = 'Jump to previous git [c]hange' })
-- Actions
-- visual mode
map('v', '<leader>hs', function()
gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' }
end, { desc = 'git [s]tage hunk' })
map('v', '<leader>hr', function()
gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' }
end, { desc = 'git [r]eset hunk' })
-- normal mode
map('n', '<leader>hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' })
map('n', '<leader>hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' })
map('n', '<leader>hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' })
map('n', '<leader>hu', gitsigns.stage_hunk, { desc = 'git [u]ndo stage hunk' })
map('n', '<leader>hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' })
map('n', '<leader>hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' })
map('n', '<leader>hb', gitsigns.blame_line, { desc = 'git [b]lame line' })
map('n', '<leader>hd', gitsigns.diffthis, { desc = 'git [d]iff against index' })
map('n', '<leader>hD', function()
gitsigns.diffthis '@'
end, { desc = 'git [D]iff against last commit' })
-- Toggles
map('n', '<leader>tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' })
map('n', '<leader>tD', gitsigns.preview_hunk_inline, { desc = '[T]oggle git show [D]eleted' })
end,
},
},
}

View File

@@ -0,0 +1,2 @@
-- Detect tabstop and shiftwidth automatically
return 'NMAC427/guess-indent.nvim'

View File

@@ -0,0 +1,9 @@
return {
{ -- Add indentation guides even on blank lines
'lukas-reineke/indent-blankline.nvim',
-- Enable `lukas-reineke/indent-blankline.nvim`
-- See `:help ibl`
main = 'ibl',
opts = {},
},
}

View File

@@ -0,0 +1,12 @@
-- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
-- used for completion, annotations and signatures of Neovim apis
return {
'folke/lazydev.nvim',
ft = 'lua',
opts = {
library = {
-- Load luvit types when the `vim.uv` word is found
{ path = '${3rd}/luv/library', words = { 'vim%.uv' } },
},
},
}

View File

@@ -0,0 +1,60 @@
return {
{ -- Linting
'mfussenegger/nvim-lint',
event = { 'BufReadPre', 'BufNewFile' },
config = function()
local lint = require 'lint'
lint.linters_by_ft = {
markdown = { 'markdownlint' },
}
-- To allow other plugins to add linters to require('lint').linters_by_ft,
-- instead set linters_by_ft like this:
-- lint.linters_by_ft = lint.linters_by_ft or {}
-- lint.linters_by_ft['markdown'] = { 'markdownlint' }
--
-- However, note that this will enable a set of default linters,
-- which will cause errors unless these tools are available:
-- {
-- clojure = { "clj-kondo" },
-- dockerfile = { "hadolint" },
-- inko = { "inko" },
-- janet = { "janet" },
-- json = { "jsonlint" },
-- markdown = { "vale" },
-- rst = { "vale" },
-- ruby = { "ruby" },
-- terraform = { "tflint" },
-- text = { "vale" }
-- }
--
-- You can disable the default linters by setting their filetypes to nil:
-- lint.linters_by_ft['clojure'] = nil
-- lint.linters_by_ft['dockerfile'] = nil
-- lint.linters_by_ft['inko'] = nil
-- lint.linters_by_ft['janet'] = nil
-- lint.linters_by_ft['json'] = nil
-- lint.linters_by_ft['markdown'] = nil
-- lint.linters_by_ft['rst'] = nil
-- lint.linters_by_ft['ruby'] = nil
-- lint.linters_by_ft['terraform'] = nil
-- lint.linters_by_ft['text'] = nil
-- Create autocommand which carries out the actual linting
-- on the specified events.
local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true })
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
group = lint_augroup,
callback = function()
-- Only run the linter in buffers that you can modify in order to
-- avoid superfluous noise, notably within the handy LSP pop-ups that
-- describe the hovered symbol using Markdown.
if vim.bo.modifiable then
lint.try_lint()
end
end,
})
end,
},
}

View File

@@ -0,0 +1,38 @@
-- Collection of various small independent plugins/modules
return {
'echasnovski/mini.nvim',
config = function()
-- Better Around/Inside textobjects
--
-- Examples:
-- - va) - [V]isually select [A]round [)]paren
-- - yinq - [Y]ank [I]nside [N]ext [Q]uote
-- - ci' - [C]hange [I]nside [']quote
require('mini.ai').setup { n_lines = 500 }
-- Add/delete/replace surroundings (brackets, quotes, etc.)
--
-- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren
-- - sd' - [S]urround [D]elete [']quotes
-- - sr)' - [S]urround [R]eplace [)] [']
require('mini.surround').setup()
-- Simple and easy statusline.
-- You could remove this setup call if you don't like it,
-- and try some other statusline plugin
local statusline = require 'mini.statusline'
-- set use_icons to true if you have a Nerd Font
statusline.setup { use_icons = vim.g.have_nerd_font }
-- You can configure sections in the statusline by overriding their
-- default behavior. For example, here we set the section for
-- cursor location to LINE:COLUMN
---@diagnostic disable-next-line: duplicate-set-field
statusline.section_location = function()
return '%2l:%-2v'
end
-- ... and there is more!
-- Check out: https://github.com/echasnovski/mini.nvim
end,
}

View File

@@ -0,0 +1,25 @@
-- Neo-tree is a Neovim plugin to browse the file system
-- https://github.com/nvim-neo-tree/neo-tree.nvim
return {
'nvim-neo-tree/neo-tree.nvim',
version = '*',
dependencies = {
'nvim-lua/plenary.nvim',
'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
'MunifTanjim/nui.nvim',
},
lazy = false,
keys = {
{ '\\', ':Neotree reveal<CR>', desc = 'NeoTree reveal', silent = true },
},
opts = {
filesystem = {
window = {
mappings = {
['\\'] = 'close_window',
},
},
},
},
}

View File

@@ -0,0 +1,214 @@
-- Main LSP Configuration
return {
'neovim/nvim-lspconfig',
dependencies = {
-- Automatically install LSPs and related tools to stdpath for Neovim
-- Mason must be loaded before its dependents so we need to set it up here.
-- `opts = {}` is the same as calling `require('mason').setup({})`
{ 'mason-org/mason.nvim', opts = {} },
'mason-org/mason-lspconfig.nvim',
'WhoIsSethDaniel/mason-tool-installer.nvim',
-- Useful status updates for LSP.
{ 'j-hui/fidget.nvim', opts = {} },
-- Allows extra capabilities provided by blink.cmp
'saghen/blink.cmp',
},
config = function()
-- If you're wondering about lsp vs treesitter, you can check out the wonderfully
-- and elegantly composed help section, `:help lsp-vs-treesitter`
-- This function gets run when an LSP attaches to a particular buffer.
-- That is to say, every time a new file is opened that is associated with
-- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this
-- function will be executed to configure the current buffer
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }),
callback = function(event)
-- In this case, we create a function that lets us more easily define mappings specific
-- for LSP related items. It sets the mode, buffer and description for us each time.
local map = function(keys, func, desc, mode)
mode = mode or 'n'
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
end
-- Rename the variable under your cursor.
-- Most Language Servers support renaming across files, etc.
map('grn', vim.lsp.buf.rename, '[R]e[n]ame')
-- Execute a code action, usually your cursor needs to be on top of an error
-- or a suggestion from your LSP for this to activate.
map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' })
-- Find references for the word under your cursor.
map('grr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
-- Jump to the implementation of the word under your cursor.
-- Useful when your language has ways of declaring types without an actual implementation.
map('gri', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
-- Jump to the definition of the word under your cursor.
-- This is where a variable was first declared, or where a function is defined, etc.
-- To jump back, press <C-t>.
map('grd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
-- Fuzzy find all the symbols in your current document.
-- Symbols are things like variables, functions, types, etc.
map('gO', require('telescope.builtin').lsp_document_symbols, 'Open Document Symbols')
-- Fuzzy find all the symbols in your current workspace.
-- Similar to document symbols, except searches over your entire project.
map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols,
'Open Workspace Symbols')
-- Jump to the type of the word under your cursor.
-- Useful when you're not sure what type a variable is and you want to see
-- the definition of its *type*, not where it was *defined*.
map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition')
-- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
---@param client vim.lsp.Client
---@param method vim.lsp.protocol.Method
---@param bufnr? integer some lsp support methods only in specific files
---@return boolean
local function client_supports_method(client, method, bufnr)
if vim.fn.has 'nvim-0.11' == 1 then
return client:supports_method(method, bufnr)
else
return client.supports_method(method, { bufnr = bufnr })
end
end
-- The following two autocommands are used to highlight references of the
-- word under your cursor when your cursor rests there for a little while.
-- See `:help CursorHold` for information about when this is executed
--
-- When you move your cursor, the highlights will be cleared (the second autocommand).
local client = vim.lsp.get_client_by_id(event.data.client_id)
if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then
local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight',
{ clear = false })
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
buffer = event.buf,
group = highlight_augroup,
callback = vim.lsp.buf.document_highlight,
})
vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
buffer = event.buf,
group = highlight_augroup,
callback = vim.lsp.buf.clear_references,
})
vim.api.nvim_create_autocmd('LspDetach', {
group = vim.api.nvim_create_augroup('kickstart-lsp-detach',
{ clear = true }),
callback = function(event2)
vim.lsp.buf.clear_references()
vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf }
end,
})
end
-- The following code creates a keymap to toggle inlay hints in your
-- code, if the language server you are using supports them
--
-- This may be unwanted, since they displace some of your code
if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then
map('<leader>th', function()
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
end, '[T]oggle Inlay [H]ints')
end
end,
})
-- Diagnostic Config
-- See :help vim.diagnostic.Opts
vim.diagnostic.config {
severity_sort = true,
float = { border = 'rounded', source = 'if_many' },
underline = { severity = vim.diagnostic.severity.ERROR },
signs = vim.g.have_nerd_font and {
text = {
[vim.diagnostic.severity.ERROR] = '󰅚 ',
[vim.diagnostic.severity.WARN] = '󰀪 ',
[vim.diagnostic.severity.INFO] = '󰋽 ',
[vim.diagnostic.severity.HINT] = '󰌶 ',
},
} or {},
virtual_text = {
source = 'if_many',
spacing = 2,
format = function(diagnostic)
local diagnostic_message = {
[vim.diagnostic.severity.ERROR] = diagnostic.message,
[vim.diagnostic.severity.WARN] = diagnostic.message,
[vim.diagnostic.severity.INFO] = diagnostic.message,
[vim.diagnostic.severity.HINT] = diagnostic.message,
}
return diagnostic_message[diagnostic.severity]
end,
},
}
-- LSP servers and clients are able to communicate to each other what features they support.
-- By default, Neovim doesn't support everything that is in the LSP specification.
-- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities.
-- So, we create new capabilities with blink.cmp, and then broadcast that to the servers.
local capabilities = require('blink.cmp').get_lsp_capabilities()
-- Enable the following language servers
--
-- Add any additional override configuration in the following tables. Available keys are:
-- - cmd (table): Override the default command used to start the server
-- - filetypes (table): Override the default list of associated filetypes for the server
-- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features.
-- - settings (table): Override the default settings passed when initializing the server.
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
local servers = {
lua_ls = {
settings = {
Lua = {
completion = {
callSnippet = 'Replace',
},
},
},
},
gopls = {},
pylsp = {},
}
local servers_skip_mason = { lua_ls = true, gopls = true }
local ensure_installed = vim.tbl_filter(function(name)
return not servers_skip_mason[name]
end, vim.tbl_keys(servers or {}))
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
for name, _ in pairs(servers_skip_mason) do
local server = servers[name] or {}
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
vim.lsp.config[name] = server
vim.lsp.enable(name)
end
require('mason-lspconfig').setup {
ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
automatic_installation = false,
handlers = {
function(server_name)
if servers_skip_mason[server_name] then
return
end
local server = servers[server_name] or {}
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities,
server.capabilities or {})
vim.lsp.config[server_name] = server
vim.lsp.enable(server_name)
end,
},
}
end,
}

View File

@@ -0,0 +1,27 @@
-- Highlight, edit, and navigate code
return {
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate',
event = { 'BufReadPost', 'BufNewFile' },
cmd = { 'TSInstall', 'TSUpdate', 'TSUninstall' },
config = function()
vim.api.nvim_create_autocmd('VimEnter', {
callback = function()
local installed = require('nvim-treesitter.config').get_installed()
local wanted = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc', 'python', 'go' }
local to_install = vim.tbl_filter(function(lang)
return not vim.list_contains(installed, lang)
end, wanted)
if #to_install > 0 then
vim.cmd.TSInstall({ args = to_install, bang = true })
end
end,
})
end,
-- There are additional nvim-treesitter modules that you can use to interact
-- with nvim-treesitter. You should go explore a few and see what interests you:
--
-- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod`
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
}

View File

@@ -0,0 +1,77 @@
-- Fuzzy Finder (files, lsp, etc)
return {
'nvim-telescope/telescope.nvim',
event = 'VimEnter',
dependencies = {
'nvim-lua/plenary.nvim',
{ -- If encountering errors, see telescope-fzf-native README for installation instructions
'nvim-telescope/telescope-fzf-native.nvim',
-- `build` is used to run some command when the plugin is installed/updated.
-- This is only run then, not every time Neovim starts up.
build = 'make',
-- `cond` is a condition used to determine whether this plugin should be
-- installed and loaded.
cond = function()
return vim.fn.executable 'make' == 1
end,
},
{ 'nvim-telescope/telescope-ui-select.nvim' },
-- Useful for getting pretty icons, but requires a Nerd Font.
{ 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
},
config = function()
-- [[ Configure Telescope ]]
-- See `:help telescope` and `:help telescope.setup()`
require('telescope').setup {
extensions = {
['ui-select'] = {
require('telescope.themes').get_dropdown(),
},
},
}
-- Enable Telescope extensions if they are installed
pcall(require('telescope').load_extension, 'fzf')
pcall(require('telescope').load_extension, 'ui-select')
-- See `:help telescope.builtin`
local builtin = require 'telescope.builtin'
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
vim.keymap.set('n', '<leader>so', builtin.lsp_document_symbols, { desc = '[S]earch Symbol [O]utline' })
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
-- Slightly advanced example of overriding default behavior and theme
vim.keymap.set('n', '<leader>/', function()
-- You can pass additional configuration to Telescope to change the theme, layout, etc.
builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
winblend = 10,
previewer = false,
})
end, { desc = '[/] Fuzzily search in current buffer' })
-- It's also possible to pass additional configuration options.
-- See `:help telescope.builtin.live_grep()` for information about particular keys
vim.keymap.set('n', '<leader>s/', function()
builtin.live_grep {
grep_open_files = true,
prompt_title = 'Live Grep in Open Files',
}
end, { desc = '[S]earch [/] in Open Files' })
-- Shortcut for searching your Neovim configuration files
vim.keymap.set('n', '<leader>sn', function()
builtin.find_files { cwd = vim.fn.stdpath 'config' }
end, { desc = '[S]earch [N]eovim files' })
end,
}

View File

@@ -0,0 +1,14 @@
-- Highlight todo, notes, etc in comments
return {
'folke/todo-comments.nvim',
event = 'VimEnter',
dependencies = { 'nvim-lua/plenary.nvim' },
opts = { signs = false },
config = function()
require('todo-comments').setup()
vim.keymap.set('n', '<leader>st', function()
vim.cmd ':TodoTelescope'
end, { desc = '[S]earch [T]odo comments' })
end,
}

View File

@@ -0,0 +1,53 @@
-- Useful plugin to show you pending keybinds.
return {
'folke/which-key.nvim',
event = 'VimEnter', -- sets the loading event to 'VimEnter' (`:help autocmd-events`)
opts = {
-- delay between pressing a key and opening which-key (milliseconds)
-- this setting is independent of vim.o.timeoutlen
delay = 500,
icons = {
-- set icon mappings to true if you have a Nerd Font
mappings = vim.g.have_nerd_font,
-- If you are using a Nerd Font: set icons.keys to an empty table which will use the
-- default which-key.nvim defined Nerd Font icons, otherwise define a string table
keys = vim.g.have_nerd_font and {} or {
Up = '<Up> ',
Down = '<Down> ',
Left = '<Left> ',
Right = '<Right> ',
C = '<C-…> ',
M = '<M-…> ',
D = '<D-…> ',
S = '<S-…> ',
CR = '<CR> ',
Esc = '<Esc> ',
ScrollWheelDown = '<ScrollWheelDown> ',
ScrollWheelUp = '<ScrollWheelUp> ',
NL = '<NL> ',
BS = '<BS> ',
Space = '<Space> ',
Tab = '<Tab> ',
F1 = '<F1>',
F2 = '<F2>',
F3 = '<F3>',
F4 = '<F4>',
F5 = '<F5>',
F6 = '<F6>',
F7 = '<F7>',
F8 = '<F8>',
F9 = '<F9>',
F10 = '<F10>',
F11 = '<F11>',
F12 = '<F12>',
},
},
-- Document existing key chains
spec = {
{ '<leader>s', group = '[S]earch' },
{ '<leader>t', group = '[T]oggle' },
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
},
},
}

View File

@@ -0,0 +1,11 @@
-- The gruvbox theme
return {
'ellisonleao/gruvbox.nvim',
priority = 1000,
config = function()
require('gruvbox').setup {
contrast = 'soft',
}
vim.cmd.colorscheme 'gruvbox'
end,
}

View File

@@ -0,0 +1,11 @@
-- The kanagawa theme
return {
'rebelot/kanagawa.nvim',
priority = 1000,
config = function()
require('kanagawa').setup {
theme = 'wave', -- alt.: dragon
}
vim.cmd.colorscheme 'kanagawa'
end,
}

View File

@@ -0,0 +1,8 @@
-- The melange theme
return {
'savq/melange-nvim',
priority = 1000,
config = function()
vim.cmd.colorscheme 'melange'
end,
}

View File

@@ -0,0 +1,20 @@
-- You can easily change to a different colorscheme.
--
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
return {
'folke/tokyonight.nvim',
priority = 1000, -- Make sure to load this before all the other start plugins.
config = function()
---@diagnostic disable-next-line: missing-fields
require('tokyonight').setup {
styles = {
comments = { italic = true }, -- Enable italics in comments
},
}
-- Like many other themes, this one has different styles, and you could load
-- any other, such as 'tokyonight-night', 'tokyonight-storm', 'tokyonight-moon',
-- or 'tokyonight-day'.
vim.cmd.colorscheme 'tokyonight-storm'
end,
}

View File

@@ -0,0 +1,9 @@
-- The vscode theme
return {
'Mofiqul/vscode.nvim',
priority = 1000,
config = function()
require('vscode').setup {}
vim.cmd.colorscheme 'vscode'
end,
}

View File

@@ -6,59 +6,22 @@
defaultEditor = true;
extraPackages = with pkgs; [
# Telescope
ripgrep
fd
tree-sitter
# LSP servers
lua-language-server
gopls
python3.pkgs.python-lsp-server
# Formatters
stylua
];
};
# Minimal LSP setup - expand as needed
plugins = with pkgs.vimPlugins; [
# essentials
nvim-lspconfig
nvim-cmp
cmp-nvim-lsp
luasnip
friendly-snippets
# ui improvements
telescope-nvim
telescope-fzf-native-nvim
lualine-nvim
nvim-web-devicons
nvim-tree-lua
# treesitter
nvim-treesitter
nvim-treesitter-context
# git integration
gitsigns-nvim
vim-fugitive
];
# Basic init.lua configuration
extraConfig = ''
lua << EOF
-- Basic settings
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.expandtab = true
vim.opt.shiftwidth = 2
vim.opt.tabstop = 2
vim.opt.smartindent = true
-- LSP
local lspconfig = require('lspconfig')
-- Python
lspconfig.pyright.setup{}
-- Rust
lspconfig.rust_analyzer.setup{}
-- Node/JavaScript
lspconfig.ts_ls.setup{}
EOF
'';
# Link the lua config directory as ~/.config/nvim
# Plugins are managed by lazy.nvim (see nvim-config/lua/eliaskohout/plugins.lua)
xdg.configFile."nvim" = {
source = ../../config/nvim;
recursive = true;
};
}