···
1
+
-- Set <space> as the leader key
2
+
-- See `:help mapleader`
3
+
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
4
+
vim.g.mapleader = " "
5
+
vim.g.maplocalleader = " "
7
+
-- Set to true if you have a Nerd Font installed and selected in the terminal
8
+
vim.g.have_nerd_font = true
10
+
-- [[ Setting options ]]
11
+
-- See `:help vim.opt`
12
+
-- NOTE: You can change these options as you wish!
13
+
-- For more options, you can see `:help option-list`
15
+
-- Make line numbers default
16
+
vim.opt.number = true
17
+
-- You can also add relative line numbers, to help with jumping.
18
+
-- Experiment for yourself to see if you like it!
19
+
vim.opt.relativenumber = true
22
+
vim.opt.shiftwidth = 4
24
+
-- Enable mouse mode, can be useful for resizing splits for example!
27
+
-- Don't show the mode, since it's already in the status line
28
+
vim.opt.showmode = false
30
+
-- Sync clipboard between OS and Neovim.
31
+
-- Schedule the setting after `UiEnter` because it can increase startup-time.
32
+
-- Remove this option if you want your OS clipboard to remain independent.
33
+
-- See `:help 'clipboard'`
34
+
vim.schedule(function()
35
+
vim.opt.clipboard = "unnamedplus"
38
+
-- Enable break indent
39
+
vim.opt.breakindent = true
41
+
-- Save undo history
42
+
vim.opt.undofile = true
44
+
-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
45
+
vim.opt.ignorecase = true
46
+
vim.opt.smartcase = true
48
+
-- Keep signcolumn on by default
49
+
vim.opt.signcolumn = "yes"
51
+
-- Decrease update time
52
+
vim.opt.updatetime = 250
54
+
-- Decrease mapped sequence wait time
55
+
vim.opt.timeoutlen = 300
57
+
-- Configure how new splits should be opened
58
+
vim.opt.splitright = true
59
+
vim.opt.splitbelow = true
61
+
-- Sets how neovim will display certain whitespace characters in the editor.
62
+
-- See `:help 'list'`
63
+
-- and `:help 'listchars'`
65
+
vim.opt.listchars = { tab = "ยป ", trail = "ยท", nbsp = "โฃ" }
67
+
-- Preview substitutions live, as you type!
68
+
vim.opt.inccommand = "split"
70
+
-- Show which line your cursor is on
71
+
vim.opt.cursorline = true
73
+
-- Minimal number of screen lines to keep above and below the cursor.
74
+
vim.opt.scrolloff = 10
76
+
-- [[ Basic Keymaps ]]
77
+
-- See `:help vim.keymap.set()`
79
+
-- Clear highlights on search when pressing <Esc> in normal mode
80
+
-- See `:help hlsearch`
81
+
vim.keymap.set("n", "<Esc>", "<cmd>nohlsearch<CR>")
83
+
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
84
+
-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
85
+
-- is not what someone will guess without a bit more experience.
87
+
-- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping
88
+
-- or just use <C-\><C-n> to exit terminal mode
89
+
vim.keymap.set("t", "<Esc><Esc>", "<C-\\><C-n>", { desc = "Exit terminal mode" })
92
+
vim.keymap.set("i", "<S-CR>", "<Esc>o", { noremap = true, silent = true })
93
+
-- vim.keymap.set("i", "<Tab>", function()
94
+
-- local col = vim.fn.col(".") -- Get the current column
95
+
-- local line = vim.fn.getline(".") -- Get the current line
97
+
-- -- Check if the current character is a closing quote
98
+
-- local char = line:sub(col, col)
99
+
-- if char == '"' or char == "'" or char == "`" then
100
+
-- return "<Right>"
102
+
-- end, { expr = true, noremap = true })
104
+
-- TIP: Disable arrow keys in normal mode
105
+
-- vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
106
+
-- vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
107
+
-- vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
108
+
-- vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
110
+
-- Keybinds to make split navigation easier.
111
+
-- Use CTRL+<hjkl> to switch between windows
113
+
-- See `:help wincmd` for a list of all window commands
114
+
vim.keymap.set("n", "<C-h>", "<C-w><C-h>", { desc = "Move focus to the left window" })
115
+
vim.keymap.set("n", "<C-l>", "<C-w><C-l>", { desc = "Move focus to the right window" })
116
+
vim.keymap.set("n", "<C-j>", "<C-w><C-j>", { desc = "Move focus to the lower window" })
117
+
vim.keymap.set("n", "<C-k>", "<C-w><C-k>", { desc = "Move focus to the upper window" })
119
+
-- vim.experimental.check_rtp_message = false
121
+
vim.g.snacks_animate = false
122
+
---@type table<number, {token:lsp.ProgressToken, msg:string, done:boolean}[]>
123
+
local progress = vim.defaulttable()
124
+
vim.api.nvim_create_autocmd("LspProgress", {
125
+
---@param ev {data: {client_id: integer, params: lsp.ProgressParams}}
126
+
callback = function(ev)
127
+
local client = vim.lsp.get_client_by_id(ev.data.client_id)
128
+
local value = ev.data.params.value --[[@as {percentage?: number, title?: string, message?: string, kind: "begin" | "report" | "end"}]]
129
+
if not client or type(value) ~= "table" then
132
+
local p = progress[client.id]
133
+
for i = 1, #p + 1 do
134
+
if i == #p + 1 or p[i].token == ev.data.params.token then
136
+
token = ev.data.params.token,
137
+
msg = ("[%3d%%] %s%s"):format(
138
+
value.kind == "end" and 100 or value.percentage or 100,
140
+
value.message and (" **%s**"):format(value.message) or ""
142
+
done = value.kind == "end",
147
+
local msg = {} ---@type string[]
148
+
progress[client.id] = vim.tbl_filter(function(v)
149
+
return table.insert(msg, v.msg) or not v.done
151
+
local spinner = { "โ ", "โ ", "โ น", "โ ธ", "โ ผ", "โ ด", "โ ฆ", "โ ง", "โ ", "โ " }
152
+
vim.notify(table.concat(msg, "\n"), "info", {
153
+
id = "lsp_progress",
154
+
title = client.name,
155
+
opts = function(notif)
156
+
notif.icon = #progress[client.id] == 0 and "๏ "
157
+
or spinner[math.floor(vim.uv.hrtime() / (1e6 * 80)) % #spinner + 1]
163
+
-- [[ Basic Autocommands ]]
164
+
-- See `:help lua-guide-autocommands`
166
+
-- Highlight when yanking (copying) text
167
+
-- Try it with `yap` in normal mode
168
+
-- See `:help vim.highlight.on_yank()`
169
+
vim.api.nvim_create_autocmd("TextYankPost", {
170
+
desc = "Highlight when yanking (copying) text",
171
+
group = vim.api.nvim_create_augroup("kickstart-highlight-yank", { clear = true }),
172
+
callback = function()
173
+
vim.highlight.on_yank()
177
+
-- [[ Install `lazy.nvim` plugin manager ]]
178
+
-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
179
+
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
180
+
if not (vim.uv or vim.loop).fs_stat(lazypath) then
181
+
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
182
+
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
183
+
if vim.v.shell_error ~= 0 then
184
+
error("Error cloning lazy.nvim:\n" .. out)
187
+
vim.opt.rtp:prepend(lazypath)
189
+
-- [[ Configure and install plugins ]]
191
+
-- To check the current status of your plugins, run
194
+
-- You can press `?` in this menu for help. Use `:q` to close the window
196
+
-- To update plugins you can run
199
+
-- NOTE: Here is where you install your plugins.
200
+
require("lazy").setup({
201
+
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
202
+
{ "NMAC427/guess-indent.nvim", opts = {} }, -- Detect tabstop and shiftwidth automatically
204
+
-- NOTE: Plugins can also be added by using a table,
205
+
-- with the first argument being the link and the following
206
+
-- keys can be used to configure plugin behavior/loading/etc.
208
+
-- Use `opts = {}` to force a plugin to be loaded.
211
+
-- Here is a more advanced example where we pass configuration
212
+
-- options to `gitsigns.nvim`. This is equivalent to the following Lua:
213
+
-- require('gitsigns').setup({ ... })
215
+
-- See `:help gitsigns` to understand what the configuration keys do
216
+
{ -- Adds git related signs to the gutter, as well as utilities for managing changes
217
+
"lewis6991/gitsigns.nvim",
219
+
vim.api.nvim_set_hl(0, "GitSignsCurrentLineBlame", { fg = "#8f8f8f" }),
220
+
current_line_blame = true,
221
+
current_line_blame_opts = {
223
+
virt_text_pos = "right_align",
226
+
add = { text = "+" },
227
+
change = { text = "~" },
228
+
delete = { text = "_" },
229
+
topdelete = { text = "โพ" },
230
+
changedelete = { text = "~" },
235
+
-- NOTE: Plugins can also be configured to run Lua code when they are loaded.
237
+
-- This is often very useful to both group configuration, as well as handle
238
+
-- lazy loading plugins that don't need to be loaded immediately at startup.
240
+
-- For example, in the following configuration, we use:
241
+
-- event = 'VimEnter'
243
+
-- which loads which-key before all the UI elements are loaded. Events can be
244
+
-- normal autocommands events (`:help autocmd-events`).
246
+
-- Then, because we use the `opts` key (recommended), the configuration runs
247
+
-- after the plugin has been loaded as `require(MODULE).setup(opts)`.
249
+
{ -- Useful plugin to show you pending keybinds.
250
+
"folke/which-key.nvim",
251
+
event = "VimEnter", -- Sets the loading event to 'VimEnter'
253
+
-- delay between pressing a key and opening which-key (milliseconds)
254
+
-- this setting is independent of vim.opt.timeoutlen
257
+
-- set icon mappings to true if you have a Nerd Font
258
+
mappings = vim.g.have_nerd_font,
259
+
-- If you are using a Nerd Font: set icons.keys to an empty table which will use the
260
+
-- default which-key.nvim defined Nerd Font icons, otherwise define a string table
261
+
keys = vim.g.have_nerd_font and {} or {
265
+
Right = "<Right> ",
272
+
ScrollWheelDown = "<ScrollWheelDown> ",
273
+
ScrollWheelUp = "<ScrollWheelUp> ",
276
+
Space = "<Space> ",
295
+
-- NOTE: Plugins can specify dependencies.
297
+
-- The dependencies are proper plugin specifications as well - anything
298
+
-- you do for a plugin at the top level, you can do for a dependency.
300
+
-- Use the `dependencies` key to specify the dependencies of a particular plugin
304
+
-- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
305
+
-- used for completion, annotations and signatures of Neovim apis
306
+
"folke/lazydev.nvim",
310
+
-- Load luvit types when the `vim.uv` word is found
311
+
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
316
+
-- Main LSP Configuration
317
+
"neovim/nvim-lspconfig",
319
+
-- Automatically install LSPs and related tools to stdpath for Neovim
320
+
-- Mason must be loaded before its dependents so we need to set it up here.
321
+
-- NOTE: `opts = {}` is the same as calling `require('mason').setup({})`
322
+
{ "mason-org/mason.nvim", opts = {} },
323
+
"mason-org/mason-lspconfig.nvim",
324
+
"WhoIsSethDaniel/mason-tool-installer.nvim",
326
+
config = function()
327
+
-- Brief aside: **What is LSP?**
329
+
-- LSP is an initialism you've probably heard, but might not understand what it is.
331
+
-- LSP stands for Language Server Protocol. It's a protocol that helps editors
332
+
-- and language tooling communicate in a standardized fashion.
334
+
-- In general, you have a "server" which is some tool built to understand a particular
335
+
-- language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc.). These Language Servers
336
+
-- (sometimes called LSP servers, but that's kind of like ATM Machine) are standalone
337
+
-- processes that communicate with some "client" - in this case, Neovim!
339
+
-- LSP provides Neovim with features like:
340
+
-- - Go to definition
341
+
-- - Find references
342
+
-- - Autocompletion
346
+
-- Thus, Language Servers are external tools that must be installed separately from
347
+
-- Neovim. This is where `mason` and related plugins come into play.
349
+
-- If you're wondering about lsp vs treesitter, you can check out the wonderfully
350
+
-- and elegantly composed help section, `:help lsp-vs-treesitter`
352
+
-- This function gets run when an LSP attaches to a particular buffer.
353
+
-- That is to say, every time a new file is opened that is associated with
354
+
-- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this
355
+
-- function will be executed to configure the current buffer
356
+
vim.api.nvim_create_autocmd("LspAttach", {
357
+
group = vim.api.nvim_create_augroup("kickstart-lsp-attach", { clear = true }),
358
+
callback = function(event)
359
+
-- NOTE: Remember that Lua is a real programming language, and as such it is possible
360
+
-- to define small helper and utility functions so you don't have to repeat yourself.
362
+
-- In this case, we create a function that lets us more easily define mappings specific
363
+
-- for LSP related items. It sets the mode, buffer and description for us each time.
364
+
local map = function(keys, func, desc, mode)
366
+
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = "LSP: " .. desc })
369
+
-- Rename the variable under your cursor.
370
+
-- Most Language Servers support renaming across files, etc.
371
+
map("<leader>r", vim.lsp.buf.rename, "[R]ename")
373
+
-- Execute a code action, usually your cursor needs to be on top of an error
374
+
-- or a suggestion from your LSP for this to activate.
375
+
map("<leader>C", vim.lsp.buf.code_action, "[C]ode Action", { "n", "x" })
377
+
-- The following two autocommands are used to highlight references of the
378
+
-- word under your cursor when your cursor rests there for a little while.
379
+
-- See `:help CursorHold` for information about when this is executed
381
+
-- When you move your cursor, the highlights will be cleared (the second autocommand).
382
+
local client = vim.lsp.get_client_by_id(event.data.client_id)
383
+
if client and client:supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then
384
+
local highlight_augroup =
385
+
vim.api.nvim_create_augroup("kickstart-lsp-highlight", { clear = false })
386
+
vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, {
387
+
buffer = event.buf,
388
+
group = highlight_augroup,
389
+
callback = vim.lsp.buf.document_highlight,
392
+
vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, {
393
+
buffer = event.buf,
394
+
group = highlight_augroup,
395
+
callback = vim.lsp.buf.clear_references,
398
+
vim.api.nvim_create_autocmd("LspDetach", {
399
+
group = vim.api.nvim_create_augroup("kickstart-lsp-detach", { clear = true }),
400
+
callback = function(event2)
401
+
vim.lsp.buf.clear_references()
402
+
vim.api.nvim_clear_autocmds({ group = "kickstart-lsp-highlight", buffer = event2.buf })
407
+
-- The following code creates a keymap to toggle inlay hints in your
408
+
-- code, if the language server you are using supports them
410
+
-- This may be unwanted, since they displace some of your code
411
+
if client and client:supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then
412
+
map("<leader>th", function()
413
+
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = event.buf }))
414
+
end, "[T]oggle Inlay [H]ints")
419
+
-- Change diagnostic symbols in the sign column (gutter)
420
+
if vim.g.have_nerd_font then
421
+
local signs = { ERROR = "๎ช", WARN = "๎ฉฌ", INFO = "๎ฉด", HINT = "๎ฉก" }
422
+
local diagnostic_signs = {}
423
+
for type, icon in pairs(signs) do
424
+
diagnostic_signs[vim.diagnostic.severity[type]] = icon
426
+
vim.diagnostic.config({ signs = { text = diagnostic_signs } })
429
+
local capabilities = vim.lsp.protocol.make_client_capabilities()
431
+
local function get_python_path(workspace)
432
+
-- Check for uv first
434
+
vim.fn.system("cd " .. workspace .. " && uv run which python 2>/dev/null"):gsub("\n", "")
435
+
if vim.v.shell_error == 0 and uv_python ~= "" then
439
+
-- Fallback to standard virtual environments
440
+
local venv_paths = {
441
+
workspace .. "/.venv/bin/python",
442
+
workspace .. "/venv/bin/python",
443
+
workspace .. "/.virtualenv/bin/python",
446
+
for _, path in ipairs(venv_paths) do
447
+
if vim.fn.filereadable(path) == 1 then
452
+
-- Final fallback to system python
453
+
return vim.fn.exepath("python3") or vim.fn.exepath("python") or "python"
456
+
-- Enable the following language servers
457
+
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
459
+
-- Add any additional override configuration in the following tables. Available keys are:
460
+
-- - cmd (table): Override the default command used to start the server
461
+
-- - filetypes (table): Override the default list of associated filetypes for the server
462
+
-- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features.
463
+
-- - settings (table): Override the default settings passed when initializing the server.
464
+
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
467
+
docker_compose_language_service = {},
474
+
["rust-analyzer"] = {
476
+
command = "clippy",
479
+
allFeatures = true,
489
+
-- filetypes = { ... },
490
+
-- capabilities = {},
494
+
callSnippet = "Replace",
496
+
-- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
497
+
diagnostics = { disable = { "missing-fields" } },
504
+
configurationPreference = "filesystemFirst",
506
+
organizeImports = true,
507
+
workspaceSettings = {
509
+
targetVersion = "py311",
513
+
on_attach = function(client, bufnr)
514
+
client.server_capabilities.hoverProvider = false
516
+
vim.api.nvim_create_autocmd("BufWritePre", {
518
+
callback = function()
519
+
vim.lsp.buf.format({ async = false })
525
+
before_init = function(_, config)
526
+
config.settings.python = vim.tbl_deep_extend("force", config.settings.python or {}, {
527
+
pythonPath = get_python_path(config.root_dir),
533
+
typeCheckingMode = "strict",
534
+
diagnosticMode = "workspace",
535
+
useLibraryCodeForTypes = true,
536
+
autoSearchPaths = true,
537
+
autoImportCompletions = true,
538
+
diagnosticSeverityOverrides = {
539
+
reportMissingTypeStubs = "none",
540
+
reportGeneralTypeIssues = "warning",
541
+
reportOptionalMemberAccess = "none",
543
+
stubPath = "typings",
544
+
ignore = { "**/node_modules", "**/__pycache__", "**/venv", "**/.venv" },
551
+
on_attach = function(client, bufnr)
552
+
-- Disable formatting capabilities for Pyright (let ruff handle it)
553
+
client.server_capabilities.documentFormattingProvider = false
554
+
client.server_capabilities.documentRangeFormattingProvider = false
559
+
for server, config in pairs(servers) do
560
+
vim.lsp.config(server, config)
563
+
-- Ensure the servers and tools above are installed
565
+
-- To check the current status of installed tools and/or manually install
566
+
-- other tools, you can run
569
+
-- You can press `g?` for help in this menu.
571
+
-- `mason` had to be setup earlier: to configure its options see the
572
+
-- `dependencies` table for `nvim-lspconfig` above.
574
+
-- You can add other tools here that you want Mason to install
575
+
-- for you, so that they are available from within Neovim.
576
+
local ensure_installed = vim.tbl_keys(servers or {})
577
+
vim.list_extend(ensure_installed, {
578
+
"stylua", -- Used to format Lua code
587
+
"reorder-python-imports",
593
+
require("mason-tool-installer").setup({ ensure_installed = ensure_installed })
595
+
require("mason-lspconfig").setup({
596
+
ensure_installed = {},
597
+
automatic_enable = true,
598
+
automatic_installation = false,
600
+
function(server_name)
601
+
local server = servers[server_name] or {}
602
+
-- This handles overriding only values explicitly passed
603
+
-- by the server configuration above. Useful when disabling
604
+
-- certain features of an LSP (for example, turning off formatting for ts_ls)
605
+
server.capabilities = vim.tbl_deep_extend("force", {}, capabilities, server.capabilities or {})
606
+
require("lspconfig")[server_name].setup(server)
614
+
"stevearc/conform.nvim",
615
+
event = { "BufWritePre" },
616
+
cmd = { "ConformInfo" },
621
+
require("conform").format({ async = true, lsp_format = "fallback" })
624
+
desc = "[F]ormat buffer",
628
+
notify_on_error = false,
629
+
format_on_save = function(bufnr)
630
+
-- Disable "format_on_save lsp_fallback" for languages that don't
631
+
-- have a well standardized coding style. You can add additional
632
+
-- languages here or re-enable it for the disabled ones.
633
+
local disable_filetypes = { c = true, cpp = true }
634
+
local lsp_format_opt
635
+
if disable_filetypes[vim.bo[bufnr].filetype] then
636
+
lsp_format_opt = "never"
638
+
lsp_format_opt = "fallback"
642
+
lsp_format = lsp_format_opt,
645
+
formatters_by_ft = {
646
+
lua = { "stylua" },
647
+
-- Conform can also run multiple formatters sequentially
648
+
-- python = { "isort", "black" },
650
+
-- You can use 'stop_after_first' to run the first available formatter from the list
651
+
javascript = { "prettierd" },
652
+
javascriptreact = { "prettierd" },
653
+
json = { "prettierd" },
654
+
jsonc = { "prettierd" },
655
+
css = { "prettierd" },
656
+
html = { "prettierd" },
657
+
typescript = { "prettierd" },
658
+
typescriptreact = { "prettierd" },
659
+
go = { "goimports" },
665
+
"ellisonleao/gruvbox.nvim",
669
+
transparent_mode = true,
670
+
palette_overrides = {
675
+
vim.cmd.colorscheme("gruvbox")
679
+
-- Highlight todo, notes, etc in comments
681
+
"folke/todo-comments.nvim",
682
+
event = "VimEnter",
683
+
dependencies = { "nvim-lua/plenary.nvim" },
684
+
opts = { signs = false },
688
+
"pwntester/octo.nvim",
689
+
dependencies = { "nvim-lua/plenary.nvim", "folke/snacks.nvim", "nvim-tree/nvim-web-devicons" },
692
+
default_remote = { "origin" },
693
+
default_merge_method = "squash",
694
+
default_delete_branch = false,
697
+
field = "CREATED_AT",
698
+
direction = "DESC",
702
+
auto_show_threads = true,
707
+
field = "UPDATED_AT",
708
+
direction = "DESC",
710
+
always_select_remote_on_create = false,
711
+
use_branch_name_as_title = false,
716
+
{ -- Collection of various small independent plugins/modules
717
+
"echasnovski/mini.nvim",
718
+
config = function()
719
+
-- Better Around/Inside textobjects
722
+
-- - va) - [V]isually select [A]round [)]paren
723
+
-- - yinq - [Y]ank [I]nside [N]ext [Q]uote
724
+
-- - ci' - [C]hange [I]nside [']quote
725
+
require("mini.ai").setup({ n_lines = 500 })
727
+
-- Add/delete/replace surroundings (brackets, quotes, etc.)
729
+
-- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren
730
+
-- - sd' - [S]urround [D]elete [']quotes
731
+
-- - sr)' - [S]urround [R]eplace [)] [']
732
+
require("mini.surround").setup()
734
+
-- Simple and easy statusline.
735
+
-- You could remove this setup call if you don't like it,
736
+
-- and try some other statusline plugin
737
+
local statusline = require("mini.statusline")
738
+
-- Status line content configuration
739
+
local content = function()
740
+
local mode, mode_hl = MiniStatusline.section_mode({ trunc_width = 120 })
741
+
local git = MiniStatusline.section_git({ trunc_width = 40 })
742
+
local diff = MiniStatusline.section_diff({ trunc_width = 75 })
743
+
local diagnostics = statusline.section_diagnostics({
752
+
local lsp = MiniStatusline.section_lsp({ trunc_width = 75 })
753
+
local filename = MiniStatusline.section_filename({ trunc_width = 140 })
754
+
local fileinfo = MiniStatusline.section_fileinfo({ trunc_width = 120 })
755
+
local location = MiniStatusline.section_location({ trunc_width = 75 })
756
+
local search = MiniStatusline.section_searchcount({ trunc_width = 75 })
758
+
return MiniStatusline.combine_groups({
759
+
{ hl = mode_hl, strings = { mode } },
760
+
{ hl = "MiniStatuslineDevinfo", strings = { git, diff, diagnostics, lsp } },
761
+
"%<", -- Mark general truncate point
762
+
{ hl = "MiniStatuslineFilename", strings = { filename } },
763
+
"%=", -- End left alignment
764
+
{ hl = "MiniStatuslineFileinfo", strings = { fileinfo } },
765
+
{ hl = mode_hl, strings = { search, location } },
768
+
-- set use_icons to true if you have a Nerd Font
769
+
statusline.setup({ use_icons = vim.g.have_nerd_font, content = { active = content } })
771
+
-- You can configure sections in the statusline by overriding their
772
+
-- default behavior. For example, here we set the section for
773
+
-- cursor location to LINE:COLUMN
774
+
---@diagnostic disable-next-line: duplicate-set-field
775
+
statusline.section_location = function()
779
+
-- ... and there is more!
780
+
-- Check out: https://github.com/echasnovski/mini.nvim
783
+
{ -- Highlight, edit, and navigate code
784
+
"nvim-treesitter/nvim-treesitter",
785
+
build = ":TSUpdate",
786
+
main = "nvim-treesitter.configs", -- Sets main module to use for opts
787
+
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
789
+
ensure_installed = {
803
+
-- Autoinstall languages that are not installed
804
+
auto_install = true,
807
+
-- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules.
808
+
-- If you are experiencing weird indenting issues, add the language to
809
+
-- the list of additional_vim_regex_highlighting and disabled languages for indent.
810
+
additional_vim_regex_highlighting = { "ruby" },
812
+
indent = { enable = true, disable = { "ruby" } },
814
+
-- There are additional nvim-treesitter modules that you can use to interact
815
+
-- with nvim-treesitter. You should go explore a few and see what interests you:
817
+
-- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod`
818
+
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
819
+
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
822
+
-- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the
823
+
-- init.lua. If you want these files, they are in the repository, so you can just download them and
824
+
-- place them in the correct locations.
826
+
-- NOTE: Next step on your Neovim journey: Add/Configure additional plugins for Kickstart
828
+
-- Here are some example plugins that I've included in the Kickstart repository.
829
+
-- Uncomment any of the lines below to enable them (you will need to restart nvim).
831
+
-- require 'kickstart.plugins.debug',
832
+
-- require("kickstart.plugins.indent_line"),
833
+
require("kickstart.plugins.lint"),
834
+
require("kickstart.plugins.autopairs"),
835
+
-- require("kickstart.plugins.neo-tree"),
836
+
require("kickstart.plugins.gitsigns"), -- adds gitsigns recommend keymaps
839
+
"saghen/blink.cmp",
841
+
---@module 'blink.cmp'
842
+
---@type blink.cmp.Config
844
+
keymap = { preset = "enter" },
846
+
use_nvim_cmp_as_default = true,
847
+
nerd_font_variant = "mono",
850
+
default = { "lsp", "path" },
852
+
fuzzy = { implementation = "prefer_rust_with_warning" },
859
+
opts_extend = { "sources.default" },
863
+
"ray-x/lsp_signature.nvim",
864
+
config = function()
865
+
require("lsp_signature").setup({})
870
+
"rachartier/tiny-inline-diagnostic.nvim",
871
+
event = "VeryLazy", -- Or `LspAttach`
872
+
priority = 1000, -- needs to be loaded in first
873
+
config = function()
874
+
require("tiny-inline-diagnostic").setup({
878
+
always_show = true,
882
+
vim.diagnostic.config({ virtual_text = false }) -- Only if needed in your configuration, if you already have native LSP diagnostics
887
+
"OXY2DEV/markview.nvim",
893
+
"sindrets/diffview.nvim",
894
+
dependencies = { "nvim-tree/nvim-web-devicons" },
895
+
config = function()
896
+
local diffview = require("diffview")
897
+
vim.keymap.set("n", "<leader>gd", diffview.open, { desc = "[G]it [D]iff" })
898
+
vim.keymap.set("n", "<leader>gh", diffview.file_history, { desc = "[G]it [H]istory" })
899
+
vim.keymap.set("n", "<leader>gc", diffview.close, { desc = "[G]it [C]lose" })
904
+
"zgs225/gomodifytags.nvim",
905
+
cmd = { "GoAddTags", "GoRemoveTags", "GoInstallModifyTagsBin" },
907
+
"nvim-treesitter/nvim-treesitter",
909
+
config = function()
910
+
require("gomodifytags").setup({}) -- Optional: You can add any specific configuration here if needed.
914
+
{ "akinsho/bufferline.nvim", version = "*", dependencies = "nvim-tree/nvim-web-devicons", opts = {} },
916
+
{ "windwp/nvim-ts-autotag", lazy = false, opts = {} },
919
+
"folke/snacks.nvim",
922
+
---@module "snacks"
923
+
---@type snacks.Config
925
+
bigfile = { enabled = true },
929
+
{ section = "header" },
930
+
{ section = "keys", gap = 1, padding = 1 },
931
+
{ section = "startup" },
933
+
section = "terminal",
934
+
cmd = "pokemon-colorscripts -r --no-title; sleep .1",
942
+
explorer = { enabled = true },
943
+
indent = { enabled = true },
944
+
input = { enabled = true },
949
+
picker = { enabled = true },
950
+
quickfile = { enabled = true },
951
+
scope = { enabled = true },
952
+
statuscolumn = { enabled = true },
953
+
words = { enabled = true },
957
+
-- Top Pickers & Explorer
958
+
{ "<leader>fd", function() Snacks.picker.smart() end, desc = "Smart Find Files" },
959
+
{ "<leader>,", function() Snacks.picker.buffers() end, desc = "Buffers" },
960
+
{ "<leader>/", function() Snacks.picker.grep({need_search = false, live = false}) end, desc = "Grep" },
961
+
{ "<leader>e", function() Snacks.explorer() end, desc = "File Explorer" },
962
+
{ "\\", function() Snacks.explorer() end, desc = "File Explorer" },
964
+
{ "<leader><space>", function() Snacks.picker.buffers() end, desc = "Buffers" },
965
+
{ "<leader>ff", function() Snacks.picker.files() end, desc = "Find Files" },
966
+
{ "<leader>fp", function() Snacks.picker.projects() end, desc = "Projects" },
968
+
{ "<leader>gb", function() Snacks.picker.git_branches() end, desc = "Git Branches" },
969
+
{ "<leader>gl", function() Snacks.picker.git_log() end, desc = "Git Log" },
970
+
{ "<leader>gL", function() Snacks.picker.git_log_line() end, desc = "Git Log Line" },
971
+
{ "<leader>gS", function() Snacks.picker.git_stash() end, desc = "Git Stash" },
972
+
-- { "<leader>gd", function() Snacks.picker.git_diff() end, desc = "Git Diff (Hunks)" },
973
+
{ "<leader>gf", function() Snacks.picker.git_log_file() end, desc = "Git Log File" },
975
+
{ "<leader>sb", function() Snacks.picker.lines() end, desc = "Buffer Lines" },
976
+
{ "<leader>sB", function() Snacks.picker.grep_buffers() end, desc = "Grep Open Buffers" },
977
+
{ "<leader>sg", function() Snacks.picker.grep({need_search = false, live = false}) end, desc = "Grep" },
978
+
{ "<leader>sw", function() Snacks.picker.grep_word() end, desc = "Visual selection or word", mode = { "n", "x" } },
980
+
{ "<leader>s/", function() Snacks.picker.search_history() end, desc = "Search History" },
981
+
{ "<leader>sa", function() Snacks.picker.autocmds() end, desc = "Autocmds" },
982
+
{ "<leader>sb", function() Snacks.picker.lines() end, desc = "Buffer Lines" },
983
+
{ "<leader>sC", function() Snacks.picker.commands() end, desc = "Commands" },
984
+
{ "<leader>sd", function() Snacks.picker.diagnostics() end, desc = "Diagnostics" },
985
+
{ "<leader>sD", function() Snacks.picker.diagnostics_buffer() end, desc = "Buffer Diagnostics" },
986
+
{ "<leader>sh", function() Snacks.picker.help() end, desc = "Help Pages" },
987
+
{ "<leader>sH", function() Snacks.picker.highlights() end, desc = "Highlights" },
988
+
{ "<leader>su", function() Snacks.picker.undo() end, desc = "Undo History" },
990
+
{ "gd", function() Snacks.picker.lsp_definitions() end, desc = "Goto Definition" },
991
+
{ "gD", function() Snacks.picker.lsp_declarations() end, desc = "Goto Declaration" },
992
+
{ "gr", function() Snacks.picker.lsp_references() end, nowait = true, desc = "References" },
993
+
{ "gI", function() Snacks.picker.lsp_implementations() end, desc = "Goto Implementation" },
994
+
{ "gy", function() Snacks.picker.lsp_type_definitions() end, desc = "Goto T[y]pe Definition" },
995
+
{ "<leader>ss", function() Snacks.picker.lsp_symbols() end, desc = "LSP Symbols" },
996
+
{ "<leader>sS", function() Snacks.picker.lsp_workspace_symbols() end, desc = "LSP Workspace Symbols" },
998
+
{ "<leader>gB", function() Snacks.gitbrowse() end, desc = "Git Browse", mode = { "n", "v" } },
999
+
{ "<c-/>", function() Snacks.terminal() end, desc = "Toggle Terminal" },
1000
+
{ "]]", function() Snacks.words.jump(vim.v.count1) end, desc = "Next Reference", mode = { "n", "t" } },
1001
+
{ "[[", function() Snacks.words.jump(-vim.v.count1) end, desc = "Prev Reference", mode = { "n", "t" } },
1005
+
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
1006
+
-- This is the easiest way to modularize your config.
1008
+
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
1009
+
-- { import = 'custom.plugins' },
1012
+
-- If you are using a Nerd Font: set icons to an empty table which will use the
1013
+
-- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table
1014
+
icons = vim.g.have_nerd_font and {} or {
1032
+
vim.api.nvim_create_autocmd({ "BufEnter", "BufRead", "BufNewFile" }, {
1034
+
callback = function()
1035
+
local root_dir = vim.fn.getcwd()
1037
+
local uv_python = vim.fn.system("cd " .. root_dir .. " && uv run which python 2>/dev/null"):gsub("\n", "")
1039
+
if vim.v.shell_error == 0 and uv_python ~= "" then
1040
+
local venv_path = uv_python:match("(.*/%.venv)")
1042
+
vim.env.VIRTUAL_ENV = venv_path
1043
+
vim.env.PATH = venv_path .. "/bin:" .. vim.env.PATH
1044
+
vim.g.python3_host_prog = uv_python
1047
+
local venv_paths = {
1048
+
root_dir .. "/.venv",
1049
+
root_dir .. "/venv",
1050
+
root_dir .. "/.virtualenv",
1053
+
for _, venv in ipairs(venv_paths) do
1054
+
if vim.fn.isdirectory(venv) == 1 then
1055
+
vim.env.VIRTUAL_ENV = venv
1056
+
vim.env.PATH = venv .. "/bin:" .. vim.env.PATH
1057
+
vim.g.python3_host_prog = venv .. "/bin/python"
1065
+
-- The line beneath this is called `modeline`. See `:help modeline`
1066
+
-- vim: ts=2 sts=2 sw=2 et