nvim-upgrade #4

Merged
tomas.mirchev merged 13 commits from nvim-upgrade into main 2025-10-20 13:57:14 +00:00
42 changed files with 763 additions and 1209 deletions
Showing only changes of commit 64a20b1292 - Show all commits

View File

@ -0,0 +1 @@
return { globals = { 'vim' } }

View File

@ -0,0 +1,14 @@
{
"$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json",
"runtime": {
"version": "LuaJIT"
},
"workspace": {
"library": [
"lua",
"$VIMRUNTIME",
"${3rd}/luv/library"
],
"checkThirdParty": false
}
}

View File

@ -0,0 +1,7 @@
column_width = 100
indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferSingle"
call_parentheses = "Always"
line_endings = "Unix"

View File

@ -1 +0,0 @@
require("themes.invero").load()

View File

@ -0,0 +1,215 @@
TODO:
- wrap up invero theme in separate repo and proper colors?
- check plugins logins
- cache / create final result
- simplify coding: ts, lsp, lint, format (check other repos)
- how to download parsers and plugins alternative
- telescope alternative
- keymaps
- wrap up everything
```lua
--[[
Neovim Lua config: ways to set things
- vim.opt : preferred modern API for options (handles lists, cleaner syntax)
- vim.g : global variables (leader key, plugin settings, disable builtins, etc.)
- vim.o : global-only option (rarely needed directly)
- vim.wo : window-local option (applies to current window only, use in autocmds)
- vim.bo : buffer-local option (applies to current buffer only, use in autocmds)
- vim.env : set environment variables (like PATH, LANG)
- vim.fn : call Vimscript functions (e.g. vim.fn.getcwd())
- vim.cmd : run raw Vimscript/Ex commands (e.g. vim.cmd("colorscheme desert"))
- vim.api : low-level Neovim API (create autocmds, keymaps, buffer/window ops, etc.)
TL;DR -> use vim.opt + vim.g in options.lua for defaults.
Use vim.wo/vim.bo only in context-specific tweaks (autocmds).
Use vim.env, vim.fn, vim.cmd, vim.api as needed for scripting.
--]]
```
## check macos fileS: https://github.com/dsully/dotfiles/blob/main/.data/macos-defaults/globals.yaml
# Used pacakges:
- rockspaces Metadata files describing how to build and install a Lua package.
- luarocks Package manager for Lua modules. (optional)
- tree-sitter Parser generator. Not needed except for using CLI. (optional)
- fd-find (fd) Alternative to `find`. (optional)
- ripgrep (rg) Line-oriented search tool. (recommended)
- git Revision control system. (requirement)
- lazygit Terminal UI for git commands. (optional)
- fzf Command-line fuzzy finder.
- curl Command-line for transferring data specified with URL syntax.
- wget Utility for downloading files from the Web.
- make
- cc Collection of compilers.
- build-essential Meta-package that installs standard C/C++ libraries and headers.
These are needed to compile tree-sitter parsers. Run only on the first time.
cc (gcc, clang) C compiler. Usually it points to `clang` (on macos) or `gcc` (on linux).
g++ C++ compiler.
make Build automation tool from source code.
- unzip Extraction utility for archives compressed in .zip.
- ca-certificates Provides a set of trusted Certificate Authority (CA) certificates.
- openssh-client Tools for connecting to remote servers securely over SSH.
- libssl-dev Development libraries and headers for OpenSSL.
- sudo
- tree
- jq
- man-db
- python3
- volta Node manager
- ncurses ncurses-dev ncurses-libs ncurses-terminfo \
- check: https://github.com/glepnir/nvim/blob/main/Dockerfile
# Currently installed
- plenary.nvim
- lazy.nvim
- nvim-treesitter
- neovim/nvim-lspconfig
- williamboman/mason.nvim
- williamboman/mason-lspconfig.nvim
- j-hui/fidget.nvim
- hrsh7th/cmp-nvim-lsp
- b0o/schemastore.nvim
- windwp/nvim-ts-autotag # auto close,rename tags
- nvim-autopairs # auto pair chars
- stevearc/conform.nvim # formatter
- nvim-cmp # completion
- cmp-path
- cmp-nvim-lsp
- nvim-tree.lua # file explorer
- telescope.nvim
- telescope-fzf-native.nvim
- telescope-ui-select.nvim
- plenary.nvim
- harpoon # tags
# Notes:
- in lsp change tsserver to vtsls
# New package definition
- Plugin and Package managers
- folke/lazy.nvim
- mason-org/mason.nvim
- TS
- nvim-treesitter
- nvim-treesitter-textobjects
- LSP
- neovim/nvim-lspconfig
- nvim-ts-autotag tag elements (`</>`)
- windwp/nvim-autopairs auto pairs
- blink.cmp autocompletion
- stevearc/conform.nvim autoformat
- mini.ai `a/i` motions
- mini.pairs
- mini.surround
- mfussenegger/nvim-lint
- nvim-lspconfig
- fzf-lua (replace telescope)
- ? indent guides
- lukas-reineke/indent-blankline.nvim
- snacks.indent
- mini.indentscope
## Deps:
- SchemaStore.nvim
- mason-lspconfig.nvim
- mason.nvim
## Maybe:
- folke/ts-comments.nvim better comments
- grug-far.nvim find and replace
- markdown-preview.nvim side by side md (disabled in folke)
- toppair/peek.nvim another markdown preview?
- render-markdown.nvim inline viewer
- diffview.nvim
- octo.nvim edit and review GH issues and pr
- yanky.nvim better yank+put. has history
- inc-rename.nvim LSP renaming with visual feedback
- mini.basics defaults options
- mini.test run tests under cursor
- mini.diff inline diff
- mini.hipatters hilight patters and hex colors
- mini.move move chunks (like vscode)
- undo tree (find a plugin)
## AI help
- jackMort/ChatGPT.nvim
- MunifTanjim/nui.nvim (dep)
- nvim-lua/plenary.nvim (dep)
- nvim-telescope/telescope.nvim (dep)
- robitx/gp.nvim
- zbirenbaum/copilot.lua (folke)
- milanglacier/minuet-ai.nvim (folke)
## Options
```
opt.backup = true
opt.backupdir = vim.fn(stdpath("state") .. "/backup"
opt.mousescroll = "vert:1,hor:4"
opt.winborder = "rounded"
opt.undofile = true
-- lazy
rtp = {
disabled_plugins = { "gzip", "tarPlugin", "zipPlugin", "tohtml", "tutor" },
},
vim.keymap.set("n", "<C-c>", "ciw")
-- ts lsp
includeCompletionsWithSnippetText = true,
jsxAttributeCompletionStyle = "auto",
-- tree-sitter parsers naming:
https://github.com/nvim-treesitter/nvim-treesitter/blob/master/lua/nvim-treesitter/parsers.lua
```
folke cmd
```lua
-- show cursor line only in active window
vim.api.nvim_create_autocmd({ "InsertLeave", "WinEnter" }, {
callback = function()
if vim.w.auto_cursorline then
vim.wo.cursorline = true
vim.w.auto_cursorline = nil
end
end,
})
vim.api.nvim_create_autocmd({ "InsertEnter", "WinLeave" }, {
callback = function()
if vim.wo.cursorline then
vim.w.auto_cursorline = true
vim.wo.cursorline = false
end
end,
})
-- backups
vim.api.nvim_create_autocmd("BufWritePre", {
group = vim.api.nvim_create_augroup("better_backup", { clear = true }),
callback = function(event)
local file = vim.uv.fs_realpath(event.match) or event.match
local backup = vim.fn.fnamemodify(file, ":p:~:h")
backup = backup:gsub("[/\\]", "%%")
vim.go.backupext = backup
end,
})
```
Enable folding with TS:
```
vim.opt.foldmethod = "expr"
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
vim.opt.foldenable = false -- start with all folds open
```

