This commit is contained in:
cedricreper 2025-10-17 15:04:25 +09:00
parent ab58d1a503
commit 631e88bdd2
15 changed files with 122 additions and 366 deletions

View File

@ -21,16 +21,23 @@ The configuration is organized into three main directories:
│ │ ├── keymaps.lua # Global key mappings │ │ ├── keymaps.lua # Global key mappings
│ │ └── autocommands.lua # Autocommands (highlight on yank, etc.) │ │ └── autocommands.lua # Autocommands (highlight on yank, etc.)
│ ├── plugins/ # Plugin specifications (auto-loaded by lazy.nvim) │ ├── plugins/ # Plugin specifications (auto-loaded by lazy.nvim)
│ │ ├── colorscheme.lua # Color scheme (kanso.nvim + alternatives) │ │ ├── autopairs.lua # Auto-close brackets and quotes
│ │ ├── treesitter.lua # Syntax highlighting & parsing
│ │ ├── lsp.lua # LSP configuration & Mason
│ │ ├── completion.lua # blink.cmp & LuaSnip
│ │ ├── telescope.lua # Fuzzy finder
│ │ ├── navigation.lua # Harpoon, Flash, Oil, tmux-navigator
│ │ ├── formatting.lua # conform.nvim
│ │ ├── ui.lua # which-key, lualine
│ │ ├── utils.lua # vim-sleuth, gitsigns, autopairs, snacks
│ │ ├── claude-code.lua # Claude Code integration │ │ ├── claude-code.lua # Claude Code integration
│ │ ├── colorscheme.lua # Color scheme (kanso.nvim + alternatives)
│ │ ├── completion.lua # blink.cmp & LuaSnip
│ │ ├── flash.lua # Rapid cursor movement
│ │ ├── formatting.lua # conform.nvim for code formatting
│ │ ├── gitsigns.lua # Git signs and operations
│ │ ├── harpoon.lua # File bookmarking
│ │ ├── lsp.lua # LSP configuration & Mason
│ │ ├── lualine.lua # Status line
│ │ ├── oil.lua # File browser
│ │ ├── snacks.lua # Utility plugin
│ │ ├── telescope.lua # Fuzzy finder
│ │ ├── treesitter.lua # Syntax highlighting & parsing
│ │ ├── vim-sleuth.lua # Auto-detect indentation
│ │ ├── vim-tmux-navigator.lua # Tmux/Vim navigation
│ │ ├── which-key.lua # Keybinding hints
│ │ └── optional/ # Optional plugins (not loaded by default) │ │ └── optional/ # Optional plugins (not loaded by default)
│ │ ├── README.md # Instructions for enabling optional plugins │ │ ├── README.md # Instructions for enabling optional plugins
│ │ ├── debug.lua # DAP debugger for Go │ │ ├── debug.lua # DAP debugger for Go
@ -46,34 +53,26 @@ The configuration is organized into three main directories:
- **Auto-Loading**: All files in `lua/plugins/*.lua` are automatically loaded - **Auto-Loading**: All files in `lua/plugins/*.lua` are automatically loaded
- **Custom Plugins**: Add your own in `lua/custom/plugins/init.lua` or create new files there - **Custom Plugins**: Add your own in `lua/custom/plugins/init.lua` or create new files there
### Key Plugin Categories ### Key Plugins
1. **LSP Configuration** (`lua/plugins/lsp.lua`) Each plugin is in its own file for easy management:
- Mason for LSP installation
- Configured servers: `pyright`, `zls`, `rust_analyzer`, `ts_ls`, `lua_ls`
- LSP capabilities enhanced by blink.cmp
- Autocommands for LSP attach events setup keymaps and highlighting
2. **Completion** (`lua/plugins/completion.lua`) - **lsp.lua** - LSP configuration with Mason, servers: `pyright`, `zls`, `rust_analyzer`, `ts_ls`, `lua_ls`
- blink.cmp for autocompletion - **completion.lua** - blink.cmp autocompletion with LuaSnip snippets
- LuaSnip for snippet expansion - **telescope.lua** - Fuzzy finder with vertical layout, fzf and ui-select extensions
- Default keymap preset uses `<c-y>` to accept - **harpoon.lua** - Quick file bookmarking and navigation
- **flash.lua** - Rapid cursor movement with `s`, `S`, `r`, `R` keys
3. **Telescope** (`lua/plugins/telescope.lua`) - **oil.lua** - File browser with `-` key binding
- Fuzzy finder with vertical layout - **vim-tmux-navigator.lua** - Seamless tmux/vim split navigation
- Extensions: fzf, ui-select - **formatting.lua** - conform.nvim with format-on-save (stylua, prettier)
- Leader-based keymaps for searching files, grep, diagnostics, etc. - **gitsigns.lua** - Git signs in gutter with staging/diffing keymaps
- **which-key.lua** - Keybinding hints popup
4. **Navigation & Movement** (`lua/plugins/navigation.lua`) - **lualine.lua** - Status line with base16 theme
- Harpoon2 for file bookmarking - **treesitter.lua** - Syntax highlighting for multiple languages
- Flash.nvim for rapid cursor movement - **autopairs.lua** - Auto-close brackets and quotes
- Oil.nvim for file browsing - **vim-sleuth.lua** - Auto-detect indentation
- vim-tmux-navigator for seamless tmux/vim navigation - **snacks.lua** - Utility plugin collection
- **colorscheme.lua** - Multiple color schemes (kanso active)
5. **Formatting** (`lua/plugins/formatting.lua`)
- conform.nvim handles formatting
- Format on save enabled (except for C/C++)
- Configured formatters: stylua (Lua), prettier (JS/TS/CSS/HTML/JSON)
## Common Commands ## Common Commands
@ -205,9 +204,9 @@ Currently using kanso.nvim. Several commented-out alternatives available (gruvbo
### Plugin Organization Philosophy ### Plugin Organization Philosophy
- **Separation by Function**: Each file in `lua/plugins/` represents a logical category - **One Plugin Per File**: Each plugin has its own dedicated file in `lua/plugins/` (except colorscheme.lua which contains theme options)
- **Easy Discovery**: Find all plugins of a type in one file - **Easy Discovery**: Plugin files are named after the plugin they configure
- **Modular**: Add/remove entire categories by managing single files - **Modular**: Add/remove individual plugins by managing single files
- **Custom Additions**: Use `lua/custom/plugins/` for your personal plugins without modifying core structure - **Custom Additions**: Use `lua/custom/plugins/` for your personal plugins without modifying core structure
### Optional Plugins ### Optional Plugins

View File

@ -0,0 +1,9 @@
return {
{
'windwp/nvim-autopairs',
event = 'InsertEnter',
config = true,
-- use opts = {} for passing setup options
-- this is equivalent to setup({}) function
},
}

16
lua/plugins/flash.lua Normal file
View File

@ -0,0 +1,16 @@
return {
{
'folke/flash.nvim',
event = 'VeryLazy',
---@type Flash.Config
opts = {},
-- stylua: ignore
keys = {
{ "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" },
{ "S", mode = { "n", "x", "o" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" },
{ "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" },
{ "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" },
{ "<c-s>", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" },
},
},
}

View File

@ -1,7 +1,4 @@
return { return {
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
{ -- Adds git related signs to the gutter, as well as utilities for managing changes { -- Adds git related signs to the gutter, as well as utilities for managing changes
'lewis6991/gitsigns.nvim', 'lewis6991/gitsigns.nvim',
opts = { opts = {
@ -64,16 +61,4 @@ return {
end, end,
}, },
}, },
{
'windwp/nvim-autopairs',
event = 'InsertEnter',
config = true,
-- use opts = {} for passing setup options
-- this is equivalent to setup({}) function
},
{
'folke/snacks.nvim',
priority = 1000,
lazy = false,
},
} }

View File

@ -1,36 +1,4 @@
return { return {
{
'christoomey/vim-tmux-navigator',
cmd = {
'TmuxNavigateLeft',
'TmuxNavigateDown',
'TmuxNavigateUp',
'TmuxNavigateRight',
'TmuxNavigatePrevious',
'TmuxNavigatorProcessList',
},
keys = {
{ '<c-h>', '<cmd><C-U>TmuxNavigateLeft<cr>' },
{ '<c-j>', '<cmd><C-U>TmuxNavigateDown<cr>' },
{ '<c-k>', '<cmd><C-U>TmuxNavigateUp<cr>' },
{ '<c-l>', '<cmd><C-U>TmuxNavigateRight<cr>' },
{ '<c-\\>', '<cmd><C-U>TmuxNavigatePrevious<cr>' },
},
},
{
'folke/flash.nvim',
event = 'VeryLazy',
---@type Flash.Config
opts = {},
-- stylua: ignore
keys = {
{ "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" },
{ "S", mode = { "n", "x", "o" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" },
{ "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" },
{ "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" },
{ "<c-s>", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" },
},
},
{ {
'ThePrimeagen/harpoon', 'ThePrimeagen/harpoon',
branch = 'harpoon2', branch = 'harpoon2',
@ -91,20 +59,4 @@ return {
end, { desc = 'Open harpoon window' }) end, { desc = 'Open harpoon window' })
end, end,
}, },
{
'stevearc/oil.nvim',
---@module 'oil'
---@type oil.SetupOpts
opts = {},
-- Optional dependencies
dependencies = { { 'echasnovski/mini.icons', opts = {} } },
-- dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if you prefer nvim-web-devicons
-- Lazy loading is not recommended because it is very tricky to make it work correctly in all situations.
lazy = false,
config = function()
require('oil').setup {
vim.keymap.set('n', '-', '<CMD>Oil<CR>', { desc = 'Open parent directory' }),
}
end,
},
} }

11
lua/plugins/lualine.lua Normal file
View File

@ -0,0 +1,11 @@
return {
{
'nvim-lualine/lualine.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' },
config = function()
require('lualine').setup {
theme = 'base16',
}
end,
},
}

18
lua/plugins/oil.lua Normal file
View File

@ -0,0 +1,18 @@
return {
{
'stevearc/oil.nvim',
---@module 'oil'
---@type oil.SetupOpts
opts = {},
-- Optional dependencies
dependencies = { { 'echasnovski/mini.icons', opts = {} } },
-- dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if you prefer nvim-web-devicons
-- Lazy loading is not recommended because it is very tricky to make it work correctly in all situations.
lazy = false,
config = function()
require('oil').setup {
vim.keymap.set('n', '-', '<CMD>Oil<CR>', { desc = 'Open parent directory' }),
}
end,
},
}

View File

@ -1,33 +0,0 @@
# Optional Plugins
These are optional plugins that are not enabled by default but may be useful for certain workflows.
## How to Enable
To enable an optional plugin, simply move it from `lua/plugins/optional/` to `lua/plugins/` and restart Neovim.
For example:
```bash
mv lua/plugins/optional/debug.lua lua/plugins/debug.lua
```
Or create a symlink:
```bash
ln -s optional/debug.lua lua/plugins/debug.lua
```
## Available Optional Plugins
- **indent-blankline.lua** - Adds indentation guides on blank lines
- **debug.lua** - DAP debugger for Go (and extensible to other languages)
- **lint.lua** - Linting with nvim-lint (markdown example included)
## Alternative Approach
You can also import these directly by adding to your `init.lua`:
```lua
require('lazy').setup({
{ import = 'plugins' },
{ import = 'plugins.optional.debug' }, -- Enable debug plugin
})
```

View File

@ -1,149 +0,0 @@
-- debug.lua
--
-- DAP (Debug Adapter Protocol) plugin for debugging your code.
-- To enable: move this file to lua/plugins/ or import it in init.lua
--
-- Primarily focused on configuring the debugger for Go, but can
-- be extended to other languages as well.
-- See `:help dap` for more information
return {
-- NOTE: Yes, you can install new plugins here!
'mfussenegger/nvim-dap',
-- NOTE: And you can specify dependencies as well
dependencies = {
-- Creates a beautiful debugger UI
'rcarriga/nvim-dap-ui',
-- Required dependency for nvim-dap-ui
'nvim-neotest/nvim-nio',
-- Installs the debug adapters for you
'williamboman/mason.nvim',
'jay-babu/mason-nvim-dap.nvim',
-- Add your own debuggers here
'leoluz/nvim-dap-go',
},
keys = {
-- Basic debugging keymaps, feel free to change to your liking!
{
'<F5>',
function()
require('dap').continue()
end,
desc = 'Debug: Start/Continue',
},
{
'<F1>',
function()
require('dap').step_into()
end,
desc = 'Debug: Step Into',
},
{
'<F2>',
function()
require('dap').step_over()
end,
desc = 'Debug: Step Over',
},
{
'<F3>',
function()
require('dap').step_out()
end,
desc = 'Debug: Step Out',
},
{
'<leader>b',
function()
require('dap').toggle_breakpoint()
end,
desc = 'Debug: Toggle Breakpoint',
},
{
'<leader>B',
function()
require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ')
end,
desc = 'Debug: Set Breakpoint',
},
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
{
'<F7>',
function()
require('dapui').toggle()
end,
desc = 'Debug: See last session result.',
},
},
config = function()
local dap = require 'dap'
local dapui = require 'dapui'
require('mason-nvim-dap').setup {
-- Makes a best effort to setup the various debuggers with
-- reasonable debug configurations
automatic_installation = true,
-- You can provide additional configuration to the handlers,
-- see mason-nvim-dap README for more information
handlers = {},
-- You'll need to check that you have the required things installed
-- online, please don't ask me how to install them :)
ensure_installed = {
-- Update this to ensure that you have the debuggers for the langs you want
'delve',
},
}
-- Dap UI setup
-- For more information, see |:help nvim-dap-ui|
dapui.setup {
-- Set icons to characters that are more likely to work in every terminal.
-- Feel free to remove or use ones that you like more! :)
-- Don't feel like these are good choices.
icons = { expanded = '', collapsed = '', current_frame = '*' },
controls = {
icons = {
pause = '',
play = '',
step_into = '',
step_over = '',
step_out = '',
step_back = 'b',
run_last = '▶▶',
terminate = '',
disconnect = '',
},
},
}
-- Change breakpoint icons
-- vim.api.nvim_set_hl(0, 'DapBreak', { fg = '#e51400' })
-- vim.api.nvim_set_hl(0, 'DapStop', { fg = '#ffcc00' })
-- local breakpoint_icons = vim.g.have_nerd_font
-- and { Breakpoint = '', BreakpointCondition = '', BreakpointRejected = '', LogPoint = '', Stopped = '' }
-- or { Breakpoint = '●', BreakpointCondition = '⊜', BreakpointRejected = '⊘', LogPoint = '◆', Stopped = '⭔' }
-- for type, icon in pairs(breakpoint_icons) do
-- local tp = 'Dap' .. type
-- local hl = (type == 'Stopped') and 'DapStop' or 'DapBreak'
-- vim.fn.sign_define(tp, { text = icon, texthl = hl, numhl = hl })
-- end
dap.listeners.after.event_initialized['dapui_config'] = dapui.open
dap.listeners.before.event_terminated['dapui_config'] = dapui.close
dap.listeners.before.event_exited['dapui_config'] = dapui.close
-- Install golang specific config
require('dap-go').setup {
delve = {
-- On Windows delve must be run attached or it crashes.
-- See https://github.com/leoluz/nvim-dap-go/blob/main/README.md#configuring
detached = vim.fn.has 'win32' == 0,
},
}
end,
}

View File

@ -1,11 +0,0 @@
-- Adds indentation guides even on blank lines
-- To enable: move this file to lua/plugins/ or import it in init.lua
-- See `:help ibl`
return {
{
'lukas-reineke/indent-blankline.nvim',
main = 'ibl',
opts = {},
},
}

View File

@ -1,63 +0,0 @@
-- Linting with nvim-lint
-- To enable: move this file to lua/plugins/ or import it in init.lua
-- See `:help lint` for more information
return {
{ -- Linting
'mfussenegger/nvim-lint',
event = { 'BufReadPre', 'BufNewFile' },
config = function()
local lint = require 'lint'
lint.linters_by_ft = {
markdown = { 'markdownlint' },
}
-- To allow other plugins to add linters to require('lint').linters_by_ft,
-- instead set linters_by_ft like this:
-- lint.linters_by_ft = lint.linters_by_ft or {}
-- lint.linters_by_ft['markdown'] = { 'markdownlint' }
--
-- However, note that this will enable a set of default linters,
-- which will cause errors unless these tools are available:
-- {
-- clojure = { "clj-kondo" },
-- dockerfile = { "hadolint" },
-- inko = { "inko" },
-- janet = { "janet" },
-- json = { "jsonlint" },
-- markdown = { "vale" },
-- rst = { "vale" },
-- ruby = { "ruby" },
-- terraform = { "tflint" },
-- text = { "vale" }
-- }
--
-- You can disable the default linters by setting their filetypes to nil:
-- lint.linters_by_ft['clojure'] = nil
-- lint.linters_by_ft['dockerfile'] = nil
-- lint.linters_by_ft['inko'] = nil
-- lint.linters_by_ft['janet'] = nil
-- lint.linters_by_ft['json'] = nil
-- lint.linters_by_ft['markdown'] = nil
-- lint.linters_by_ft['rst'] = nil
-- lint.linters_by_ft['ruby'] = nil
-- lint.linters_by_ft['terraform'] = nil
-- lint.linters_by_ft['text'] = nil
-- Create autocommand which carries out the actual linting
-- on the specified events.
local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true })
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
group = lint_augroup,
callback = function()
-- Only run the linter in buffers that you can modify in order to
-- avoid superfluous noise, notably within the handy LSP pop-ups that
-- describe the hovered symbol using Markdown.
if vim.opt_local.modifiable:get() then
lint.try_lint()
end
end,
})
end,
},
}

7
lua/plugins/snacks.lua Normal file
View File

@ -0,0 +1,7 @@
return {
{
'folke/snacks.nvim',
priority = 1000,
lazy = false,
},
}

View File

@ -0,0 +1,4 @@
-- Detect tabstop and shiftwidth automatically
return {
'tpope/vim-sleuth',
}

View File

@ -0,0 +1,20 @@
return {
{
'christoomey/vim-tmux-navigator',
cmd = {
'TmuxNavigateLeft',
'TmuxNavigateDown',
'TmuxNavigateUp',
'TmuxNavigateRight',
'TmuxNavigatePrevious',
'TmuxNavigatorProcessList',
},
keys = {
{ '<c-h>', '<cmd><C-U>TmuxNavigateLeft<cr>' },
{ '<c-j>', '<cmd><C-U>TmuxNavigateDown<cr>' },
{ '<c-k>', '<cmd><C-U>TmuxNavigateUp<cr>' },
{ '<c-l>', '<cmd><C-U>TmuxNavigateRight<cr>' },
{ '<c-\\>', '<cmd><C-U>TmuxNavigatePrevious<cr>' },
},
},
}

View File

@ -9,13 +9,4 @@ return {
delay = 0, delay = 0,
}, },
}, },
{
'nvim-lualine/lualine.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' },
config = function()
require('lualine').setup {
theme = 'base16',
}
end,
},
} }