clean nvim

This commit is contained in:
2025-10-12 19:01:26 +03:00
parent 9418d8ccc7
commit 64a20b1292
42 changed files with 763 additions and 1209 deletions

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

@@ -0,0 +1,105 @@
-- 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-w h - Move to window on the left
Ctrl-w j - Move to window below
Ctrl-w k - Move to window above
Ctrl-w 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
Ctrl-w r - Rotate windows downward/rightward
Ctrl-w R - Rotate windows upward/leftward
Ctrl-w x - Exchange current window with next one
-- 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 1 column
Ctrl-w < - Decrease width by 1 column
Ctrl-w + - Increase height by 1 row
Ctrl-w - - Decrease height by 1 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
Ctrl-w ] - Split window and jump to definition
Ctrl-w f - Split window and edit file under cursor
Ctrl-w i - Split window and show declaration
Ctrl-w ^ - Split window and edit alternate file
-- Tab
gt :tabnext - Go to next tab
gT :tabprevious - Go to previous tab
{n}gt :tabnext {n} - Go to tab number {n}
<Leader>tn :tabnew - Create a new tab - Suggested
<Leader>tc :tabclose - Close current tab - Suggested
<Leader>to :tabonly - Close all other tabs - Suggested
<Leader>t{n} {n}gt - Go to tab {n} - Suggested
<Leader>tm. :tabmove +1 - Move tab right - Suggested
<Leader>tm, :tabmove -1 - Move tab left - Suggested
-- Buffer
<Leader>bl :ls - List all buffers - Suggested
<Leader>bd :bdelete - Delete current buffer - Suggested
<Leader>bn :bnext - Go to next buffer - Suggested
<Leader>bp :bprevious - Go to previous buffer - Suggested
<Leader>b{n} :buffer {n} - Go to buffer {n} - Suggested
<Leader>bb :b<Space> - Start buffer selection - Suggested
<Leader>bo :bufdo bd|1bd - Delete all other buffers - Suggested
-- Telescope
<Leader>sf telescope.find_files - Search Files
<Leader>sg telescope.live_grep - Search by Grep
<Leader>sb telescope.buffers - Search Buffers
<Leader>sh telescope.help_tags - Search Help
<Leader>sp telescope.projects - Search Projects
<Leader>sm telescope.marks - Search Marks
<Leader>sc telescope.commands - Search Commands
<Leader>sk telescope.keymaps - Search Keymaps
<Leader>ss telescope.git_status - Search Git Status
<Leader>sw telescope.grep_string - Search current Word
<Leader>sd telescope.diagnostics - Search Diagnostics
<Leader>sr telescope.lsp_references - Search References
-- Neo-tree
<Leader>e :Neotree toggle - Explorer Toggle
<Leader>E :Neotree focus - Explorer Focus
<Leader>ef :Neotree float - Explorer Float
<Leader>eb :Neotree buffers - Explorer Buffers
<Leader>eg :Neotree git_status - Explorer Git
-- 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

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 }
},
},
}