Compare commits

...

6 Commits

Author SHA1 Message Date
713af0f937 new 2026-02-25 16:39:43 +02:00
e65a7f3f13 disable md 2026-02-15 04:18:15 +02:00
d08b246a3b new docs 2026-02-13 02:10:06 +02:00
6cc023ec35 new steps 2026-02-13 02:05:33 +02:00
6b4008ca38 update 2026-02-12 23:20:29 +02:00
9f37a379ea update 2026-02-11 07:32:24 +02:00
15 changed files with 219 additions and 606 deletions

70
README.md Normal file
View File

@@ -0,0 +1,70 @@
# Neovim Setup
## Initial setup flow
1. List/update plugins in `lua/setup/packages.lua`.
2. List/update language specs in `lua/modules/language-specs.lua`.
3. Run `nvim --headless +Setup +qa`.
4. Run `nvim --headless +FetchLspConfigs +qa`.
If `prettierd` is stuck, run `pkill prettierd` and re-run install commands.
## Where to put what
- `lua/setup/packages.lua`: plugin package list managed by Paq.
- `lua/modules/language-specs.lua`: language spec source of truth.
- `lsp/*.lua`: native Neovim LSP config files (fetched by `FetchLspConfigs`).
## Setup commands
- `:Setup`
- bootstraps Paq if needed
- installs plugins
- installs treesitter parsers + Mason tools (LSP/linters/formatters)
- `:InstallPackages` (included in `:Setup`)
- bootstraps Paq if needed
- installs plugins
- `:InstallLanguages` (included in `:Setup`)
- installs language tooling from language specs (treesitter + Mason tools)
- `:FetchLspConfigs` (manually executed after modifying language-specs)
- fetches default `nvim-lspconfig` server config files
- writes them into `~/.config/nvim/lsp`
- skips files that already exist
- `:Sync`
- runs Paq sync for plugin updates/cleanup
## Language specs: how they work
Each item in `lua/modules/language-specs.lua` can define:
- `ft`: one filetype or a list of filetypes
- `ts`: treesitter parser(s)
- `lsp`: Mason package name(s) for language servers
- `lint`: Mason package name(s) for linters
- `format`: Mason package name(s) for formatters
One spec file drives all three layers together:
1. install layer
- treesitter parsers are installed via `nvim-treesitter`
- LSP/lint/format tools are installed via Mason
2. runtime layer
- native Neovim `vim.lsp.enable(...)` starts the resolved LSP configs
- `nvim-lint` is configured by filetype
- `conform.nvim` is configured by filetype
3. config layer
- `FetchLspConfigs` downloads matching `lsp/*.lua` server configs for Neovim 0.11+
Important: for `lsp`, use Mason package names from:
`https://github.com/mason-org/mason-registry/tree/main/packages`
## Add a new language
1. Add/update a spec in `lua/modules/language-specs.lua`.
2. Run `nvim --headless +InstallLanguages +qa`.
3. Run `nvim --headless +FetchLspConfigs +qa`.
4. Open Neovim and run `:checkhealth vim.lsp` if needed.

View File

@@ -1,15 +0,0 @@
# New Spec
For new LSP, add in `lua/modules/language-specs.lua` at `lsp = <name>`.
Name should match the mason registry one at: `https://github.com/mason-org/mason-registry/tree/main/packages`
1. Run `nvim --headless +InstallAll +qa` (it invalidates cache automatically)
2. Run ` nvim --headless +FetchLspConfigs +qa` -> It will download the nvim-lspconfig variant in `lsp/`
You may need to run: `pkill prettierd` (as it is running in background)
# Other commands
```
nvim --headless +Sync +qa # For packages/plugins
```

View File