View File

View File

View File

@ -0,0 +1,51 @@
-- [[
-- TreeSitter parsers do not match directly with the filename.
-- See: github/nvim-treesitter:lua/nvim-treesitter/parsers.lua
-- ]]
local M = {
-- <filetype> = { <treesitter>, <lsp>, <linter>, <formatter> }
-- note: lsp will match the `<path>/lsp/<file>.lua` file. The CMD the proper language-server.
markdown = { 'markdown', 'lua_ls', 'luacheck', 'stylua' },
javascript = { 'javascript', ' ts_ls', 'eslint', 'prettierd' },
typescript = { 'typescript', ' ts_ls', 'eslint', 'prettierd' },
javascriptreact = { '', ' ts_ls', 'eslint', 'prettierd' },
typescript = { 'typescript', ' ts_ls', 'eslint', 'prettierd' },
}
return {
opts = {
view = { signcolumn = 'no' },
renderer = {
root_folder_label = false,
indent_width = 2,
indent_markers = {
enable = true,
icons = { corner = '', none = '', bottom = '' },
},
icons = {
show = {
file = true,
folder = true,
folder_arrow = false, -- KEEP FALSE
git = false,
modified = false,
hidden = false,
diagnostics = false,
bookmarks = false,
},
glyphs = {
default = ' ',
folder = {
default = '',
open = '',
},
},
},
},
hijack_cursor = true,
sync_root_with_cwd = true,
update_focused_file = {
enabled = true,
-- update_root = { enabled = true }
},
},
}

View File

@ -1,22 +1,6 @@
--[[
Neovim Lua config: ways to set things
- vim.opt : preferred modern API for options (handles lists, cleaner syntax)
- vim.g : global variables (leader key, plugin settings, disable builtins, etc.)
- vim.o : global-only option (rarely needed directly)
- vim.wo : window-local option (applies to current window only, use in autocmds)
- vim.bo : buffer-local option (applies to current buffer only, use in autocmds)
- vim.env : set environment variables (like PATH, LANG)
- vim.fn : call Vimscript functions (e.g. vim.fn.getcwd())
- vim.cmd : run raw Vimscript/Ex commands (e.g. vim.cmd("colorscheme desert"))
- vim.api : low-level Neovim API (create autocmds, keymaps, buffer/window ops, etc.)
TL;DR -> use vim.opt + vim.g in options.lua for defaults.
Use vim.wo/vim.bo only in context-specific tweaks (autocmds).
Use vim.env, vim.fn, vim.cmd, vim.api as needed for scripting.
]]
require("config.options")
require("config.keymaps")
require("config.lazy")
require("config.autocmds")
require('config.options')
require('config.keymaps')
require('config.autocmds')
require('config.clipboard')
require('config.terminal')
require('config.lazy')

View File

