Compare commits

...

2 Commits

Author SHA1 Message Date
65680cb255 add readme and yaml spec 2026-01-29 02:11:31 +02:00
f54bbc5676 finder fixed char render 2026-01-29 01:18:33 +02:00
5 changed files with 178 additions and 99 deletions

15
docs/README.md Normal file
View File

@@ -0,0 +1,15 @@
# 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,13 +1,3 @@
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
@@ -31,121 +21,125 @@ TODO:
## 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)
- 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)
- git Revision control system. (requirement)
- lazygit Terminal UI for git commands. (optional)
- fd-find (fd) Alternative to `find`. (optional)
- ripgrep (rg) Line-oriented search tool. (recommended)
- 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.
- git Revision control system. (requirement)
- lazygit Terminal UI for git commands. (optional)
- 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.
- 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
- 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
- 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
- cmp-path
- cmp-nvim-lsp
- nvim-tree.lua # file explorer
- telescope.nvim
- telescope-fzf-native.nvim
- telescope-ui-select.nvim
- plenary.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
- folke/lazy.nvim
- mason-org/mason.nvim
- TS
- nvim-treesitter
- nvim-treesitter-textobjects
- 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
- 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
- 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
- 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)
- 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)
@@ -155,6 +149,7 @@ TODO:
- milanglacier/minuet-ai.nvim (folke)
## Options
```
opt.backup = true
@@ -178,6 +173,7 @@ vim.keymap.set("n", "<C-c>", "ciw")
```
folke cmd
```lua
-- show cursor line only in active window
vim.api.nvim_create_autocmd({ "InsertLeave", "WinEnter" }, {
@@ -210,6 +206,7 @@ vim.api.nvim_create_autocmd("BufWritePre", {
```
Enable folding with TS:
```
vim.opt.foldmethod = "expr"
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"

View File

@@ -2,22 +2,28 @@ local M = {}
function M.get()
return {
{ ts = { 'yaml', 'toml', 'sql', 'diff', 'dockerfile', 'gitcommit', 'gitignore' } },
{ ts = { 'c', 'cpp', 'go', 'rust', 'python' } },
{
ft = 'yaml',
ts = 'yaml',
lsp = 'yaml-language-server',
format = { 'prettierd', 'prettier' },
},
{ ts = { 'yaml', 'toml', 'sql', 'diff', 'dockerfile', 'gitcommit', 'gitignore' } },
{ ts = { 'c', 'cpp', 'go', 'rust', 'python' } },
{ ft = 'markdown', ts = { 'markdown', 'markdown_inline' }, format = 'prettier' },
{ ft = 'bash', lsp = 'bash-language-server', lint = 'shellcheck', format = 'shfmt' },
{ ft = 'lua', lsp = 'lua-language-server', lint = 'luacheck', format = 'stylua' },
{ ft = { 'json', 'jsonc' }, lsp = 'json-lsp' },
{ ft = 'html', lsp = 'html-lsp' },
{ ft = 'css', lsp = { 'css-lsp', 'tailwindcss-language-server' } },
{
ft = { 'javascript', 'typescript', 'javascriptreact', 'typescriptreact' },
ts = { 'javascript', 'typescript', 'tsx' },
lsp = { 'vtsls', 'eslint-lsp' },
format = { 'prettierd', 'prettier' },
},
}
{ ft = 'markdown', ts = { 'markdown', 'markdown_inline' }, format = 'prettier' },
{ ft = 'bash', lsp = 'bash-language-server', lint = 'shellcheck', format = 'shfmt' },
{ ft = 'lua', lsp = 'lua-language-server', lint = 'luacheck', format = 'stylua' },
{ ft = { 'json', 'jsonc' }, lsp = 'json-lsp' },
{ ft = 'html', lsp = 'html-lsp' },
{ ft = 'css', lsp = { 'css-lsp', 'tailwindcss-language-server' } },
{
ft = { 'javascript', 'typescript', 'javascriptreact', 'typescriptreact' },
ts = { 'javascript', 'typescript', 'tsx' },
lsp = { 'vtsls', 'eslint-lsp' },
format = { 'prettierd', 'prettier' },
},
}
end
return M

View File

@@ -16,6 +16,7 @@ M.config = {
max_items = 5000, -- safety cap for massive outputs
debug = false,
follow_symlinks = true, -- pass -L to fd
grep_path_width = 30,
-- Exclusion patterns (used by fd/rg in addition to their gitignore handling)
exclude_patterns = { 'node_modules', 'dist', 'build', '.git' },
@@ -241,6 +242,60 @@ local function render()
end
end
-- For grep mode, reformat lines with fixed-width path column
local offset_map = {} -- maps display line -> character offset for highlighting
if S.mode == 'grep' and total > 0 then
local path_width = M.config.grep_path_width or 40
for i = 1, #view do
local line = view[i]
if line then
-- Parse original vimgrep format: file:line:col:content
local file, lnum, col = line:match('^(.-):(%d+):(%d+):')
if file and lnum and col then
-- Pad line number to 3 chars with underscores
local padded_lnum = lnum
while #padded_lnum < 3 do
padded_lnum = ' ' .. padded_lnum
end
local lineinfo = ':' .. padded_lnum .. '|'
local content_start = #file + 1 + #lnum + 1 + #col + 2 -- file + :lnum: + col:
local content_part = line:sub(content_start)
-- Calculate how much space we need for file + lineinfo
local prefix_len = #file + #lineinfo
local formatted_line
if prefix_len > path_width then
-- Need to truncate the filepath part only
local available_for_file = path_width - #lineinfo
if available_for_file > 1 then
local truncated_file = '' .. file:sub(-(available_for_file - 1))
formatted_line = truncated_file .. lineinfo .. content_part
-- Offset is: original_file_length - truncated_file_length
offset_map[i] = #file - #truncated_file
else
-- Extreme case: line info itself is too long, just show what we can
formatted_line = ('' .. file):sub(1, path_width) .. lineinfo .. content_part
offset_map[i] = #file - (path_width - #lineinfo)
end
elseif prefix_len < path_width then
-- Right-align by padding before the filepath
local padding = string.rep(' ', path_width - prefix_len)
formatted_line = padding .. file .. lineinfo .. content_part
offset_map[i] = -(path_width - prefix_len) -- negative for padding added
else
formatted_line = file .. lineinfo .. content_part
offset_map[i] = 0
end
view[i] = formatted_line
end
end
end
end
vim.bo[S.buf_res].modifiable = true
vim.api.nvim_buf_set_lines(S.buf_res, 0, -1, false, view)
vim.api.nvim_buf_clear_namespace(S.buf_res, S.ns, 0, -1)
@@ -253,17 +308,15 @@ local function render()
local idx = S.scroll + i
local line = view[i]
-- In grep mode, highlight the "file:line:col:" prefix in gray
-- In grep mode, highlight the entire "file:line|" prefix in gray
if S.mode == 'grep' and line then
local prefix_end = line:find('^.-:%d+:%d+:')
-- Find the end of the full prefix including the pipe
local _, prefix_end = line:find(':[ 0-9]+|')
if prefix_end then
local _, epos = line:find('^.-:%d+:%d+:')
if epos then
pcall(vim.api.nvim_buf_set_extmark, S.buf_res, S.ns, i - 1, 0, {
end_col = epos,
hl_group = 'FinderPath',
})
end
pcall(vim.api.nvim_buf_set_extmark, S.buf_res, S.ns, i - 1, 0, {
end_col = prefix_end,
hl_group = 'FinderPath',
})
end
end
@@ -272,7 +325,14 @@ local function render()
if spans then
for _, se in ipairs(spans) do
local scol, ecol = se[1], se[2]
if ecol > scol then
-- Adjust positions for grep mode formatting
if S.mode == 'grep' and offset_map[i] then
scol = scol - offset_map[i]
ecol = ecol - offset_map[i]
end
if ecol > scol and scol >= 0 then
pcall(vim.api.nvim_buf_set_extmark, S.buf_res, S.ns, i - 1, scol, {
end_col = ecol,
hl_group = 'FinderMatch',

View File

@@ -73,7 +73,8 @@ vim.api.nvim_create_user_command('Sync', function()
end, {})
vim.api.nvim_create_user_command('FetchLspConfigs', function()
local base_url = 'https://raw.githubusercontent.com/neovim/nvim-lspconfig/master/lsp/'
-- 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 lm = require('plugins.language-manager')
lm.invalidate_cache()