From b27f0e7026f4030f4dbf794819acfbef4bd9cdc2 Mon Sep 17 00:00:00 2001 From: Mathias Scheider Date: Wed, 25 Mar 2026 20:17:48 +0100 Subject: [PATCH 1/3] some tree-sitter adjustments --- nvim/.config/nvim/lua/basic-settings.lua | 3 ++- nvim/.config/nvim/lua/plugins/treesitter.lua | 12 ++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/nvim/.config/nvim/lua/basic-settings.lua b/nvim/.config/nvim/lua/basic-settings.lua index 88ee11e..ab0f33c 100644 --- a/nvim/.config/nvim/lua/basic-settings.lua +++ b/nvim/.config/nvim/lua/basic-settings.lua @@ -1,7 +1,8 @@ -- Basics vim.opt.foldmethod = "expr" -vim.opt.foldexpr = "nvim_treesitter#foldexpr()" +vim.opt.foldexpr = "v:lua.vim.treesitter.foldexpr()" +vim.opt.foldlevel = 99 vim.opt.number = true vim.opt.relativenumber = true vim.opt.tabstop = 4 diff --git a/nvim/.config/nvim/lua/plugins/treesitter.lua b/nvim/.config/nvim/lua/plugins/treesitter.lua index d37bbd9..612ae26 100644 --- a/nvim/.config/nvim/lua/plugins/treesitter.lua +++ b/nvim/.config/nvim/lua/plugins/treesitter.lua @@ -2,11 +2,15 @@ -- treesitter: code parser return { "nvim-treesitter/nvim-treesitter", + branch = "master", build = ":TSUpdate", opts = { - ensure_installed = {"python", "bash", "lua", "json", "java", "typescript"}, + ensure_installed = {"python", "bash", "lua", "json", "java", "typescript", "vim", "markdown", "yaml", "toml"}, + auto_install = true, highlight = { enable = true }, - indent = { enable = true }, - fold = { enable = true } - } + indent = { enable = true } + }, + config = function(_, opts) + require("nvim-treesitter.configs").setup(opts) + end, } From fddd7c15732aac72d10eb2c845d964792caa7e7a Mon Sep 17 00:00:00 2001 From: Mathias Schneider Date: Wed, 25 Mar 2026 20:34:02 +0100 Subject: [PATCH 2/3] yet another tree-sitter optimization --- nvim/.config/nvim/lua/plugins/treesitter.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/nvim/.config/nvim/lua/plugins/treesitter.lua b/nvim/.config/nvim/lua/plugins/treesitter.lua index 612ae26..be8d599 100644 --- a/nvim/.config/nvim/lua/plugins/treesitter.lua +++ b/nvim/.config/nvim/lua/plugins/treesitter.lua @@ -10,7 +10,5 @@ return { highlight = { enable = true }, indent = { enable = true } }, - config = function(_, opts) - require("nvim-treesitter.configs").setup(opts) - end, + } From 2e241c123c4a331225cc842a5f0eb7648898153a Mon Sep 17 00:00:00 2001 From: Mathias Scheider Date: Wed, 25 Mar 2026 22:48:05 +0100 Subject: [PATCH 3/3] with a little help from my chatbot --- nvim/.config/README.md | 256 +++++++++++++++++++ nvim/.config/nvim/init.lua | 63 ++++- nvim/.config/nvim/lua/basic-settings.lua | 162 +++++++++++- nvim/.config/nvim/lua/plugins/catppuccin.lua | 12 +- nvim/.config/nvim/lua/plugins/debugging.lua | 26 ++ nvim/.config/nvim/lua/plugins/gitsigns.lua | 116 +-------- nvim/.config/nvim/lua/plugins/lsp-config.lua | 76 ++++-- nvim/.config/nvim/lua/plugins/lualine.lua | 17 +- nvim/.config/nvim/lua/plugins/neo-tree.lua | 10 +- nvim/.config/nvim/lua/plugins/telescope.lua | 52 ++-- nvim/.config/nvim/lua/plugins/treesitter.lua | 22 +- 11 files changed, 596 insertions(+), 216 deletions(-) create mode 100644 nvim/.config/README.md create mode 100644 nvim/.config/nvim/lua/plugins/debugging.lua diff --git a/nvim/.config/README.md b/nvim/.config/README.md new file mode 100644 index 0000000..cb92156 --- /dev/null +++ b/nvim/.config/README.md @@ -0,0 +1,256 @@ +# Neovim IDE Configuration + +A feature-rich Neovim setup optimized for Python, JSON, and CSV development. + +## Features + +### LSP (Language Server Protocol) +- **Python** (pyright) - Autocomplete, type checking, goto definition, hover docs, rename +- **JSON** (jsonls) - Validation, formatting, schema support +- **YAML** (yamlls) - YAML file support +- **HTML/CSS** (html, cssls) - Web development +- **Bash** (bashls) - Shell script support +- **Lua** (lua_ls) - Neovim config development + +### Completion +- **nvim-cmp** - Smart autocomplete with LSP integration +- **LuaSnip** - Snippet support + +### Syntax Highlighting & Parsing +- **Treesitter** - Advanced syntax highlighting for Python, JSON, CSV, YAML, Markdown, and more +- **CSV Support** - Syntax highlighting for CSV files + +### File Management +- **Neo-tree** - File explorer with git integration +- **Telescope** - Fuzzy finder for files, text, and more + +### Git Integration +- **Gitsigns** - Git status in the gutter (added, modified, deleted lines) + +### Debugging +- **nvim-dap** - Debug Python code with breakpoints, step-through debugging +- **dap-ui** - Visual debugging interface + +### UI Enhancements +- **Catppuccin** - Beautiful dark color scheme (Mocha flavor) +- **Lualine** - Custom statusline showing mode, git branch, file, diagnostics + +### Formatting +- **conform.nvim** - Auto-format on save (ruff for Python, jq for JSON, etc.) + +### Utilities +- **nvim-comment** - Easy commenting (toggle comments with `gcc`) + +--- + +## Installation + +1. **Install Neovim** (version 0.10+ recommended) + +2. **Link this config:** + ```bash + ln -s ~/.dotfiles/nvim ~/.config/nvim + ``` + +3. **Open Neovim** - plugins will install automatically + +4. **Install debugpy for Python debugging:** + ```bash + pip install debugpy + ``` + +5. **Install formatters (optional):** + ```bash + pip install ruff black + ``` + +--- + +## Keymaps + +### General + +| Keymap | Action | +|--------|--------| +| `w` | Save file | +| `q` | Quit Neovim | +| `` | Exit insert mode | +| `u` | Undo | +| `` | Redo | +| `dd` | Delete line | +| `yy` | Yank (copy) line | +| `p` | Paste | + +### Navigation + +| Keymap | Action | +|--------|--------| +| `h/j/k/l` | Move left/down/up/right | +| `w/b` | Jump forward/back by word | +| `0/$` | Jump to start/end of line | +| `gg` | Jump to beginning of file | +| `G` | Jump to end of file | +| `/` | Jump down/up half page | +| `/` | Jump forward/back page | + +### File Explorer (Neo-tree) + +| Keymap | Action | +|--------|--------| +| `` | Toggle file explorer | +| `Enter` | Open file/folder | +| `h` | Close folder | +| `l` | Open folder | +| `a` | Add file | +| `d` | Delete file | +| `r` | Rename file | +| `y/x` | Copy/Cut file | +| `p` | Paste | + +### Fuzzy Finder (Telescope) + +| Keymap | Action | +|--------|--------| +| `` | Find files | +| `fg` | Grep (search text in files) | + +### LSP (Language Server) + +| Keymap | Action | +|--------|--------| +| `gd` | Go to definition | +| `gD` | Go to declaration | +| `gi` | Go to implementation | +| `gr` | Show references | +| `K` | Show hover documentation | +| `rn` | Rename symbol | +| `ca` | Code actions / quick fixes | +| `e` | Show diagnostic error | +| `[d / ]d` | Previous/next diagnostic | + +### Formatting + +| Keymap | Action | +|--------|--------| +| `f` | Format file | + +### Git (Gitsigns) + +| Keymap | Action | +|--------|--------| +| `]c / [c` | Next/previous hunk (change) | +| `hs` | Stage current hunk | +| `hr` | Reset current hunk | +| `hp` | Preview hunk changes | +| `hb` | Blame line | + +### Debugging (DAP) + +| Keymap | Action | +|--------|--------| +| `` | Continue / Start debugger | +| `` | Toggle breakpoint | +| `` | Step over | +| `` | Step into | +| `` | Step out | +| `du` | Toggle debugger UI | + +### Commenting + +| Keymap | Action | +|--------|--------| +| `gcc` | Toggle line comment | +| `gc` (visual) | Toggle selection comment | + +### Folding + +| Keymap | Action | +|--------|--------| +| `zc` | Close (fold) current block | +| `zo` | Open (unfold) current block | +| `za` | Toggle fold at cursor | +| `zM` | Close all folds | +| `zR` | Open all folds | +| `zC` | Close folds recursively | +| `zO` | Open folds recursively | +| `zE` | Eliminate all folds | +| `zv` | Open folds enough to see cursor | + +--- + +## File Type Specifics + +### Python (.py) +- **LSP**: Full autocompletion, type checking, goto definition +- **Formatting**: ruff format (fast), black (backup) +- **Debugging**: Set breakpoints with `F9`, run with `F5` +- **Indentation**: 4 spaces (Python convention) + +### JSON (.json) +- **LSP**: Validation, schema support +- **Formatting**: jq +- **Indentation**: 2 spaces +- **Folding**: JSON objects/arrays are foldable (`za` to toggle, `zM` to close all) + +### CSV (.csv) +- **Treesitter**: Syntax highlighting +- **No wrap**: Full row visibility +- **Navigation**: Standard motions (`j/k`, `/`, etc.) +- **Tip**: Use `set nowrap` for viewing wide CSV files without line wrapping + +### YAML (.yaml/.yml) +- **LSP**: Validation, schema support +- **Folding**: Nested structures are foldable + +### Python (.py) +- **Folding**: Functions, classes, and code blocks are foldable +- **Tip**: Use `za` to toggle a fold at cursor, `zM` to close all folds + +--- + +## Troubleshooting + +### LSP not working +1. Ensure the language server is installed +2. Run `:LspInfo` to check status +3. Try `:LspRestart` + +### Debugging not working +1. Install debugpy: `pip install debugpy` +2. Place breakpoint with `F9` +3. Start with `F5` + +### Colors wrong +The config uses Catppuccin Mocha theme. If you see color issues, run: +```vim +:colorscheme catppuccin +``` + +--- + +## Adding New Plugins + +Plugins are defined in `lua/plugins/`. Each `.lua` file is a plugin spec that returns a table. + +Example (`lua/plugins/myplugin.lua`): +```lua +return { + "username/repo-name", + config = function() + require("myplugin").setup() + end, +} +``` + +--- + +## Credits + +- [lazy.nvim](https://github.com/folke/lazy.nvim) - Plugin manager +- [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) - LSP configuration +- [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) - Completion +- [Telescope](https://github.com/nvim-telescope/telescope.nvim) - Fuzzy finder +- [Neo-tree](https://github.com/nvim-neo-tree/neo-tree.nvim) - File explorer +- [Catppuccin](https://github.com/catppuccin/nvim) - Colorscheme +- [Gitsigns](https://github.com/lewis6991/gitsigns.nvim) - Git integration +- [nvim-dap](https://github.com/mfussenegger/nvim-dap) - Debugging diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua index 6adfbcc..fd98cb2 100644 --- a/nvim/.config/nvim/init.lua +++ b/nvim/.config/nvim/init.lua @@ -1,25 +1,60 @@ +--[[ + init.lua - Main Neovim configuration entry point + + HOW THIS WORKS: + 1. Bootstrap lazy.nvim (plugin manager) + 2. Load basic settings + 3. Load all plugins from plugins/ directory + 4. Set global keymaps and LSP keymaps +]] --- Bootstrap lazy.nvim +-- ============================================================================ +-- STEP 1: BOOTSTRAP LAZY.NVIM +-- ============================================================================ local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then - vim.fn.system({ - "git", - "clone", - "--filter=blob:none", - "https://github.com/folke/lazy.nvim.git", - "--branch=stable", - lazypath, - }) + vim.fn.system({ + "git", "clone", "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", lazypath, + }) end vim.opt.rtp:prepend(lazypath) - +-- ============================================================================ +-- STEP 2: LOAD SETTINGS +-- ============================================================================ require("basic-settings") + +-- ============================================================================ +-- STEP 3: LOAD PLUGINS +-- ============================================================================ require("lazy").setup("plugins") +-- ============================================================================ +-- STEP 4: LSP KEYMAPS +-- ============================================================================ +vim.keymap.set("n", "gd", vim.lsp.buf.definition, { desc = "Go to definition" }) +vim.keymap.set("n", "gD", vim.lsp.buf.declaration, { desc = "Go to declaration" }) +vim.keymap.set("n", "gi", vim.lsp.buf.implementation, { desc = "Go to implementation" }) +vim.keymap.set("n", "gr", vim.lsp.buf.references, { desc = "Show references" }) +vim.keymap.set("n", "K", vim.lsp.buf.hover, { desc = "Show hover docs" }) +vim.keymap.set("n", "rn", vim.lsp.buf.rename, { desc = "Rename symbol" }) +vim.keymap.set("n", "ca", vim.lsp.buf.code_action, { desc = "Code actions" }) +vim.keymap.set("n", "e", vim.diagnostic.open_float, { desc = "Show diagnostic" }) +vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, { desc = "Previous diagnostic" }) +vim.keymap.set("n", "]d", vim.diagnostic.goto_next, { desc = "Next diagnostic" }) +vim.diagnostic.config({ + virtual_text = { prefix = "●" }, + signs = true, + float = { border = "rounded" }, +}) - - - - +-- ============================================================================ +-- STEP 5: GLOBAL KEYMAPS +-- ============================================================================ +vim.keymap.set("n", "w", ":w", { desc = "Save file" }) +vim.keymap.set("n", "q", ":q", { desc = "Quit" }) +vim.keymap.set("n", "", ":Neotree filesystem reveal left", { desc = "Toggle explorer" }) +vim.keymap.set("n", "", ":Telescope find_files", { desc = "Find files" }) diff --git a/nvim/.config/nvim/lua/basic-settings.lua b/nvim/.config/nvim/lua/basic-settings.lua index ab0f33c..65df423 100644 --- a/nvim/.config/nvim/lua/basic-settings.lua +++ b/nvim/.config/nvim/lua/basic-settings.lua @@ -1,14 +1,172 @@ +--[[ + BASIC-SETTINGS.LUA + + This file contains fundamental Neovim settings that don't require plugins. + These are applied to Neovim globally and affect the core editing experience. + + In Lua (this file), we use: + - vim.opt.* for options that take values + - vim.g.* for global variables + - vim.go.* for global option shorthand +]] --- Basics +-- ============================================================================ +-- FOLDING SETTINGS (Code folding) +-- ============================================================================ +-- Foldmethod determines how code blocks are detected and folded +-- "expr" means folds are based on expressions (we use treesitter for this) vim.opt.foldmethod = "expr" + +-- Foldexpr is the expression used to determine fold level +-- v:lua.vim.treesitter.foldexpr() uses Treesitter to calculate folds vim.opt.foldexpr = "v:lua.vim.treesitter.foldexpr()" + +-- Foldlevel: Higher number = more folds are open by default +-- 99 means almost all folds are open when opening a file vim.opt.foldlevel = 99 + +-- ============================================================================ +-- LINE NUMBERS +-- ============================================================================ +-- Show line numbers (absolute numbering) vim.opt.number = true + +-- Show relative line numbers (helps with motions like 5j, 3k, etc.) +-- When combined with 'number', the current line shows absolute number vim.opt.relativenumber = true + +-- ============================================================================ +-- INDENTATION SETTINGS +-- ============================================================================ +-- Tabstop: How many spaces a TAB character counts for +-- When viewing a file, TABs appear as this many spaces vim.opt.tabstop = 4 + +-- Shiftwidth: How many spaces to use for auto-indentation and >> << commands vim.opt.shiftwidth = 4 + +-- Expandtab: Convert TABs to spaces when typing +-- true = pressing TAB inserts spaces; false = inserts actual TAB characters +-- Recommendation: Use true (spaces) for better portability across systems vim.opt.expandtab = true + +-- Smartindent: Auto-indent based on file type and syntax +-- Automatically adds indent after lines ending with specific characters vim.opt.smartindent = true + +-- ============================================================================ +-- UI/UX SETTINGS +-- ============================================================================ +-- Show line length marker (optional, helps keep lines under 80/120 chars) +-- Uncomment if you want: vim.opt.colorcolumn = "80" + +-- Enable cursor line highlighting (subtle background on current line) +vim.opt.cursorline = true + +-- Enable cursor column highlighting (column where cursor is) +vim.opt.cursorcolumn = true + +-- Better command-line completion (popup menu for completions) +vim.opt.wildmenu = true + +-- Ignore case when searching UNLESS you include an uppercase letter +vim.opt.ignorecase = true +vim.opt.smartcase = true + +-- Highlight search matches as you type +vim.opt.incsearch = true + +-- When search reaches end, wrap back to beginning +vim.opt.wrapscan = true + +-- Show matching brackets/parentheses +vim.opt.showmatch = true + +-- How long (ms) to show matching bracket +vim.opt.matchtime = 2 + +-- Show current mode in last line (like -- INSERT --) +vim.opt.showmode = true + +-- Show incomplete commands at bottom +vim.opt.showcmd = true + +-- Command line height (number of lines for command area) +vim.opt.cmdheight = 1 + +-- Always show status line (even in single window) +vim.opt.laststatus = 3 + +-- Don't redraw while executing macros (faster) +vim.opt.lazyredraw = false + +-- Don't show mode in the window title (cleaner) +vim.opt.title = false + +-- ============================================================================ +-- EDITING BEHAVIOR +-- ============================================================================ +-- Enable mouse support (click to move cursor, resize splits) +vim.opt.mouse = "a" + +-- Allow backspace to delete indent, eol, and start of line +vim.opt.backspace = "indent,eol,start" + +-- Auto-read file when changed externally (e.g., by another program) +vim.opt.autoread = true + +-- Auto-write when switching buffers or leaving +-- 'a' = auto-write for all buffers; uncomment if you want: +-- vim.opt.autowrite = true + +-- Remember moreundo for longer undo history +vim.opt.undofile = true + +-- ============================================================================ +-- SPLIT AND TAB SETTINGS +-- ============================================================================ +-- Split below (instead of above) when creating horizontal splits +vim.opt.splitbelow = true + +-- Split right (instead of left) when creating vertical splits +vim.opt.splitright = true + +-- ============================================================================ +-- PERFORMANCE SETTINGS +-- ============================================================================ +-- Faster terminal response +vim.opt.timeout = true +vim.opt.timeoutlen = 300 -- Time in ms to wait for a mapped sequence + +-- Async handling for some operations +vim.opt.ttimeoutlen = 10 + +-- ============================================================================ +-- LEADER KEY +-- ============================================================================ +-- The key is used as a prefix for custom keybindings +-- By convention, space is commonly used as the leader key vim.g.mapleader = " " -vim.keymap.set("t", "", [[]], { desc = "Exit terminal mode" }) +-- ============================================================================ +-- TERMINAL SETTINGS +-- ============================================================================ +-- Exit terminal mode with Escape +vim.keymap.set("t", "", [[]], { + desc = "Exit terminal mode" +}) + +-- Alternative: Exit with Alt key combinations as well +vim.keymap.set("t", "", [[]], { + desc = "Exit terminal mode with Alt" +}) + +-- ============================================================================ +-- CLIPBOARD (System clipboard integration) +-- ============================================================================ +-- Use system clipboard for yank/paste +-- Requires +clipboard feature (check with: :echo has('clipboard')) +if vim.fn.has("clipboard") == 1 then + -- Use system clipboard for all yank/delete/paste operations + vim.opt.clipboard = "unnamedplus" +end diff --git a/nvim/.config/nvim/lua/plugins/catppuccin.lua b/nvim/.config/nvim/lua/plugins/catppuccin.lua index e0fe487..3032542 100644 --- a/nvim/.config/nvim/lua/plugins/catppuccin.lua +++ b/nvim/.config/nvim/lua/plugins/catppuccin.lua @@ -1,14 +1,10 @@ - --- catppuccin: color scheme return { "catppuccin/nvim", - lazy = false, name = "catppuccin", + lazy = false, priority = 1000, - - -- set up config = function() - vim.cmd.colorscheme "catppuccin" - end + require("catppuccin").setup({ flavor = "mocha" }) + vim.cmd.colorscheme("catppuccin") + end, } - diff --git a/nvim/.config/nvim/lua/plugins/debugging.lua b/nvim/.config/nvim/lua/plugins/debugging.lua new file mode 100644 index 0000000..d9ef3fd --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/debugging.lua @@ -0,0 +1,26 @@ +--[[ + DEBUGGING.LUA + nvim-dap for Python debugging + Requirements: pip install debugpy +]] + +return { + { "mfussenegger/nvim-dap" }, + { "nvim-neotest/nvim-nio" }, + { + "rcarriga/nvim-dap-ui", + dependencies = { "mfussenegger/nvim-dap", "nvim-neotest/nvim-nio" }, + config = function() + local dap, dapui = require("dap"), require("dapui") + dapui.setup() + dap.listeners.after.event_initialized["dapui_config"] = dapui.open + vim.keymap.set("n", "", dap.continue, { desc = "Continue" }) + vim.keymap.set("n", "", dap.step_over, { desc = "Step over" }) + vim.keymap.set("n", "", dap.step_into, { desc = "Step into" }) + vim.keymap.set("n", "", dap.step_out, { desc = "Step out" }) + vim.keymap.set("n", "", dap.toggle_breakpoint, { desc = "Breakpoint" }) + vim.keymap.set("n", "du", dapui.toggle, { desc = "DAP UI" }) + end, + }, + { "mfussenegger/nvim-dap-python", dependencies = { "mfussenegger/nvim-dap" } }, +} diff --git a/nvim/.config/nvim/lua/plugins/gitsigns.lua b/nvim/.config/nvim/lua/plugins/gitsigns.lua index a4d37a9..cefc0a6 100644 --- a/nvim/.config/nvim/lua/plugins/gitsigns.lua +++ b/nvim/.config/nvim/lua/plugins/gitsigns.lua @@ -1,118 +1,6 @@ return { "lewis6991/gitsigns.nvim", config = function() - require('gitsigns').setup { - signs = { - add = { text = '┃' }, - change = { text = '┃' }, - delete = { text = '_' }, - topdelete = { text = '‾' }, - changedelete = { text = '~' }, - untracked = { text = '┆' }, - }, - signs_staged = { - add = { text = '┃' }, - change = { text = '┃' }, - delete = { text = '_' }, - topdelete = { text = '‾' }, - changedelete = { text = '~' }, - untracked = { text = '┆' }, - }, - signs_staged_enable = true, - signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` - numhl = false, -- Toggle with `:Gitsigns toggle_numhl` - linehl = false, -- Toggle with `:Gitsigns toggle_linehl` - word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` - watch_gitdir = { - follow_files = true - }, - auto_attach = true, - attach_to_untracked = false, - current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame` - current_line_blame_opts = { - virt_text = true, - virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align' - delay = 1000, - ignore_whitespace = false, - virt_text_priority = 100, - use_focus = true, - }, - current_line_blame_formatter = ', - ', - sign_priority = 6, - update_debounce = 100, - status_formatter = nil, -- Use default - max_file_length = 40000, -- Disable if file is longer than this (in lines) - preview_config = { - -- Options passed to nvim_open_win - style = 'minimal', - relative = 'cursor', - row = 0, - col = 1 - }, - - on_attach = function(bufnr) - local gitsigns = require('gitsigns') - - local function map(mode, l, r, opts) - opts = opts or {} - opts.buffer = bufnr - vim.keymap.set(mode, l, r, opts) - end - - -- Navigation - map('n', ']c', function() - if vim.wo.diff then - vim.cmd.normal({']c', bang = true}) - else - gitsigns.nav_hunk('next') - end - end) - - map('n', '[c', function() - if vim.wo.diff then - vim.cmd.normal({'[c', bang = true}) - else - gitsigns.nav_hunk('prev') - end - end) - - -- Actions - map('n', 'hs', gitsigns.stage_hunk) - map('n', 'hr', gitsigns.reset_hunk) - - map('v', 'hs', function() - gitsigns.stage_hunk({ vim.fn.line('.'), vim.fn.line('v') }) - end) - - map('v', 'hr', function() - gitsigns.reset_hunk({ vim.fn.line('.'), vim.fn.line('v') }) - end) - - map('n', 'hS', gitsigns.stage_buffer) - map('n', 'hR', gitsigns.reset_buffer) - map('n', 'hp', gitsigns.preview_hunk) - map('n', 'hi', gitsigns.preview_hunk_inline) - - map('n', 'hb', function() - gitsigns.blame_line({ full = true }) - end) - - map('n', 'hd', gitsigns.diffthis) - - map('n', 'hD', function() - gitsigns.diffthis('~') - end) - - map('n', 'hQ', function() gitsigns.setqflist('all') end) - map('n', 'hq', gitsigns.setqflist) - - -- Toggles - map('n', 'tb', gitsigns.toggle_current_line_blame) - map('n', 'tw', gitsigns.toggle_word_diff) - - -- Text object - map({'o', 'x'}, 'ih', gitsigns.select_hunk) - end - } - end + require('gitsigns').setup() + end, } diff --git a/nvim/.config/nvim/lua/plugins/lsp-config.lua b/nvim/.config/nvim/lua/plugins/lsp-config.lua index c0c43a9..515e32b 100644 --- a/nvim/.config/nvim/lua/plugins/lsp-config.lua +++ b/nvim/.config/nvim/lua/plugins/lsp-config.lua @@ -1,40 +1,70 @@ return { + -- Mason (LSP server installer) { "mason-org/mason.nvim", config = function() require("mason").setup() - end + end, }, + + -- Mason-LSPconfig (bridge Mason and nvim-lspconfig) { "mason-org/mason-lspconfig.nvim", - opts = { - automatic_enable = true - } + config = function() + require("mason-lspconfig").setup({ + ensure_installed = { + "pyright", -- Python + "jsonls", -- JSON + "yamlls", -- YAML + "html", -- HTML + "cssls", -- CSS + "bashls", -- Bash + "lua_ls", -- Lua + }, + automatic_enable = true, + }) + end, }, + + -- nvim-lspconfig { "neovim/nvim-lspconfig", config = function() + -- Lua + vim.lsp.config('lua_ls', { + settings = { + Lua = { + runtime = { version = "LuaJIT" }, + workspace = { library = vim.api.nvim_get_runtime_file("", true) }, + }, + }, + }) + + -- Other languages + vim.lsp.config('pyright', { + settings = { + python = { + analysis = { + typeCheckingMode = "basic", + extraPaths = {}, -- Add extra import paths if needed + }, + }, + }, +}) + vim.lsp.config('jsonls', {}) + vim.lsp.config('yamlls', {}) + vim.lsp.config('html', {}) + vim.lsp.config('cssls', {}) + vim.lsp.config('bashls', {}) + + -- Enable servers vim.lsp.enable('lua_ls') vim.lsp.enable('pyright') - vim.lsp.enable('bashls') - vim.lsp.enable('html') vim.lsp.enable('jsonls') - vim.lsp.enable('ts_ls') - vim.lsp.enable('tsserver') - vim.lsp.enable('volar') + vim.lsp.enable('yamlls') + vim.lsp.enable('html') vim.lsp.enable('cssls') - - vim.keymap.set("n", "gd", vim.lsp.buf.definition, {}) - vim.keymap.set("n", "gD", vim.lsp.buf.declaration, {}) - vim.keymap.set("n", "gi", vim.lsp.buf.implementation, {}) - vim.keymap.set("n", "gr", vim.lsp.buf.references, {}) - vim.keymap.set("n", "K", vim.lsp.buf.hover, {}) - vim.keymap.set("n", "rn", vim.lsp.buf.rename, {}) - vim.keymap.set("n", "ca", vim.lsp.buf.code_action, {}) - vim.keymap.set("n", "e", vim.diagnostic.open_float, {}) - vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, {}) - vim.keymap.set("n", "]d", vim.diagnostic.goto_next, {}) - end - } + vim.lsp.enable('bashls') + end, + }, } - diff --git a/nvim/.config/nvim/lua/plugins/lualine.lua b/nvim/.config/nvim/lua/plugins/lualine.lua index f683625..2050c67 100644 --- a/nvim/.config/nvim/lua/plugins/lualine.lua +++ b/nvim/.config/nvim/lua/plugins/lualine.lua @@ -1,11 +1,20 @@ - return { "nvim-lualine/lualine.nvim", config = function() require('lualine').setup({ options = { - theme = 'dracula' - } + theme = "auto", + globalstatus = true, + }, + sections = { + lualine_a = { "mode" }, + lualine_b = { "branch", "diff" }, + lualine_c = { "diagnostics", "filename" }, + lualine_x = { "encoding", "fileformat", "filetype" }, + lualine_y = { "progress" }, + lualine_z = { "location" }, + }, + extensions = { "neo-tree" }, }) - end + end, } diff --git a/nvim/.config/nvim/lua/plugins/neo-tree.lua b/nvim/.config/nvim/lua/plugins/neo-tree.lua index 29612cc..ac35073 100644 --- a/nvim/.config/nvim/lua/plugins/neo-tree.lua +++ b/nvim/.config/nvim/lua/plugins/neo-tree.lua @@ -1,25 +1,21 @@ - --- nvim-neo-tree: Tree file browser return { "nvim-neo-tree/neo-tree.nvim", branch = "v3.x", dependencies = { "nvim-lua/plenary.nvim", "MunifTanjim/nui.nvim", - "nvim-tree/nvim-web-devicons", -- optional, but recommended + "nvim-tree/nvim-web-devicons", }, - lazy = false, -- neo-tree will lazily load itself - - -- set up config = function() require("neo-tree").setup({ filesystem = { filtered_items = { visible = true, hide_dotfiles = false, + hide_hidden = false, }, }, }) vim.keymap.set('n', '', ':Neotree filesystem reveal left', {}) - end + end, } diff --git a/nvim/.config/nvim/lua/plugins/telescope.lua b/nvim/.config/nvim/lua/plugins/telescope.lua index 7b588ef..e61b86f 100644 --- a/nvim/.config/nvim/lua/plugins/telescope.lua +++ b/nvim/.config/nvim/lua/plugins/telescope.lua @@ -1,48 +1,32 @@ - --- telescope: fuzzy search return { { "nvim-telescope/telescope.nvim", - -- tag = '0.1.5', dependencies = { "nvim-lua/plenary.nvim" }, - - -- set up config = function() local builtin = require("telescope.builtin") + require("telescope").setup({ + defaults = { + prompt_prefix = " ", + entry_prefix = " ", + initial_mode = "insert", + sorting_strategy = "ascending", + file_ignore_patterns = { + "node_modules", ".git", "__pycache__", "*.pyc", "dist", "build" + }, + -- Disable treesitter in preview + preview = { + treesitter = false, + }, + }, + }) vim.keymap.set('n', '', builtin.find_files, {}) - vim.keymap.set('n', 'f', builtin.live_grep, {}) + vim.keymap.set('n', 'fg', builtin.live_grep, {}) end }, { "nvim-telescope/telescope-ui-select.nvim", config = function() - -- This is your opts table - require("telescope").setup { - extensions = { - ["ui-select"] = { - require("telescope.themes").get_dropdown { - -- even more opts - } - - -- pseudo code / specification for writing custom displays, like the one - -- for "codeactions" - -- specific_opts = { - -- [kind] = { - -- make_indexed = function(items) -> indexed_items, width, - -- make_displayer = function(widths) -> displayer - -- make_display = function(displayer) -> function(e) - -- make_ordinal = function(e) -> string - -- }, - -- -- for example to disable the custom builtin "codeactions" display - -- do the following - -- codeactions = false, - -- } - } - } - } - -- To get ui-select loaded and working with telescope, you need to call - -- load_extension, somewhere after setup function: require("telescope").load_extension("ui-select") - end - } + end, + }, } diff --git a/nvim/.config/nvim/lua/plugins/treesitter.lua b/nvim/.config/nvim/lua/plugins/treesitter.lua index be8d599..ad61880 100644 --- a/nvim/.config/nvim/lua/plugins/treesitter.lua +++ b/nvim/.config/nvim/lua/plugins/treesitter.lua @@ -1,14 +1,16 @@ - --- treesitter: code parser return { "nvim-treesitter/nvim-treesitter", - branch = "master", + lazy = true, build = ":TSUpdate", - opts = { - ensure_installed = {"python", "bash", "lua", "json", "java", "typescript", "vim", "markdown", "yaml", "toml"}, - auto_install = true, - highlight = { enable = true }, - indent = { enable = true } - }, - + event = { "BufReadPost", "BufNewFile" }, + config = function() + local ok, configs = pcall(require, "nvim-treesitter.configs") + if ok then + configs.setup({ + ensure_installed = { "python", "lua", "json", "yaml", "markdown" }, + highlight = { enable = true }, + indent = { enable = true }, + }) + end + end, }