@ -1,22 +1,12 @@
{
"cmp-nvim-lsp": { "branch": "main", "commit": "bd5a7d6db125d4654b50eeae9f5217f24bb22fd3" },
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
"conform.nvim": { "branch": "master", "commit": "b4aab989db276993ea5dcb78872be494ce546521" },
"fidget.nvim": { "branch": "main", "commit": "4d5858bd4c471c895060e1b9f3575f1551184dc5" },
"harpoon": { "branch": "harpoon2", "commit": "ed1f853847ffd04b2b61c314865665e1dadf22c7" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "25c11854aa25558ee6c03432edfa0df0217324be" },
"mason.nvim": { "branch": "main", "commit": "d66c60e17dd6fd8165194b1d14d21f7eb2c1697a" },
"blink.cmp": { "branch": "main", "commit": "327fff91fe6af358e990be7be1ec8b78037d2138" },
"conform.nvim": { "branch": "master", "commit": "fbcb4fa7f34bfea9be702ffff481a8e336ebf6ed" },
"invero.nvim": { "branch": "main", "commit": "95048ee10d712a2b74851a74277b23baef019079" },
"lazy.nvim": { "branch": "main", "commit": "1ea3c4085785f460fb0e46d2fe1ee895f5f9e7c1" },
"mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" },
"nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" },
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
"nvim-lspconfig": { "branch": "master", "commit": "d9879110d0422a566fa01d732556f4d5515e1738" },
"nvim-lint": { "branch": "master", "commit": "9da1fb942dd0668d5182f9c8dee801b9c190e2bb" },
"nvim-tree.lua": { "branch": "master", "commit": "321bc61580fd066b76861c32de3319c3a6d089e7" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"nvim-ts-autotag": { "branch": "main", "commit": "c4ca798ab95b316a768d51eaaaee48f64a4a46bc" },
"nvim-web-devicons": { "branch": "master", "commit": "6e51ca170563330e063720449c21f43e27ca0bc1" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"schemastore.nvim": { "branch": "main", "commit": "0fccf9234acfd981867cbd42c4101829e6808790" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" },
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }
"nvim-ts-autotag": { "branch": "main", "commit": "c4ca798ab95b316a768d51eaaaee48f64a4a46bc" }
}

View File

@ -0,0 +1,8 @@
return {
cmd = { "vscode-json-language-server", "--stdio" },
filetypes = { "json", "jsonc" },
init_options = {
provideFormatter = true,
},
root_markers = { ".git" },
}

View File

@ -0,0 +1,14 @@
return {
cmd = { "lua-language-server" },
filetypes = { "lua" },
root_markers = {
".luarc.json",
".luarc.jsonc",
".luacheckrc",
".stylua.toml",
"stylua.toml",
"selene.toml",
"selene.yml",
".git",
},
}

View File

@ -1,128 +1,17 @@
-- Highlight when yanking (copying) text
vim.api.nvim_create_autocmd("TextYankPost", {
callback = function()
vim.highlight.on_yank()
end,
vim.api.nvim_create_autocmd('TextYankPost', {
callback = function()
vim.highlight.on_yank()
end,
})
----------------------------------------------
-- Reload ColorScheme by clearing cached modules
vim.api.nvim_create_user_command("ReloadColorscheme", function()
local current = vim.g.colors_name
if not current then
vim.notify("No colorscheme is currently set", vim.log.levels.WARN)
return
end
-- clear only the cached modules for this theme
for k in pairs(package.loaded) do
if k:match("^themes%." .. current) then
package.loaded[k] = nil
end
end
-- reload it
vim.cmd("colorscheme " .. current)
vim.notify("Reloaded " .. current .. " colorscheme", vim.log.levels.INFO)
end, { desc = "Reload the current colorscheme" })
----------------------------------------------
--[[
Command :TSHighlightRoots (works but uncomment only when used)
Description:
Collects all Tree-sitter highlight groups, resolves their links,
and outputs the unique root groups actually used (for theming/debugging).
Usage:
:TSHighlightRoots -> prints roots in the command line
:TSHighlightRoots <filename> -> writes roots into <filename> (overwrites)
(filename supports ~ and tab-completion)
]]
-- local function resolve_link(name)
-- local seen = {}
-- while name and not seen[name] do
-- seen[name] = true
-- local hl = vim.api.nvim_get_hl(0, { name = name })
-- if hl.link then
-- name = hl.link
-- else
-- return name
-- end
-- end
-- end
--
-- vim.api.nvim_create_autocmd("VimEnter", {
-- callback = function()
-- vim.api.nvim_create_user_command("TSHighlightRoots", function(opts)
-- local roots = {}
-- for _, group in ipairs(vim.fn.getcompletion("@", "highlight")) do
-- local root = resolve_link(group)
-- if root then
-- roots[root] = true
-- end
-- end
--
-- local output = { "Unique root highlight groups used by Tree-sitter:" }
-- for root in pairs(roots) do
-- table.insert(output, " " .. root)
-- end
--
-- if opts.args ~= "" then
-- -- write to file
-- local filename = vim.fn.expand(opts.args)
-- local fd = assert(io.open(filename, "w"))
-- fd:write(table.concat(output, "\n"))
-- fd:close()
-- print("Wrote roots to " .. filename)
-- else
-- -- default: print to command line
-- for _, line in ipairs(output) do
-- print(line)
-- end
-- end
-- end, {
-- nargs = "?", -- allow 0 or 1 argument
-- complete = "file", -- tab-complete filenames
-- })
-- end,
-- })
----------------------------------------------
-- Useful tricks that do not fully work
----------------------------------------------
-- -- Show cursorline only in the active window
--
-- vim.api.nvim_create_autocmd({ "WinEnter", "BufEnter" }, {
-- callback = function()
-- local ft = vim.bo.filetype
-- vim.notify("enter: " .. ft .. " - " .. vim.bo.buftype)
-- -- if not ft:match("^Telescope") and ft ~= "NvimTree" then
-- -- vim.wo.cursorline = true
-- -- end
-- end,
-- })
-- vim.api.nvim_create_autocmd({ "WinLeave", "BufLeave" }, {
-- callback = function()
-- local ft = vim.bo.filetype
-- vim.notify("exit: " .. ft .. " - " .. vim.bo.buftype)
-- -- if not ft:match("^Telescope") and ft ~= "NvimTree" then
-- -- vim.wo.cursorline = false
-- -- end
-- end,
-- })
----------------------------------------------
-- -- Associate filetype
--
-- vim.api.nvim_create_autocmd("FileType", {
-- pattern = "text",
-- callback = function()
-- vim.bo.filetype = "markdown"
-- end,
-- })
-- Set filetype on new buffers
vim.api.nvim_create_user_command('Capture', function(opts)
local out = vim.fn.execute(opts.args)
vim.cmd('enew')
vim.bo.buftype = 'nofile'
vim.bo.bufhidden = 'hide'
vim.bo.swapfile = false
vim.bo.filetype = 'capture'
vim.api.nvim_buf_set_lines(0, 0, -1, false, vim.split(out, '\n'))
end, { nargs = '+', complete = 'command' })

View File

@ -0,0 +1,17 @@
if vim.env.CONTAINER then
vim.g.clipboard = {
name = "osc52",
copy = {
["+"] = require("vim.ui.clipboard.osc52").copy("+"),
["*"] = require("vim.ui.clipboard.osc52").copy("*"),
},
paste = {
["+"] = require("vim.ui.clipboard.osc52").paste("+"),
["*"] = require("vim.ui.clipboard.osc52").paste("*"),
},
}
end
vim.schedule(function()
vim.o.clipboard = "unnamedplus"
end)

View File

@ -1,50 +1,44 @@
local remap = require("utils.remap")
vim.keymap.set(
'n',
'<leader>q',
vim.diagnostic.setloclist,
{ desc = 'Open diagnostic [Q]uickfix list' }
)
remap.nmap("<leader>q", vim.diagnostic.setloclist, { desc = "Open diagnostic [Q]uickfix list" })
remap.imap("jk", "<Esc>", { desc = "Exit insert mode with jk" })
remap.cmap("jk", "<C-c>", { desc = "Exit command/search mode with jk" })
remap.nmap("<Esc>", "<cmd>nohlsearch<CR>", { desc = "Clear highlights" })
vim.keymap.set('i', 'jk', '<Esc>', { desc = 'Exit insert mode with jk' })
vim.keymap.set('c', 'jk', '<C-c>', { desc = 'Exit command/search mode with jk' })
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>', { desc = 'Clear highlights' })
-- Prevent "x" from overriding the register
remap.nmap("x", '"_x')
vim.keymap.set('n', 'x', '"_x')
-- Window Navigation
remap.nmap("<C-h>", "<C-w>h", { desc = "Move focus to the left window" })
remap.nmap("<C-l>", "<C-w>l", { desc = "Move focus to the right window" })
remap.nmap("<C-j>", "<C-w>j", { desc = "Move focus to the lower window" })
remap.nmap("<C-k>", "<C-w>k", { desc = "Move focus to the upper window" })
vim.keymap.set('n', '<C-h>', '<C-w>h', { desc = 'Move focus to the left window' })
vim.keymap.set('n', '<C-l>', '<C-w>l', { desc = 'Move focus to the right window' })
vim.keymap.set('n', '<C-j>', '<C-w>j', { desc = 'Move focus to the lower window' })
vim.keymap.set('n', '<C-k>', '<C-w>k', { desc = 'Move focus to the upper window' })
-- Tab management
remap.nmap("<Leader>tn", ":tabnew<CR>", { desc = "[T]ab [N]ew" })
remap.nmap("<Leader>tc", ":tabclose<CR>", { desc = "[T]ab [C]lose" })
remap.nmap("<Leader>to", ":tabonly<CR>", { desc = "[T]ab [O]nly" })
remap.nmap("<Leader>tl", ":tabnext<CR>", { desc = "[T]ab Next" })
remap.nmap("<Leader>th", ":tabprevious<CR>", { desc = "[T]ab Previous" })
remap.nmap("<Leader>tm.", ":tabmove +1<CR>", { desc = "[T]ab [M]ove Right" })
remap.nmap("<Leader>tm,", ":tabmove -1<CR>", { desc = "[T]ab [M]ove Left" })
vim.keymap.set('n', '<Leader>tn', ':tabnew<CR>', { desc = '[T]ab [N]ew' })
vim.keymap.set('n', '<Leader>tc', ':tabclose<CR>', { desc = '[T]ab [C]lose' })
vim.keymap.set('n', '<Leader>to', ':tabonly<CR>', { desc = '[T]ab [O]nly' })
vim.keymap.set('n', '<Leader>tl', ':tabnext<CR>', { desc = '[T]ab Next' })
vim.keymap.set('n', '<Leader>th', ':tabprevious<CR>', { desc = '[T]ab Previous' })
vim.keymap.set('n', '<Leader>tm.', ':tabmove +1<CR>', { desc = '[T]ab [M]ove Right' })
vim.keymap.set('n', '<Leader>tm,', ':tabmove -1<CR>', { desc = '[T]ab [M]ove Left' })
for i = 1, 9 do
remap.nmap(string.format("<Leader>%d", i), string.format("%dgt", i), { desc = string.format("[T]ab %d", i) })
vim.keymap.set(
'n',
string.format('<Leader>%d', i),
string.format('%dgt', i),
{ desc = string.format('[T]ab %d', i) }
)
end
-- Buffer Management
remap.nmap("<Leader>bl", ":ls<CR>", { desc = "[B]uffer [L]ist" })
remap.nmap("<Leader>bd", ":bdelete<CR>", { desc = "[B]uffer [D]elete" })
remap.nmap("]b", ":bnext<CR>", { desc = "[B]uffer [N]ext" })
remap.nmap("[b", ":bprevious<CR>", { desc = "[B]uffer [P]revious" })
remap.nmap("<Leader>bb", ":b<Space>", { desc = "[B]uffer Select" })
remap.nmap("<Leader>bo", ":bufdo bd|1bd<CR>", { desc = "[B]uffer Delete Others" })
-- Terminal
remap.nmap("<Leader>tet", function()
vim.cmd("terminal")
vim.cmd("startinsert")
end, { desc = "[T]erminal" })
remap.nmap("<leader>ter", function()
local buf_dir = vim.fn.expand("%:p:h")
vim.cmd("edit term://" .. buf_dir .. "//zsh")
vim.cmd("startinsert")
end, { desc = "[T]erminal [R]elative" })
remap.tmap("<Esc>", "<C-\\><C-n>", { desc = "Terminal Normal Mode" })
remap.tmap("jk", "<C-\\><C-n>", { desc = "Terminal Normal Mode" })
remap.tmap("<C-w>", "<C-\\><C-n><C-w>", { desc = "Terminal Window Command" })
vim.keymap.set('n', '<Leader>bl', ':ls<CR>', { desc = '[B]uffer [L]ist' })
vim.keymap.set('n', '<Leader>bd', ':bdelete<CR>', { desc = '[B]uffer [D]elete' })
vim.keymap.set('n', ']b', ':bnext<CR>', { desc = '[B]uffer [N]ext' })
vim.keymap.set('n', '[b', ':bprevious<CR>', { desc = '[B]uffer [P]revious' })
vim.keymap.set('n', '<Leader>bb', ':b<Space>', { desc = '[B]uffer Select' })
vim.keymap.set('n', '<Leader>bo', ':bufdo bd|1bd<CR>', { desc = '[B]uffer Delete Others' })

View File

@ -1,18 +1,23 @@
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
-- 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 }
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)
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 ---@diagnostic disable-next-line: undefined-field
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
spec = { { import = "plugins" } },
ui = {
backdrop = 100,
border = "rounded"
},
require('lazy').setup({
spec = { { import = 'plugins' } },
change_detection = { notify = false },
rocks = { enabled = false },
})

View File

@ -1,95 +1,55 @@
-- Map Leader
vim.g.mapleader = " "
vim.g.maplocalleader = " "
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
vim.g.have_nerd_font = true
-- Use Nerd Font
vim.g.have_nerd_font = false
-- use nvim-tree instead
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
if vim.env.CONTAINER == "true" then
vim.g.clipboard = {
name = "osc52",
copy = {
["+"] = require("vim.ui.clipboard.osc52").copy("+"),
["*"] = require("vim.ui.clipboard.osc52").copy("*"),
},
paste = {
["+"] = require("vim.ui.clipboard.osc52").paste("+"),
["*"] = require("vim.ui.clipboard.osc52").paste("*"),
},
}
end
vim.opt.formatoptions:remove('o')
-- Sync clipboard between OS and Neovim
vim.schedule(function()
vim.opt.clipboard = "unnamedplus"
end)
vim.opt.modeline = true
vim.opt.modelines = 5
-- Add vertical line
vim.opt.colorcolumn = "100"
-- UI and appearance
vim.opt.termguicolors = true -- Disable TrueColor
vim.opt.colorcolumn = '100' -- Vertical guide at column 100
vim.opt.signcolumn = 'no' -- Hide sign column
vim.opt.cursorline = true -- Highlight current line
vim.opt.guicursor = 'n-v-i-c:block' -- Block cursor shape
vim.opt.number = true -- Show absolute line numbers
vim.opt.relativenumber = true -- Show relative numbers
vim.opt.statusline = '%F%m%r%h%w%=%l,%c %P ' -- Custom statusline
vim.opt.swapfile = false
-- vim.opt.laststatus = 3
vim.opt.signcolumn = "no"
vim.opt.wrap = false -- Line wrapping
vim.opt.linebreak = true -- Wrap long lines at convenient points
vim.opt.breakindent = true -- Preserve indent when wrapping long lines
-- Enable TrueColor
vim.opt.termguicolors = false
-- Editing behavior
vim.opt.shiftwidth = 2 -- Number of spaces to use for (auto)indent
vim.opt.tabstop = 2 -- Number of spaces that a <Tab> in file counts for
vim.opt.softtabstop = 2 -- Number of spaces when pressing <Tab> in insert mode
vim.opt.expandtab = true -- Use spaces instead of literal tab characters
vim.opt.autoindent = true -- Copy indent from the current line when starting a new one
vim.opt.smartindent = true -- Automatically inserts indents in code blocks (for C-like languages)
-- Scroll lines/columns
vim.opt.mousescroll = "hor:1,ver:1"
-- Scroll
vim.opt.scrolloff = 10 -- Keep lines visible above/below cursor
vim.opt.mousescroll = 'hor:1,ver:1' -- Scroll lines/columns
vim.opt.mouse = 'a' -- Enable mouse mode
-- Set indentation preferences
vim.opt.expandtab = true -- Convert tabs to spaces
vim.opt.shiftwidth = 4 -- Number of spaces for auto-indent
vim.opt.tabstop = 4 -- Number of spaces a tab counts for
vim.opt.softtabstop = 4 -- Number of spaces a tab counts for when editing
vim.opt.autoindent = true -- Copy indent from current line when starting new line
vim.opt.smartindent = true -- Do smart autoindenting when starting a new line
-- Search and substitution
vim.opt.ignorecase = true -- Case-insensitive search
vim.opt.smartcase = true -- Smart-case search
vim.opt.inccommand = 'split' -- Live substitution preview
-- Disable line wrapping
vim.opt.wrap = false
-- Splits and windows
vim.opt.splitright = true -- Vertical splits to the right
vim.opt.splitbelow = true -- Horizontal splits below
-- Enable break indent
vim.opt.breakindent = true
-- Make line numbers default
vim.opt.number = true
vim.opt.relativenumber = true
-- Enable mouse mode, can be useful for resizing splits for example
vim.opt.mouse = "a"
-- Full path on status line
vim.opt.statusline = "%F%m%r%h%w%=%l,%c %P "
-- vim.opt.statusline = "%= %F%m%r%h%w ─ (%l,%c %P) %="
-- vim.opt.fillchars:append({ stl = "─", stlnc = "─" })
-- Save undo history
vim.opt.undofile = true
-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
vim.opt.ignorecase = true
vim.opt.smartcase = true
-- Decrease update time
vim.opt.updatetime = 250
-- Decrease mapped sequence wait time
-- Displays which-key popup sooner
vim.opt.timeoutlen = 300
-- Configure how new splits should be opened
vim.opt.splitright = true
vim.opt.splitbelow = true
-- Preview substitutions live, as you type
vim.opt.inccommand = "split"
-- Show which line your cursor is on
vim.opt.cursorline = true
vim.opt.guicursor = "n-v-i-c:block"
-- Minimal number of screen lines to keep above and below the cursor
vim.opt.scrolloff = 10
-- Load the colorscheme
vim.cmd.colorscheme("invero")
-- Performance and persistence
vim.opt.undofile = false -- Save undo history
vim.opt.updatetime = 250 -- Faster updates
vim.opt.timeoutlen = 300 -- Shorter keymap timeout

View File

@ -0,0 +1,34 @@
vim.api.nvim_create_autocmd("TermOpen", {
group = vim.api.nvim_create_augroup("custom-term-open", { clear = true }),
callback = function()
vim.opt_local.number = false
vim.opt_local.relativenumber = false
vim.opt_local.scrolloff = 0
vim.bo.filetype = "terminal"
vim.cmd("startinsert")
end,
})
-- Open a relative terminal in the current files directory
vim.keymap.set("n", "<leader>ter", function()
vim.cmd.edit(string.format("term://%s//zsh", vim.fn.expand("%:p:h")))
end, { desc = "[T]erminal [R]elative" })
-- Open a split terminal at the bottom
vim.keymap.set("n", "<leader>ts", function()
vim.cmd.new()
vim.cmd.wincmd("J")
vim.api.nvim_win_set_height(0, 12)
vim.wo.winfixheight = true
vim.cmd.term()
end, { desc = "[T]erminal [S]plit" })
-- Simple terminal open
vim.keymap.set("n", "<Leader>tet", ":terminal<CR>", { desc = "[T]erminal" })
-- Terminal mode keymaps
vim.keymap.set("t", "<Esc>", "<C-\\><C-n>", { desc = "Terminal Normal Mode" })
vim.keymap.set("t", "jk", "<C-\\><C-n>", { desc = "Terminal Normal Mode" })
vim.keymap.set("t", "<C-w>", "<C-\\><C-n><C-w>", { desc = "Terminal Window Command" })

View File

@ -1,46 +0,0 @@
return { -- Autoformat
"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)
local disable_filetypes = { c = true, cpp = true }
local lsp_format_opt
if disable_filetypes[vim.bo[bufnr].filetype] then
lsp_format_opt = "never"
else
lsp_format_opt = "fallback"
end
return {
timeout_ms = 500,
lsp_format = lsp_format_opt,
}
end,
formatters_by_ft = {
lua = { "stylua" },
sh = { "shfmt" },
swift = { "swift_format" },
python = { "isort", "black", stop_after_first = true },
javascript = { "prettierd", "prettier", stop_after_first = true },
javascriptreact = { "prettierd", "prettier", stop_after_first = true },
typescript = { "prettierd", "prettier", stop_after_first = true },
typescriptreact = { "prettierd", "prettier", stop_after_first = true },
},
formatters = {
shfmt = {
prepend_args = { "-i", "4", "-ci" }, -- 4 spaces, indent cases
},
},
},
}

