Merge remote-tracking branch 'refs/remotes/origin/main'
This commit is contained in:
@@ -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 |
|
||||
|--------|--------|
|
||||
| `<leader>w` | Save file |
|
||||
| `<leader>q` | Quit Neovim |
|
||||
| `<Esc>` | Exit insert mode |
|
||||
| `u` | Undo |
|
||||
| `<C-r>` | 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 |
|
||||
| `<C-d>/<C-u>` | Jump down/up half page |
|
||||
| `<C-f>/<C-b>` | Jump forward/back page |
|
||||
|
||||
### File Explorer (Neo-tree)
|
||||
|
||||
| Keymap | Action |
|
||||
|--------|--------|
|
||||
| `<C-n>` | 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 |
|
||||
|--------|--------|
|
||||
| `<C-p>` | Find files |
|
||||
| `<leader>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 |
|
||||
| `<leader>rn` | Rename symbol |
|
||||
| `<leader>ca` | Code actions / quick fixes |
|
||||
| `<leader>e` | Show diagnostic error |
|
||||
| `[d / ]d` | Previous/next diagnostic |
|
||||
|
||||
### Formatting
|
||||
|
||||
| Keymap | Action |
|
||||
|--------|--------|
|
||||
| `<leader>f` | Format file |
|
||||
|
||||
### Git (Gitsigns)
|
||||
|
||||
| Keymap | Action |
|
||||
|--------|--------|
|
||||
| `]c / [c` | Next/previous hunk (change) |
|
||||
| `<leader>hs` | Stage current hunk |
|
||||
| `<leader>hr` | Reset current hunk |
|
||||
| `<leader>hp` | Preview hunk changes |
|
||||
| `<leader>hb` | Blame line |
|
||||
|
||||
### Debugging (DAP)
|
||||
|
||||
| Keymap | Action |
|
||||
|--------|--------|
|
||||
| `<F5>` | Continue / Start debugger |
|
||||
| `<F9>` | Toggle breakpoint |
|
||||
| `<F10>` | Step over |
|
||||
| `<F11>` | Step into |
|
||||
| `<S-F11>` | Step out |
|
||||
| `<leader>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
|
||||
+49
-14
@@ -1,25 +1,60 @@
|
||||
--[[
|
||||
init.lua - Main Neovim configuration entry point
|
||||
|
||||
-- Bootstrap lazy.nvim
|
||||
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
|
||||
]]
|
||||
|
||||
-- ============================================================================
|
||||
-- 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", "<leader>rn", vim.lsp.buf.rename, { desc = "Rename symbol" })
|
||||
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, { desc = "Code actions" })
|
||||
vim.keymap.set("n", "<leader>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", "<leader>w", ":w<CR>", { desc = "Save file" })
|
||||
vim.keymap.set("n", "<leader>q", ":q<CR>", { desc = "Quit" })
|
||||
vim.keymap.set("n", "<C-n>", ":Neotree filesystem reveal left<CR>", { desc = "Toggle explorer" })
|
||||
vim.keymap.set("n", "<C-p>", ":Telescope find_files<CR>", { desc = "Find files" })
|
||||
|
||||
@@ -1,13 +1,172 @@
|
||||
--[[
|
||||
BASIC-SETTINGS.LUA
|
||||
|
||||
-- Basics
|
||||
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
|
||||
]]
|
||||
|
||||
-- ============================================================================
|
||||
-- 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"
|
||||
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
|
||||
|
||||
-- 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 <Leader> 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", "<esc>", [[<C-\><C-n>]], { desc = "Exit terminal mode" })
|
||||
-- ============================================================================
|
||||
-- TERMINAL SETTINGS
|
||||
-- ============================================================================
|
||||
-- Exit terminal mode with Escape
|
||||
vim.keymap.set("t", "<Esc>", [[<C-\><C-n>]], {
|
||||
desc = "Exit terminal mode"
|
||||
})
|
||||
|
||||
-- Alternative: Exit with Alt key combinations as well
|
||||
vim.keymap.set("t", "<A-x>", [[<C-\><C-n>]], {
|
||||
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
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
|
||||
@@ -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", "<F5>", dap.continue, { desc = "Continue" })
|
||||
vim.keymap.set("n", "<F10>", dap.step_over, { desc = "Step over" })
|
||||
vim.keymap.set("n", "<F11>", dap.step_into, { desc = "Step into" })
|
||||
vim.keymap.set("n", "<S-F11>", dap.step_out, { desc = "Step out" })
|
||||
vim.keymap.set("n", "<F9>", dap.toggle_breakpoint, { desc = "Breakpoint" })
|
||||
vim.keymap.set("n", "<leader>du", dapui.toggle, { desc = "DAP UI" })
|
||||
end,
|
||||
},
|
||||
{ "mfussenegger/nvim-dap-python", dependencies = { "mfussenegger/nvim-dap" } },
|
||||
}
|
||||
@@ -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 = '<author>, <author_time:%R> - <summary>',
|
||||
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', '<leader>hs', gitsigns.stage_hunk)
|
||||
map('n', '<leader>hr', gitsigns.reset_hunk)
|
||||
|
||||
map('v', '<leader>hs', function()
|
||||
gitsigns.stage_hunk({ vim.fn.line('.'), vim.fn.line('v') })
|
||||
end)
|
||||
|
||||
map('v', '<leader>hr', function()
|
||||
gitsigns.reset_hunk({ vim.fn.line('.'), vim.fn.line('v') })
|
||||
end)
|
||||
|
||||
map('n', '<leader>hS', gitsigns.stage_buffer)
|
||||
map('n', '<leader>hR', gitsigns.reset_buffer)
|
||||
map('n', '<leader>hp', gitsigns.preview_hunk)
|
||||
map('n', '<leader>hi', gitsigns.preview_hunk_inline)
|
||||
|
||||
map('n', '<leader>hb', function()
|
||||
gitsigns.blame_line({ full = true })
|
||||
end)
|
||||
|
||||
map('n', '<leader>hd', gitsigns.diffthis)
|
||||
|
||||
map('n', '<leader>hD', function()
|
||||
gitsigns.diffthis('~')
|
||||
end)
|
||||
|
||||
map('n', '<leader>hQ', function() gitsigns.setqflist('all') end)
|
||||
map('n', '<leader>hq', gitsigns.setqflist)
|
||||
|
||||
-- Toggles
|
||||
map('n', '<leader>tb', gitsigns.toggle_current_line_blame)
|
||||
map('n', '<leader>tw', gitsigns.toggle_word_diff)
|
||||
|
||||
-- Text object
|
||||
map({'o', 'x'}, 'ih', gitsigns.select_hunk)
|
||||
end
|
||||
}
|
||||
end
|
||||
require('gitsigns').setup()
|
||||
end,
|
||||
}
|
||||
|
||||
@@ -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", "<leader>rn", vim.lsp.buf.rename, {})
|
||||
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, {})
|
||||
vim.keymap.set("n", "<leader>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,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
@@ -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', '<C-n>', ':Neotree filesystem reveal left<CR>', {})
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
@@ -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', '<C-p>', builtin.find_files, {})
|
||||
vim.keymap.set('n', '<leader>f', builtin.live_grep, {})
|
||||
vim.keymap.set('n', '<leader>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,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
|
||||
-- treesitter: code parser
|
||||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
lazy = true,
|
||||
build = ":TSUpdate",
|
||||
opts = {
|
||||
ensure_installed = {"python", "bash", "lua", "json", "java", "typescript"},
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
fold = { 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,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user