@@ -1,109 +0,0 @@
#============================================================
# Neovim Command Reference (Core Commands)
#============================================================
#============================================================
# FILE & SESSION MANAGEMENT
#============================================================
:w (write) Save current buffer
:w <file> Write to <file> (does NOT rename buffer)
:sav (saveas) <file> Save to <file> and rename current buffer
:q (quit) Quit current window if no unsaved changes
:q! Force quit (discard changes)
:wq Write and quit current buffer
:wqa Write and quit all buffers
:qa Quit all windows
:qa! Quit all without saving
:e (edit) <file> Edit <file> in current window (new buffer)
:e! Revert buffer to last saved version (discard changes)
:enew Create new empty buffer
:r (read) <file> Read <file> into current buffer after cursor
:ter (terminal) Open terminal buffer
:clo (close) Close current window
#============================================================
# BUFFERS
#============================================================
:ls (buffers) List open buffers
:bn (bnext) Go to next buffer
:bp (bprev) Go to previous buffer
:b<num> Go to buffer by number
:b <file> Go to buffer by (partial) name
:bd (bdelete) [<num>] Delete current (or given) buffer
:bw (bwipeout) [<num>] Delete buffer and remove from memory
:bo (only) Close all windows except current
:e # Edit alternate (previous) buffer
:b# Switch to alternate buffer
:b% Re-edit current buffer (no-op)
:b$ Go to last buffer
#============================================================
# WINDOWS (SPLITS)
#============================================================
:sp (split) [<file>] Split horizontally (optionally open <file>)
:vsp (vsplit) [<file>] Split vertically (optionally open <file>)
:new Split with new empty buffer
:vnew Vertical split with new empty buffer
:close Close current window
:only Keep only current window open
#============================================================
# TABS
#============================================================
:tabnew [<file>] Open new tab (optionally edit <file>)
:tabn (tabnext) Go to next tab
:tabp (tabprev) Go to previous tab
:tabm (tabmove) <num> Move current tab to position <num>
:tabfirst Jump to first tab
:tablast Jump to last tab
:tabc (tabclose) Close current tab
:tabo (tabonly) Close all other tabs
:tabdo <cmd> Execute <cmd> in all tabs (e.g. :tabdo q)
#============================================================
# REGISTERS, MARKS & HISTORY
#============================================================
:reg (registers) Show register contents
:marks Show all marks
:ju (jumps) Show jump list
:changes Show change list
#============================================================
# SEARCH / GREP / QUICKFIX
#============================================================
:g/{pattern}/d Delete all lines matching {pattern}
:g!/{pattern}/d Delete all lines NOT matching {pattern}
:vim /{pattern}/ **/* Search for {pattern} recursively in all files
:cn (cnext) Jump to next quickfix entry
:cp (cprevious) Jump to previous quickfix entry
:cope (copen) Open quickfix window
:ccl (cclose) Close quickfix window
:cl (clist) List quickfix entries
#============================================================
# DIFF MODE
#============================================================
:diffthis Start diff mode for current window
:diffo (diffoff) Turn off diff mode
:diffu (diffupdate) Recalculate diff
:diffg (diffget) Get changes from other window
:diffpu (diffput) Send changes to other window
#============================================================
# NOTES & SYMBOLS
#============================================================
% Current buffer
# Alternate (last visited) buffer
$ Last buffer in list
+ Next buffer
- Previous buffer
" Most recently edited buffer (context dependent)

View File

@@ -1,214 +0,0 @@
```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.
- bat "cat" but with colors
- 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
- markview.nvim
- 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

@@ -1,119 +0,0 @@
#============================================================
# NEOVIM KEYMAP REFERENCE (CORE & USEFUL)
#============================================================
#============================================================
# INSERT MODE (Ctrl + ...)
#============================================================
Ctrl + h Delete character before cursor
Ctrl + w Delete word before cursor
Ctrl + j Insert line break (newline) at cursor
Ctrl + t Indent current line one 'shiftwidth' to the right
Ctrl + d De-indent current line one 'shiftwidth' to the left
Ctrl + n Insert next auto-completion match
Ctrl + p Insert previous auto-completion match
Ctrl + r x Insert contents of register x
Ctrl + o {cmd} Temporarily enter Normal mode to execute {cmd}
Esc / Ctrl + c Exit insert mode and return to Normal mode
#============================================================
# NORMAL MODE — WINDOW & TAB MANAGEMENT
#============================================================
C-w s Split current window horizontally
C-w v Split current window vertically
C-w c Close current window
C-w q Quit current window (same as close but exit if last)
C-w w Cycle through open windows
C-w x Exchange window with next one
C-w = Equalize window sizes
C-w _ Maximize height of current window
C-w | Maximize width of current window
C-w h Move to window left
C-w j Move to window below
C-w k Move to window above
C-w l Move to window right
C-w H Move current window far left
C-w J Move current window to bottom
C-w K Move current window to top
C-w L Move current window far right
C-w t Move current split into a new tab
gt Go to next tab
gT Go to previous tab
<n>gt Go to tab number <n>
#============================================================
# NORMAL MODE — TAGS, JUMPS & MOTIONS
#============================================================
Ctrl + ] Jump to tag under cursor
gd Go to local declaration
gD Go to global declaration
{ Jump backward one paragraph/block
} Jump forward one paragraph/block
; Repeat last motion forward
, Repeat last motion backward
Ctrl + e Scroll window down (cursor stays put)
Ctrl + y Scroll window up (cursor stays put)
H Move cursor to top of screen
M Move cursor to middle of screen
L Move cursor to bottom of screen
#============================================================
# NORMAL MODE — TEXT OBJECTS
#============================================================
aw "A word" — select word + following space
ab "A block" — select around ()
aB "A Block" — select around {}
at "A tag" — select around XML/HTML tag
ib "Inner block" — inside ()
iB "Inner Block" — inside {}
it "Inner tag" — inside tag (no delimiters)
#============================================================
# NORMAL MODE — DIFF / CHANGES
#============================================================
do Obtain (get) changes from other window
dp Put (send) changes to other window
#============================================================
# REGISTERS & CLIPBOARD
#============================================================
"xy Yank into register x
"xp Paste contents of register x
"+y Yank into system clipboard
"+p Paste from system clipboard
#--- Common Registers ---
"0 Last yank
" Unnamed register (last delete or yank)
"% Current file name
"# Alternate file name
"* X11 primary selection clipboard
"+ X11 clipboard register
"/ Last search pattern
": Last command-line command
". Last inserted text
"- Last small (less than a line) delete
"= Expression register (evaluate expression)
"_ Black hole register (discard output)
#============================================================
# TIPS & NOTES
#============================================================
- Ctrl + o in Insert mode is a powerful way to run one Normal-mode command temporarily.
- Use “aw”, “iw”, “ab”, “ib”, etc. with operators (e.g., daw, yib) for precise text manipulation.
- The system clipboard is “+” (Windows/macOS/Linux), but some X11 systems also use “*”.
- When in diff mode, do and dp are complementary: “get” vs. “put” changes.

View File

@@ -1,94 +0,0 @@
-- Window Creation/Closing
Ctrl-w s - Split window horizontally
Ctrl-w v - Split window vertically
Ctrl-w n - Create new window horizontally with empty buffer
Ctrl-w c - Close current window
Ctrl-w o - Close all windows except current one
-- Window Navigation
Ctrl-h - Move to window on the left
Ctrl-j - Move to window below
Ctrl-k - Move to window above
Ctrl-l - Move to window on the right
-- Window Moving/Rearranging
Ctrl-w H - Move current window to far left
Ctrl-w J - Move current window to bottom
Ctrl-w K - Move current window to top
Ctrl-w L - Move current window to far right
-- Window Resizing
Ctrl-w = - Make all windows equal size
Ctrl-w _ - Maximize height of current window
Ctrl-w | - Maximize width of current window
Ctrl-w > - Increase width by 5 column
Ctrl-w < - Decrease width by 5 column
Ctrl-w + - Increase height by 5 row
Ctrl-w - - Decrease height by 5 row
-- Window Special Commands
Ctrl-w T - Move current window to new tab
Ctrl-w } - Preview definition in new window
Ctrl-w z - Close preview window
-- Tab
<Leader>t] :tabnext - Go to next tab
<Leader>t[ :tabprevious - Go to previous tab
<Leader>tn :tabnew - Create a new tab
<Leader>tc :tabclose - Close current tab
<Leader>to :tabonly - Close all other tabs
<Leader>{n} :{n}gt - Go to tab {n}
-- Buffer
-- note: mainly using the telescope one
<Leader>space telescope.buffers - open buffers with telescope. there can navigate and delete
<Leader>bl :ls - List all buffers
<Leader>bd :bdelete - Delete current buffer
<Leader>bn :bnext - Go to next buffer
<Leader>bp :bprevious - Go to previous buffer
<Leader>b{n} :buffer {n} - Go to buffer {n}
<Leader>bb :b<Space> - Start buffer selection
<Leader>bo :bufdo bd|1bd - Delete all other buffers
-- Telescope
<Leader>ff telescope.find_files - Search Files
<Leader>fg telescope.live_grep - Search by Grep
<Leader>fb telescope.buffers - Search Buffers
<Leader>fh telescope.help_tags - Search Help
<Leader>fp telescope.projects - Search Projects
<Leader>fm telescope.marks - Search Marks
<Leader>fc telescope.commands - Search Commands
<Leader>fk telescope.keymaps - Search Keymaps
<Leader>fs telescope.git_status - Search Git Status
<Leader>fw telescope.grep_string - Search current Word
<Leader>fd telescope.diagnostics - Search Diagnostics
<Leader>fr telescope.lsp_references - Search References
-- Neo-tree
<Leader>e :NvimTree toggle - Explorer Toggle
<Leader>E :NvimTree focus - Explorer Focus
-- Harpoon
<Leader>h harpoon_ui.toggle_menu - Harpoon Menu
<Leader>m harpoon_mark.add_file - Mark File
<Leader>1 harpoon_ui.nav_file(1) - Harpoon File 1
<Leader>2 harpoon_ui.nav_file(2) - Harpoon File 2
<Leader>3 harpoon_ui.nav_file(3) - Harpoon File 3
<Leader>4 harpoon_ui.nav_file(4) - Harpoon File 4
<Leader>hn harpoon_ui.nav_next - Harpoon Next
<Leader>hp harpoon_ui.nav_prev - Harpoon Previous
-- Terminal
<Leader>tet :terminal cd %:h - Terminal in This dir
<Leader>ter :terminal - Terminal Regular
<Leader>tec :!cd %:h && - Terminal Command
<Esc> <C-\><C-n> - Terminal Normal Mode
<C-w> <C-\><C-n><C-w> - Terminal Window Command
-- LSP
gd vim.lsp.buf.definition - Goto Definition
gr vim.lsp.buf.references - Goto References
K vim.lsp.buf.hover - Hover Documentation
<Leader>rn vim.lsp.buf.rename - Rename
<Leader>ca vim.lsp.buf.code_action - Code Action
<Leader>f vim.lsp.buf.format - Format

View File

@@ -5,25 +5,7 @@ end
vim.env.PATH = vim.fn.stdpath('data') .. '/mason/bin:' .. vim.env.PATH vim.env.PATH = vim.fn.stdpath('data') .. '/mason/bin:' .. vim.env.PATH
vim.filetype.add({
pattern = {
['.*/templates/.*%.ya?ml'] = 'helm',
['.*/manifests/.*%.ya?ml'] = 'helm',
['.*/crds/.*%.ya?ml'] = 'helm',
['.*/kubernetes/.*%.ya?ml'] = 'helm',
['.*/k8s/.*%.ya?ml'] = 'helm',
['.*/charts/.*%.ya?ml'] = 'helm',
},
})
function _G.see(val)
local lines = vim.split(vim.inspect(val), '\n')
vim.cmd('new')
vim.api.nvim_buf_set_lines(0, 0, -1, false, lines)
vim.bo.buftype = 'nofile'
vim.bo.bufhidden = 'wipe'
end
require('core.options') require('core.options')
require('core.filetypes')
require('core.keymaps') require('core.keymaps')
require('core.events') require('core.events')