View File

@ -1,13 +0,0 @@
return {
'windwp/nvim-autopairs',
event = 'InsertEnter',
-- Optional dependency
dependencies = { 'hrsh7th/nvim-cmp' },
config = function()
require('nvim-autopairs').setup {}
-- If you want to automatically add `(` after selecting a function or method
local cmp_autopairs = require 'nvim-autopairs.completion.cmp'
local cmp = require 'cmp'
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
end,
}

View File

@ -1,11 +0,0 @@
return {
"windwp/nvim-ts-autotag",
opts = {
autotag = {
enable = true,
enable_close = true,
enable_rename = true,
enable_close_on_slash = true,
},
},
}

View File

@ -0,0 +1,27 @@
return {
{
'windwp/nvim-ts-autotag',
opts = {
autotag = {
enable = true,
enable_close = true,
enable_rename = true,
enable_close_on_slash = true,
},
},
},
{
'windwp/nvim-autopairs',
event = 'InsertEnter',
config = true,
},
{
'triimdev/invero.nvim',
lazy = false,
priority = 1000,
config = function()
vim.o.background = 'light'
vim.cmd.colorscheme('invero')
end,
},
}

View File

@ -1,60 +0,0 @@
return {
"hrsh7th/nvim-cmp",
event = "InsertEnter",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-path",
},
config = function()
local cmp = require("cmp")
cmp.setup({
window = {
completion = {
border = "single",
-- or border = true for default border
},
documentation = {
border = "single",
},
},
completion = { completeopt = "menu,menuone,noselect" }, -- This ensures nothing is auto-selected
sources = cmp.config.sources({
{ name = "nvim_lsp" }, -- from language server
{ name = "buffer" }, -- from current buffer
{ name = "path" }, -- for file paths
}),
mapping = cmp.mapping.preset.insert({
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item({ behavior = cmp.SelectBehavior.Insert })
else
fallback()
end
end),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item({ behavior = cmp.SelectBehavior.Insert })
else
fallback()
end
end),
["<C-e>"] = cmp.mapping.abort(), -- This closes the completion menu
["<C-u>"] = cmp.mapping(function(fallback)
if cmp.visible() and cmp.get_selected_entry() then
cmp.scroll_docs(-4)
else
fallback()
end
end),
["<C-d>"] = cmp.mapping(function(fallback)
if cmp.visible() and cmp.get_selected_entry() then
cmp.scroll_docs(4)
else
fallback()
end
end),
}),
})
end,
}

