xonecas.io
56101
Df

dotfiles / commit 46e7524

feat: add neovim configuration with LSP and git integration

- Add modern Neovim config using lazy.nvim plugin manager
- Configure LSP with mason for language server management
- Add git integration (diffview, gitsigns) with custom diff highlighting
- Include file explorer (oil.nvim), statusline (lualine), and commenting
- Use ANSI colorscheme respecting terminal palette
- Add comprehensive README and update root documentation
- Remove redundant KEYBINDINGS.md in favor of inline config docs

xonecas2026-01-29 46e752446db0f696715122a99e9473ec8de9df31 parent f46cb1f

11 files changed

README.md+51−0
@@ -1 +1,52 @@
11 # dotfiles
2+
3+Personal configuration files for development tools and environments.
4+
5+## Overview
6+
7+This repository contains my personal configuration files (dotfiles) for various development tools. These configurations are tailored to my workflow and preferences.
8+
9+## Contents
10+
11+### Neovim Configuration
12+
13+Location: `nvim/`
14+
15+My Neovim setup with custom keybindings, plugins, and color schemes.
16+
17+- **init.lua** - Main configuration file
18+- **lua/plugins/** - Plugin configurations using lazy.nvim
19+- **colors/** - Custom color schemes
20+- **KEYBINDINGS.md** - Documentation of custom keybindings
21+- **README.md** - Detailed Neovim setup documentation
22+
23+### OpenCode Configuration
24+
25+Location: `opencode/`
26+
27+Configuration for the OpenCode AI coding assistant.
28+
29+- **AGENTS.md** - Agent behavior and instructions
30+- **commands/** - Custom slash commands
31+- **skills/** - Reusable skills for specific tasks
32+
33+## Installation
34+
35+To use these configurations, symlink the desired config directories to their expected locations:
36+
37+```bash
38+# Neovim
39+ln -s /path/to/dotfiles/nvim ~/.config/nvim
40+
41+# OpenCode
42+ln -s /path/to/dotfiles/opencode ~/.config/opencode
43+```
44+
45+## Requirements
46+
47+- Neovim >= 0.9.0
48+- OpenCode CLI tool
49+
50+## License
51+
52+Personal use only.
nvim/README.md+98−0
@@ -0,0 +1,98 @@
1+# Neovim Configuration
2+
3+Modern Neovim configuration using Lua and lazy.nvim plugin manager.
4+
5+## Structure
6+
7+```
8+~/.config/nvim/
9+├── init.lua # Main configuration file
10+├── lua/
11+│ └── plugins/ # Plugin configurations
12+│ ├── oil.lua # File explorer
13+│ ├── diffview.lua # Git diff viewer
14+│ ├── gitsigns.lua # Git decorations
15+│ ├── comment.lua # Comment toggling
16+│ └── lualine.lua # Statusline
17+├── colors/
18+│ └── ansi.vim # Colorscheme
19+└── README.md # This file
20+```
21+
22+## Plugins
23+
24+### File Management
25+- **oil.nvim** - Edit your filesystem like a buffer. Press `-` or `<Space>n` to open.
26+
27+### Git Integration
28+- **diffview.nvim** - Review git changes, commits, and file history with ease.
29+- **gitsigns.nvim** - Inline git decorations showing added/changed/deleted lines in the sign column.
30+
31+### Editing
32+- **Comment.nvim** - Smart commenting with treesitter support. Press `gcc` to toggle line comment.
33+
34+### UI
35+- **lualine.nvim** - Fast statusline with git branch, diff stats, and diagnostics.
36+
37+## Getting Started
38+
39+1. Open Neovim - plugins will automatically install on first run:
40+ ```bash
41+ nvim
42+ ```
43+
44+2. Wait for lazy.nvim to install all plugins (happens automatically)
45+
46+3. Check plugin status:
47+ ```
48+ :Lazy
49+ ```
50+
51+4. Try the file explorer:
52+ ```
53+ Press <Space>n or -
54+ ```
55+
56+5. Try commenting:
57+ ```
58+ Press gcc (toggle comment on line)
59+ Press gc + motion (comment with motion, e.g., gcap)
60+ ```
61+
62+6. Try git integration (in a git repo):
63+ ```
64+ Press <Space>dv (open diffview)
65+ Press ]c (next git change)
66+ ```
67+
68+## Key Features
69+
70+- **Leader key**: `Space`
71+- **File explorer**: Buffer-based with oil.nvim (edit filesystem like text)
72+- **Git diff viewer**: Comprehensive diff interface with diffview.nvim
73+- **Git decorations**: Inline change markers with gitsigns.nvim
74+- **Terminal colors**: Uses the `ansi` colorscheme and 16-color theme for lualine, respecting your terminal's color palette
75+- **Clean config**: Only essential options, modern Lua syntax
76+- **No clutter**: Swap files, backups disabled
77+
78+## Configuration Philosophy
79+
80+- Minimal and focused - only includes what's needed
81+- Modern Neovim defaults - removes redundant settings
82+- Buffer-centric workflow - oil.nvim instead of traditional tree explorer
83+- Git-first - excellent git integration out of the box
84+
85+## Customization
86+
87+- Edit plugin configurations in `lua/plugins/*.lua`
88+- Global keybindings are in `init.lua`
89+- Plugin-specific keybindings are in each plugin's config file under `lua/plugins/`
90+
91+## Resources
92+
93+- [lazy.nvim docs](https://github.com/folke/lazy.nvim)
94+- [oil.nvim docs](https://github.com/stevearc/oil.nvim)
95+- [diffview.nvim docs](https://github.com/sindrets/diffview.nvim)
96+- [gitsigns.nvim docs](https://github.com/lewis6991/gitsigns.nvim)
97+- [Comment.nvim docs](https://github.com/numToStr/Comment.nvim)
98+- [lualine.nvim docs](https://github.com/nvim-lualine/lualine.nvim)
nvim/colors/ansi.vim+208−0
@@ -0,0 +1,208 @@
1+" https://hamvocke.com/blog/ansi-vim-color-scheme/
2+set background=dark
3+
4+hi clear
5+
6+let g:colors_name = 'ansi'
7+set notermguicolors
8+
9+" This color scheme relies on ANSI colors only. It automatically inherits
10+" the 16 colors of your terminal color scheme. You can change the colors of
11+" certain highlight groups by picking a different color from the following set
12+" of colors. If you sticked to the ANSI color palette conventions when setting
13+" colors in your terminal emulator, this will look pretty neat. If you used
14+" a terminal color scheme that uses a different convention (e.g. base16)
15+" colors will likely look very odd if you use this color scheme.
16+"
17+" 0: Black │ 8: Bright Black (dark gray)
18+" 1: Red │ 9: Bright Red
19+" 2: Green │ 10: Bright Green
20+" 3: Yellow │ 11: Bright Yellow
21+" 4: Blue │ 12: Bright Blue
22+" 5: Magenta │ 13: Bright Magenta
23+" 6: Cyan │ 14: Bright Cyan
24+" 7: White (gray) │ 15: Bright White
25+"
26+" Use the 'cterm' argument to make certain highlight groups appear in italic
27+" (if your terminal and font support it), bold, reverse, underlined, etc.
28+" See ':help attr-list' for possible options.
29+
30+" Editor Elements
31+hi NonText ctermfg=0
32+hi Ignore ctermfg=NONE ctermbg=NONE cterm=NONE
33+hi Underlined cterm=underline
34+hi Bold cterm=bold
35+hi Italic cterm=italic
36+hi StatusLine ctermfg=15 ctermbg=8 cterm=NONE
37+hi StatusLineNC ctermfg=15 ctermbg=0 cterm=NONE
38+hi VertSplit ctermfg=8
39+hi TabLine ctermfg=7 ctermbg=0
40+hi TabLineFill ctermfg=0 ctermbg=NONE
41+hi TabLineSel ctermfg=0 ctermbg=11
42+hi Title ctermfg=4 cterm=bold
43+hi CursorLine ctermbg=0 ctermfg=NONE
44+hi Cursor ctermbg=15 ctermfg=0
45+hi CursorColumn ctermbg=0
46+hi LineNr ctermfg=8
47+hi CursorLineNr ctermfg=6
48+hi helpLeadBlank ctermbg=NONE ctermfg=NONE
49+hi helpNormal ctermbg=NONE ctermfg=NONE
50+hi Visual ctermbg=8 ctermfg=15 cterm=bold
51+hi VisualNOS ctermbg=8 ctermfg=15 cterm=bold
52+hi Pmenu ctermbg=0 ctermfg=15
53+hi PmenuSbar ctermbg=8 ctermfg=7
54+hi PmenuSel ctermbg=8 ctermfg=15 cterm=bold
55+hi PmenuThumb ctermbg=7 ctermfg=NONE
56+hi FoldColumn ctermfg=7
57+hi Folded ctermfg=12
58+hi WildMenu ctermbg=0 ctermfg=15 cterm=NONE
59+hi SpecialKey ctermfg=0
60+hi IncSearch ctermbg=1 ctermfg=0
61+hi CurSearch ctermbg=3 ctermfg=0
62+hi Search ctermbg=11 ctermfg=0
63+hi Directory ctermfg=4
64+hi MatchParen ctermbg=0 ctermfg=3 cterm=underline
65+hi SpellBad cterm=undercurl
66+hi SpellCap cterm=undercurl
67+hi SpellLocal cterm=undercurl
68+hi SpellRare cterm=undercurl
69+hi ColorColumn ctermbg=8
70+hi SignColumn ctermfg=7
71+hi ModeMsg ctermbg=15 ctermfg=0 cterm=bold
72+hi MoreMsg ctermfg=4
73+hi Question ctermfg=4
74+hi QuickFixLine ctermbg=0 ctermfg=14
75+hi Conceal ctermfg=8
76+hi ToolbarLine ctermbg=0 ctermfg=15
77+hi ToolbarButton ctermbg=8 ctermfg=15
78+hi debugPC ctermfg=7
79+hi debugBreakpoint ctermfg=8
80+hi ErrorMsg ctermfg=1 cterm=bold,italic
81+hi WarningMsg ctermfg=11
82+hi DiffAdd ctermbg=10 ctermfg=0
83+hi DiffChange ctermbg=12 ctermfg=0
84+hi DiffDelete ctermbg=9 ctermfg=0
85+hi DiffText ctermbg=14 ctermfg=0
86+hi diffAdded ctermfg=10
87+hi diffRemoved ctermfg=9
88+hi diffChanged ctermfg=12
89+hi diffOldFile ctermfg=11
90+hi diffNewFile ctermfg=13
91+hi diffFile ctermfg=12
92+hi diffLine ctermfg=7
93+hi diffIndexLine ctermfg=14
94+hi healthError ctermfg=1
95+hi healthSuccess ctermfg=2
96+hi healthWarning ctermfg=3
97+
98+" Syntax
99+hi Comment ctermfg=8 cterm=italic
100+hi Constant ctermfg=3
101+hi Error ctermfg=1
102+hi Identifier ctermfg=9
103+hi Function ctermfg=4
104+hi Special ctermfg=13
105+hi Statement ctermfg=5
106+hi String ctermfg=2
107+hi Operator ctermfg=6
108+hi Boolean ctermfg=3
109+hi Label ctermfg=14
110+hi Keyword ctermfg=5
111+hi Exception ctermfg=5
112+hi Conditional ctermfg=5
113+hi PreProc ctermfg=13
114+hi Include ctermfg=5
115+hi Macro ctermfg=5
116+hi StorageClass ctermfg=11
117+hi Structure ctermfg=11
118+hi Todo ctermfg=0 ctermbg=9 cterm=bold
119+hi Type ctermfg=11
120+
121+" Treesitter highlighting
122+" - allows for more precise syntax highlighting
123+" - only available for nvim >0.5
124+" - see also :help treesitter-highlight-groups
125+
126+hi @variable ctermfg=15
127+hi @variable.builtin ctermfg=1
128+hi @variable.parameter ctermfg=1
129+hi @variable.member ctermfg=1
130+hi @constant.builtin ctermfg=5
131+hi @string.regexp ctermfg=1
132+hi @string.escape ctermfg=6
133+hi @string.special.url ctermfg=4 cterm=underline
134+hi @string.special.symbol ctermfg=13
135+hi @type.builtin ctermfg=3
136+hi @property ctermfg=1
137+hi @function.builtin ctermfg=5
138+hi @constructor ctermfg=11
139+hi @keyword.coroutine ctermfg=1
140+hi @keyword.function ctermfg=5
141+hi @keyword.return ctermfg=5
142+hi @keyword.export ctermfg=14
143+hi @punctuation.bracket ctermfg=15
144+hi @comment.error ctermbg=9 ctermfg=0
145+hi @comment.warning ctermbg=11 ctermfg=0
146+hi @comment.todo ctermbg=12 ctermfg=0
147+hi @comment.note ctermbg=14 ctermfg=0
148+hi @markup ctermfg=15
149+hi @markup.strong ctermfg=15 cterm=bold
150+hi @markup.italic ctermfg=15 cterm=italic
151+hi @markup.strikethrough ctermfg=15 cterm=strikethrough
152+hi @markup.heading ctermfg=4 cterm=bold
153+hi @markup.quote ctermfg=6
154+hi @markup.math ctermfg=4
155+hi @markup.link.url ctermfg=5 cterm=underline
156+hi @markup.raw ctermfg=14
157+hi @markup.list.checked ctermfg=2
158+hi @markup.list.unchecked ctermfg=7
159+hi @tag ctermfg=5
160+hi @tag.builtin ctermfg=6
161+hi @tag.attribute ctermfg=4
162+hi @tag.delimiter ctermfg=15
163+
164+hi link @variable.parameter.builtin @variable.parameter
165+hi link @constant Constant
166+hi link @constant.macro Macro
167+hi link @module Structure
168+hi link @module.builtin Special
169+hi link @label Label
170+hi link @string String
171+hi link @string.special Special
172+hi link @character Character
173+hi link @character.special SpecialChar
174+hi link @boolean Boolean
175+hi link @number Number
176+hi link @number.float Float
177+hi link @type Type
178+hi link @type.definition Type
179+hi link @attribute Constant
180+hi link @attribute.builtin Constant
181+hi link @function Function
182+hi link @function.call Function
183+hi link @function.method Function
184+hi link @function.method.call Function
185+hi link @operator Operator
186+hi link @keyword Keyword
187+hi link @keyword.operator Operator
188+hi link @keyword.import Include
189+hi link @keyword.type Keyword
190+hi link @keyword.modifier Keyword
191+hi link @keyword.repeat Repeat
192+hi link @keyword.debug Exception
193+hi link @keyword.exception Exception
194+hi link @keyword.conditional Conditional
195+hi link @keyword.conditional.ternary Operator
196+hi link @keyword.directive PreProc
197+hi link @keyword.directive.define Define
198+hi link @punctuation.delimiter Delimiter
199+hi link @punctuation.special Special
200+hi link @comment Comment
201+hi link @comment.documentation Comment
202+hi link @markup.underline underline
203+hi link @markup.link Tag
204+hi link @markup.link.label Label
205+hi link @markup.list Special
206+hi link @diff.plus diffAdded
207+hi link @diff.minus diffRemoved
208+hi link @diff.delta diffChanged
nvim/init.lua+102−0
@@ -0,0 +1,102 @@
1+-- Neovim configuration
2+
3+-- Basic settings
4+vim.opt.relativenumber = true
5+vim.opt.number = true
6+vim.opt.ignorecase = true
7+vim.opt.smartcase = true
8+vim.opt.smartindent = true
9+vim.opt.cinkeys:remove('0#') -- Prevent auto-unindenting lines that start with '#' (for Python comments, preprocessor directives)
10+vim.opt.linebreak = true
11+vim.opt.swapfile = false
12+vim.opt.backup = false
13+vim.opt.writebackup = false
14+vim.opt.wildmode = 'list:longest,full'
15+vim.opt.wildignore = {
16+ '*.pyc',
17+ '*.o',
18+ '*.obj',
19+ '*.so',
20+ '*.swp',
21+ '*.zip',
22+ '*.exe',
23+ '*.dll',
24+ '*/.git/*',
25+ '*/.svn/*',
26+ '*/node_modules/*',
27+ '*/bower_components/*',
28+ '*/.DS_Store',
29+ '*/dist/*',
30+ '*/build/*',
31+ '*/target/*',
32+ '*/__pycache__/*',
33+ '*.egg-info',
34+}
35+vim.opt.list = true
36+vim.opt.listchars = { tab = '▸ ', trail = '·', eol = '¬', nbsp = '_' }
37+
38+-- Indentation settings
39+vim.opt.expandtab = true
40+vim.opt.tabstop = 2
41+vim.opt.shiftwidth = 2
42+vim.opt.softtabstop = 2
43+
44+-- Set leader key to space (must be set before lazy.nvim)
45+vim.g.mapleader = ' '
46+vim.g.maplocalleader = ' '
47+
48+-- Bootstrap lazy.nvim
49+local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
50+if not vim.loop.fs_stat(lazypath) then
51+ vim.fn.system({
52+ 'git',
53+ 'clone',
54+ '--filter=blob:none',
55+ 'https://github.com/folke/lazy.nvim.git',
56+ '--branch=stable',
57+ lazypath,
58+ })
59+end
60+vim.opt.rtp:prepend(lazypath)
61+
62+-- Load plugins
63+require('lazy').setup('plugins', {
64+ change_detection = {
65+ notify = false, -- Don't notify on config changes
66+ },
67+})
68+
69+-- Keymaps
70+local keymap = vim.keymap.set
71+local opts = { noremap = true, silent = true }
72+
73+-- Buffer navigation
74+keymap('n', '<leader>]', ':bnext<CR>', opts)
75+keymap('n', '<leader>[', ':bprev<CR>', opts)
76+keymap('n', '<leader>e', ':e#<CR>', opts)
77+keymap('n', '<leader>x', ':bdelete<CR>', opts)
78+
79+-- Search highlighting
80+keymap('n', '<leader>h', ':nohlsearch<CR>', opts)
81+
82+-- LSP formatting
83+keymap('n', '<leader>f', function()
84+ vim.lsp.buf.format({ async = true })
85+end, { noremap = true, silent = true, desc = 'Format buffer with LSP' })
86+
87+-- Movement remaps
88+keymap('n', 'j', 'gj', { noremap = true })
89+keymap('n', 'k', 'gk', { noremap = true })
90+
91+-- Command aliases
92+vim.api.nvim_create_user_command('Q', 'q', {})
93+vim.api.nvim_create_user_command('W', 'w', {})
94+
95+-- Colorscheme
96+vim.cmd.colorscheme('ansi')
97+
98+-- Override diff highlight groups to remove backgrounds (keep only sign column indicators)
99+vim.api.nvim_set_hl(0, 'DiffAdd', { ctermbg = 'NONE', ctermfg = 'NONE' })
100+vim.api.nvim_set_hl(0, 'DiffChange', { ctermbg = 'NONE', ctermfg = 'NONE' })
101+vim.api.nvim_set_hl(0, 'DiffDelete', { ctermbg = 'NONE', ctermfg = 'NONE' })
102+vim.api.nvim_set_hl(0, 'DiffText', { ctermbg = 'NONE', ctermfg = 'NONE' })
nvim/lazy-lock.json+7−0
@@ -0,0 +1,7 @@
1+{
2+ "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
3+ "gitsigns.nvim": { "branch": "main", "commit": "abf82a65f185bd54adc0679f74b7d6e1ada690c9" },
4+ "lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
5+ "nvim-web-devicons": { "branch": "master", "commit": "803353450c374192393f5387b6a0176d0972b848" },
6+ "oil.nvim": { "branch": "master", "commit": "f55b25e493a7df76371cfadd0ded5004cb9cd48a" }
7+}
nvim/lua/plugins/comment.lua+39−0
@@ -0,0 +1,39 @@
1+-- Comment.nvim - Smart and powerful comment plugin
2+return {
3+ 'numToStr/Comment.nvim',
4+ config = function()
5+ require('Comment').setup({
6+ -- Add a space between comment and the line
7+ padding = true,
8+ -- Whether the cursor should stay at its position
9+ sticky = true,
10+ -- Lines to be ignored while (un)comment
11+ ignore = nil,
12+ -- LHS of toggle mappings in NORMAL mode
13+ toggler = {
14+ line = 'gcc', -- Line-comment toggle keymap
15+ block = 'gbc', -- Block-comment toggle keymap
16+ },
17+ -- LHS of operator-pending mappings in NORMAL and VISUAL mode
18+ opleader = {
19+ line = 'gc', -- Line-comment keymap
20+ block = 'gb', -- Block-comment keymap
21+ },
22+ -- LHS of extra mappings
23+ extra = {
24+ above = 'gcO', -- Add comment on the line above
25+ below = 'gco', -- Add comment on the line below
26+ eol = 'gcA', -- Add comment at the end of line
27+ },
28+ -- Enable keybindings
29+ mappings = {
30+ basic = true,
31+ extra = true,
32+ },
33+ -- Function to call before (un)comment
34+ pre_hook = nil,
35+ -- Function to call after (un)comment
36+ post_hook = nil,
37+ })
38+ end,
39+}
nvim/lua/plugins/diffview.lua+30−0
@@ -0,0 +1,30 @@
1+-- diffview.nvim - Single tabpage interface for cycling through diffs
2+return {
3+ 'sindrets/diffview.nvim',
4+ dependencies = { 'nvim-tree/nvim-web-devicons' },
5+ config = function()
6+ require('diffview').setup({
7+ diff_binaries = false, -- Show diffs for binaries
8+ enhanced_diff_hl = true, -- Use nvim's builtin diff highlighting
9+ use_icons = true, -- Requires nvim-web-devicons
10+ view = {
11+ -- Configure the layout and behavior of different types of views
12+ default = {
13+ layout = 'diff2_horizontal',
14+ },
15+ },
16+ file_panel = {
17+ listing_style = 'list', -- 'list' or 'tree'
18+ },
19+ keymaps = {
20+ disable_defaults = false, -- Disable default keymaps
21+ },
22+ })
23+
24+ -- Keybindings
25+ vim.keymap.set('n', '<leader>dv', '<CMD>DiffviewOpen<CR>', { desc = 'Open diffview' })
26+ vim.keymap.set('n', '<leader>dc', '<CMD>DiffviewClose<CR>', { desc = 'Close diffview' })
27+ vim.keymap.set('n', '<leader>dh', '<CMD>DiffviewFileHistory %<CR>', { desc = 'File history (current file)' })
28+ vim.keymap.set('n', '<leader>df', '<CMD>DiffviewFileHistory<CR>', { desc = 'File history (all files)' })
29+ end,
30+}
nvim/lua/plugins/gitsigns.lua+95−0
@@ -0,0 +1,95 @@
1+-- gitsigns.nvim - Git decorations in sign column and inline blame
2+return {
3+ 'lewis6991/gitsigns.nvim',
4+ config = function()
5+ require('gitsigns').setup({
6+ signs = {
7+ add = { text = '┃' },
8+ change = { text = '┃' },
9+ delete = { text = '_' },
10+ topdelete = { text = '‾' },
11+ changedelete = { text = '~' },
12+ untracked = { text = '┆' },
13+ },
14+ signs_staged = {
15+ add = { text = '┃' },
16+ change = { text = '┃' },
17+ delete = { text = '_' },
18+ topdelete = { text = '‾' },
19+ changedelete = { text = '~' },
20+ untracked = { text = '┆' },
21+ },
22+ signs_staged_enable = true,
23+ signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
24+ numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
25+ linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
26+ word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
27+ watch_gitdir = {
28+ follow_files = true
29+ },
30+ auto_attach = true,
31+ attach_to_untracked = false,
32+ current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
33+ current_line_blame_opts = {
34+ virt_text = true,
35+ virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
36+ delay = 1000,
37+ ignore_whitespace = false,
38+ virt_text_priority = 100,
39+ use_focus = true,
40+ },
41+ current_line_blame_formatter = '<author>, <author_time:%R> - <summary>',
42+ sign_priority = 6,
43+ update_debounce = 100,
44+ status_formatter = nil, -- Use default
45+ max_file_length = 40000, -- Disable if file is longer than this (in lines)
46+ preview_config = {
47+ -- Options passed to nvim_open_win
48+ style = 'minimal',
49+ relative = 'cursor',
50+ row = 0,
51+ col = 1
52+ },
53+ on_attach = function(bufnr)
54+ local gs = package.loaded.gitsigns
55+
56+ local function map(mode, l, r, opts)
57+ opts = opts or {}
58+ opts.buffer = bufnr
59+ vim.keymap.set(mode, l, r, opts)
60+ end
61+
62+ -- Navigation
63+ map('n', ']c', function()
64+ if vim.wo.diff then return ']c' end
65+ vim.schedule(function() gs.next_hunk() end)
66+ return '<Ignore>'
67+ end, { expr = true, desc = 'Next git hunk' })
68+
69+ map('n', '[c', function()
70+ if vim.wo.diff then return '[c' end
71+ vim.schedule(function() gs.prev_hunk() end)
72+ return '<Ignore>'
73+ end, { expr = true, desc = 'Previous git hunk' })
74+
75+ -- Actions
76+ map('n', '<leader>hs', gs.stage_hunk, { desc = 'Stage hunk' })
77+ map('n', '<leader>hr', gs.reset_hunk, { desc = 'Reset hunk' })
78+ map('v', '<leader>hs', function() gs.stage_hunk {vim.fn.line('.'), vim.fn.line('v')} end, { desc = 'Stage hunk' })
79+ map('v', '<leader>hr', function() gs.reset_hunk {vim.fn.line('.'), vim.fn.line('v')} end, { desc = 'Reset hunk' })
80+ map('n', '<leader>hS', gs.stage_buffer, { desc = 'Stage buffer' })
81+ map('n', '<leader>hu', gs.undo_stage_hunk, { desc = 'Undo stage hunk' })
82+ map('n', '<leader>hR', gs.reset_buffer, { desc = 'Reset buffer' })
83+ map('n', '<leader>hp', gs.preview_hunk, { desc = 'Preview hunk' })
84+ map('n', '<leader>hb', function() gs.blame_line{full=true} end, { desc = 'Blame line' })
85+ map('n', '<leader>tb', gs.toggle_current_line_blame, { desc = 'Toggle line blame' })
86+ map('n', '<leader>hd', gs.diffthis, { desc = 'Diff this' })
87+ map('n', '<leader>hD', function() gs.diffthis('~') end, { desc = 'Diff this ~' })
88+ map('n', '<leader>td', gs.toggle_deleted, { desc = 'Toggle deleted' })
89+
90+ -- Text object
91+ map({'o', 'x'}, 'ih', ':<C-U>Gitsigns select_hunk<CR>', { desc = 'Select hunk' })
92+ end
93+ })
94+ end,
95+}
nvim/lua/plugins/lsp.lua+98−0
@@ -0,0 +1,98 @@
1+-- LSP configuration with Mason for server management
2+return {
3+ -- Mason: LSP server installer
4+ {
5+ 'williamboman/mason.nvim',
6+ config = function()
7+ require('mason').setup({
8+ ui = {
9+ border = 'single',
10+ icons = {
11+ package_installed = '✓',
12+ package_pending = '➜',
13+ package_uninstalled = '✗'
14+ }
15+ }
16+ })
17+ end,
18+ },
19+
20+ -- Mason-lspconfig: Bridge between mason and lspconfig
21+ {
22+ 'williamboman/mason-lspconfig.nvim',
23+ dependencies = { 'williamboman/mason.nvim' },
24+ config = function()
25+ require('mason-lspconfig').setup({
26+ -- Automatically install these language servers
27+ ensure_installed = {},
28+ -- Auto-install servers configured in lspconfig
29+ automatic_installation = false,
30+ })
31+ end,
32+ },
33+
34+ -- LSP configurations
35+ {
36+ 'neovim/nvim-lspconfig',
37+ dependencies = {
38+ 'williamboman/mason.nvim',
39+ 'williamboman/mason-lspconfig.nvim',
40+ },
41+ config = function()
42+ local lspconfig = require('lspconfig')
43+
44+ -- LSP keybindings (only active when LSP is attached)
45+ vim.api.nvim_create_autocmd('LspAttach', {
46+ group = vim.api.nvim_create_augroup('UserLspConfig', {}),
47+ callback = function(ev)
48+ local opts = { buffer = ev.buf, noremap = true, silent = true }
49+
50+ -- Navigation
51+ vim.keymap.set('n', 'gd', vim.lsp.buf.definition, vim.tbl_extend('force', opts, { desc = 'Go to definition' }))
52+ vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, vim.tbl_extend('force', opts, { desc = 'Go to declaration' }))
53+ vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, vim.tbl_extend('force', opts, { desc = 'Go to implementation' }))
54+ vim.keymap.set('n', 'gr', vim.lsp.buf.references, vim.tbl_extend('force', opts, { desc = 'Show references' }))
55+ vim.keymap.set('n', 'K', vim.lsp.buf.hover, vim.tbl_extend('force', opts, { desc = 'Hover documentation' }))
56+
57+ -- Actions
58+ vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, vim.tbl_extend('force', opts, { desc = 'Rename symbol' }))
59+ vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, vim.tbl_extend('force', opts, { desc = 'Code action' }))
60+
61+ -- Diagnostics
62+ vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, vim.tbl_extend('force', opts, { desc = 'Previous diagnostic' }))
63+ vim.keymap.set('n', ']d', vim.diagnostic.goto_next, vim.tbl_extend('force', opts, { desc = 'Next diagnostic' }))
64+ vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, vim.tbl_extend('force', opts, { desc = 'Diagnostic list' }))
65+ end,
66+ })
67+
68+ -- Default server capabilities
69+ local capabilities = vim.lsp.protocol.make_client_capabilities()
70+
71+ -- Setup language servers here
72+ -- Example configurations (uncomment and modify as needed):
73+
74+ -- lspconfig.lua_ls.setup({
75+ -- capabilities = capabilities,
76+ -- settings = {
77+ -- Lua = {
78+ -- diagnostics = {
79+ -- globals = { 'vim' }, -- Recognize 'vim' global
80+ -- },
81+ -- },
82+ -- },
83+ -- })
84+
85+ -- lspconfig.ts_ls.setup({
86+ -- capabilities = capabilities,
87+ -- })
88+
89+ -- lspconfig.pyright.setup({
90+ -- capabilities = capabilities,
91+ -- })
92+
93+ -- lspconfig.rust_analyzer.setup({
94+ -- capabilities = capabilities,
95+ -- })
96+ end,
97+ },
98+}
nvim/lua/plugins/lualine.lua+62−0
@@ -0,0 +1,62 @@
1+-- lualine.nvim - Fast and easy to configure statusline
2+return {
3+ 'nvim-lualine/lualine.nvim',
4+ dependencies = { 'nvim-tree/nvim-web-devicons' },
5+ config = function()
6+ require('lualine').setup({
7+ options = {
8+ icons_enabled = true,
9+ theme = '16color',
10+ component_separators = { left = '|', right = '|' },
11+ section_separators = { left = '', right = '' },
12+ disabled_filetypes = {
13+ statusline = {},
14+ winbar = {},
15+ },
16+ ignore_focus = {},
17+ always_divide_middle = true,
18+ globalstatus = false,
19+ refresh = {
20+ statusline = 1000,
21+ tabline = 1000,
22+ winbar = 1000,
23+ }
24+ },
25+ sections = {
26+ lualine_a = {'mode'},
27+ lualine_b = {
28+ 'branch',
29+ 'diff',
30+ 'diagnostics'
31+ },
32+ lualine_c = {
33+ {
34+ 'filename',
35+ path = 1, -- 0 = just filename, 1 = relative path, 2 = absolute path
36+ shorting_target = 40,
37+ symbols = {
38+ modified = '[+]',
39+ readonly = '[-]',
40+ unnamed = '[No Name]',
41+ }
42+ }
43+ },
44+ lualine_x = {'encoding', 'fileformat', 'filetype'},
45+ lualine_y = {'progress'},
46+ lualine_z = {'location'}
47+ },
48+ inactive_sections = {
49+ lualine_a = {},
50+ lualine_b = {},
51+ lualine_c = {'filename'},
52+ lualine_x = {'location'},
53+ lualine_y = {},
54+ lualine_z = {}
55+ },
56+ tabline = {},
57+ winbar = {},
58+ inactive_winbar = {},
59+ extensions = {}
60+ })
61+ end,
62+}
nvim/lua/plugins/oil.lua+67−0
@@ -0,0 +1,67 @@
1+-- oil.nvim - Edit your filesystem like a buffer
2+return {
3+ 'stevearc/oil.nvim',
4+ dependencies = { 'nvim-tree/nvim-web-devicons' },
5+ config = function()
6+ require('oil').setup({
7+ -- Oil will take over directory buffers (e.g. `vim .` or `:e src/`)
8+ default_file_explorer = true,
9+ -- Columns to show in oil buffer
10+ columns = {
11+ 'icon',
12+ -- 'permissions',
13+ -- 'size',
14+ -- 'mtime',
15+ },
16+ -- Buffer-local options to use for oil buffers
17+ buf_options = {
18+ buflisted = false,
19+ bufhidden = 'hide',
20+ },
21+ -- Window-local options to use for oil buffers
22+ win_options = {
23+ wrap = false,
24+ signcolumn = 'no',
25+ cursorcolumn = false,
26+ foldcolumn = '0',
27+ spell = false,
28+ list = false,
29+ conceallevel = 3,
30+ concealcursor = 'nvic',
31+ },
32+ -- Send deleted files to the trash instead of permanently deleting them
33+ delete_to_trash = false,
34+ -- Skip confirmation for simple operations
35+ skip_confirm_for_simple_edits = false,
36+ -- Keymaps in oil buffer
37+ keymaps = {
38+ ['g?'] = 'actions.show_help',
39+ ['<CR>'] = 'actions.select',
40+ ['<C-s>'] = 'actions.select_vsplit',
41+ ['<C-h>'] = 'actions.select_split',
42+ ['<C-t>'] = 'actions.select_tab',
43+ ['<C-p>'] = 'actions.preview',
44+ ['<C-c>'] = 'actions.close',
45+ ['<C-l>'] = 'actions.refresh',
46+ ['-'] = 'actions.parent',
47+ ['_'] = 'actions.open_cwd',
48+ ['`'] = 'actions.cd',
49+ ['~'] = 'actions.tcd',
50+ ['gs'] = 'actions.change_sort',
51+ ['gx'] = 'actions.open_external',
52+ ['g.'] = 'actions.toggle_hidden',
53+ ['g\\'] = 'actions.toggle_trash',
54+ },
55+ -- Set to false to disable all of the above keymaps
56+ use_default_keymaps = true,
57+ view_options = {
58+ -- Show files and directories that start with "."
59+ show_hidden = false,
60+ },
61+ })
62+
63+ -- Keybindings
64+ vim.keymap.set('n', '-', '<CMD>Oil<CR>', { desc = 'Open parent directory' })
65+ vim.keymap.set('n', '<leader>n', '<CMD>Oil<CR>', { desc = 'Open oil file explorer' })
66+ end,
67+}