View File

@@ -5,6 +5,63 @@ local api = vim.api
local au = api.nvim_create_autocmd local au = api.nvim_create_autocmd
local group = api.nvim_create_augroup('core.events', { clear = true }) local group = api.nvim_create_augroup('core.events', { clear = true })
vim.api.nvim_create_user_command('W', function()
vim.cmd('w')
end, { desc = 'Write current buffer' })
function _G.see(val)
local lines = vim.split(vim.inspect(val), '\n')
vim.cmd('new')
vim.api.nvim_buf_set_lines(0, 0, -1, false, lines)
vim.bo.buftype = 'nofile'
vim.bo.bufhidden = 'wipe'
end
vim.api.nvim_create_user_command('MessagesToBuffer', function()
local output = vim.api.nvim_exec2('silent messages', { output = true }).output or ''
local lines = vim.split(output, '\n', { plain = true, trimempty = false })
vim.cmd('new')
local bufnr = vim.api.nvim_get_current_buf()
vim.bo[bufnr].buftype = 'nofile'
vim.bo[bufnr].bufhidden = 'wipe'
vim.bo[bufnr].swapfile = false
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, lines)
end, { desc = 'Open :messages output in a scratch buffer' })
vim.api.nvim_create_user_command('CmdToBuffer', function(opts)
local cmd = table.concat(opts.fargs, ' ')
vim.g.__cmd_to_buffer_cmd = cmd
vim.g.__cmd_to_buffer_out = nil
local exec_line = opts.bang and 'silent execute' or 'execute'
local ok, err = pcall(vim.cmd, string.format(
[[
redir => g:__cmd_to_buffer_out
%s g:__cmd_to_buffer_cmd
redir END
]],
exec_line
))
if not ok then
pcall(vim.cmd, 'redir END')
error(err)
end
local output = vim.g.__cmd_to_buffer_out or ''
vim.g.__cmd_to_buffer_cmd = nil
vim.g.__cmd_to_buffer_out = nil
local lines = vim.split(output, '\n', { plain = true, trimempty = false })
vim.cmd('new')
local bufnr = vim.api.nvim_get_current_buf()
vim.bo[bufnr].buftype = 'nofile'
vim.bo[bufnr].bufhidden = 'wipe'
vim.bo[bufnr].swapfile = false
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, lines)
end, { nargs = '+', bang = true, complete = 'command', desc = 'Run an Ex command and open its output in a scratch buffer' })
-- Automatically create a scratch buffer if Neovim starts with no files -- Automatically create a scratch buffer if Neovim starts with no files
au('VimEnter', { au('VimEnter', {
group = group, group = group,

14
lua/core/filetypes.lua Normal file
View File

@@ -0,0 +1,14 @@
vim.filetype.add({
pattern = {
['.*/templates/.*%.ya?ml'] = 'helm',
['.*/manifests/.*%.ya?ml'] = 'helm',
['.*/crds/.*%.ya?ml'] = 'helm',
['.*/kubernetes/.*%.ya?ml'] = 'helm',
['.*/k8s/.*%.ya?ml'] = 'helm',
['.*/charts/.*%.ya?ml'] = 'helm',
},
extension = {
gotmpl = 'helm',
tftpl = 'yaml',
},
})

View File

@@ -22,6 +22,15 @@ vim.keymap.set('x', 'K', ":m '<-2<CR>gv=gv")
vim.keymap.set('n', '<leader>s', [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/g<Left><Left><Left>]]) vim.keymap.set('n', '<leader>s', [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/g<Left><Left><Left>]])
-- Scroll
-- vim.keymap.set('n', '<C-d>', function()
-- vim.cmd('normal! ' .. math.floor(vim.api.nvim_win_get_height(0) * 0.25) .. 'j')
-- end)
--
-- vim.keymap.set('n', '<C-u>', function()
-- vim.cmd('normal! ' .. math.floor(vim.api.nvim_win_get_height(0) * 0.25) .. 'k')
-- end)
-- Easy to use registers -- Easy to use registers
map('x', '<leader>p', '"_dP') map('x', '<leader>p', '"_dP')
map({ 'n', 'x' }, '<leader>y', '"+y') map({ 'n', 'x' }, '<leader>y', '"+y')
@@ -38,6 +47,7 @@ map('n', '<C-k>', '<C-w>k')
-- Tab management -- Tab management
map('n', ']t', cmd('tabnext')) map('n', ']t', cmd('tabnext'))
map('n', '[t', cmd('tabprevious')) map('n', '[t', cmd('tabprevious'))
map('n', '<leader>t', '<nop>')
map('n', '<leader>tt', cmd('tabnew')) map('n', '<leader>tt', cmd('tabnew'))
map('n', '<leader>tn', cmd('tabnew')) map('n', '<leader>tn', cmd('tabnew'))
map('n', '<leader>tc', cmd('tabclose')) map('n', '<leader>tc', cmd('tabclose'))

View File

@@ -3,6 +3,7 @@ vim.g.mapleader = ' '
vim.g.maplocalleader = ' ' vim.g.maplocalleader = ' '
-- Disable built-in plugins -- Disable built-in plugins
-- Mark plugins as “1=already loaded” so Neovim skips loading them
vim.loader.enable() vim.loader.enable()
vim.g.loaded_gzip = 1 vim.g.loaded_gzip = 1
vim.g.loaded_tar = 1 vim.g.loaded_tar = 1
@@ -23,6 +24,8 @@ vim.g.loaded_rplugin = 1
vim.g.loaded_netrw = 1 -- use nvim-tree instead vim.g.loaded_netrw = 1 -- use nvim-tree instead
vim.g.loaded_netrwPlugin = 1 vim.g.loaded_netrwPlugin = 1
vim.g.markdown_recommended_style = 0 -- Disable MD built-in styling
-- UI -- UI
vim.g.have_nerd_font = true vim.g.have_nerd_font = true
vim.opt.termguicolors = false vim.opt.termguicolors = false
@@ -68,6 +71,7 @@ vim.opt.autoindent = true -- Copy indent from the current line when starting a n
vim.opt.smartindent = true -- Automatically inserts indents in code blocks (for C-like languages) vim.opt.smartindent = true -- Automatically inserts indents in code blocks (for C-like languages)
-- Scroll and mouse -- Scroll and mouse
vim.opt.scroll = 20
vim.opt.scrolloff = 10 vim.opt.scrolloff = 10
vim.opt.sidescrolloff = 5 vim.opt.sidescrolloff = 5
vim.opt.mousescroll = 'hor:1,ver:1' vim.opt.mousescroll = 'hor:1,ver:1'

View File

@@ -46,6 +46,20 @@ local function my_on_attach(bufnr)
vim.keymap.set('n', 'U', api.tree.reload, opts) vim.keymap.set('n', 'U', api.tree.reload, opts)
end end
local ignored_watcher_dirs = {
['.git'] = true,
['.DS_Store'] = true,
build = true,
dist = true,
public = true,
node_modules = true,
target = true,
}
local function ignore_watcher_dir(path)
return ignored_watcher_dirs[vim.fs.basename(path)] or false
end
require('nvim-tree').setup({ require('nvim-tree').setup({
on_attach = my_on_attach, on_attach = my_on_attach,
view = { signcolumn = 'no' }, view = { signcolumn = 'no' },
@@ -55,6 +69,7 @@ require('nvim-tree').setup({
special_files = {}, special_files = {},
highlight_hidden = 'all', highlight_hidden = 'all',
highlight_modified = 'name',
highlight_clipboard = 'all', highlight_clipboard = 'all',
indent_markers = { indent_markers = {
@@ -70,7 +85,7 @@ require('nvim-tree').setup({
folder = false, folder = false,
folder_arrow = false, folder_arrow = false,
git = true, git = true,
modified = false, modified = true,
hidden = false, hidden = false,
diagnostics = false, diagnostics = false,
bookmarks = true, bookmarks = true,
@@ -91,6 +106,7 @@ require('nvim-tree').setup({
hijack_cursor = true, hijack_cursor = true,
prefer_startup_root = true, prefer_startup_root = true,
reload_on_bufenter = true,
update_focused_file = { update_focused_file = {
enable = true, enable = true,
update_root = { enable = true, ignore_list = {} }, update_root = { enable = true, ignore_list = {} },
@@ -110,14 +126,6 @@ require('nvim-tree').setup({
filesystem_watchers = { filesystem_watchers = {
enable = true, enable = true,
debounce_delay = 50, debounce_delay = 50,
ignore_dirs = { ignore_dirs = ignore_watcher_dir,
'/.git',
'/.DS_Store',
'/build',
'/dist',
'/public',
'/node_modules',
'/target',
},
}, },
}) })

View File

@@ -1,9 +1,10 @@
local function clone_package_manager() local lock_path = vim.fs.joinpath(vim.fn.stdpath('config'), 'paq-lock.json')
local function clone_paq()
local path = vim.fn.stdpath('data') .. '/site/pack/paqs/opt/paq-nvim' local path = vim.fn.stdpath('data') .. '/site/pack/paqs/opt/paq-nvim'
if not vim.uv.fs_stat(path) then if not vim.uv.fs_stat(path) then
local repo = 'https://github.com/savq/paq-nvim.git' local repo = 'https://github.com/savq/paq-nvim.git'
local cmd = { 'git', 'clone', '--depth=1', repo, path } local result = vim.system({ 'git', 'clone', '--depth=1', repo, path }):wait()
local result = vim.system(cmd):wait()
if result.code == 0 then if result.code == 0 then
print('Package manager installed correctly') print('Package manager installed correctly')
end end
@@ -14,11 +15,13 @@ local function load_paq()
vim.cmd.packadd('paq-nvim') vim.cmd.packadd('paq-nvim')
local paq = require('paq') local paq = require('paq')
local packages = require('setup.packages').get() local packages = require('setup.packages').get()
paq:setup({ lock = vim.fn.stdpath('config') .. '/paq-lock.json' })(packages) paq:setup({ lock = lock_path })(packages)
return paq return paq
end end
local function install_packages() local function install_packages()
clone_paq()
local done = false local done = false
vim.api.nvim_create_autocmd('User', { vim.api.nvim_create_autocmd('User', {
pattern = 'PaqDoneInstall', pattern = 'PaqDoneInstall',
@@ -31,11 +34,6 @@ local function install_packages()
local paq = load_paq() local paq = load_paq()
paq.install() paq.install()
local to_install = paq.query('to_install')
if #to_install == 0 then
return
end
vim.wait(60000, function() vim.wait(60000, function()
return done return done
end, 200) end, 200)
@@ -57,30 +55,20 @@ local function install_languages()
lm.install() lm.install()
end end
vim.api.nvim_create_user_command('InstallAll', function() local function sync_packages()
print('> Starting clone package manager...') clone_paq()
clone_package_manager()
print('\n> Starting installing packages...')
install_packages()
print('\n> Starting installing languages: ts parsers, language servers, linters, formatters...')
install_languages()
print('\n=== Install Finished ===\n\n')
end, {})
vim.api.nvim_create_user_command('Sync', function()
local paq = load_paq() local paq = load_paq()
paq:sync() paq:sync()
end, {}) end
vim.api.nvim_create_user_command('FetchLspConfigs', function() local function fetch_lsp_configs()
-- local base_url = 'https://raw.githubusercontent.com/neovim/nvim-lspconfig/master/lsp/'
local base_url = 'https://raw.githubusercontent.com/neovim/nvim-lspconfig/refs/heads/master/lsp/' local base_url = 'https://raw.githubusercontent.com/neovim/nvim-lspconfig/refs/heads/master/lsp/'
local lm = require('plugins.language-manager') local lm = require('plugins.language-manager')
lm.invalidate_cache() lm.invalidate_cache()
local general = lm.load_specs() local general = lm.load_specs()
local lsp_dir = vim.fs.joinpath(vim.fn.getcwd(), 'lsp') local lsp_dir = vim.fs.joinpath(vim.fn.stdpath('config'), 'lsp')
vim.fn.mkdir(lsp_dir, 'p') vim.fn.mkdir(lsp_dir, 'p')
for _, name in ipairs(general.language_servers or {}) do for _, name in ipairs(general.language_servers or {}) do
@@ -99,4 +87,31 @@ vim.api.nvim_create_user_command('FetchLspConfigs', function()
vim.notify('Skipped existing ' .. name .. '.lua', vim.log.levels.INFO) vim.notify('Skipped existing ' .. name .. '.lua', vim.log.levels.INFO)
end end
end end
end, { desc = 'Fetch default LSP configs into ./lsp in cwd' }) end
local function create_command(name, callback, desc)
vim.api.nvim_create_user_command(name, callback, { desc = desc })
end
create_command('Setup', function()
print('> Installing packages...')
install_packages()
print('\n> Installing languages: treesitter parsers, language servers, linters, formatters...')
install_languages()
print('\n=== Setup Finished ===\n')
end, 'Install packages and language tooling (first-time setup)')
create_command('InstallPackages', function()
print('> Installing packages...')
install_packages()
print('\n=== Package Install Finished ===\n')
end, 'Install packages via Paq')
create_command('InstallLanguages', function()
print('> Installing languages: treesitter parsers, language servers, linters, formatters...')
install_languages()
print('\n=== Language Install Finished ===\n')
end, 'Install treesitter, LSP, linter, and formatter tooling')
create_command('Sync', sync_packages, 'Sync packages with Paq')
create_command('FetchLspConfigs', fetch_lsp_configs, 'Fetch default LSP configs into lsp/')

View File

@@ -14,6 +14,10 @@ function M.get()
{ 'https://github.com/nvim-treesitter/nvim-treesitter', version = 'master' }, { 'https://github.com/nvim-treesitter/nvim-treesitter', version = 'master' },
{ 'https://github.com/mfussenegger/nvim-lint' }, { 'https://github.com/mfussenegger/nvim-lint' },
{ 'https://github.com/stevearc/conform.nvim' }, { 'https://github.com/stevearc/conform.nvim' },
{ 'https://github.com/tpope/vim-fugitive' },
-- { 'https://github.com/MeanderingProgrammer/render-markdown.nvim' },
} }
end end

View File

@@ -1 +1 @@
{"nvim-ts-autotag":{"status":1,"dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/nvim-ts-autotag","name":"nvim-ts-autotag","url":"https://github.com/windwp/nvim-ts-autotag","hash":""},"nvim-autopairs":{"status":1,"dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/nvim-autopairs","name":"nvim-autopairs","url":"https://github.com/windwp/nvim-autopairs","hash":""},"conform.nvim":{"status":1,"dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/conform.nvim","name":"conform.nvim","url":"https://github.com/stevearc/conform.nvim","hash":""},"nvim-tree.lua":{"status":1,"dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/nvim-tree.lua","name":"nvim-tree.lua","url":"https://gitea.tomastm.com/tomas.mirchev/nvim-tree.lua","hash":""},"invero.nvim":{"status":1,"dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/invero.nvim","name":"invero.nvim","url":"https://github.com/triimd/invero.nvim","hash":""},"mason.nvim":{"status":1,"dir":"/home/tomas/.local/share/nvim/site/pack/paqs/opt/mason.nvim","name":"mason.nvim","url":"https://github.com/mason-org/mason.nvim","hash":""},"nvim-lint":{"status":1,"dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/nvim-lint","name":"nvim-lint","url":"https://github.com/mfussenegger/nvim-lint","hash":""},"paq-nvim":{"status":0,"dir":"/home/tomas/.local/share/nvim/site/pack/paqs/opt/paq-nvim","name":"paq-nvim","url":"https://github.com/savq/paq-nvim.git","hash":"971344d1fe1fd93580961815e7b7c8853c3605e4"},"nvim-treesitter":{"status":1,"dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/nvim-treesitter","name":"nvim-treesitter","url":"https://github.com/nvim-treesitter/nvim-treesitter","hash":""}} {"nvim-autopairs":{"name":"nvim-autopairs","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/nvim-autopairs","status":0,"url":"https://github.com/windwp/nvim-autopairs","hash":"59bce2eef357189c3305e25bc6dd2d138c1683f5"},"nvim-tree.lua":{"name":"nvim-tree.lua","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/nvim-tree.lua","status":0,"url":"https://gitea.tomastm.com/tomas.mirchev/nvim-tree.lua","hash":"7c0f7e906ab6f11b61eec52171eaf7dc06726ef1"},"nvim-treesitter":{"name":"nvim-treesitter","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/nvim-treesitter","status":0,"url":"https://github.com/nvim-treesitter/nvim-treesitter","hash":"42fc28ba918343ebfd5565147a42a26580579482"},"nvim-lint":{"name":"nvim-lint","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/nvim-lint","status":0,"url":"https://github.com/mfussenegger/nvim-lint","hash":"bcd1a44edbea8cd473af7e7582d3f7ffc60d8e81"},"paq-nvim":{"name":"paq-nvim","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/opt/paq-nvim","status":0,"url":"https://github.com/savq/paq-nvim.git","hash":"971344d1fe1fd93580961815e7b7c8853c3605e4"},"invero.nvim":{"name":"invero.nvim","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/invero.nvim","status":0,"url":"https://github.com/triimd/invero.nvim","hash":"1a1761f4f4444d3b9b9e87308a33c0b043e209d3"},"mason.nvim":{"name":"mason.nvim","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/opt/mason.nvim","status":0,"url":"https://github.com/mason-org/mason.nvim","hash":"44d1e90e1f66e077268191e3ee9d2ac97cc18e65"},"vim-fugitive":{"name":"vim-fugitive","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/vim-fugitive","status":1,"url":"https://github.com/tpope/vim-fugitive","hash":""},"nvim-ts-autotag":{"name":"nvim-ts-autotag","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/nvim-ts-autotag","status":0,"url":"https://github.com/windwp/nvim-ts-autotag","hash":"8e1c0a389f20bf7f5b0dd0e00306c1247bda2595"},"conform.nvim":{"name":"conform.nvim","dir":"/home/tomas/.local/share/nvim/site/pack/paqs/start/conform.nvim","status":0,"url":"https://github.com/stevearc/conform.nvim","hash":"c2526f1cde528a66e086ab1668e996d162c75f4f"}}