View File

@ -0,0 +1,130 @@
vim.keymap.set('n', '<leader>e', '<cmd>NvimTreeToggle<CR>')
local function my_on_attach(bufnr)
local api = require('nvim-tree.api')
local opts = { buffer = bufnr }
-- basics: copy/cut/paste/create/rename/remove
vim.keymap.set('n', 'c', api.fs.copy.node, opts)
vim.keymap.set('n', 'x', api.fs.cut, opts)
vim.keymap.set('n', 'p', api.fs.paste, opts)
vim.keymap.set('n', 'a', api.fs.create, opts)
vim.keymap.set('n', 'r', api.fs.rename, opts)
vim.keymap.set('n', 'R', api.fs.rename_basename, opts)
vim.keymap.set('n', 'd', api.fs.remove, opts)
-- bulk mark and delete/move
vim.keymap.set('n', 's', api.marks.toggle, opts)
vim.keymap.set('n', 'S', api.marks.clear, opts)
vim.keymap.set('n', 'bd', api.marks.bulk.delete, opts)
vim.keymap.set('n', 'bm', api.marks.bulk.move, opts)
-- copy filename/path
vim.keymap.set('n', 'y', api.fs.copy.filename, opts)
vim.keymap.set('n', 'Y', api.fs.copy.relative_path, opts)
vim.keymap.set('n', 'gy', api.fs.copy.absolute_path, opts)
vim.keymap.set('n', 'ge', api.fs.copy.basename, opts)
-- expand/collapse
vim.keymap.set('n', 'e', api.tree.expand_all, opts)
vim.keymap.set('n', 'E', api.tree.collapse_all, opts)
-- filter
vim.keymap.set('n', 'f', api.live_filter.start, opts)
vim.keymap.set('n', 'F', api.live_filter.clear, opts)
-- navigate
vim.keymap.set('n', 'J', api.node.navigate.sibling.last, opts)
vim.keymap.set('n', 'K', api.node.navigate.sibling.first, opts)
vim.keymap.set('n', 'P', api.node.navigate.parent, opts)
-- open
vim.keymap.set('n', '<CR>', api.node.open.edit, opts)
vim.keymap.set('n', 'o', api.node.open.edit, opts)
vim.keymap.set('n', 'O', api.node.open.no_window_picker, opts)
-- miscellaneous
vim.keymap.set('n', 'K', api.node.show_info_popup, opts)
vim.keymap.set('n', 'U', api.tree.reload, opts)
end
return {
'nvim-tree/nvim-tree.lua',
version = '*',
opts = {
on_attach = my_on_attach,
view = { signcolumn = 'no' },
actions = { file_popup = { open_win_config = { border = 'rounded' } } },
renderer = {
root_folder_label = false,
special_files = {},
highlight_hidden = 'all',
highlight_clipboard = 'all',
indent_markers = {
enable = true,
inline_arrows = false,
icons = { corner = '', none = '', bottom = ' ' },
},
icons = {
bookmarks_placement = 'after',
show = {
file = false,
folder = false,
folder_arrow = false, -- KEEP FALSE
git = true,
modified = false,
hidden = false,
diagnostics = false,
bookmarks = true,
},
git_placement = 'after',
glyphs = {
git = {
unstaged = '',
staged = '',
unmerged = '',
renamed = '',
untracked = '',
deleted = '', -- '󰧧',
ignored = '',
},
},
},
},
hijack_cursor = true,
hijack_unnamed_buffer_when_opening = true,
prefer_startup_root = true,
update_focused_file = {
enable = true,
update_root = { enable = true, ignore_list = {} },
exclude = false,
},
modified = { enable = true, show_on_dirs = true, show_on_open_dirs = true },
filters = {
enable = true,
git_ignored = true,
dotfiles = false,
git_clean = false,
no_buffer = false,
no_bookmark = false,
custom = {},
exclude = {},
},
filesystem_watchers = {
enable = true,
debounce_delay = 50,
ignore_dirs = {
'/.git',
'/.DS_Store',
'/build',
'/dist',
'/public',
'/node_modules',
'/target',
},
},
},
}

View File

@ -1,42 +0,0 @@
return {
"ThePrimeagen/harpoon",
branch = "harpoon2",
opts = {
menu = {
width = vim.api.nvim_win_get_width(0) - 4,
},
settings = {
save_on_toggle = true,
},
},
keys = function()
local keys = {
{
"<leader>H",
function()
require("harpoon"):list():add()
end,
desc = "Harpoon File",
},
{
"<leader>h",
function()
local harpoon = require("harpoon")
harpoon.ui:toggle_quick_menu(harpoon:list())
end,
desc = "Harpoon Quick Menu",
},
}
for i = 1, 5 do
table.insert(keys, {
"<C-" .. i .. ">",
function()
require("harpoon"):list():select(i)
end,
desc = "Harpoon to File " .. i,
})
end
return keys
end,
}

View File

@ -1,104 +0,0 @@
local remap = require("utils.remap")
vim.diagnostic.config({
update_in_insert = false,
virtual_text = {
source = true,
},
float = {
border = "rounded",
},
})
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
border = "rounded",
})
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
border = "rounded",
})
return {
"neovim/nvim-lspconfig",
dependencies = {
{ "williamboman/mason.nvim", version = "1.8.0", config = true },
{ "williamboman/mason-lspconfig.nvim", version = "1.31.0"},
{ "j-hui/fidget.nvim", opts = {} }, -- side fidget showing status
"hrsh7th/cmp-nvim-lsp", -- completion
"b0o/schemastore.nvim",
},
config = function()
require("mason").setup({
ui = {
border = "rounded",
backdrop = 0
},
})
require("mason-lspconfig").setup()
local lspconfig = require("lspconfig")
local capabilities = require("cmp_nvim_lsp").default_capabilities()
require("lspconfig.ui.windows").default_options = {
border = "rounded",
}
lspconfig.ts_ls.setup({
capabilities = capabilities,
init_options = {
preferences = {
includeCompletionsWithSnippetText = true,
jsxAttributeCompletionStyle = "auto",
},
},
on_attach = function(client, bufnr)
-- Mappings
local opts = { buffer = bufnr }
remap.nmap("gd", vim.lsp.buf.definition, opts)
remap.nmap("gr", vim.lsp.buf.references, opts)
remap.nmap("K", vim.lsp.buf.hover, opts)
remap.nmap("<leader>rn", vim.lsp.buf.rename, opts)
remap.nmap("<leader>ca", vim.lsp.buf.code_action, opts)
remap.nmap("<leader>ri", function()
local diagnostics = vim.diagnostic.get(0)
-- Filter for TypeScript's unused import diagnostics (code 6133)
local unused_imports_diagnostics = {}
for _, diagnostic in ipairs(diagnostics) do
if diagnostic.code == 6133 and diagnostic.source == "typescript" then
table.insert(unused_imports_diagnostics, diagnostic)
end
end
vim.lsp.buf.code_action({
context = {
diagnostics = unused_imports_diagnostics,
only = { "source.removeUnusedImports" },
},
})
end, { desc = "Remove unused imports" })
remap.nmap("[d", vim.diagnostic.goto_prev, opts)
remap.nmap("]d", vim.diagnostic.goto_next, opts)
remap.nmap("<leader>d", vim.diagnostic.open_float, opts)
end,
})
lspconfig.eslint.setup({})
lspconfig.html.setup({})
lspconfig.cssls.setup({})
lspconfig.jsonls.setup({
capabilities = capabilities,
settings = {
json = {
schemas = require("schemastore").json.schemas(),
validate = { enable = true },
allowComments = true,
},
},
})
end,
}

View File

@ -1,212 +0,0 @@
return {
"nvim-tree/nvim-tree.lua",
version = "*",
lazy = false,
keys = {
{ "<Leader>et", ":NvimTreeToggle<CR>", desc = "Explorer Toggle", silent = true },
{
"<Leader>ei",
function()
require("nvim-tree.api").node.show_info_popup()
end,
desc = "NvimTree: Info",
mode = "n",
},
},
config = function()
local function my_on_attach(bufnr)
local api = require("nvim-tree.api")
local function opts(desc)
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
end
api.config.mappings.default_on_attach(bufnr)
vim.keymap.set("n", "<Leader>et", api.tree.toggle, opts("Open or close the tree"))
vim.keymap.set("n", "<Leader>ei", api.node.show_info_popup, opts("Show info popup"))
vim.keymap.set("n", "?", api.tree.toggle_help, opts("Help"))
vim.keymap.del("n", "<C-k>", { buffer = bufnr })
end
require("nvim-tree").setup({
on_attach = my_on_attach,
hijack_cursor = true,
disable_netrw = true,
hijack_netrw = true,
hijack_unnamed_buffer_when_opening = true,
root_dirs = { ".git", "package.json" },
prefer_startup_root = true,
sync_root_with_cwd = true,
reload_on_bufenter = true,
respect_buf_cwd = true,
view = {
centralize_selection = false,
cursorline = true,
cursorlineopt = "both",
debounce_delay = 15,
side = "left",
preserve_window_proportions = false,
number = false,
relativenumber = false,
signcolumn = "no",
width = 30,
},
renderer = {
add_trailing = false,
group_empty = false,
full_name = false,
root_folder_label = false,
-- special_files = { "Cargo.toml", "Makefile", "README.md", "readme.md" },
special_files = {}, -- keep to overwrite defaults
symlink_destination = true,
icons = {
padding = "",
glyphs = {
folder = {
arrow_closed = "+",
arrow_open = "-",
},
},
show = {
file = false,
folder = false,
folder_arrow = true,
git = false,
modified = false,
hidden = false,
diagnostics = false,
bookmarks = false,
},
},
},
hijack_directories = {
enable = true,
auto_open = true,
},
update_focused_file = {
enable = true,
update_root = {
enable = true,
ignore_list = {},
},
exclude = false,
},
filters = {
enable = true,
git_ignored = true,
dotfiles = false,
git_clean = false,
no_buffer = false,
no_bookmark = false,
custom = {},
exclude = {},
},
live_filter = {
prefix = "[FILTER]: ",
always_show_folders = true,
},
filesystem_watchers = {
enable = true,
debounce_delay = 50,
ignore_dirs = {
-- C / C++
"/.ccls-cache",
"/build",
"/out",
"/cmake-build-*",
-- Node.js / Web
"/node_modules",
"/dist",
"/.next",
"/.nuxt",
"/coverage",
"/storybook-static",
-- Rust
"/target",
-- Java / JVM
"/target", -- (Maven)
"/build", -- (Gradle)
"/out", -- (IDEA / javac)
-- Python
"/.venv",
"/venv",
"/__pycache__",
"/.mypy_cache",
"/.pytest_cache",
-- Go
"/bin",
"/pkg",
-- General
"/tmp",
"/.cache",
"/.idea",
"/.vscode",
"/logs",
},
},
trash = {
cmd = "gio trash",
},
})
end,
}
-- return {
-- "nvim-neo-tree/neo-tree.nvim",
-- version = "*",
-- dependencies = {
-- "nvim-lua/plenary.nvim",
-- "nvim-tree/nvim-web-devicons",
-- "MunifTanjim/nui.nvim",
-- },
-- cmd = "Neotree",
-- keys = {
-- { "<Leader>et", ":Neotree position=left toggle<CR>", desc = "Explorer Toggle", silent = true },
-- { "<Leader>E", ":Neotree focus<CR>", desc = "Explorer Focus", silent = true },
-- { "<Leader>ef", ":Neotree float<CR>", desc = "Explorer Float", silent = true },
-- { "<Leader>eb", ":Neotree buffers<CR>", desc = "Explorer Buffers", silent = true },
-- { "<Leader>eg", ":Neotree git_status<CR>", desc = "Explorer Git", silent = true },
-- },
-- opts = {
-- event_handlers = {
-- {
-- event = require("neo-tree.ui.events").NEO_TREE_WINDOW_AFTER_OPEN,
-- handler = function(args)
-- if args and args.winid and vim.api.nvim_win_is_valid(args.winid) then
-- vim.api.nvim_win_set_option(args.winid, "colorcolumn", "")
-- vim.api.nvim_win_set_option(args.winid, "signcolumn", "no")
-- end
-- end,
-- },
-- },
-- popup_border_style = "single",
-- window = {
-- mappings = {
-- ["<Leader>e"] = "close_window",
-- },
-- },
-- default_component_configs = {
-- icon = { enabled = false },
-- git_status = { symbols = {}, align = "none" },
-- name = { trailing_slash = true }
-- },
-- enable_git_status = false,
-- enable_diagnostics = false,
-- filesystem = {
-- follow_current_file = {
-- enabled = true, -- Enable this feature
-- leave_dirs_open = true, -- Leave directories open when following
-- },
-- filtered_items = {
-- visible = true,
-- }
-- },
-- },
-- }

View File

@ -0,0 +1,125 @@
vim.keymap.set('n', '<leader>d', vim.diagnostic.open_float, { noremap = true, silent = true })
vim.diagnostic.config({
update_in_insert = false,
virtual_text = {
prefix = '', -- remove annoying ▎ etc
format = function(diagnostic)
-- Show the source (e.g. "luacheck", "lua_ls") before the message
if diagnostic.source then
return string.format('[%s] %s', diagnostic.source, diagnostic.message)
end
return diagnostic.message
end,
},
float = {
border = 'rounded',
source = true, -- show source in floating window too
},
severity_sort = true,
})
vim.lsp.enable({ 'lua_ls' })
vim.lsp.enable({ 'json_ls' })
return {
{ 'mason-org/mason.nvim', config = true },
-- { 'saghen/blink.cmp', version = '1.*' },
{
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate',
main = 'nvim-treesitter.configs',
opts = {
highlight = { enable = true },
incremental_selection = { enable = true },
textobjects = { enable = true },
ensure_installed = {
-- Documentation
'vim',
'vimdoc',
'markdown',
'markdown_inline',
-- Data
'gitcommit',
'gitignore',
'dockerfile',
'diff',
'json',
'jsonc',
-- Scripting
'bash',
'lua',
'sql',
-- Programming
'c',
'cpp',
'go',
'rust',
'python',
-- Web
'html',
'css',
'javascript',
'typescript',
'tsx',
},
},
},
{
'mfussenegger/nvim-lint',
event = { 'BufReadPre', 'BufNewFile' },
opts = {
linters_by_ft = {
lua = { 'luacheck' },
python = { 'ruff' },
javascript = { 'eslint_d' },
},
},
config = function(_, opts)
local lint = require('lint')
lint.linters_by_ft = opts.linters_by_ft
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
group = vim.api.nvim_create_augroup('lint_autocmd', { clear = true }),
callback = function()
lint.try_lint()
end,
})
end,
},
{
'stevearc/conform.nvim',
event = { 'BufWritePre' },
opts = {
-- Automatically format on save
format_on_save = {
timeout_ms = 500,
lsp_format = 'fallback', -- Use LSP when no formatter is configured
},
-- Formatters per filetype
default_format_opts = { stop_after_first = true },
formatters_by_ft = {
lua = { 'stylua' },
sh = { 'shfmt' },
swift = { 'swift_format' },
python = { 'isort', 'black' },
javascript = { 'prettierd', 'prettier' },
javascriptreact = { 'prettierd', 'prettier' },
typescript = { 'prettierd', 'prettier' },
typescriptreact = { 'prettierd', 'prettier' },
},
},
config = function(_, opts)
require('conform').setup(opts)
-- Create a command to format manually
vim.api.nvim_create_user_command('Format', function()
require('conform').format({
async = true,
lsp_format = 'fallback',
})
end, { desc = 'Format current buffer' })
end,
},
}

View File

@ -1,52 +0,0 @@
local remap = require("utils.remap")
return {
"nvim-telescope/telescope.nvim",
event = "VimEnter",
branch = "0.1.x",
dependencies = {
"nvim-lua/plenary.nvim",
{
"nvim-telescope/telescope-fzf-native.nvim",
build = "make",
cond = function()
return vim.fn.executable("make") == 1
end,
},
{ "nvim-telescope/telescope-ui-select.nvim" },
-- { "nvim-tree/nvim-web-devicons", enabled = vim.g.have_nerd_font },
},
config = function()
require("telescope").setup({
defaults = {
layout_strategy = "vertical",
layout_config = {
width = { 0.95, max = 100 },
height = 0.95,
preview_cutoff = 1,
preview_height = 0.7,
},
mappings = {
n = {
["d"] = "delete_buffer",
},
},
},
})
pcall(require("telescope").load_extension, "fzf")
pcall(require("telescope").load_extension, "ui-select")
local builtin = require("telescope.builtin")
remap.nmap("<leader>sk", builtin.keymaps, { desc = "[S]earch [K]eymaps" })
remap.nmap("<leader>sf", builtin.find_files, { desc = "[S]earch [F]iles" })
remap.nmap("<leader>sw", builtin.grep_string, { desc = "[S]earch current [W]ord" })
remap.nmap("<leader>ss", builtin.current_buffer_fuzzy_find, { desc = "[S]earch [C]urrent file" })
remap.nmap("<leader>sg", builtin.live_grep, { desc = "[S]earch by [G]rep" })
remap.nmap("<leader>sd", builtin.diagnostics, { desc = "[S]earch [D]iagnostics" })
remap.nmap("<leader>sr", builtin.lsp_references, { desc = "[S]earch [R]references" })
remap.nmap("<leader>s.", builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
-- remap.nmap("<leader>ss", builtin.git_status, { desc = "[S]earch Git [S]tatus" })
remap.nmap("<leader><leader>", builtin.buffers, { desc = "Find existing [B]uffers" })
end,
}

View File

@ -1,32 +0,0 @@
return {
"nvim-treesitter/nvim-treesitter",
build = "TSUpdate",
main = "nvim-treesitter.configs",
opts = {
ensure_installed = {
"diff",
"lua",
"html",
"css",
"javascript",
"typescript",
"tsx",
"markdown",
"markdown_inline",
},
auto_install = true,
highlight = {
enable = true,
},
indent = { enable = true },
},
config = function(_, opts)
require("nvim-treesitter.configs").setup(opts)
-- Add MDX filetype detection
vim.filetype.add({
extension = {
mdx = "markdown.mdx",
},
})
end,
}

View File

@ -1,19 +0,0 @@
local M = {}
function M.get(P)
local colors = {
base = P.white,
surface = P.gray_light,
outline = P.gray_dark,
text = P.black,
muted = P.gray,
accent = P.blue,
accent_light = P.blue_light,
syntax = P.slate_indigo,
none = "NONE",
}
return vim.tbl_extend("force", P, colors)
end
return M

View File

@ -1,35 +0,0 @@
local M = {}
function M.get(C)
return {
Normal = { fg = C.text, bg = C.none },
Directory = { fg = C.accent },
Question = { fg = C.text },
LineNr = { fg = C.muted },
CursorLineNr = { fg = C.accent, bold = true },
CursorLine = { bg = C.surface },
Visual = { bg = C.accent_light },
ColorColumn = { bg = C.surface },
Search = { fg = C.yellow },
CurSearch = { fg = C.yellow, bg = C.none, bold = true },
IncSearch = { fg = C.yellow, bg = C.none, bold = true },
MatchParen = { fg = C.accent, bg = C.accent_light, bold = true },
EndOfBuffer = { fg = C.base }, -- End-of-buffer marker (~ lines)
WinSeparator = { fg = C.outline },
-- StatusLine = { fg = C.outline, bg = C.none }, -- Active statusline (where filename)
StatusLine = { fg = C.base, bg = C.outline, bold = false }, -- Active statusline (where filename)
StatusLineNC = { fg = C.base, bg = C.outline, bold = false }, -- Active statusline (where filename)
MsgArea = { fg = C.text, bg = C.none }, -- Command-line / message area
MsgSeparator = { fg = C.text, bg = C.surface }, -- Separator for messages
ModeMsg = { fg = C.text },
TabLine = { fg = C.muted }, -- Unselected tab
TabLineSel = { fg = C.text, bold = true }, -- Selected tab
TabLineFill = { bg = C.none }, -- Empty space in the tabline
}
end
return M

View File

@ -1,7 +0,0 @@
local M = {}
function M.get(C)
return {}
end
return M

View File

@ -1,9 +0,0 @@
local M = {}
function M.get(C)
return {
TelescopeMatching = { fg = C.yellow, bg = C.none, bold = true },
}
end
return M

View File

@ -1,21 +0,0 @@
local M = {}
function M.get(C)
return {
["@constant.macro"] = { fg = C.syntax },
["@function.method"] = { fg = C.syntax },
["@type.qualifier"] = { fg = C.syntax },
["@variable.parameter"] = { fg = C.syntax },
["@variable"] = { fg = C.syntax },
["@type.definition"] = { fg = C.syntax },
["@markup.italic"] = { fg = C.syntax },
["@markup.strong"] = { fg = C.syntax },
["@markup.underline"] = { fg = C.syntax },
["@markup.strikethrough"] = { fg = C.syntax },
["@_jsx_attribute"] = { link = "Constant" },
["@string.documentation.python"] = { link = "Comment" },
}
end
return M

View File

@ -1,38 +0,0 @@
local M = {}
function M.get(C)
return {
Comment = { fg = C.muted, italic = true },
String = { fg = C.green },
Boolean = { fg = C.accent, bold = true, italic = true },
Number = { fg = C.accent },
-- syntax color
Constant = { fg = C.syntax },
Function = { fg = C.syntax },
Type = { fg = C.syntax },
Statement = { fg = C.syntax },
Identifier = { fg = C.syntax },
Operator = { fg = C.syntax },
PreProc = { fg = C.syntax },
Special = { fg = C.syntax },
Delimiter = { fg = C.syntax },
Todo = { fg = C.syntax },
Title = { fg = C.syntax },
Underlined = { fg = C.syntax },
-- diffs
Added = { fg = C.green },
Removed = { fg = C.red },
Changed = { fg = C.yellow },
-- diagnostics
DiagnosticInfo = { fg = C.blue },
DiagnosticWarn = { fg = C.yellow },
DiagnosticError = { fg = C.red },
DiagnosticDeprecated = { fg = C.magenta },
DiagnosticUnderlineError = { fg = C.syntax, underline = true },
}
end
return M

View File

@ -1,31 +0,0 @@
local M = {}
function M.get(C)
return {
terminal_color_0 = { fg = C.black },
terminal_color_8 = { fg = C.black },
terminal_color_1 = { fg = C.red },
terminal_color_9 = { fg = C.red },
terminal_color_2 = { fg = C.green },
terminal_color_10 = { fg = C.green },
terminal_color_3 = { fg = C.yellow },
terminal_color_11 = { fg = C.yellow },
terminal_color_4 = { fg = C.blue },
terminal_color_12 = { fg = C.blue },
terminal_color_5 = { fg = C.magenta },
terminal_color_13 = { fg = C.magenta },
terminal_color_6 = { fg = C.cyan },
terminal_color_14 = { fg = C.cyan },
terminal_color_7 = { fg = C.white },
terminal_color_15 = { fg = C.white },
}
end
return M

View File

@ -1,14 +0,0 @@
local M = {
name = "invero",
variant = "light",
mode = "ansi",
exclude_integrations = {},
}
function M.load()
local setup = require("themes." .. M.name .. ".setup")
setup.reset(M)
setup.apply(M)
end
return M

View File

@ -1,53 +0,0 @@
local M = {}
local modes = {
ansi = {
black = 0,
red = 1,
green = 2,
yellow = 3,
blue = 4,
magenta = 5,
cyan = 6,
white = 7,
},
default = {
black = 238,
red = 196,
green = 35,
yellow = 221,
blue = 27,
magenta = 125,
cyan = 30,
white = 255,
},
}
local shared_palette = {
gray_dark = 245,
gray = 247,
gray_light = 253,
orange = 166,
orange_light = 180,
yellow_light = 180,
blue_light = 153,
slate_indigo = 60,
}
---Get color palette
---@param mode '"ansi"'|'"default"'
---@return table
function M.get(mode)
local mode_palette = modes[mode]
if not mode_palette then
vim.notify(
string.format('Invalid palette mode: "%s" (valid: ansi, default)', tostring(mode)),
vim.log.levels.WARN,
{ title = "palette" }
)
mode_palette = modes.default
end
return vim.tbl_extend("force", mode_palette, shared_palette)
end
return M

View File

@ -1,72 +0,0 @@
local M = {}
function M.reset(theme)
vim.opt.background = (theme.variant == "light") and "light" or "dark"
vim.g.colors_name = theme.name
end
local function list_integrations(theme_name)
local path = vim.fn.stdpath("config") .. "/lua/themes/" .. theme_name .. "/groups/integrations/"
local files = {}
for name, type in vim.fs.dir(path) do
if type == "file" then
local mod_name = vim.fn.fnamemodify(name, ":r")
table.insert(files, mod_name)
end
end
return files
end
function M.apply(theme)
local base = "themes." .. theme.name
local P = require(base .. ".palette").get(theme.mode)
local C = require(base .. ".colors").get(P)
local modules = {
require(base .. ".groups.editor"),
require(base .. ".groups.syntax"),
require(base .. ".groups.terminal"),
}
local exclude = theme.exclude_integrations or {}
local function should_load(name)
return not vim.tbl_contains(exclude, name)
end
-- auto-discover integrations
for _, plugin in ipairs(list_integrations(theme.name)) do
if should_load(plugin) then
local ok_mod, mod = pcall(require, base .. ".groups.integrations." .. plugin)
if ok_mod then
table.insert(modules, mod)
end
end
end
-- Apply highlights
for _, mod in ipairs(modules) do
local groups = mod.get(C) or {}
for group, opts in pairs(groups) do
if type(opts) ~= "table" then
print("Non-table opts detected in group:", group, "value:", vim.inspect(opts))
end
local hl = {}
for k, v in pairs(opts) do
if k == "fg" then
hl.ctermfg = v
elseif k == "bg" then
hl.ctermbg = v
else
hl[k] = v -- bold, italic, underline, sp, etc.
end
end
vim.api.nvim_set_hl(0, group, hl)
end
end
end
return M

View File

@ -1,39 +0,0 @@
local M = {}
function M.map(mode, lhs, rhs, opts)
local options = { silent = true, noremap = true }
if opts then
options = vim.tbl_extend("force", options, opts)
end
if type(mode) == "table" then
for _, m in ipairs(mode) do
vim.keymap.set(m, lhs, rhs, options)
end
else
vim.keymap.set(mode, lhs, rhs, options)
end
end
function M.nmap(lhs, rhs, opts)
M.map("n", lhs, rhs, opts)
end
function M.imap(lhs, rhs, opts)
M.map("i", lhs, rhs, opts)
end
function M.vmap(lhs, rhs, opts)
M.map("v", lhs, rhs, opts)
end
function M.tmap(lhs, rhs, opts)
M.map("t", lhs, rhs, opts)
end
function M.cmap(lhs, rhs, opts)
M.map("c", lhs, rhs, opts)
end
return M