From 88d84fee4ccb2a71de35164a9b26632f2da3e9ce Mon Sep 17 00:00:00 2001 From: Anup Sebastian <56888132+anupjsebastian@users.noreply.github.com> Date: Sat, 1 Nov 2025 03:01:29 -0500 Subject: [PATCH] migration complete --- README.md | 422 +++++++-------- archive/CONSISTENCY.md | 82 +++ archive/DUPLICATES.md | 90 ++++ INSTALLATION.md => archive/INSTALLATION.md | 0 archive/KEYMAPS.md | 422 +++++++++++++++ MIGRATION.md => archive/MIGRATION.md | 0 .../NEO-TREE-CHEATSHEET.md | 0 ORGANIZATION.md => archive/ORGANIZATION.md | 0 archive/README.old.md | 241 +++++++++ SETUP-GUIDE.md => archive/SETUP-GUIDE.md | 0 TESTING.md => archive/TESTING.md | 0 doc/kickstart.txt | 24 - doc/tags | 3 - docs/DOCUMENTATION-PLAN.md | 316 ++++++++++++ docs/README.md | 256 +++++++++ docs/getting-started/README.md | 195 +++++++ docs/keymaps/README.md | 226 ++++++++ docs/keymaps/consistency.md | 82 +++ docs/keymaps/duplicates.md | 90 ++++ docs/languages/flutter-dart.md | 295 +++++++++++ docs/vim-mastery/README.md | 272 ++++++++++ docs/vim-mastery/week-01-motions.md | 380 ++++++++++++++ init.lua | 2 +- lazy-lock.json | 2 + lua/config/keymaps.lua | 34 ++ lua/custom/plugins/flutter.lua | 485 ++++++++++++++++++ lua/plugins/core/cheatsheet.lua | 396 ++++++++++++++ lua/plugins/core/debug.lua | 49 ++ lua/plugins/core/editor.lua | 101 +++- lua/plugins/core/neo-tree.lua | 43 +- lua/plugins/lang/flutter.lua | 48 +- lua/plugins/lang/python.lua | 50 ++ lua/plugins/lang/rust.lua | 272 ++++++++++ lua/plugins/lang/svelte.lua | 44 ++ 34 files changed, 4641 insertions(+), 281 deletions(-) create mode 100644 archive/CONSISTENCY.md create mode 100644 archive/DUPLICATES.md rename INSTALLATION.md => archive/INSTALLATION.md (100%) create mode 100644 archive/KEYMAPS.md rename MIGRATION.md => archive/MIGRATION.md (100%) rename NEO-TREE-CHEATSHEET.md => archive/NEO-TREE-CHEATSHEET.md (100%) rename ORGANIZATION.md => archive/ORGANIZATION.md (100%) create mode 100644 archive/README.old.md rename SETUP-GUIDE.md => archive/SETUP-GUIDE.md (100%) rename TESTING.md => archive/TESTING.md (100%) delete mode 100644 doc/kickstart.txt delete mode 100644 doc/tags create mode 100644 docs/DOCUMENTATION-PLAN.md create mode 100644 docs/README.md create mode 100644 docs/getting-started/README.md create mode 100644 docs/keymaps/README.md create mode 100644 docs/keymaps/consistency.md create mode 100644 docs/keymaps/duplicates.md create mode 100644 docs/languages/flutter-dart.md create mode 100644 docs/vim-mastery/README.md create mode 100644 docs/vim-mastery/week-01-motions.md create mode 100644 lua/custom/plugins/flutter.lua create mode 100644 lua/plugins/core/cheatsheet.lua create mode 100644 lua/plugins/core/debug.lua create mode 100644 lua/plugins/lang/rust.lua diff --git a/README.md b/README.md index 41139505..42920514 100644 --- a/README.md +++ b/README.md @@ -1,241 +1,263 @@ -# kickstart.nvim +# 🚀 Kickstart.nvim - Professional Edition -## Introduction +> A powerful, modular Neovim configuration built on kickstart.nvim, enhanced with LazyVim-style organization and comprehensive language support. -A starting point for Neovim that is: +[![Neovim](https://img.shields.io/badge/Neovim-0.11.4+-57A143?style=for-the-badge&logo=neovim&logoColor=white)](https://neovim.io/) +[![Lua](https://img.shields.io/badge/Lua-5.1+-2C2D72?style=for-the-badge&logo=lua&logoColor=white)](https://www.lua.org/) +[![License](https://img.shields.io/badge/License-MIT-blue?style=for-the-badge)](./LICENSE.md) -* Small -* Single-file -* Completely Documented +--- -**NOT** a Neovim distribution, but instead a starting point for your configuration. +## ✨ Features -## Installation +### 🎨 **LazyVim-Style Interface** +- Beautiful which-key menu with icons and intuitive groupings +- Consistent keybindings across all plugins (Telescope, Neo-tree, etc.) +- Comprehensive searchable cheatsheet with 200+ keymaps (`sc`) -### Install Neovim +### 🛠️ **Language Support** +- **Flutter/Dart**: Full Flutter tools integration with device management +- **Rust**: rust-analyzer + Crates.io integration for dependency management +- **Python**: Pyright LSP with virtual environment support +- **Svelte**: Complete web development setup +- **Go, TypeScript, Lua**: Pre-configured LSP servers -Kickstart.nvim targets *only* the latest -['stable'](https://github.com/neovim/neovim/releases/tag/stable) and latest -['nightly'](https://github.com/neovim/neovim/releases/tag/nightly) of Neovim. -If you are experiencing issues, please make sure you have the latest versions. +### 🔍 **Advanced Tooling** +- **Telescope**: Fuzzy finder for files, git, LSP, and more +- **Neo-tree**: File explorer with git integration +- **nvim-dap**: Full debugging support for all languages +- **Gitsigns**: Git integration with blame, hunk navigation, and staging +- **Mini.nvim**: Surround, autopairs, comments, and more -### Install External Dependencies +### 📚 **Comprehensive Documentation** +- In-editor cheatsheet accessible anytime +- Progressive learning path from basics to advanced +- Vim mastery tips to build your skills over time -External Requirements: -- Basic utils: `git`, `make`, `unzip`, C Compiler (`gcc`) -- [ripgrep](https://github.com/BurntSushi/ripgrep#installation), - [fd-find](https://github.com/sharkdp/fd#installation) -- Clipboard tool (xclip/xsel/win32yank or other depending on the platform) -- A [Nerd Font](https://www.nerdfonts.com/): optional, provides various icons - - if you have it set `vim.g.have_nerd_font` in `init.lua` to true -- Emoji fonts (Ubuntu only, and only if you want emoji!) `sudo apt install fonts-noto-color-emoji` -- Language Setup: - - If you want to write Typescript, you need `npm` - - If you want to write Golang, you will need `go` - - etc. +--- -> [!NOTE] -> See [Install Recipes](#Install-Recipes) for additional Windows and Linux specific notes -> and quick install snippets +## 📋 Requirements -### Install Kickstart +### Core Dependencies +- **Neovim** 0.11.4+ (stable or nightly) +- **Git** for plugin management +- **C Compiler** (gcc/clang) for TreeSitter +- **Make** and **unzip** -> [!NOTE] -> [Backup](#FAQ) your previous configuration (if any exists) +### Recommended Tools +- **ripgrep** - Fast file searching (required for Telescope) +- **fd** - Fast file finding +- **Nerd Font** - Icons support (set `vim.g.have_nerd_font = true`) +- **Clipboard tool** - xclip (Linux), pbcopy (macOS), win32yank (Windows) -Neovim's configurations are located under the following paths, depending on your OS: +### Language-Specific +- **Node.js** & **npm** - TypeScript, Svelte, web development +- **Python 3** - Python development +- **Rust** & **Cargo** - Rust development +- **Flutter SDK** - Flutter/Dart development +- **Go** - Go development -| OS | PATH | -| :- | :--- | -| Linux, MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` | -| Windows (cmd)| `%localappdata%\nvim\` | -| Windows (powershell)| `$env:LOCALAPPDATA\nvim\` | +--- -#### Recommended Step +## 🚀 Quick Start -[Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) this repo -so that you have your own copy that you can modify, then install by cloning the -fork to your machine using one of the commands below, depending on your OS. - -> [!NOTE] -> Your fork's URL will be something like this: -> `https://github.com//kickstart.nvim.git` - -You likely want to remove `lazy-lock.json` from your fork's `.gitignore` file -too - it's ignored in the kickstart repo to make maintenance easier, but it's -[recommended to track it in version control](https://lazy.folke.io/usage/lockfile). - -#### Clone kickstart.nvim - -> [!NOTE] -> If following the recommended step above (i.e., forking the repo), replace -> `nvim-lua` with `` in the commands below - -
Linux and Mac - -```sh -git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim +### 1. Backup Existing Config +```bash +# macOS/Linux +mv ~/.config/nvim ~/.config/nvim.backup +mv ~/.local/share/nvim ~/.local/share/nvim.backup +mv ~/.local/state/nvim ~/.local/state/nvim.backup +mv ~/.cache/nvim ~/.cache/nvim.backup ``` -
- -
Windows - -If you're using `cmd.exe`: - -``` -git clone https://github.com/nvim-lua/kickstart.nvim.git "%localappdata%\nvim" +### 2. Clone This Configuration +```bash +git clone https://github.com/anupjsebastian/kickstart.nvim.git ~/.config/nvim +cd ~/.config/nvim ``` -If you're using `powershell.exe` +### 3. Install Dependencies +```bash +# macOS (using Homebrew) +brew install neovim ripgrep fd -``` -git clone https://github.com/nvim-lua/kickstart.nvim.git "${env:LOCALAPPDATA}\nvim" +# Ubuntu/Debian +sudo apt install neovim ripgrep fd-find + +# Arch Linux +sudo pacman -S neovim ripgrep fd ``` -
- -### Post Installation - -Start Neovim - -```sh +### 4. Launch Neovim +```bash nvim ``` -That's it! Lazy will install all the plugins you have. Use `:Lazy` to view -the current plugin status. Hit `q` to close the window. +On first launch: +- Lazy.nvim will automatically install all plugins +- TreeSitter will compile language parsers +- LSP servers will be installed via Mason +- Wait for all installations to complete (check bottom right) -#### Read The Friendly Documentation - -Read through the `init.lua` file in your configuration folder for more -information about extending and exploring Neovim. That also includes -examples of adding popularly requested plugins. - -> [!NOTE] -> For more information about a particular plugin check its repository's documentation. - - -### Getting Started - -[The Only Video You Need to Get Started with Neovim](https://youtu.be/m8C0Cq9Uv9o) - -### FAQ - -* What should I do if I already have a pre-existing Neovim configuration? - * You should back it up and then delete all associated files. - * This includes your existing init.lua and the Neovim files in `~/.local` - which can be deleted with `rm -rf ~/.local/share/nvim/` -* Can I keep my existing configuration in parallel to kickstart? - * Yes! You can use [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME)`=nvim-NAME` - to maintain multiple configurations. For example, you can install the kickstart - configuration in `~/.config/nvim-kickstart` and create an alias: - ``` - alias nvim-kickstart='NVIM_APPNAME="nvim-kickstart" nvim' - ``` - When you run Neovim using `nvim-kickstart` alias it will use the alternative - config directory and the matching local directory - `~/.local/share/nvim-kickstart`. You can apply this approach to any Neovim - distribution that you would like to try out. -* What if I want to "uninstall" this configuration: - * See [lazy.nvim uninstall](https://lazy.folke.io/usage#-uninstalling) information -* Why is the kickstart `init.lua` a single file? Wouldn't it make sense to split it into multiple files? - * The main purpose of kickstart is to serve as a teaching tool and a reference - configuration that someone can easily use to `git clone` as a basis for their own. - As you progress in learning Neovim and Lua, you might consider splitting `init.lua` - into smaller parts. A fork of kickstart that does this while maintaining the - same functionality is available here: - * [kickstart-modular.nvim](https://github.com/dam9000/kickstart-modular.nvim) - * Discussions on this topic can be found here: - * [Restructure the configuration](https://github.com/nvim-lua/kickstart.nvim/issues/218) - * [Reorganize init.lua into a multi-file setup](https://github.com/nvim-lua/kickstart.nvim/pull/473) - -### Install Recipes - -Below you can find OS specific install instructions for Neovim and dependencies. - -After installing all the dependencies continue with the [Install Kickstart](#Install-Kickstart) step. - -#### Windows Installation - -
Windows with Microsoft C++ Build Tools and CMake -Installation may require installing build tools and updating the run command for `telescope-fzf-native` - -See `telescope-fzf-native` documentation for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation) - -This requires: - -- Install CMake and the Microsoft C++ Build Tools on Windows - -```lua -{'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' } -``` -
-
Windows with gcc/make using chocolatey -Alternatively, one can install gcc and make which don't require changing the config, -the easiest way is to use choco: - -1. install [chocolatey](https://chocolatey.org/install) -either follow the instructions on the page or use winget, -run in cmd as **admin**: -``` -winget install --accept-source-agreements chocolatey.chocolatey +### 5. Verify Installation +```vim +:checkhealth ``` -2. install all requirements using choco, exit the previous cmd and -open a new one so that choco path is set, and run in cmd as **admin**: -``` -choco install -y neovim git ripgrep wget fd unzip gzip mingw make -``` -
-
WSL (Windows Subsystem for Linux) +--- + +## 📖 Documentation + +### Essential Reading +- **[Getting Started](docs/getting-started/README.md)** - First-time setup and orientation +- **[Installation Guide](docs/getting-started/installation.md)** - Detailed installation steps +- **[Quick Reference](docs/getting-started/quick-reference.md)** - Most common commands + +### Core Guides +- **[Keymaps Reference](docs/keymaps/README.md)** - Complete keymap documentation + - [Core Keymaps](docs/keymaps/core.md) - Leader key organization + - [LSP Keymaps](docs/keymaps/lsp.md) - Language Server Protocol commands + - [Plugin Keymaps](docs/keymaps/plugins.md) - Telescope, Neo-tree, etc. + - [Duplicates Guide](docs/keymaps/duplicates.md) - Understanding multiple keys for same action + +- **[Plugins Guide](docs/plugins/README.md)** - Plugin documentation + - [Core Plugins](docs/plugins/core.md) - Essential plugins (Telescope, Neo-tree, which-key) + - [Editor Plugins](docs/plugins/editor.md) - Editing enhancements + - [LSP & Completion](docs/plugins/lsp.md) - Language features + - [Debug Adapter](docs/plugins/debug.md) - Debugging setup + +- **[Language Setup](docs/languages/README.md)** - Language-specific configuration + - [Flutter/Dart](docs/languages/flutter.md) + - [Rust](docs/languages/rust.md) + - [Python](docs/languages/python.md) + - [Svelte](docs/languages/svelte.md) + - [Other Languages](docs/languages/others.md) + +### Advanced Topics +- **[Vim Mastery](docs/vim-mastery/README.md)** - Progressive skill building + - [Week 1: Motion Basics](docs/vim-mastery/week-01-motions.md) + - [Week 2: Text Objects](docs/vim-mastery/week-02-text-objects.md) + - [Week 3: Advanced Editing](docs/vim-mastery/week-03-advanced.md) + - [Week 4: Macros & Registers](docs/vim-mastery/week-04-macros.md) + - [Tips & Tricks](docs/vim-mastery/tips-and-tricks.md) + - [Workflow Optimization](docs/vim-mastery/workflows.md) + +- **[Customization](docs/customization.md)** - Making it your own +- **[Troubleshooting](docs/troubleshooting.md)** - Common issues and solutions +- **[FAQ](docs/faq.md)** - Frequently asked questions + +--- + +## 🎯 Quick Access Cheatsheet + +### In-Editor Help +- `sc` - Open comprehensive cheatsheet (searchable!) +- `sk` - Search all keymaps with Telescope +- `?` - Quick keymap search +- `sK` - Which-key command palette + +### Essential Keymaps +| Keymap | Action | Category | +|--------|--------|----------| +| `sf` | Find files | Search | +| `sg` | Live grep | Search | +| `bb` | List buffers | Buffer | +| `\` | Toggle Neo-tree | Files | +| `gg` | LazyGit | Git | +| `dc` or `F5` | Start debugging | Debug | +| `K` | Hover documentation | LSP | +| `gra` | Code actions | LSP | + +> **Pro Tip**: Press `` and wait - which-key will show you all available keymaps! + +--- + +## 🏗️ Project Structure ``` -wsl --install -wsl -sudo add-apt-repository ppa:neovim-ppa/unstable -y -sudo apt update -sudo apt install make gcc ripgrep unzip git xclip neovim +~/.config/nvim/ +├── init.lua # Entry point +├── lua/ +│ ├── config/ +│ │ ├── keymaps.lua # Global keymaps +│ │ ├── lazy.lua # Plugin manager setup +│ │ └── options.lua # Neovim options +│ ├── plugins/ +│ │ ├── core/ # Essential plugins +│ │ │ ├── editor.lua # Telescope, which-key +│ │ │ ├── neo-tree.lua # File explorer +│ │ │ ├── debug.lua # Debug adapter +│ │ │ └── cheatsheet.lua # In-editor help +│ │ └── lang/ # Language-specific +│ │ ├── flutter.lua +│ │ ├── rust.lua +│ │ ├── python.lua +│ │ └── svelte.lua +│ └── kickstart/ +│ └── plugins/ # Additional plugins +└── docs/ # Documentation + ├── getting-started/ + ├── keymaps/ + ├── plugins/ + ├── languages/ + └── vim-mastery/ ``` -
-#### Linux Install -
Ubuntu Install Steps +--- -``` -sudo add-apt-repository ppa:neovim-ppa/unstable -y -sudo apt update -sudo apt install make gcc ripgrep unzip git xclip neovim -``` -
-
Debian Install Steps +## 🎨 Philosophy -``` -sudo apt update -sudo apt install make gcc ripgrep unzip git xclip curl +This configuration follows these principles: -# Now we install nvim -curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux-x86_64.tar.gz -sudo rm -rf /opt/nvim-linux-x86_64 -sudo mkdir -p /opt/nvim-linux-x86_64 -sudo chmod a+rX /opt/nvim-linux-x86_64 -sudo tar -C /opt -xzf nvim-linux-x86_64.tar.gz +1. **Modular**: Each plugin in its own file, easy to enable/disable +2. **Discoverable**: Comprehensive which-key menus and cheatsheet +3. **Consistent**: Same keys work the same way across plugins +4. **Progressive**: Learn at your own pace with structured guides +5. **Documented**: Every keymap and feature explained +6. **Extensible**: Easy to customize and add your own plugins -# make it available in /usr/local/bin, distro installs to /usr/bin -sudo ln -sf /opt/nvim-linux-x86_64/bin/nvim /usr/local/bin/ -``` -
-
Fedora Install Steps +--- -``` -sudo dnf install -y gcc make git ripgrep fd-find unzip neovim -``` -
+## 🤝 Contributing -
Arch Install Steps +Found a bug? Have a suggestion? Contributions are welcome! -``` -sudo pacman -S --noconfirm --needed gcc make git ripgrep fd unzip neovim -``` -
+1. Fork the repository +2. Create a feature branch (`git checkout -b feature/amazing-feature`) +3. Commit your changes (`git commit -m 'Add amazing feature'`) +4. Push to the branch (`git push origin feature/amazing-feature`) +5. Open a Pull Request +--- + +## 📝 License + +This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details. + +--- + +## 🙏 Acknowledgments + +- **[kickstart.nvim](https://github.com/nvim-lua/kickstart.nvim)** - The foundation of this config +- **[LazyVim](https://www.lazyvim.org/)** - Inspiration for keybinding organization +- **[AstroVim](https://astronvim.com/)** - Cheatsheet inspiration +- **Neovim Community** - Amazing plugins and support + +--- + +## 📚 Learn More + +- [Neovim Documentation](https://neovim.io/doc/) +- [Lua Guide for Neovim](https://github.com/nanotee/nvim-lua-guide) +- [Awesome Neovim Plugins](https://github.com/rockerBOO/awesome-neovim) +- [This Configuration's Full Documentation](docs/README.md) + +--- + +
+ +**Built with ❤️ using Neovim** + +[Get Started](docs/getting-started/README.md) • [Keymaps](docs/keymaps/README.md) • [Plugins](docs/plugins/README.md) • [Languages](docs/languages/README.md) + +
diff --git a/archive/CONSISTENCY.md b/archive/CONSISTENCY.md new file mode 100644 index 00000000..a57c2c52 --- /dev/null +++ b/archive/CONSISTENCY.md @@ -0,0 +1,82 @@ +# Keymap Consistency Guide + +> **Last Updated:** November 1, 2025 +> **Purpose:** Document consistent keymaps across Telescope and Neo-tree + +## 🎯 Consistent Actions + +The following keymaps work **identically** in both Telescope and Neo-tree: + +### File Opening Actions + +| Key | Action | Telescope | Neo-tree | +|-----|--------|-----------|----------| +| `` or `o` | Open in current window | ✅ | ✅ | +| `` | Open in horizontal split | ✅ | ✅ | +| `` | Open in vertical split | ✅ | ✅ | +| `` | Open in new tab | ✅ | ✅ | + +### Navigation + +| Key | Action | Telescope | Neo-tree | +|-----|--------|-----------|----------| +| `` | Next item/source | ✅ | ✅ | +| `` | Previous item/source | ✅ | ✅ | +| `j/k` (normal mode) | Down/Up | ✅ | ✅ | +| `gg/G` (normal mode) | First/Last | ✅ | ✅ | + +### Utility + +| Key | Action | Telescope | Neo-tree | +|-----|--------|-----------|----------| +| `?` | Show help | ✅ | ✅ | +| `` or `q` | Close | ✅ | ✅ (`\\` for Neo-tree) | + +### Cross-Plugin Integration + +| Key | Action | Context | +|-----|--------|---------| +| `sf` | Telescope find files | Works in both editor and Neo-tree | +| `sg` | Telescope live grep | Works in both editor and Neo-tree | + +When used in Neo-tree, these commands search from the currently selected directory! + +## 📚 Complete Cheatsheet Access + +Access the comprehensive cheatsheet with: + +``` +sc - Complete cheatsheet (vim, plugins, language-specific) +sk - Search keymaps (Telescope) +sK - All keymaps (which-key) +? - Quick keymap search +``` + +## 🎨 Visual Consistency + +Both Telescope and Neo-tree now follow the same pattern: +- **Same keys** for same actions +- **Predictable behavior** across interfaces +- **Integrated workflows** (use Telescope from Neo-tree) +- **Help always available** with `?` + +## 📝 Quick Reference + +### In Telescope: +1. `` to navigate +2. `` to open in split/vsplit/tab +3. `` to open in current window +4. `?` for help + +### In Neo-tree: +1. `` to switch sources +2. `` to open in split/vsplit/tab +3. `` or `o` to open file +4. `?` for help +5. `sf/sg` to launch Telescope from current directory + +### Both Share: +- Consistent split/tab opening +- Same navigation philosophy +- Integrated search capabilities +- Help on demand diff --git a/archive/DUPLICATES.md b/archive/DUPLICATES.md new file mode 100644 index 00000000..0406cae9 --- /dev/null +++ b/archive/DUPLICATES.md @@ -0,0 +1,90 @@ +# Duplicate Keymaps Reference + +This document lists all keymaps where the same action can be performed using multiple key combinations. + +## Philosophy + +Having duplicate keymaps is **intentional and beneficial**: +- **Vim defaults + Modern alternatives**: Keep familiar vim keys while adding intuitive modern ones +- **Consistency across plugins**: Same keys work the same way in Telescope and Neo-tree +- **Ergonomics**: Function keys (F5-F12) AND leader keys for debugging +- **Context switching**: Use what feels natural in different workflows + +## Debug Actions + +| Action | Keys | Notes | +|--------|------|-------| +| Continue | `F5` or `dc` | F5 is standard in many IDEs | +| Step over | `F10` or `dO` | Uppercase O for over | +| Step into | `F11` or `di` | | +| Step out | `F12` or `do` | Lowercase o for out | + +**Why duplicates?** Function keys are muscle memory from other IDEs. Leader keys are more discoverable via which-key and don't conflict with terminal function keys. + +## Neo-tree vs Consistent Actions + +| Action | Neo-tree Default | Consistent Alternative | Notes | +|--------|------------------|------------------------|-------| +| Vertical split | `s` | `Ctrl-v` | Matches Telescope | +| Horizontal split | `S` | `Ctrl-x` | Matches Telescope | +| New tab | `t` | `Ctrl-t` | Matches Telescope | +| Next source | `>` | `Ctrl-j` | Matches Telescope navigation | +| Previous source | `<` | `Ctrl-k` | Matches Telescope navigation | +| Close window | `q` | `\` or `Esc` | Backslash mirrors toggle | +| Open file | `` | `o` | Two ways to open | + +**Why duplicates?** Neo-tree defaults are efficient single-key presses. Consistent alternatives (`Ctrl-x/v/t/j/k`) work the same way in Telescope, reducing cognitive load when switching between file finder and file tree. + +## Flutter Code Actions + +| Action | Keys | Notes | +|--------|------|-------| +| Code actions | `.` or `gra` | Period mimics Cmd+. in IDEs, gra is standard LSP | + +**Why duplicates?** Flutter developers coming from IDEs expect `.` (like Cmd+.). `gra` is the standard LSP keymap used everywhere else. + +## Telescope Navigation + +| Action | Keys | Notes | +|--------|------|-------| +| Next/prev item | `Ctrl-j/k` or `j/k` (normal) | Insert mode uses Ctrl, normal mode uses plain | +| Close | `Ctrl-c` or `Esc` or `q` (normal) | Three ways to exit | + +**Why duplicates?** `Ctrl-j/k` work in insert mode without switching modes. In normal mode, plain `j/k` are more natural. + +## Vim Defaults + +| Action | Keys | Notes | +|--------|------|-------| +| Save and quit | `:wq` or `ZZ` | ZZ is faster | +| Quit without save | `:q!` or `ZQ` | ZQ is faster | + +**Why duplicates?** Both are vim defaults. ZZ/ZQ are faster but less discoverable. + +## Summary of Duplicate Patterns + +1. **Debug**: F-keys + Leader keys (muscle memory from IDEs + discoverability) +2. **Splits/Tabs**: Single keys + Ctrl combos (efficiency + consistency) +3. **Navigation**: Plain + Ctrl variants (context-dependent ergonomics) +4. **Close/Exit**: Multiple keys (q, Esc, Ctrl-c, \\) (different mental models) + +## Design Principles + +1. **Never remove defaults** unless they conflict +2. **Add consistent alternatives** that work across plugins +3. **Document all options** so users can choose their preferred style +4. **Optimize for discoverability** (leader keys show in which-key) +5. **Respect muscle memory** (keep vim and IDE conventions) + +## Quick Reference: Cross-Plugin Consistency + +These keys work the same way in **both Telescope and Neo-tree**: + +- `Ctrl-x` → Horizontal split +- `Ctrl-v` → Vertical split +- `Ctrl-t` → New tab +- `Ctrl-j` → Next/down +- `Ctrl-k` → Previous/up +- `?` → Show help + +This consistency means once you learn these in one plugin, they work the same everywhere. diff --git a/INSTALLATION.md b/archive/INSTALLATION.md similarity index 100% rename from INSTALLATION.md rename to archive/INSTALLATION.md diff --git a/archive/KEYMAPS.md b/archive/KEYMAPS.md new file mode 100644 index 00000000..95c02a83 --- /dev/null +++ b/archive/KEYMAPS.md @@ -0,0 +1,422 @@ +# Neovim Keymap Reference + +> **Last Updated:** November 1, 2025 +> **Organization Status:** ⚠️ NEEDS CLEANUP - Duplicates and conflicts identified + +## Table of Contents +- [Global Keymaps](#global-keymaps) +- [LSP Keymaps](#lsp-keymaps) +- [Language-Specific Keymaps](#language-specific-keymaps) +- [Conflicts & Duplicates](#conflicts--duplicates) +- [Proposed Organization](#proposed-organization) + +--- + +## Global Keymaps + +### Window Navigation +| Key | Mode | Action | Status | +|-----|------|--------|--------| +| `` | n | Move to left window | ✅ Keep | +| `` | n | Move to right window | ✅ Keep | +| `` | n | Move to lower window | ⚠️ **CONFLICT** with Telescope | +| `` | n | Move to upper window | ⚠️ **CONFLICT** with Telescope | + +### Quit Commands +| Key | Mode | Action | Status | +|-----|------|--------|--------| +| `Q` | n | Quit all | ✅ Keep | +| `q` | n | Open diagnostic quickfix | ✅ Keep | + +### File Explorer +| Key | Mode | Action | Status | +|-----|------|--------|--------| +| `\` | n | Toggle Neo-tree | ✅ Keep (user requested) | + +### Terminal +| Key | Mode | Action | Status | +|-----|------|--------|--------| +| `` | t | Exit terminal mode | ✅ Keep | + +### Escape/Clear +| Key | Mode | Action | Status | +|-----|------|--------|--------| +| `` | n | Clear highlights + close floats | ✅ Keep | + +--- + +## Search/Telescope (`s`) + +| Key | Mode | Action | Status | +|-----|------|--------|--------| +| `sh` | n | Search Help | ✅ Keep | +| `sk` | n | Search Keymaps | ✅ Keep | +| `sf` | n | Search Files | ✅ Keep | +| `ss` | n | Search Select Telescope | ✅ Keep | +| `sw` | n | Search current Word | ✅ Keep | +| `sg` | n | Search by Grep | ✅ Keep | +| `sd` | n | Search Diagnostics | ✅ Keep | +| `sr` | n | Search Resume | ✅ Keep | +| `s.` | n | Search Recent Files | ✅ Keep | +| `s/` | n | Search in open files | ✅ Keep | +| `sn` | n | Search Neovim config | ✅ Keep | +| `/` | n | Fuzzy search in buffer | ✅ Keep | +| `` | n | Find buffers | ✅ Keep | + +### Telescope Navigation (Within Telescope) +| Key | Mode | Action | Status | +|-----|------|--------|--------| +| `` | i | Next item | ⚠️ **CONFLICT** with window nav | +| `` | i | Previous item | ⚠️ **CONFLICT** with window nav | + +--- + +## Session (`S`) + +| Key | Mode | Action | Status | +|-----|------|--------|--------| +| `Ss` | n | Session save | ✅ Keep | +| `Sr` | n | Session restore | ✅ Keep | +| `Sd` | n | Session delete | ✅ Keep | + +--- + +## LSP Keymaps (All Languages) + +### Go-to Commands (`gr*`) +| Key | Mode | Action | Status | +|-----|------|--------|--------| +| `grd` | n | Go to Definition | ✅ Keep | +| `grD` | n | Go to Declaration | ✅ Keep | +| `gri` | n | Go to Implementation | ✅ Keep | +| `grr` | n | Go to References | ✅ Keep | +| `grt` | n | Go to Type Definition | ✅ Keep | +| `grn` | n | Rename | ✅ Keep | +| `gra` | n,v | Code Action | ⚠️ **DUPLICATE** (also `.` in Flutter) | + +### Other LSP +| Key | Mode | Action | Status | +|-----|------|--------|--------| +| `K` | n | Hover Documentation | ✅ Keep | +| `gO` | n | Document Symbols | ✅ Keep | +| `gW` | n | Workspace Symbols | ✅ Keep | + +--- + +## Toggle (`t`) + +| Key | Mode | Action | Status | +|-----|------|--------|--------| +| `th` | n | Toggle Inlay Hints | ✅ Keep | + +--- + +## Diagnostics/Quickfix (`x`) + +| Key | Mode | Action | Status | +|-----|------|--------|--------| +| `xx` | n | Toggle diagnostics list (Trouble) | ✅ Keep | +| `xX` | n | Toggle buffer diagnostics (Trouble) | ✅ Keep | +| `xs` | n | Toggle symbols (Trouble) | ✅ Keep | + +--- + +## Git Hunks (`h`) + +| Key | Mode | Action | Status | +|-----|------|--------|--------| +| `hs` | n,v | Stage hunk | ✅ Keep | +| `hr` | n,v | Reset hunk | ✅ Keep | +| `hS` | n | Stage buffer | ✅ Keep | +| `hu` | n | Undo stage hunk | ✅ Keep | +| `hR` | n | Reset buffer | ✅ Keep | +| `hp` | n | Preview hunk | ✅ Keep | +| `hb` | n | Blame line | ✅ Keep | +| `hd` | n | Diff this | ✅ Keep | +| `hD` | n | Diff this ~ | ✅ Keep | + +--- + +## Language-Specific Keymaps + +### Flutter/Dart (`f`, `d`) + +#### Flutter Workflow +| Key | Mode | Action | Status | +|-----|------|--------|--------| +| `fr` | n | Flutter Run | ✅ Keep | +| `fR` | n | Flutter Hot Restart | ✅ Keep | +| `fq` | n | Flutter Quit | ✅ Keep | +| `fd` | n | Flutter Devices (select) | ✅ Keep | +| `fe` | n | Flutter Emulators | ✅ Keep | +| `fo` | n | Flutter Outline Toggle | ✅ Keep | +| `fc` | n | Flutter Copy Profiler URL | ✅ Keep | +| `fl` | n | Flutter LSP Restart | ✅ Keep | + +#### Flutter Code Actions +| Key | Mode | Action | Status | +|-----|------|--------|--------| +| `.` | n,v | Code Actions (Cmd+.) | ⚠️ **DUPLICATE** with `gra` | +| `gra` | n,v | Code Action | ⚠️ **DUPLICATE** with `.` | + +#### Debug (Flutter/Dart) +| Key | Mode | Action | Status | +|-----|------|--------|--------| +| `` | n | Debug: Start/Continue | ✅ Keep | +| `` | n | Debug: Step Over | ✅ Keep | +| `` | n | Debug: Step Into | ✅ Keep | +| `` | n | Debug: Step Out | ✅ Keep | +| `db` | n | Debug: Toggle Breakpoint | ✅ Keep | +| `dB` | n | Debug: Conditional Breakpoint | ✅ Keep | +| `dc` | n | Debug: Continue | ⚠️ **DUPLICATE** with `` | +| `dt` | n | Debug: Terminate | ✅ Keep | +| `du` | n | Debug: Toggle UI | ✅ Keep | + +### Rust (`r`, `c`) + +#### Rust Tools +| Key | Mode | Action | Status | +|-----|------|--------|--------| +| `rh` | n | Rust Hover Actions | ✅ Keep | +| `ra` | n | Rust Code Actions | ✅ Keep | +| `re` | n | Rust Explain Error | ✅ Keep | +| `rc` | n | Rust Open Cargo.toml | ⚠️ **CONFLICT** with Crates (in Cargo.toml) | +| `rp` | n | Rust Parent Module | ✅ Keep | +| `rj` | n | Rust Join Lines | ✅ Keep | + +#### Crates (Cargo.toml only) +| Key | Mode | Action | Status | +|-----|------|--------|--------| +| `ct` | n | Crates Toggle | ✅ Keep | +| `cr` | n | Crates Reload | ⚠️ **CONFLICT** with `rc` in .rs files | +| `cv` | n | Crates Show Versions | ✅ Keep | +| `cf` | n | Crates Show Features | ✅ Keep | +| `cd` | n | Crates Show Dependencies | ✅ Keep | +| `cu` | n,v | Crates Update | ✅ Keep | +| `ca` | n | Crates Update All | ✅ Keep | +| `cU` | n,v | Crates Upgrade | ✅ Keep | +| `cA` | n | Crates Upgrade All | ✅ Keep | +| `ce` | n | Crates Expand to inline | ✅ Keep | +| `cE` | n | Crates Extract to table | ✅ Keep | +| `cH` | n | Crates Open Homepage | ✅ Keep | +| `cR` | n | Crates Open Repository | ✅ Keep | +| `cD` | n | Crates Open Documentation | ✅ Keep | +| `cC` | n | Crates Open Crates.io | ✅ Keep | + +### Python (`p`) +| Key | Mode | Action | Status | +|-----|------|--------|--------| +| (No keymaps defined yet) | - | - | ⚠️ Need to add | + +### Svelte (`v`) +| Key | Mode | Action | Status | +|-----|------|--------|--------| +| (No keymaps defined yet) | - | - | ⚠️ Need to add | + +--- + +## Conflicts & Duplicates + +### 🔴 Critical Conflicts + +1. **Window Navigation vs Telescope Navigation** + - `` and `` used for BOTH window navigation AND Telescope item navigation + - **Impact:** Medium - Can't navigate windows while Telescope is open + - **Resolution:** Telescope should use different keys or remain as-is (works in insert mode) + +2. **Code Actions: `gra` vs `.`** + - Both do the same thing in Flutter/Dart files + - **Impact:** Low - Just redundant + - **Resolution:** Keep both (muscle memory from different editors) + +3. **Debug Continue: `` vs `dc`** + - Both do the same thing + - **Impact:** Low - Just redundant + - **Resolution:** Keep both (F5 is standard, leader-based for discoverability) + +4. **Rust Cargo.toml conflicts** + - `rc` means different things in `.rs` vs `Cargo.toml` files + - `cr` means different things in `.rs` vs `Cargo.toml` files + - **Impact:** High - Same key does different things based on filename + - **Resolution:** This is acceptable since they're context-dependent (filetype-specific) + +### 🟡 Minor Issues + +1. **No Python or Svelte keymaps** + - Missing language-specific shortcuts + - **Resolution:** Add `p` for Python, `v` for Svelte + +2. **No unified debug keymaps** + - Debug keys only in Flutter, not available globally + - **Resolution:** Move debug keymaps to global scope if DAP is loaded + +--- + +## Proposed Organization + +### Leader Key Groups (LazyVim-style with Icons) + +``` + +├── → Buffers +├── / → Search in buffer +├── . → Code action (Flutter/Dart specific) +├── Q → Quit all +├── q → Quickfix diagnostics +│ +├── 󰊄 b → [B]uffer operations (NEW) +│ ├── bd → Delete buffer +│ ├── bD → Delete buffer (force) +│ ├── bn → Next buffer +│ ├── bp → Previous buffer +│ └── bP → Pin buffer +│ +├── c → [C]ode operations (NEW - UNIFY CODE ACTIONS) +│ ├── ca → Code action +│ ├── cf → Format +│ ├── cr → Rename +│ └── cs → Symbol search +│ +├── d → [D]ebug (GLOBAL - move from Flutter-only) +│ ├── db → Toggle breakpoint +│ ├── dB → Conditional breakpoint +│ ├── dc → Continue +│ ├── di → Step into +│ ├── do → Step out +│ ├── dO → Step over +│ ├── dt → Terminate +│ └── du → Toggle UI +│ +├── f → [F]lutter (Dart files only) +│ ├── fr → Run +│ ├── fR → Hot restart +│ ├── fq → Quit +│ ├── fd → Devices +│ ├── fe → Emulators +│ ├── fo → Outline toggle +│ ├── fc → Copy profiler URL +│ └── fl → LSP restart +│ +├── g → [G]it (RENAME from h) +│ ├── gs → Stage hunk +│ ├── gr → Reset hunk +│ ├── gS → Stage buffer +│ ├── gu → Undo stage +│ ├── gR → Reset buffer +│ ├── gp → Preview hunk +│ ├── gb → Blame line +│ ├── gd → Diff this +│ └── gD → Diff this ~ +│ +├── p → [P]ython (Python files only) (NEW) +│ ├── pr → Run file +│ ├── pR → Run with args +│ ├── pi → Import sort +│ ├── pe → Select environment +│ └── pt → Run tests +│ +├── r → [R]ust (Rust files only) +│ ├── rh → Hover actions +│ ├── ra → Code actions +│ ├── re → Explain error +│ ├── rc → Open Cargo.toml +│ ├── rp → Parent module +│ ├── rj → Join lines +│ ├── rt → Runnables +│ └── rr → Run (NEW) +│ │ +│ └── rc → [C]rates (Cargo.toml only) +│ ├── rct → Toggle +│ ├── rcr → Reload +│ ├── rcv → Show versions +│ ├── rcf → Show features +│ ├── rcd → Show dependencies +│ ├── rcu → Update crate +│ ├── rca → Update all +│ ├── rcU → Upgrade crate +│ └── rcA → Upgrade all +│ +├── s → [S]earch +│ ├── sh → Help +│ ├── sk → Keymaps +│ ├── sf → Files +│ ├── ss → Select Telescope +│ ├── sw → Current word +│ ├── sg → Grep +│ ├── sd → Diagnostics +│ ├── sr → Resume +│ ├── s. → Recent files +│ ├── s/ → Open files +│ ├── sn → Neovim config +│ └── sc → Cheatsheet (NEW) +│ +├── S → [S]ession +│ ├── Ss → Save +│ ├── Sr → Restore +│ └── Sd → Delete +│ +├── t → [T]oggle +│ ├── th → Inlay hints +│ ├── td → Diagnostics +│ ├── tl → Line numbers +│ ├── tr → Relative numbers +│ ├── ts → Spell check +│ ├── tw → Wrap +│ └── tc → Conceallevel +│ +├── u → [U]I (NEW) +│ ├── un → Noice dismiss +│ ├── ul → Lazy +│ ├── um → Mason +│ └── ui → Inspect tree +│ +├── v → S[v]elte (Svelte files only) (NEW) +│ └── (TBD) +│ +├── w → [W]indow operations (NEW) +│ ├── ww → Other window +│ ├── wd → Delete window +│ ├── ws → Split below +│ ├── wv → Split right +│ └── wm → Maximize toggle +│ +└── x → Diagnostics/quickfi[X] + ├── xx → Toggle diagnostics + ├── xX → Buffer diagnostics + └── xs → Symbols +``` + +### Non-Leader Keys + +``` +\ → Toggle Neo-tree (file explorer) +K → Hover documentation (LSP) + → Clear highlights + close floats + +gr* → LSP "go to" commands +├── grd → Definition +├── grD → Declaration +├── gri → Implementation +├── grr → References +├── grt → Type definition +├── grn → Rename +└── gra → Code action + +gO → Document symbols +gW → Workspace symbols + + → Window navigation + → Debug keys (when available) +``` + +--- + +## Next Steps + +1. ✅ **Document current state** (this file) +2. ⏳ **Clean up duplicates** - Remove redundant keymaps +3. ⏳ **Reorganize which-key** - Add icons, proper groups, submenus +4. ⏳ **Add missing keymaps** - Python, Svelte, Buffer, Window, UI operations +5. ⏳ **Update language configs** - Move Crates under `rc`, standardize patterns +6. ⏳ **Implement cheatsheet** - Telescope-based searchable keymap reference +7. ⏳ **Test everything** - Ensure no conflicts, all descriptions visible diff --git a/MIGRATION.md b/archive/MIGRATION.md similarity index 100% rename from MIGRATION.md rename to archive/MIGRATION.md diff --git a/NEO-TREE-CHEATSHEET.md b/archive/NEO-TREE-CHEATSHEET.md similarity index 100% rename from NEO-TREE-CHEATSHEET.md rename to archive/NEO-TREE-CHEATSHEET.md diff --git a/ORGANIZATION.md b/archive/ORGANIZATION.md similarity index 100% rename from ORGANIZATION.md rename to archive/ORGANIZATION.md diff --git a/archive/README.old.md b/archive/README.old.md new file mode 100644 index 00000000..41139505 --- /dev/null +++ b/archive/README.old.md @@ -0,0 +1,241 @@ +# kickstart.nvim + +## Introduction + +A starting point for Neovim that is: + +* Small +* Single-file +* Completely Documented + +**NOT** a Neovim distribution, but instead a starting point for your configuration. + +## Installation + +### Install Neovim + +Kickstart.nvim targets *only* the latest +['stable'](https://github.com/neovim/neovim/releases/tag/stable) and latest +['nightly'](https://github.com/neovim/neovim/releases/tag/nightly) of Neovim. +If you are experiencing issues, please make sure you have the latest versions. + +### Install External Dependencies + +External Requirements: +- Basic utils: `git`, `make`, `unzip`, C Compiler (`gcc`) +- [ripgrep](https://github.com/BurntSushi/ripgrep#installation), + [fd-find](https://github.com/sharkdp/fd#installation) +- Clipboard tool (xclip/xsel/win32yank or other depending on the platform) +- A [Nerd Font](https://www.nerdfonts.com/): optional, provides various icons + - if you have it set `vim.g.have_nerd_font` in `init.lua` to true +- Emoji fonts (Ubuntu only, and only if you want emoji!) `sudo apt install fonts-noto-color-emoji` +- Language Setup: + - If you want to write Typescript, you need `npm` + - If you want to write Golang, you will need `go` + - etc. + +> [!NOTE] +> See [Install Recipes](#Install-Recipes) for additional Windows and Linux specific notes +> and quick install snippets + +### Install Kickstart + +> [!NOTE] +> [Backup](#FAQ) your previous configuration (if any exists) + +Neovim's configurations are located under the following paths, depending on your OS: + +| OS | PATH | +| :- | :--- | +| Linux, MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` | +| Windows (cmd)| `%localappdata%\nvim\` | +| Windows (powershell)| `$env:LOCALAPPDATA\nvim\` | + +#### Recommended Step + +[Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) this repo +so that you have your own copy that you can modify, then install by cloning the +fork to your machine using one of the commands below, depending on your OS. + +> [!NOTE] +> Your fork's URL will be something like this: +> `https://github.com//kickstart.nvim.git` + +You likely want to remove `lazy-lock.json` from your fork's `.gitignore` file +too - it's ignored in the kickstart repo to make maintenance easier, but it's +[recommended to track it in version control](https://lazy.folke.io/usage/lockfile). + +#### Clone kickstart.nvim + +> [!NOTE] +> If following the recommended step above (i.e., forking the repo), replace +> `nvim-lua` with `` in the commands below + +
Linux and Mac + +```sh +git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim +``` + +
+ +
Windows + +If you're using `cmd.exe`: + +``` +git clone https://github.com/nvim-lua/kickstart.nvim.git "%localappdata%\nvim" +``` + +If you're using `powershell.exe` + +``` +git clone https://github.com/nvim-lua/kickstart.nvim.git "${env:LOCALAPPDATA}\nvim" +``` + +
+ +### Post Installation + +Start Neovim + +```sh +nvim +``` + +That's it! Lazy will install all the plugins you have. Use `:Lazy` to view +the current plugin status. Hit `q` to close the window. + +#### Read The Friendly Documentation + +Read through the `init.lua` file in your configuration folder for more +information about extending and exploring Neovim. That also includes +examples of adding popularly requested plugins. + +> [!NOTE] +> For more information about a particular plugin check its repository's documentation. + + +### Getting Started + +[The Only Video You Need to Get Started with Neovim](https://youtu.be/m8C0Cq9Uv9o) + +### FAQ + +* What should I do if I already have a pre-existing Neovim configuration? + * You should back it up and then delete all associated files. + * This includes your existing init.lua and the Neovim files in `~/.local` + which can be deleted with `rm -rf ~/.local/share/nvim/` +* Can I keep my existing configuration in parallel to kickstart? + * Yes! You can use [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME)`=nvim-NAME` + to maintain multiple configurations. For example, you can install the kickstart + configuration in `~/.config/nvim-kickstart` and create an alias: + ``` + alias nvim-kickstart='NVIM_APPNAME="nvim-kickstart" nvim' + ``` + When you run Neovim using `nvim-kickstart` alias it will use the alternative + config directory and the matching local directory + `~/.local/share/nvim-kickstart`. You can apply this approach to any Neovim + distribution that you would like to try out. +* What if I want to "uninstall" this configuration: + * See [lazy.nvim uninstall](https://lazy.folke.io/usage#-uninstalling) information +* Why is the kickstart `init.lua` a single file? Wouldn't it make sense to split it into multiple files? + * The main purpose of kickstart is to serve as a teaching tool and a reference + configuration that someone can easily use to `git clone` as a basis for their own. + As you progress in learning Neovim and Lua, you might consider splitting `init.lua` + into smaller parts. A fork of kickstart that does this while maintaining the + same functionality is available here: + * [kickstart-modular.nvim](https://github.com/dam9000/kickstart-modular.nvim) + * Discussions on this topic can be found here: + * [Restructure the configuration](https://github.com/nvim-lua/kickstart.nvim/issues/218) + * [Reorganize init.lua into a multi-file setup](https://github.com/nvim-lua/kickstart.nvim/pull/473) + +### Install Recipes + +Below you can find OS specific install instructions for Neovim and dependencies. + +After installing all the dependencies continue with the [Install Kickstart](#Install-Kickstart) step. + +#### Windows Installation + +
Windows with Microsoft C++ Build Tools and CMake +Installation may require installing build tools and updating the run command for `telescope-fzf-native` + +See `telescope-fzf-native` documentation for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation) + +This requires: + +- Install CMake and the Microsoft C++ Build Tools on Windows + +```lua +{'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' } +``` +
+
Windows with gcc/make using chocolatey +Alternatively, one can install gcc and make which don't require changing the config, +the easiest way is to use choco: + +1. install [chocolatey](https://chocolatey.org/install) +either follow the instructions on the page or use winget, +run in cmd as **admin**: +``` +winget install --accept-source-agreements chocolatey.chocolatey +``` + +2. install all requirements using choco, exit the previous cmd and +open a new one so that choco path is set, and run in cmd as **admin**: +``` +choco install -y neovim git ripgrep wget fd unzip gzip mingw make +``` +
+
WSL (Windows Subsystem for Linux) + +``` +wsl --install +wsl +sudo add-apt-repository ppa:neovim-ppa/unstable -y +sudo apt update +sudo apt install make gcc ripgrep unzip git xclip neovim +``` +
+ +#### Linux Install +
Ubuntu Install Steps + +``` +sudo add-apt-repository ppa:neovim-ppa/unstable -y +sudo apt update +sudo apt install make gcc ripgrep unzip git xclip neovim +``` +
+
Debian Install Steps + +``` +sudo apt update +sudo apt install make gcc ripgrep unzip git xclip curl + +# Now we install nvim +curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux-x86_64.tar.gz +sudo rm -rf /opt/nvim-linux-x86_64 +sudo mkdir -p /opt/nvim-linux-x86_64 +sudo chmod a+rX /opt/nvim-linux-x86_64 +sudo tar -C /opt -xzf nvim-linux-x86_64.tar.gz + +# make it available in /usr/local/bin, distro installs to /usr/bin +sudo ln -sf /opt/nvim-linux-x86_64/bin/nvim /usr/local/bin/ +``` +
+
Fedora Install Steps + +``` +sudo dnf install -y gcc make git ripgrep fd-find unzip neovim +``` +
+ +
Arch Install Steps + +``` +sudo pacman -S --noconfirm --needed gcc make git ripgrep fd unzip neovim +``` +
+ diff --git a/SETUP-GUIDE.md b/archive/SETUP-GUIDE.md similarity index 100% rename from SETUP-GUIDE.md rename to archive/SETUP-GUIDE.md diff --git a/TESTING.md b/archive/TESTING.md similarity index 100% rename from TESTING.md rename to archive/TESTING.md diff --git a/doc/kickstart.txt b/doc/kickstart.txt deleted file mode 100644 index cb87ac3f..00000000 --- a/doc/kickstart.txt +++ /dev/null @@ -1,24 +0,0 @@ -================================================================================ -INTRODUCTION *kickstart.nvim* - -Kickstart.nvim is a project to help you get started on your neovim journey. - - *kickstart-is-not* -It is not: -- Complete framework for every plugin under the sun -- Place to add every plugin that could ever be useful - - *kickstart-is* -It is: -- Somewhere that has a good start for the most common "IDE" type features: - - autocompletion - - goto-definition - - find references - - fuzzy finding - - and hinting at what more can be done :) -- A place to _kickstart_ your journey. - - You should fork this project and use/modify it so that it matches your - style and preferences. If you don't want to do that, there are probably - other projects that would fit much better for you (and that's great!)! - - vim:tw=78:ts=8:ft=help:norl: diff --git a/doc/tags b/doc/tags deleted file mode 100644 index 687ae772..00000000 --- a/doc/tags +++ /dev/null @@ -1,3 +0,0 @@ -kickstart-is kickstart.txt /*kickstart-is* -kickstart-is-not kickstart.txt /*kickstart-is-not* -kickstart.nvim kickstart.txt /*kickstart.nvim* diff --git a/docs/DOCUMENTATION-PLAN.md b/docs/DOCUMENTATION-PLAN.md new file mode 100644 index 00000000..cfa5c7aa --- /dev/null +++ b/docs/DOCUMENTATION-PLAN.md @@ -0,0 +1,316 @@ +# 📋 Documentation Plan & Status + +## ✅ Completed + +### 1. Changed to in Cheatsheet +- Updated `lua/plugins/core/cheatsheet.lua` +- All 105 instances of `` changed to `` +- Ensures consistency with which-key display + +### 2. Created New Professional README.md +- Location: `README.new.md` (ready to replace README.md) +- Features: Badges, features list, requirements, quick start +- Links to comprehensive documentation structure +- Professional appearance with emojis and formatting + +### 3. Created Documentation Structure +``` +docs/ +├── README.md # Main documentation index ✅ +├── getting-started/ +│ ├── README.md # Getting started overview ✅ +│ ├── installation.md # Detailed install steps (TODO) +│ ├── first-steps.md # First hour tutorial (TODO) +│ ├── quick-reference.md # Essential commands (TODO) +│ └── philosophy.md # Design principles (TODO) +├── keymaps/ +│ ├── README.md # Keymaps overview ✅ +│ ├── core.md # Leader key bindings (TODO) +│ ├── lsp.md # LSP commands (TODO) +│ ├── plugins.md # Plugin-specific (TODO) +│ ├── debug.md # Debug keymaps (TODO) +│ ├── consistency.md # Cross-plugin patterns ✅ (copied) +│ └── duplicates.md # Duplicate keys guide ✅ (copied) +├── plugins/ +│ ├── README.md # Plugins overview (TODO) +│ ├── core.md # Telescope, Neo-tree, which-key (TODO) +│ ├── editor.md # TreeSitter, mini.nvim, etc (TODO) +│ ├── lsp.md # LSP & completion (TODO) +│ ├── debug.md # nvim-dap (TODO) +│ ├── git.md # Git integration (TODO) +│ └── ui.md # UI enhancements (TODO) +├── languages/ +│ ├── README.md # Languages overview (TODO) +│ ├── flutter.md # Flutter/Dart guide (TODO) +│ ├── rust.md # Rust guide (TODO) +│ ├── python.md # Python guide (TODO) +│ ├── svelte.md # Svelte guide (TODO) +│ ├── typescript.md # TypeScript guide (TODO) +│ ├── go.md # Go guide (TODO) +│ └── others.md # Other languages (TODO) +├── vim-mastery/ +│ ├── README.md # Vim mastery overview ✅ +│ ├── week-01-motions.md # Motion basics ✅ +│ ├── week-02-text-objects.md # Text objects (TODO) +│ ├── week-03-advanced.md # Advanced editing (TODO) +│ ├── week-04-macros.md # Macros & registers (TODO) +│ ├── week-05-cmdline.md # Command line (TODO) +│ ├── week-06-windows.md # Windows & tabs (TODO) +│ ├── week-07-search.md # Search & replace (TODO) +│ ├── week-08-marks.md # Marks & jumps (TODO) +│ ├── tips-and-tricks.md # Productivity tips (TODO) +│ ├── workflows.md # Real-world patterns (TODO) +│ └── advanced.md # Advanced topics (TODO) +├── customization.md # Customization guide (TODO) +├── plugin-development.md # Plugin dev (TODO) +├── performance.md # Performance tuning (TODO) +├── troubleshooting.md # Troubleshooting (TODO) +├── migration.md # Migration guide (TODO) +└── faq.md # FAQ (TODO) +``` + +--- + +## 📝 Files to Remove/Consolidate + +### Remove (Redundant) +- `NEO-TREE-CHEATSHEET.md` - Incorporated into docs/keymaps/plugins.md +- `ORGANIZATION.md` - Internal planning doc, not needed for users + +### Move to Archive or Remove +- `TESTING.md` - Move to docs/development/ or remove +- `MIGRATION.md` - Move to docs/migration.md +- `SETUP-GUIDE.md` - Consolidate into docs/getting-started/installation.md +- `INSTALLATION.md` - Consolidate into docs/getting-started/installation.md + +### Keep but Update +- `LICENSE.md` - Keep at root +- `README.md` - Replace with README.new.md +- `lazy-lock.json` - Keep (Lazy.nvim uses this) + +--- + +## 🎯 Next Steps (Priority Order) + +### Phase 1: Core Documentation (High Priority) +1. **Replace README.md** with README.new.md +2. **Complete getting-started/** + - installation.md (consolidate INSTALLATION.md + SETUP-GUIDE.md) + - first-steps.md (interactive tutorial) + - quick-reference.md (one-page cheat sheet) + - philosophy.md (design decisions) + +3. **Complete keymaps/core.md** + - Consolidate KEYMAPS.md + - Organize by category + - Add examples + +4. **Complete keymaps/lsp.md** and **keymaps/plugins.md** + - Document all LSP keymaps + - Document Telescope, Neo-tree, Git, etc. + +### Phase 2: Plugin Documentation (Medium Priority) +5. **Create plugins/core.md** + - Telescope deep dive + - Neo-tree features + - which-key customization + +6. **Create plugins/lsp.md** and **plugins/debug.md** + - LSP configuration + - Mason setup + - Debug adapter setup + +### Phase 3: Language Guides (Medium Priority) +7. **Create language guides** + - flutter.md (full Flutter tools guide) + - rust.md (Crates.io integration) + - python.md (virtual envs, testing) + - Others as needed + +### Phase 4: Vim Mastery (Ongoing) +8. **Complete Vim mastery weeks 2-8** + - week-02-text-objects.md + - week-03-advanced.md + - week-04-macros.md + - week-05-cmdline.md + - week-06-windows.md + - week-07-search.md + - week-08-marks.md + +9. **Create supplementary guides** + - tips-and-tricks.md + - workflows.md + - advanced.md + +### Phase 5: Advanced Topics (Low Priority) +10. **Create advanced guides** + - customization.md + - plugin-development.md + - performance.md + - troubleshooting.md + - faq.md + +--- + +## 🎨 Documentation Style Guide + +### Writing Principles +1. **Clear and Concise**: Get to the point quickly +2. **Example-Driven**: Show, don't just tell +3. **Progressive Disclosure**: Basic → Intermediate → Advanced +4. **Actionable**: Every guide includes exercises +5. **Searchable**: Good headers, keywords, cross-references + +### Formatting Standards +- **Emojis for visual hierarchy**: 🎯 🔥 💡 ⚠️ 📚 +- **Code blocks with language**: ```vim, ```lua, ```bash +- **Tables for comparisons**: Keymap tables, feature matrices +- **Callouts**: Tips, Warnings, Notes +- **Navigation**: Links at top and bottom of every page + +### File Naming +- Use kebab-case: `week-01-motions.md` +- Be descriptive: `lsp-configuration.md` not `lsp.md` +- Group by prefix: `week-01-`, `week-02-`, etc. + +--- + +## 📊 Estimated Completion Times + +### Already Done (4 hours) +- ✅ Cheatsheet +- ✅ README.new.md +- ✅ docs/README.md +- ✅ docs/getting-started/README.md +- ✅ docs/keymaps/README.md +- ✅ docs/vim-mastery/README.md +- ✅ docs/vim-mastery/week-01-motions.md +- ✅ Copied consistency.md and duplicates.md + +### Phase 1 (8 hours) +- getting-started/ guides (4 hours) +- keymaps/core.md (2 hours) +- keymaps/lsp.md (1 hour) +- keymaps/plugins.md (1 hour) + +### Phase 2 (6 hours) +- plugins/ guides (6 hours total) + +### Phase 3 (8 hours) +- language guides (8 hours total) + +### Phase 4 (12 hours) +- Vim mastery weeks 2-8 (9 hours) +- tips/workflows/advanced (3 hours) + +### Phase 5 (6 hours) +- Advanced topics (6 hours) + +**Total Estimated**: ~44 hours of documentation writing + +--- + +## 🎯 Immediate Action Items + +### Right Now +1. **Backup old README.md** + ```bash + mv README.md README.old.md + mv README.new.md README.md + ``` + +2. **Remove redundant files** + ```bash + rm NEO-TREE-CHEATSHEET.md + rm ORGANIZATION.md + ``` + +3. **Clean up root directory** + ```bash + mkdir archive + mv KEYMAPS.md archive/ + mv CONSISTENCY.md archive/ # Now in docs/keymaps/ + mv DUPLICATES.md archive/ # Now in docs/keymaps/ + ``` + +### Next Session +4. **Write getting-started/installation.md** + - Consolidate INSTALLATION.md and SETUP-GUIDE.md + - Add macOS, Linux, Windows sections + - Include troubleshooting + +5. **Write getting-started/first-steps.md** + - Interactive 30-minute tutorial + - Essential keymaps only + - Real code examples + +6. **Write getting-started/quick-reference.md** + - One-page PDF-printable guide + - 50 most-used commands + - Organized by category + +--- + +## 💡 Content Sources + +### From Existing Files +- KEYMAPS.md → docs/keymaps/core.md +- CONSISTENCY.md → docs/keymaps/consistency.md ✅ +- DUPLICATES.md → docs/keymaps/duplicates.md ✅ +- INSTALLATION.md + SETUP-GUIDE.md → docs/getting-started/installation.md +- lua/ plugin files → docs/plugins/ and docs/languages/ + +### From Configuration +- lua/config/keymaps.lua → keymap docs +- lua/plugins/ → plugin guides +- lua/plugins/lang/ → language guides +- Comments in code → feature documentation + +### Original Content Needed +- Vim mastery guides (weeks 2-8) +- Tips and tricks +- Workflows +- Troubleshooting +- FAQ +- Customization guide + +--- + +## 🔄 Maintenance Plan + +### Weekly +- Update any changed keymaps +- Add new plugin documentation +- Review and improve based on feedback + +### Monthly +- Check all links still work +- Update screenshots if needed +- Add new tips discovered + +### Per Release +- Update version numbers +- Document new features +- Archive old migration guides + +--- + +## 🎊 Success Criteria + +Documentation is complete when: +- ✅ New users can install and be productive in 1 hour +- ✅ All keymaps are documented with examples +- ✅ All plugins have usage guides +- ✅ Complete Vim mastery path (8 weeks) +- ✅ Troubleshooting covers common issues +- ✅ Users say "I found it in the docs" instead of asking + +--- + +
+ +**Documentation is a journey, not a destination!** + +This plan provides the structure. Now we execute, one file at a time. + +
diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 00000000..f69497a5 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,256 @@ +# 📚 Complete Documentation Guide + +Welcome to the comprehensive documentation for this Neovim configuration. This guide is organized to help you progress from beginner to advanced user. + +--- + +## 🗺️ Documentation Structure + +### 🚀 Getting Started +**Start here if you're new or just installed the config** + +- [**Installation**](getting-started/installation.md) - Step-by-step setup guide +- [**First Steps**](getting-started/first-steps.md) - Your first hour with this config +- [**Quick Reference**](getting-started/quick-reference.md) - Essential commands cheat sheet +- [**Philosophy**](getting-started/philosophy.md) - Design principles and organization + +### ⌨️ Keymaps +**Complete keymap documentation with examples** + +- [**Overview**](keymaps/README.md) - Keymap organization philosophy +- [**Core Keymaps**](keymaps/core.md) - Leader key bindings (buffer, window, search, etc.) +- [**LSP Keymaps**](keymaps/lsp.md) - Language Server Protocol commands +- [**Plugin Keymaps**](keymaps/plugins.md) - Telescope, Neo-tree, Git, etc. +- [**Debug Keymaps**](keymaps/debug.md) - Debugging commands +- [**Duplicates Guide**](keymaps/duplicates.md) - Understanding multiple keys for same action +- [**Consistency Guide**](keymaps/consistency.md) - Cross-plugin key patterns + +### 🔌 Plugins +**Understanding each plugin and how to use it** + +- [**Overview**](plugins/README.md) - All plugins explained +- [**Core Plugins**](plugins/core.md) - Telescope, Neo-tree, which-key, lazy.nvim +- [**Editor Plugins**](plugins/editor.md) - TreeSitter, mini.nvim, autopairs, etc. +- [**LSP & Completion**](plugins/lsp.md) - Language servers, nvim-cmp, snippets +- [**Debug Adapter**](plugins/debug.md) - nvim-dap setup and usage +- [**Git Integration**](plugins/git.md) - Gitsigns, LazyGit, fugitive +- [**UI Enhancements**](plugins/ui.md) - Colorscheme, statusline, bufferline + +### 💻 Language Setup +**Language-specific configuration and features** + +- [**Overview**](languages/README.md) - All supported languages +- [**Flutter/Dart**](languages/flutter-dart.md) - Flutter tools, device management, hot reload +- [**Rust**](languages/rust.md) - rust-analyzer, Crates.io integration +- [**Python**](languages/python.md) - Pyright, virtual environments, testing +- [**Svelte**](languages/svelte.md) - Svelte LSP, web development +- [**TypeScript/JavaScript**](languages/typescript.md) - tsserver, ESLint, Prettier +- [**Go**](languages/go.md) - gopls, testing, debugging +- [**Other Languages**](languages/others.md) - Lua, JSON, YAML, Markdown, etc. + +### 🎓 Vim Mastery +**Progressive learning path to master Vim** + +- [**Overview**](vim-mastery/README.md) - Learning philosophy and roadmap +- [**Week 1: Motion Basics**](vim-mastery/week-01-motions.md) - hjkl, word motions, searching +- [**Week 2: Text Objects**](vim-mastery/week-02-text-objects.md) - iw, ap, at, etc. +- [**Week 3: Advanced Editing**](vim-mastery/week-03-advanced.md) - Visual mode, macros intro +- [**Week 4: Macros & Registers**](vim-mastery/week-04-macros.md) - Recording and replay +- [**Week 5: Command Line**](vim-mastery/week-05-cmdline.md) - Ex commands, ranges, substitution +- [**Week 6: Windows & Tabs**](vim-mastery/week-06-windows.md) - Managing your workspace +- [**Tips & Tricks**](vim-mastery/tips-and-tricks.md) - Productivity boosters +- [**Workflows**](vim-mastery/workflows.md) - Real-world editing patterns +- [**Advanced Topics**](vim-mastery/advanced.md) - Vim script, Lua, custom commands + +### 🛠️ Advanced Topics + +- [**Customization**](customization.md) - Make this config your own +- [**Plugin Development**](plugin-development.md) - Create your own plugins +- [**Performance Tuning**](performance.md) - Optimize startup time +- [**Troubleshooting**](troubleshooting.md) - Common issues and solutions +- [**Migration Guide**](migration.md) - Coming from other configs +- [**FAQ**](faq.md) - Frequently asked questions + +--- + +## 📖 How to Use This Documentation + +### For Beginners +1. Start with [Getting Started](getting-started/README.md) +2. Learn [Quick Reference](getting-started/quick-reference.md) commands +3. Follow [Vim Mastery Week 1](vim-mastery/week-01-motions.md) +4. Use the [in-editor cheatsheet](#in-editor-help) constantly + +### For Intermediate Users +1. Review [Keymaps documentation](keymaps/README.md) to discover new commands +2. Explore [Plugin guides](plugins/README.md) for advanced features +3. Continue [Vim Mastery](vim-mastery/README.md) progression +4. Learn language-specific features in [Languages](languages/README.md) + +### For Advanced Users +1. Study [Customization](customization.md) to extend the config +2. Optimize with [Performance Tuning](performance.md) +3. Master [Advanced Topics](vim-mastery/advanced.md) +4. Contribute improvements back to the project + +--- + +## 🎯 In-Editor Help + +You don't need to leave Neovim to access help: + +### Built-in Cheatsheet +- `sc` - Comprehensive searchable cheatsheet (200+ keymaps) +- `sk` - Telescope keymap search +- `?` - Quick keymap fuzzy search +- `sK` - Which-key command palette + +### Context-Sensitive Help +- `K` - Hover documentation (LSP) +- `k` - Signature help +- `?` (in Telescope/Neo-tree) - Show plugin-specific help +- `:help ` - Vim's built-in help system + +### Discovery Tools +- Press `` and wait - which-key shows all available keymaps +- Press `g` and wait - see all "go to" commands +- Press `]` or `[` and wait - see all next/previous commands + +--- + +## 💡 Learning Philosophy + +This documentation follows a **progressive disclosure** approach: + +1. **Start Simple**: Basic commands to be productive immediately +2. **Build Gradually**: Add one new technique per week +3. **Practice Deliberately**: Focus on mastering before moving on +4. **Apply Immediately**: Use new skills in real work +5. **Iterate**: Return to earlier topics with new understanding + +### The One-Trick-Per-Week Method + +Instead of trying to learn everything at once: +- Pick ONE new command/technique each week +- Use it consciously until it becomes muscle memory +- Track your progress in [Vim Mastery](vim-mastery/README.md) +- After a year, you'll have 52 new tricks! + +--- + +## 🗺️ Learning Paths + +### Path 1: Productive in One Day +*Goal: Get work done immediately* + +1. [Installation](getting-started/installation.md) - 30 min +2. [Quick Reference](getting-started/quick-reference.md) - 15 min +3. [Core Keymaps](keymaps/core.md) - Learn `sf`, `sg`, `bb` +4. Start coding with LSP features (K, gra, gd) + +### Path 2: Vim Proficiency in 6 Weeks +*Goal: Become efficient with Vim motions* + +1. Week 1: [Motion Basics](vim-mastery/week-01-motions.md) +2. Week 2: [Text Objects](vim-mastery/week-02-text-objects.md) +3. Week 3: [Advanced Editing](vim-mastery/week-03-advanced.md) +4. Week 4: [Macros & Registers](vim-mastery/week-04-macros.md) +5. Week 5: [Command Line](vim-mastery/week-05-cmdline.md) +6. Week 6: [Windows & Tabs](vim-mastery/week-06-windows.md) + +### Path 3: Master All Features +*Goal: Unlock the full power of this config* + +1. Complete Path 2 (Vim Proficiency) +2. Deep dive into [All Plugins](plugins/README.md) +3. Master your primary language setup +4. Learn [Advanced Workflows](vim-mastery/workflows.md) +5. Customize and extend ([Customization Guide](customization.md)) + +--- + +## 🎓 Recommended External Resources + +### Books +- **Practical Vim** by Drew Neil - The best Vim book +- **Modern Vim** by Drew Neil - Neovim-specific features +- **Learning the Vi and Vim Editors** - Comprehensive reference + +### Video Courses +- **ThePrimeagen's Vim Course** - Entertaining and informative +- **Vim Casts** - Short, focused video tutorials +- **TJ DeVries' Neovim YouTube** - Creator of kickstart.nvim + +### Interactive Learning +- **vimtutor** - Run `:Tutor` in Neovim +- **Vim Adventures** - Game to learn Vim +- **OpenVim** - Interactive tutorial + +### Community +- **r/neovim** - Reddit community +- **Neovim Discourse** - Official forum +- **Matrix/Discord** - Real-time chat + +--- + +## 📝 Documentation Conventions + +### Notation +- `` - Your leader key (default: Space) +- `` - Control + x +- `` - Alt/Meta + x +- `` - Enter/Return key +- `{motion}` - Any motion command (w, e, $, etc.) +- `[count]` - Optional number prefix + +### Visual Cues +- 💡 **Tip** - Helpful suggestion +- ⚠️ **Warning** - Important caution +- 📌 **Note** - Additional information +- 🎯 **Pro Tip** - Advanced technique +- 🔍 **Example** - Practical demonstration + +--- + +## 🔄 Keeping Documentation Updated + +This documentation evolves with the configuration: + +- **Check for updates**: `git pull` in `~/.config/nvim` +- **Version**: Documentation matches config version +- **Feedback**: Open issues for unclear docs +- **Contribute**: Submit PRs for improvements + +--- + +## 🎯 Quick Navigation + +### By Topic +- **Need to find a file?** → [Telescope Guide](plugins/core.md#telescope) +- **Want to understand a keymap?** → [Keymaps Overview](keymaps/README.md) +- **LSP not working?** → [Troubleshooting LSP](troubleshooting.md#lsp-issues) +- **Adding a language?** → [Language Setup](languages/README.md) +- **Config too slow?** → [Performance Tuning](performance.md) + +### By Skill Level +- **Beginner** → [Getting Started](getting-started/README.md) +- **Intermediate** → [Vim Mastery](vim-mastery/README.md) +- **Advanced** → [Customization](customization.md) + +### By Plugin +- [Telescope](plugins/core.md#telescope) +- [Neo-tree](plugins/core.md#neo-tree) +- [which-key](plugins/core.md#which-key) +- [nvim-cmp](plugins/lsp.md#completion) +- [nvim-dap](plugins/debug.md) +- [Gitsigns](plugins/git.md) + +--- + +
+ +**Happy Coding! 🚀** + +[Back to Main README](../README.md) | [Get Started →](getting-started/README.md) + +
diff --git a/docs/getting-started/README.md b/docs/getting-started/README.md new file mode 100644 index 00000000..55888323 --- /dev/null +++ b/docs/getting-started/README.md @@ -0,0 +1,195 @@ +# 🚀 Getting Started + +Welcome! This guide will help you get up and running with this Neovim configuration. + +--- + +## 📚 Guide Structure + +1. **[Installation](installation.md)** - Set up Neovim and this configuration +2. **[First Steps](first-steps.md)** - Your first hour with the config +3. **[Quick Reference](quick-reference.md)** - Essential commands you'll use daily +4. **[Philosophy](philosophy.md)** - Understanding the design principles + +--- + +## ⚡ Quick Start (5 Minutes) + +### 1. Install Neovim 0.11.4+ +```bash +# macOS +brew install neovim + +# Ubuntu/Debian +sudo apt install neovim + +# Arch Linux +sudo pacman -S neovim +``` + +### 2. Backup Old Config +```bash +mv ~/.config/nvim ~/.config/nvim.backup +mv ~/.local/share/nvim ~/.local/share/nvim.backup +``` + +### 3. Clone This Config +```bash +git clone https://github.com/anupjsebastian/kickstart.nvim.git ~/.config/nvim +``` + +### 4. Install Dependencies +```bash +# macOS +brew install ripgrep fd + +# Ubuntu +sudo apt install ripgrep fd-find + +# Arch +sudo pacman -S ripgrep fd +``` + +### 5. Launch Neovim +```bash +nvim +``` + +Wait for all plugins to install (watch bottom right corner). + +### 6. Verify Everything Works +```vim +:checkhealth +``` + +--- + +## 🎯 What You'll Learn + +### Immediate (Day 1) +- Opening and editing files +- Basic navigation with Telescope +- Using LSP features (autocomplete, go to definition) +- Essential keymaps you'll use every day + +### Short Term (Week 1) +- Vim motion basics +- Using the file explorer (Neo-tree) +- Git integration +- Debugging basics + +### Medium Term (Month 1) +- Advanced Vim motions and text objects +- Customizing keymaps +- Language-specific features +- Efficient workflows + +### Long Term (Ongoing) +- Mastering Vim commands +- Building your own plugins +- Optimizing your workflow +- One new trick per week approach + +--- + +## 🗺️ Learning Path + +``` +Installation (15 min) + ↓ +First Steps (30 min) - Learn the absolute basics + ↓ +Quick Reference (ongoing) - Your daily command sheet + ↓ +Week 1: Basic Motions - hjkl, word motions, searching + ↓ +Week 2: Text Objects - iw, ap, it, edit intelligently + ↓ +Week 3: Advanced Editing - Visual mode, macros + ↓ +Continue with Vim Mastery guides... +``` + +--- + +## 💡 Key Concepts + +### Leader Key = Space +Almost all custom keymaps start with `` (the Space key). Press Space and wait - you'll see a menu! + +### Which-key is Your Friend +When you press a key prefix (like `` or `g`), a menu appears showing all available commands. + +### Everything is Searchable +- Files: `sf` +- Text: `sg` +- Keymaps: `sc` +- Help: `sh` + +### LSP Powers Your Editing +- `K` - Documentation +- `gd` - Go to definition +- `gr` - Find references +- `gra` - Code actions + +--- + +## 🆘 Getting Help + +### In-Editor +- `sc` - Comprehensive cheatsheet +- `sk` - Search all keymaps +- `` (wait) - Which-key menu +- `:help ` - Vim help + +### External +- [Full Documentation](../README.md) +- [Troubleshooting Guide](../troubleshooting.md) +- [FAQ](../faq.md) +- [GitHub Issues](https://github.com/anupjsebastian/kickstart.nvim/issues) + +--- + +## ⚠️ Common First-Day Issues + +### Plugins Not Installing +```vim +:Lazy sync +``` + +### LSP Not Working +```vim +:Mason +:LspInfo +:checkhealth +``` + +### Fonts Look Broken +Install a [Nerd Font](https://www.nerdfonts.com/) and set `vim.g.have_nerd_font = true` in `init.lua`. + +### Keymaps Not Working +Check your terminal doesn't intercept keys: +```vim +:checkhealth which-key +``` + +--- + +## 🎓 Next Steps + +1. Complete [Installation Guide](installation.md) +2. Follow [First Steps Tutorial](first-steps.md) +3. Bookmark [Quick Reference](quick-reference.md) +4. Start [Vim Mastery Week 1](../vim-mastery/week-01-motions.md) + +--- + +
+ +**Ready to dive in?** + +[Installation Guide →](installation.md) + +[Back to Documentation](../README.md) | [Back to Main README](../../README.md) + +
diff --git a/docs/keymaps/README.md b/docs/keymaps/README.md new file mode 100644 index 00000000..ff148291 --- /dev/null +++ b/docs/keymaps/README.md @@ -0,0 +1,226 @@ +# ⌨️ Keymaps Reference + +Complete guide to all keymaps in this configuration, organized by category. + +--- + +## 📋 Quick Navigation + +- **[Core Keymaps](core.md)** - Leader-key organization (buffer, window, search, git, etc.) +- **[LSP Keymaps](lsp.md)** - Language Server Protocol commands +- **[Plugin Keymaps](plugins.md)** - Telescope, Neo-tree, Git, Debug +- **[Duplicates Guide](duplicates.md)** - Understanding multiple keys for same action +- **[Consistency Guide](consistency.md)** - Cross-plugin key patterns + +--- + +## 🎯 Keymap Philosophy + +### 1. Leader-Based Organization +Almost all custom keymaps start with `` (Space key): +- `b` - **Buffer** operations +- `s` - **Search** (Telescope) +- `f` - **Flutter** (Dart files) +- `r` - **Rust** operations +- `d` - **Debug** commands +- `g` - **Git** operations +- And more... + +### 2. Mnemonic Design +Keys are chosen to be memorable: +- `sf` = **S**earch **F**iles +- `bb` = **B**uffer **B**rowse +- `gg` = Open Lazy**G**it +- `db` = **D**ebug **B**reakpoint + +### 3. Which-key Discovery +Press `` and wait - a menu shows all available commands! + +### 4. Consistent Across Plugins +Same keys work the same way everywhere: +- `Ctrl-x` = Horizontal split (Telescope, Neo-tree) +- `Ctrl-v` = Vertical split (Telescope, Neo-tree) +- `Ctrl-t` = New tab (Telescope, Neo-tree) +- `?` = Show help (Telescope, Neo-tree) + +--- + +## 🗺️ Keymap Categories + +### Core Editor +| Prefix | Category | Example | +|--------|----------|---------| +| `b` | Buffer operations | `bd` = Delete buffer | +| `w` | Window operations | `wv` = Vertical split | +| `u` | UI toggles | `uw` = Toggle wrap | +| `s` | Search/Telescope | `sf` = Find files | +| `g` | Git operations | `gg` = LazyGit | + +### LSP (Language Features) +| Prefix | Category | Example | +|--------|----------|---------| +| `gr*` | Go to... | `grd` = Go to definition | +| `K` | Hover | `K` = Show documentation | +| `c` | Code | `ca` = Code actions | + +### Debug +| Prefix | Category | Example | +|--------|----------|---------| +| `d` | Debug commands | `db` = Breakpoint | +| `F5-F12` | Debug quick keys | `F5` = Continue | + +### Language-Specific +| Prefix | Language | Example | +|--------|----------|---------| +| `f` | Flutter/Dart | `fr` = Run app | +| `r` | Rust | `ra` = Code actions | +| `rc` | Rust Crates | `rct` = Toggle | +| `p` | Python | `pr` = Run | +| `v` | Svelte | `vf` = Format | + +--- + +## 📚 Detailed Documentation + +### [Core Keymaps](core.md) +Complete reference for all leader-key bindings: +- Buffer management +- Window operations +- Search/Telescope +- Git integration +- UI toggles +- Session management + +### [LSP Keymaps](lsp.md) +Language Server Protocol commands that work in all languages: +- Go to definition, references, implementation +- Hover documentation +- Rename symbol +- Code actions +- Signature help +- Diagnostics navigation + +### [Plugin Keymaps](plugins.md) +Plugin-specific keymaps: +- **Telescope**: Fuzzy finding, live grep, file browser +- **Neo-tree**: File explorer navigation and operations +- **Git**: Gitsigns hunks, staging, blame +- **Debug**: nvim-dap debugging commands +- **Mini.nvim**: Surround, comments, pairs + +### [Duplicates Guide](duplicates.md) +Understanding why some actions have multiple keymaps: +- Vim defaults + modern alternatives +- Function keys + leader keys for debugging +- Single keys + Ctrl combos for consistency +- Default plugin keys + consistent alternatives + +### [Consistency Guide](consistency.md) +Cross-plugin key patterns: +- Same split/tab keys in Telescope and Neo-tree +- Consistent navigation patterns +- Unified help access + +--- + +## 🎓 Learning Strategy + +### Week 1: Essential Commands +Focus on these 10 keymaps: +1. `sf` - Find files +2. `sg` - Search text (grep) +3. `bb` - Browse buffers +4. `\` - Toggle file explorer +5. `gd` - Go to definition +6. `K` - Show documentation +7. `ca` - Code actions +8. `gg` - Git interface +9. `` - Switch windows +10. `sc` - Open cheatsheet! + +### Week 2: Expand Your Arsenal +Add these: +- `s/` - Search in open files +- `bd` - Delete buffer +- `wv` - Split vertical +- `gr` - Find references +- `[d` / `]d` - Next/prev diagnostic + +### Ongoing: One Per Week +Pick ONE new keymap each week from the [full documentation](core.md) and practice it until it's muscle memory. + +--- + +## 🔍 Finding Keymaps + +### In-Editor Tools +```vim +" Comprehensive searchable cheatsheet +sc + +" Search all keymaps with Telescope +sk + +" Which-key command palette +sK + +" Quick fuzzy search +? + +" Press any prefix and wait + " Shows all leader keymaps +g " Shows all 'go to' commands +[ " Shows all 'next' commands +] " Shows all 'previous' commands +``` + +### By Category +- **Buffer commands**: `b` (then wait for menu) +- **Search commands**: `s` (then wait) +- **Git commands**: `g` (then wait) +- **Debug commands**: `d` (then wait) + +### By Plugin +Inside a plugin (like Telescope or Neo-tree), press `?` for help. + +--- + +## 💡 Tips + +### Discovering Features +1. Press `` and wait - explore the which-key menu +2. Open cheatsheet with `sc` and search +3. Check plugin-specific help with `?` + +### Customizing Keymaps +See [Customization Guide](../customization.md) to: +- Change existing keymaps +- Add your own keymaps +- Disable unwanted keymaps + +### Resolving Conflicts +If a keymap doesn't work: +```vim +:verbose map sf +:checkhealth which-key +``` + +--- + +## 📖 External Resources + +- [Vim Cheat Sheet](https://vim.rtorr.com/) +- [Interactive Vim Tutorial](https://www.openvim.com/) +- [Practical Vim Book](https://pragprog.com/titles/dnvim2/practical-vim-second-edition/) + +--- + +
+ +**Master your keymaps, master your editor!** + +[Core Keymaps →](core.md) | [LSP Keymaps →](lsp.md) | [Plugin Keymaps →](plugins.md) + +[Back to Documentation](../README.md) + +
diff --git a/docs/keymaps/consistency.md b/docs/keymaps/consistency.md new file mode 100644 index 00000000..a57c2c52 --- /dev/null +++ b/docs/keymaps/consistency.md @@ -0,0 +1,82 @@ +# Keymap Consistency Guide + +> **Last Updated:** November 1, 2025 +> **Purpose:** Document consistent keymaps across Telescope and Neo-tree + +## 🎯 Consistent Actions + +The following keymaps work **identically** in both Telescope and Neo-tree: + +### File Opening Actions + +| Key | Action | Telescope | Neo-tree | +|-----|--------|-----------|----------| +| `` or `o` | Open in current window | ✅ | ✅ | +| `` | Open in horizontal split | ✅ | ✅ | +| `` | Open in vertical split | ✅ | ✅ | +| `` | Open in new tab | ✅ | ✅ | + +### Navigation + +| Key | Action | Telescope | Neo-tree | +|-----|--------|-----------|----------| +| `` | Next item/source | ✅ | ✅ | +| `` | Previous item/source | ✅ | ✅ | +| `j/k` (normal mode) | Down/Up | ✅ | ✅ | +| `gg/G` (normal mode) | First/Last | ✅ | ✅ | + +### Utility + +| Key | Action | Telescope | Neo-tree | +|-----|--------|-----------|----------| +| `?` | Show help | ✅ | ✅ | +| `` or `q` | Close | ✅ | ✅ (`\\` for Neo-tree) | + +### Cross-Plugin Integration + +| Key | Action | Context | +|-----|--------|---------| +| `sf` | Telescope find files | Works in both editor and Neo-tree | +| `sg` | Telescope live grep | Works in both editor and Neo-tree | + +When used in Neo-tree, these commands search from the currently selected directory! + +## 📚 Complete Cheatsheet Access + +Access the comprehensive cheatsheet with: + +``` +sc - Complete cheatsheet (vim, plugins, language-specific) +sk - Search keymaps (Telescope) +sK - All keymaps (which-key) +? - Quick keymap search +``` + +## 🎨 Visual Consistency + +Both Telescope and Neo-tree now follow the same pattern: +- **Same keys** for same actions +- **Predictable behavior** across interfaces +- **Integrated workflows** (use Telescope from Neo-tree) +- **Help always available** with `?` + +## 📝 Quick Reference + +### In Telescope: +1. `` to navigate +2. `` to open in split/vsplit/tab +3. `` to open in current window +4. `?` for help + +### In Neo-tree: +1. `` to switch sources +2. `` to open in split/vsplit/tab +3. `` or `o` to open file +4. `?` for help +5. `sf/sg` to launch Telescope from current directory + +### Both Share: +- Consistent split/tab opening +- Same navigation philosophy +- Integrated search capabilities +- Help on demand diff --git a/docs/keymaps/duplicates.md b/docs/keymaps/duplicates.md new file mode 100644 index 00000000..0406cae9 --- /dev/null +++ b/docs/keymaps/duplicates.md @@ -0,0 +1,90 @@ +# Duplicate Keymaps Reference + +This document lists all keymaps where the same action can be performed using multiple key combinations. + +## Philosophy + +Having duplicate keymaps is **intentional and beneficial**: +- **Vim defaults + Modern alternatives**: Keep familiar vim keys while adding intuitive modern ones +- **Consistency across plugins**: Same keys work the same way in Telescope and Neo-tree +- **Ergonomics**: Function keys (F5-F12) AND leader keys for debugging +- **Context switching**: Use what feels natural in different workflows + +## Debug Actions + +| Action | Keys | Notes | +|--------|------|-------| +| Continue | `F5` or `dc` | F5 is standard in many IDEs | +| Step over | `F10` or `dO` | Uppercase O for over | +| Step into | `F11` or `di` | | +| Step out | `F12` or `do` | Lowercase o for out | + +**Why duplicates?** Function keys are muscle memory from other IDEs. Leader keys are more discoverable via which-key and don't conflict with terminal function keys. + +## Neo-tree vs Consistent Actions + +| Action | Neo-tree Default | Consistent Alternative | Notes | +|--------|------------------|------------------------|-------| +| Vertical split | `s` | `Ctrl-v` | Matches Telescope | +| Horizontal split | `S` | `Ctrl-x` | Matches Telescope | +| New tab | `t` | `Ctrl-t` | Matches Telescope | +| Next source | `>` | `Ctrl-j` | Matches Telescope navigation | +| Previous source | `<` | `Ctrl-k` | Matches Telescope navigation | +| Close window | `q` | `\` or `Esc` | Backslash mirrors toggle | +| Open file | `` | `o` | Two ways to open | + +**Why duplicates?** Neo-tree defaults are efficient single-key presses. Consistent alternatives (`Ctrl-x/v/t/j/k`) work the same way in Telescope, reducing cognitive load when switching between file finder and file tree. + +## Flutter Code Actions + +| Action | Keys | Notes | +|--------|------|-------| +| Code actions | `.` or `gra` | Period mimics Cmd+. in IDEs, gra is standard LSP | + +**Why duplicates?** Flutter developers coming from IDEs expect `.` (like Cmd+.). `gra` is the standard LSP keymap used everywhere else. + +## Telescope Navigation + +| Action | Keys | Notes | +|--------|------|-------| +| Next/prev item | `Ctrl-j/k` or `j/k` (normal) | Insert mode uses Ctrl, normal mode uses plain | +| Close | `Ctrl-c` or `Esc` or `q` (normal) | Three ways to exit | + +**Why duplicates?** `Ctrl-j/k` work in insert mode without switching modes. In normal mode, plain `j/k` are more natural. + +## Vim Defaults + +| Action | Keys | Notes | +|--------|------|-------| +| Save and quit | `:wq` or `ZZ` | ZZ is faster | +| Quit without save | `:q!` or `ZQ` | ZQ is faster | + +**Why duplicates?** Both are vim defaults. ZZ/ZQ are faster but less discoverable. + +## Summary of Duplicate Patterns + +1. **Debug**: F-keys + Leader keys (muscle memory from IDEs + discoverability) +2. **Splits/Tabs**: Single keys + Ctrl combos (efficiency + consistency) +3. **Navigation**: Plain + Ctrl variants (context-dependent ergonomics) +4. **Close/Exit**: Multiple keys (q, Esc, Ctrl-c, \\) (different mental models) + +## Design Principles + +1. **Never remove defaults** unless they conflict +2. **Add consistent alternatives** that work across plugins +3. **Document all options** so users can choose their preferred style +4. **Optimize for discoverability** (leader keys show in which-key) +5. **Respect muscle memory** (keep vim and IDE conventions) + +## Quick Reference: Cross-Plugin Consistency + +These keys work the same way in **both Telescope and Neo-tree**: + +- `Ctrl-x` → Horizontal split +- `Ctrl-v` → Vertical split +- `Ctrl-t` → New tab +- `Ctrl-j` → Next/down +- `Ctrl-k` → Previous/up +- `?` → Show help + +This consistency means once you learn these in one plugin, they work the same everywhere. diff --git a/docs/languages/flutter-dart.md b/docs/languages/flutter-dart.md new file mode 100644 index 00000000..f21a17fa --- /dev/null +++ b/docs/languages/flutter-dart.md @@ -0,0 +1,295 @@ +# Flutter & Dart Development + +Complete reference for Flutter and Dart development in Neovim. + +## Quick Start + +1. Open any `.dart` file to activate Flutter tools +2. Select device: `fd` +3. Run app: `fr` +4. Hot reload during development: `fh` + +## Essential Keymaps + +### App Lifecycle + +| Key | Command | Description | +|-----|---------|-------------| +| `fr` | FlutterRun | Run the app (auto-selects last used device) | +| `fh` | FlutterReload | Hot reload (faster, preserves state) | +| `fR` | FlutterRestart | Hot restart (full reload, resets state) | +| `fq` | FlutterQuit | Stop the running app | + +**Workflow**: First time, use `fd` to select a device, then `fr` to run. Subsequent runs remember your device. + +### Device Management + +| Key | Command | Description | +|-----|---------|-------------| +| `fd` | FlutterDevices | List and select connected devices | +| `fe` | FlutterEmulators | Launch an emulator | +| `fa` | FlutterAttach | Attach to an already running app | +| `fD` | FlutterDetach | Detach from app (keeps it running) | + +### Developer Tools + +| Key | Command | Description | +|-----|---------|-------------| +| `ft` | FlutterDevTools | Start Dart DevTools server | +| `fc` | FlutterCopyProfilerUrl | Copy profiler URL to clipboard | +| `fo` | FlutterOutlineToggle | Toggle widget tree outline | +| `fL` | FlutterLogToggle | Show/hide application logs | + +**DevTools Workflow**: +1. Run your app: `fr` +2. Start DevTools: `ft` +3. Copy profiler URL: `fc` +4. Open URL in browser for full DevTools experience + +### Code Actions & Refactoring + +| Key | Command | Description | +|-----|---------|-------------| +| `.` | Code Actions | Quick actions (like Cmd+. in VS Code) | +| `gra` | Code Actions | Alternative LSP keymap | + +**Common Code Actions**: +- Wrap widget with Padding, Center, Column, etc. +- Remove widget (unwrap) +- Extract widget to new class +- Extract method +- Add import +- Organize imports + +### LSP & Language Server + +| Key | Command | Description | +|-----|---------|-------------| +| `fl` | FlutterLspRestart | Restart Dart language server | +| `K` | Hover | Show documentation | +| `grd` | Go to Definition | Jump to definition | +| `grr` | Go to References | Find all references | +| `grn` | Rename | Rename symbol | + +## Flutter-Specific Features + +### Widget Tree Outline + +The outline window shows your widget tree structure: + +``` +fo # Toggle outline window +``` + +The outline updates as you edit and shows: +- Widget hierarchy +- Widget types +- Quick navigation to widgets + +### Closing Tags + +Automatically shows closing tags for deeply nested widgets: + +```dart +Container( // Container + child: Column( // Column + children: [ + Text('Hello'), + Text('World'), + ], + ), // Column +), // Container +``` + +### Color Preview + +Material Design colors show inline preview: + +```dart +Colors.red # Shows red color indicator +Color(0xFF42A5F5) # Shows the actual color +``` + +### Hot Reload vs Hot Restart + +| Hot Reload (`fh`) | Hot Restart (`fR`) | +|---------------------------|---------------------------| +| Fast (< 1 second) | Slower (few seconds) | +| Preserves app state | Resets app state | +| UI changes only | Can handle code structure changes | +| Use during active development | Use after changing initState, constructors | + +## Debugging + +### Debug Keymaps + +Available when debugging (after `` or breakpoint hit): + +| Key | Description | +|-----|-------------| +| `F5` | Start/Continue | +| `F10` | Step over | +| `F11` | Step into | +| `F12` | Step out | +| `db` | Toggle breakpoint | +| `dB` | Conditional breakpoint | +| `dt` | Terminate debug session | +| `dr` | Toggle REPL | +| `du` | Toggle debug UI | + +### Debug Workflow + +1. Set breakpoints: Position cursor, press `db` +2. Start debugging: `F5` (launches app in debug mode) +3. App pauses at breakpoint +4. Inspect variables in debug UI panels +5. Step through code: `F10`, `F11`, `F12` +6. Continue execution: `F5` + +### Debug UI Panels + +When debugging starts, you get: +- **Scopes**: Local and global variables +- **Breakpoints**: All breakpoints in your project +- **Call Stack**: Function call hierarchy +- **Watches**: Custom expressions to monitor +- **REPL**: Evaluate Dart expressions live +- **Console**: Debug output and print statements + +## Logs + +``` +fL # Toggle log buffer +``` + +The log buffer shows: +- `print()` statements +- Flutter framework messages +- Hot reload/restart confirmations +- Error messages and stack traces + +## Tips & Tricks + +### Fast Development Loop + +``` +1. Make UI changes +2. fh for instant hot reload +3. See changes immediately +4. Repeat +``` + +### When Hot Reload Fails + +If hot reload shows unexpected behavior: + +``` +fR # Hot restart (full reload) +``` + +If issues persist: + +``` +fq # Quit app +fl # Restart LSP +fr # Run again +``` + +### Multiple Devices + +Switch between devices without restarting: + +``` +fq # Quit current +fd # Select new device +fr # Run on new device +``` + +### Widget Extraction + +To extract a widget to a new class: + +1. Visual select the widget code +2. Press `.` or `gra` +3. Choose "Extract Widget" +4. Enter new widget name + +### Attach to Running App + +If your app is already running (started outside Neovim): + +``` +fa # Attach to running process +``` + +This enables hot reload and debugging for external apps. + +## Configuration + +Flutter tools are configured in `lua/custom/plugins/flutter.lua`. + +Key settings: +- **Auto-start DevTools**: `dev_tools.autostart = false` (manual start) +- **Widget guides**: `widget_guides.enabled = true` (visual nesting guides) +- **Closing tags**: `closing_tags.enabled = true` (shows widget closing comments) +- **Color preview**: `lsp.color.enabled = true` (inline color indicators) + +## Troubleshooting + +### LSP Not Working + +``` +:FlutterLspRestart +# or +fl +``` + +### Can't Select Device + +Ensure Flutter can see your devices: + +``` +:!flutter devices +``` + +If devices don't show, check: +- Android emulator is running +- iOS simulator is running +- Physical device is connected and authorized +- Chrome is installed (for web) + +### Hot Reload Not Responding + +``` +fR # Force hot restart +``` + +If still not working: + +``` +fq # Quit +fr # Restart fresh +``` + +### Dart Analysis Errors + +Force re-analysis: + +``` +:FlutterReanalyze +``` + +Or restart LSP: `fl` + +## Resources + +- [Flutter Documentation](https://flutter.dev/docs) +- [Dart Language Tour](https://dart.dev/guides/language/language-tour) +- [Widget Catalog](https://flutter.dev/docs/development/ui/widgets) +- [flutter-tools.nvim GitHub](https://github.com/akinsho/flutter-tools.nvim) + +## See Also + +- [Debug Keymaps](../keymaps/README.md#debugging) - Complete debugging reference +- [LSP Features](../plugins/lsp.md) - Language Server Protocol features +- [Code Actions](../keymaps/README.md#lsp) - All code action keymaps diff --git a/docs/vim-mastery/README.md b/docs/vim-mastery/README.md new file mode 100644 index 00000000..7acdb666 --- /dev/null +++ b/docs/vim-mastery/README.md @@ -0,0 +1,272 @@ +# 🎓 Vim Mastery - Progressive Learning Path + +Master Vim one technique at a time, building real skill over months instead of trying to learn everything at once. + +--- + +## 🎯 Philosophy: The One-Trick-Per-Week Method + +Instead of overwhelming yourself with hundreds of commands: +1. **Learn ONE new command/technique each week** +2. **Practice it consciously** in your daily work +3. **Use it until it becomes muscle memory** +4. **Move to the next technique** + +After one year: **52 new powerful techniques!** + +--- + +## 🗺️ Learning Roadmap + +### Weeks 1-4: Foundation +Build essential motion and editing skills +- **[Week 1: Motion Basics](week-01-motions.md)** - Move efficiently +- **[Week 2: Text Objects](week-02-text-objects.md)** - Edit intelligently +- **[Week 3: Advanced Editing](week-03-advanced.md)** - Visual mode & macros intro +- **[Week 4: Macros & Registers](week-04-macros.md)** - Automate repetitive tasks + +### Weeks 5-8: Power User +Master Vim's unique features +- **[Week 5: Command Line](week-05-cmdline.md)** - Ex commands & substitution +- **[Week 6: Windows & Tabs](week-06-windows.md)** - Workspace management +- **[Week 7: Search & Replace](week-07-search.md)** - Advanced patterns +- **[Week 8: Marks & Jumps](week-08-marks.md)** - Navigate large codebases + +### Ongoing: Mastery +Continuous improvement +- **[Tips & Tricks](tips-and-tricks.md)** - Productivity boosters +- **[Workflows](workflows.md)** - Real-world patterns +- **[Advanced Topics](advanced.md)** - Vim script, Lua, custom commands + +--- + +## 📊 Skill Progression + +``` +Week 0: hjkl, basic editing [Beginner] + ↓ +Week 2: Word motions, text objects [Functional] + ↓ +Week 4: Visual mode, basic macros [Comfortable] + ↓ +Week 6: Ex commands, window management [Efficient] + ↓ +Week 8: Advanced searching, marks [Proficient] + ↓ +Month 3: Custom workflows [Advanced] + ↓ +Month 6: Vim expert, teaching others [Master] +``` + +--- + +## 🎯 Learning Objectives + +### By Week 4 +You will be able to: +- Navigate code without arrow keys +- Edit text objects (change word, delete paragraph) +- Use visual mode for selections +- Record and replay simple macros +- Be MORE productive than with mouse + arrow keys + +### By Week 8 +You will be able to: +- Refactor code efficiently +- Use advanced search patterns +- Manage multiple windows and tabs +- Navigate large codebases with marks +- Automate repetitive tasks with macros + +### By Month 6 +You will be able to: +- Edit at the speed of thought +- Teach Vim to others +- Create custom workflows +- Write your own Vim scripts +- Never want to use another editor + +--- + +## 📖 Weekly Structure + +Each week follows this pattern: + +### Monday: Learn +- Read the week's guide (15 minutes) +- Watch any linked videos +- Understand the concepts + +### Tuesday-Friday: Practice +- Pick 2-3 commands from the week's list +- Use them consciously in real work +- Don't worry about speed yet +- Focus on correctness + +### Weekend: Review +- What did you learn? +- What felt natural? +- What needs more practice? +- Pick next week's focus + +--- + +## 💡 Learning Tips + +### 1. Deliberate Practice +Don't just read - **use** the commands in real code. + +### 2. Start Slow +Speed comes with muscle memory. Focus on correctness first. + +### 3. One Thing at a Time +Master one command before adding another. + +### 4. Keep a Cheat Sheet +Write down your current week's commands somewhere visible. + +### 5. Use the In-Editor Cheatsheet +`sc` is your friend! + +### 6. Don't Rush +It's okay to spend 2 weeks on one topic if needed. + +### 7. Apply Immediately +Learn Monday, use in real work Tuesday. + +### 8. Embrace Mistakes +Undo (`u`) is your safety net. Experiment! + +--- + +## 🎮 Practice Exercises + +Each week includes: +- **Focused drills** - Specific command practice +- **Real-world scenarios** - Apply to actual code +- **Challenge tasks** - Test your skills +- **Cheat sheet** - Quick reference + +--- + +## 📚 Recommended Schedule + +### If You're New to Vim +- **Pace**: 1 week per topic +- **Time**: 30 minutes/day practice +- **Duration**: 8 weeks to proficiency + +### If You Know Basic Vim +- **Pace**: 2-3 topics per week +- **Time**: 15 minutes/day practice +- **Duration**: 4 weeks to level up + +### If You Want to Master Vim +- **Pace**: All topics + advanced +- **Time**: 1 hour/day practice +- **Duration**: 3-6 months to mastery + +--- + +## 🗺️ Your Journey Starts Here + +### Absolute Beginner? +Start with **[Week 1: Motion Basics](week-01-motions.md)** + +### Know hjkl Already? +Jump to **[Week 2: Text Objects](week-02-text-objects.md)** + +### Comfortable with Vim? +Explore **[Tips & Tricks](tips-and-tricks.md)** and **[Workflows](workflows.md)** + +### Want to Master Everything? +Follow the full 8-week program, then **[Advanced Topics](advanced.md)** + +--- + +## 📈 Track Your Progress + +Create a file to track what you've learned: + +```vim +:e ~/vim-mastery-log.md +``` + +Template: +```markdown +# My Vim Mastery Journey + +## Week 1: Motion Basics +- Started: 2025-11-01 +- Mastered: w, b, e, 0, $ +- Still practicing: f/F, t/T +- Favorite new trick: dt, (delete till comma) + +## Week 2: Text Objects +... +``` + +--- + +## 🎯 Success Metrics + +You're making progress when: +- ✅ You reach for hjkl instead of arrow keys +- ✅ You think "change inner word" instead of selecting with mouse +- ✅ You prefer Vim commands over GUI operations +- ✅ You can edit without looking at keyboard +- ✅ You start teaching others +- ✅ You feel frustrated using non-Vim editors + +--- + +## 💬 Community + +Share your progress: +- **Reddit**: r/vim, r/neovim +- **Discord**: Neovim community server +- **GitHub**: Open issues with questions + +--- + +## 📚 Additional Resources + +### Books +- **Practical Vim** by Drew Neil (highly recommended!) +- **Modern Vim** by Drew Neil +- **Learning the Vi and Vim Editors** + +### Videos +- **ThePrimeagen's Vim Course** +- **Vim Casts** (vimcasts.org) +- **TJ DeVries' Neovim streams** + +### Interactive +- `:Tutor` - Built into Neovim +- **Vim Adventures** - Learn through gaming +- **OpenVim** - Interactive tutorial + +### References +- `:help` - Vim's excellent documentation +- **vim.rtorr.com** - Quick reference +- **This config's cheatsheet** - `sc` + +--- + +## 🎊 Ready to Begin? + +Remember: **Progress > Perfection** + +Every expert was once a beginner. The only difference is they kept practicing. + +--- + +
+ +**Your journey to Vim mastery starts now!** + +[Week 1: Motion Basics →](week-01-motions.md) + +[Back to Documentation](../README.md) | [Tips & Tricks](tips-and-tricks.md) + +
diff --git a/docs/vim-mastery/week-01-motions.md b/docs/vim-mastery/week-01-motions.md new file mode 100644 index 00000000..ea487d4f --- /dev/null +++ b/docs/vim-mastery/week-01-motions.md @@ -0,0 +1,380 @@ +# 🎯 Week 1: Motion Basics + +Master efficient navigation - the foundation of Vim proficiency. + +--- + +## 🎓 Learning Objectives + +By the end of this week, you will: +- Navigate without arrow keys +- Move by words, not characters +- Jump to specific characters on a line +- Understand the power of count + motion +- Be faster than mouse + arrow keys + +--- + +## 📚 Core Commands + +### Basic Directional Movement +```vim +h " Left ← +j " Down ↓ +k " Up ↑ +l " Right → +``` + +**Practice Goal**: Use only hjkl for one full day. Unmap arrow keys if needed! + +### Word Movement (Most Important!) +```vim +w " Next word (start) +e " Next word (end) +b " Previous word (start) +ge " Previous word (end) + +W " Next WORD (whitespace separated) +E " Next WORD (end) +B " Previous WORD +``` + +**Difference**: +- `word`: Stops at punctuation (my-function → 3 words) +- `WORD`: Whitespace only (my-function → 1 WORD) + +### Line Movement +```vim +0 " Start of line +^ " First non-whitespace character +$ " End of line +g_ " Last non-whitespace character +``` + +### Character Search (Super Powerful!) +```vim +f{char} " Find next {char} on line → +F{char} " Find previous {char} on line ← +t{char} " Till next {char} (stop before) +T{char} " Till previous {char} + +; " Repeat last f/F/t/T forward +, " Repeat last f/F/t/T backward +``` + +**Pro Tip**: `f` and `t` are game-changers for editing! + +--- + +## 💪 Practice Exercises + +### Exercise 1: Word Navigation (5 minutes) +Open any code file: +```vim +:e ~/.config/nvim/init.lua +``` + +Practice: +1. Use `w` to move forward 10 words +2. Use `b` to come back +3. Use `e` to jump to word ends +4. Compare speed: `wwwww` vs `5w` (count!) + +### Exercise 2: Line Precision (5 minutes) +In the same file: +```vim +" Jump to line start +0 + +" Jump to first character +^ + +" Jump to line end +$ + +" Try this combo: Move to end, then back to start +$^ +``` + +### Exercise 3: Character Hunting (10 minutes) +Find a line with multiple parentheses or quotes: +```lua +local function test(arg1, arg2, arg3) +``` + +Practice: +```vim +f( " Jump to first ( +; " Jump to next ( +; " Jump to next ( +, " Go back one ( +``` + +Try these scenarios: +- Jump to the closing quote: `f"` +- Delete till comma: `dt,` +- Change till closing paren: `ct)` + +### Exercise 4: Combine Motions (10 minutes) +Real-world scenarios: + +**Scenario 1**: Change the word "function" to "method" +```vim +" Position cursor on 'f' in function +cw " Change word +method +``` + +**Scenario 2**: Delete from cursor to end of line +```vim +d$ " or D +``` + +**Scenario 3**: Change from here to next underscore +```vim +ct_ +``` + +--- + +## 🎯 Daily Challenges + +### Monday: Basic hjkl +- Disable arrow keys: Add to `init.lua`: + ```lua + vim.keymap.set('n', '', '') + vim.keymap.set('n', '', '') + vim.keymap.set('n', '', '') + vim.keymap.set('n', '', '') + ``` +- Navigate only with hjkl for the entire day + +### Tuesday: Word Motions +- Practice `w`, `b`, `e` every time you move +- Count your keystrokes: `www` = 3, `3w` = 2 +- Use counts! + +### Wednesday: Line Jumps +- Every time you need line start/end, use `^` or `$` +- Stop using `0` (except when you really need column 0) + +### Thursday: Character Search +- Find 10 opportunities to use `f` or `t` +- Practice `;` and `,` for repeating +- Try `dt,` and `ct)` patterns + +### Friday: Combinations +- Combine everything: `d3w`, `c$`, `vf)`, etc. +- Edit entire lines without arrow keys +- Feel the power! + +--- + +## 🔥 Real-World Patterns + +### Pattern 1: Change Till Character +```vim +" Change from cursor to next comma +ct, +``` +**Use when**: Editing function arguments + +### Pattern 2: Delete Word Forward +```vim +" Delete from cursor to end of word +dw + +" Delete 3 words +d3w +``` +**Use when**: Removing variable names + +### Pattern 3: Jump and Edit +```vim +" Find opening paren, then change till closing +f(ct) +``` +**Use when**: Changing function parameters + +### Pattern 4: End of Line Operations +```vim +" Append at end of line +A + +" Delete to end of line +D + +" Change to end of line +C +``` +**Use when**: Adding semicolons, removing trailing code + +--- + +## 📊 Progress Checklist + +Track your mastery: + +``` +Day 1: +[ ] Used hjkl instead of arrows at least 50% of time +[ ] Felt uncomfortable (this is good!) + +Day 2: +[ ] Used w/b/e consciously 20+ times +[ ] Started thinking in "words" not "characters" + +Day 3: +[ ] Used ^ and $ instead of Home/End +[ ] Comfortable with 0/^/$ distinction + +Day 4: +[ ] Used f/t successfully 10+ times +[ ] Discovered one "aha!" moment with dt or ct + +Day 5: +[ ] Combined motions (d3w, c$, etc.) +[ ] Hjkl feels natural +[ ] Ready for Week 2! +``` + +--- + +## 🎮 Speed Drills + +### Drill 1: The Word Race (2 minutes) +```vim +" Open a file +" Start at top: gg +" Goal: Get to word "function" on line 50 + +" Slow way: jjjjjjjjwwwwwwww +" Fast way: 50G/function +" Week 1 way: 50G (jump to line) then use w/e +``` + +### Drill 2: Line Ninja (2 minutes) +```vim +" Create test line: +" the quick brown fox jumps over the lazy dog + +" Tasks (as fast as possible): +0 " Line start +$ " Line end +^ " First char +fb " Find 'b' +; " Next 'b' +e " End of word +``` + +### Drill 3: Edit Marathon (5 minutes) +```lua +-- Start with: +local result = calculate(arg1, arg2, arg3, arg4) + +-- Tasks: +-- 1. Change "calculate" to "compute" +-- Solution: /calccw compute +-- +-- 2. Delete ", arg4" +-- Solution: f4 (on '4') then dF, (delete back to comma) +-- +-- 3. Change "result" to "output" +-- Solution: 0 (start of line) cw output +``` + +--- + +## 💡 Pro Tips + +### Tip 1: Think in Motions +Don't think: "I need to move 5 characters right" +Think: "I need to move to the next word" + +### Tip 2: Use Counts +`5w` is faster than `wwwww` and requires less thought. + +### Tip 3: f/t Are Superpowers +Once you master `f` and `t`, you'll never want to use arrow keys for horizontal navigation. + +### Tip 4: Learn the Difference +- `w` stops at punctuation: `my-word` = 3 stops +- `W` only stops at whitespace: `my-word` = 1 stop + +### Tip 5: Combine with Operators +Motions are 10x powerful with operators (d, c, y): +- `dw` = delete word +- `ct.` = change till period +- `y$` = yank to end of line + +--- + +## 🎯 Week 1 Goal + +**By end of week, you should prefer hjkl + word motions over arrow keys.** + +If you catch yourself reaching for arrows or mouse, that's your cue to practice more! + +--- + +## 🔗 Quick Reference Card + +Print this or keep it visible: + +``` +┌─────────────────────────────────────┐ +│ Week 1: Motion Basics │ +├─────────────────────────────────────┤ +│ hjkl - Directions │ +│ w/b/e - Word motions │ +│ ^/$ - Line start/end │ +│ f/F - Find character │ +│ t/T - Till character │ +│ ;/, - Repeat find │ +│ │ +│ Combos: │ +│ dw - Delete word │ +│ dt, - Delete till comma │ +│ c$ - Change to end │ +│ 5w - Move 5 words │ +└─────────────────────────────────────┘ +``` + +--- + +## ❓ Common Questions + +**Q: Why not use arrow keys?** +A: They're far from home row. Hjkl is faster once trained. + +**Q: When should I use w vs W?** +A: Use `w` for code (stops at punctuation). Use `W` for prose (whitespace only). + +**Q: I'm slower with hjkl!** +A: Normal! Stick with it for 3 days. Speed comes after correctness. + +**Q: Do I really need to learn f/t?** +A: YES! They're the secret weapon. Worth the practice. + +--- + +## 🎊 Graduation Criteria + +You're ready for Week 2 when: +- ✅ hjkl feels natural (no conscious thought) +- ✅ You use w/b/e more than arrow keys +- ✅ You've used f/t successfully in real work +- ✅ You can navigate without looking at keyboard +- ✅ You feel frustrated when using arrow keys + +--- + +
+ +**Congratulations on completing Week 1!** + +Practice these daily, and they'll become second nature. + +[← Back to Vim Mastery](README.md) | [Week 2: Text Objects →](week-02-text-objects.md) + +
diff --git a/init.lua b/init.lua index 22471048..2e66892f 100644 --- a/init.lua +++ b/init.lua @@ -8,7 +8,7 @@ and reorganized into a modular structure. For help: - Run `:Tutor` to learn Neovim basics - Run `:help` to access built-in documentation - - Press `sh` to search help with Telescope + - Press `sh` to search help with Telescope - Run `:checkhealth` to diagnose issues - See ORGANIZATION.md for structure details diff --git a/lazy-lock.json b/lazy-lock.json index 503829d0..5048a86e 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -4,6 +4,7 @@ "blink.cmp": { "branch": "main", "commit": "327fff91fe6af358e990be7be1ec8b78037d2138" }, "conform.nvim": { "branch": "master", "commit": "9fd3d5e0b689ec1bf400c53cbbec72c6fdf24081" }, "copilot.vim": { "branch": "release", "commit": "da369d90cfd6c396b1d0ec259836a1c7222fb2ea" }, + "crates.nvim": { "branch": "main", "commit": "ac9fa498a9edb96dc3056724ff69d5f40b898453" }, "dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" }, "emmet-vim": { "branch": "master", "commit": "e98397144982d1e75b20d94d55a82de3ec8f648d" }, "fidget.nvim": { "branch": "main", "commit": "e32b672d8fd343f9d6a76944fedb8c61d7d8111a" }, @@ -26,6 +27,7 @@ "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, + "rustaceanvim": { "branch": "master", "commit": "e9c5aaba16fead831379d5f44617547a90b913c7" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, diff --git a/lua/config/keymaps.lua b/lua/config/keymaps.lua index 3159d614..b56d188a 100644 --- a/lua/config/keymaps.lua +++ b/lua/config/keymaps.lua @@ -56,3 +56,37 @@ vim.keymap.set('n', 'Q', 'qa', { desc = '[Q]uit [A]ll' }) -- vim.keymap.set("n", "", "L", { desc = "Move window to the right" }) -- vim.keymap.set("n", "", "J", { desc = "Move window to the lower" }) -- vim.keymap.set("n", "", "K", { desc = "Move window to the upper" }) + +-- ======================================================================== +-- BUFFER OPERATIONS (b) +-- ======================================================================== +vim.keymap.set('n', 'bd', 'bd', { desc = 'Delete buffer' }) +vim.keymap.set('n', 'bD', 'bd!', { desc = 'Delete buffer (force)' }) +vim.keymap.set('n', 'bn', 'bnext', { desc = 'Next buffer' }) +vim.keymap.set('n', 'bp', 'bprevious', { desc = 'Previous buffer' }) +vim.keymap.set('n', 'bo', '%bd|e#|bd#', { desc = 'Delete other buffers' }) + +-- ======================================================================== +-- WINDOW OPERATIONS (w) +-- ======================================================================== +vim.keymap.set('n', 'ww', 'w', { desc = 'Other window' }) +vim.keymap.set('n', 'wd', 'c', { desc = 'Delete window' }) +vim.keymap.set('n', 'ws', 's', { desc = 'Split window below' }) +vim.keymap.set('n', 'wv', 'v', { desc = 'Split window right' }) +vim.keymap.set('n', 'wm', '_|', { desc = 'Maximize window' }) +vim.keymap.set('n', 'w=', '=', { desc = 'Balance windows' }) +vim.keymap.set('n', 'wh', 'h', { desc = 'Go to left window' }) +vim.keymap.set('n', 'wj', 'j', { desc = 'Go to lower window' }) +vim.keymap.set('n', 'wk', 'k', { desc = 'Go to upper window' }) +vim.keymap.set('n', 'wl', 'l', { desc = 'Go to right window' }) + +-- ======================================================================== +-- UI OPERATIONS (u) +-- ======================================================================== +vim.keymap.set('n', 'ul', 'Lazy', { desc = 'Open Lazy' }) +vim.keymap.set('n', 'um', 'Mason', { desc = 'Open Mason' }) +vim.keymap.set('n', 'ui', vim.show_pos, { desc = 'Inspect position' }) +vim.keymap.set('n', 'uI', 'InspectTree', { desc = 'Inspect tree' }) +vim.keymap.set('n', 'un', function() + require('noice').cmd 'dismiss' +end, { desc = 'Dismiss notifications' }) diff --git a/lua/custom/plugins/flutter.lua b/lua/custom/plugins/flutter.lua new file mode 100644 index 00000000..b9fc85cc --- /dev/null +++ b/lua/custom/plugins/flutter.lua @@ -0,0 +1,485 @@ +-- ======================================================================== +-- FLUTTER/DART PROFILE - Language-specific plugins and LSP configuration +-- ======================================================================== +-- +-- This file contains all Flutter and Dart-specific plugins and configurations. +-- These plugins will ONLY load when you open a .dart file, keeping your +-- startup time fast and avoiding conflicts with other languages. +-- +-- Key features to configure here: +-- - Flutter tools (hot reload, device management, widget inspector) +-- - Dart LSP (dartls via flutter-tools) +-- - Dart-specific formatters and linters +-- - Flutter-specific keymaps (e.g., fr for Flutter Run) +-- +-- Usage: Just open a .dart file and these plugins will automatically load! +-- ======================================================================== + +return { + -- ======================================================================== + -- NVIM-DAP - Debug Adapter Protocol for Flutter debugging + -- ======================================================================== + -- Load DAP when opening Dart files to enable breakpoint debugging + { + 'mfussenegger/nvim-dap', + ft = 'dart', + dependencies = { + 'rcarriga/nvim-dap-ui', + 'nvim-neotest/nvim-nio', + }, + }, + + -- ======================================================================== + -- FLUTTER TOOLS - Complete Flutter development environment + -- ======================================================================== + -- Provides Flutter-specific features like hot reload, device management, + -- widget inspector, and integrates the Dart LSP server. + -- + -- Flutter-specific keymaps (available in .dart files): + -- fr - Flutter Run (start app) + -- fq - Flutter Quit (stop app) + -- fR - Flutter Hot Restart + -- fh - Flutter Hot Reload + -- fd - Flutter Devices (show connected devices) + -- fe - Flutter Emulators (launch emulator) + -- fo - Flutter Outline (toggle outline/widget tree) + -- ft - Flutter DevTools (start DevTools server) + -- fa - Flutter Attach (attach to running app) + -- fD - Flutter Detach (detach from running app) + -- fL - Flutter Log Toggle (show/hide logs) + -- fc - Flutter Copy Profiler URL (for DevTools) + -- + -- Debug keymaps: + -- - Start/Continue debugging + -- - Step over + -- - Step into + -- - Step out + -- db - Toggle breakpoint + -- dB - Set conditional breakpoint + -- dc - Continue + -- dt - Terminate debugging + -- ======================================================================== + { + 'nvim-flutter/flutter-tools.nvim', + ft = 'dart', -- Only load when opening Dart files + dependencies = { + 'nvim-lua/plenary.nvim', + 'stevearc/dressing.nvim', -- Optional: better UI for Flutter commands + 'mfussenegger/nvim-dap', + 'rcarriga/nvim-dap-ui', + 'nvim-neotest/nvim-nio', + }, + config = function() + -- Get shared LSP capabilities from blink.cmp + local capabilities = require('blink.cmp').get_lsp_capabilities() + + require('flutter-tools').setup { + -- UI configuration + ui = { + border = 'rounded', -- border type for floating windows + notification_style = 'native', -- 'native' or 'plugin' (native uses vim.notify) + }, + + -- Flutter SDK path (usually auto-detected, but you can specify if needed) + -- flutter_path = '/path/to/flutter/bin/flutter', + -- flutter_lookup_cmd = nil, -- example: "dirname $(which flutter)" or "asdf where flutter" + + -- FVM support - takes priority over path, uses /.fvm/flutter_sdk if enabled + fvm = false, + + -- Root patterns to find the root of your flutter project + root_patterns = { '.git', 'pubspec.yaml' }, + + -- Uncomment to set a default device (get ID from `flutter devices`) + -- device = { + -- id = 'chrome', -- or 'macos', 'emulator-5554', etc. + -- }, + + lsp = { + capabilities = capabilities, + + -- Suppress didChange errors during snippet expansion + on_attach = function(client, bufnr) + -- Reduce didChange notification frequency to prevent errors with snippets + client.server_capabilities.textDocumentSync = vim.tbl_deep_extend('force', client.server_capabilities.textDocumentSync or {}, { + change = 2, -- 2 = Incremental (less prone to errors than full sync) + }) + + -- Filter out didChange error notifications (they're harmless during snippet expansion) + -- We'll use an autocmd to do this after noice.nvim is loaded + vim.api.nvim_create_autocmd('User', { + pattern = 'VeryLazy', + once = true, + callback = function() + local notify = vim.notify + vim.notify = function(msg, level, opts) + if type(msg) == 'string' and msg:match('textDocument/didChange') then + return -- Suppress this specific error + end + notify(msg, level, opts) + end + end, + }) + end, + + -- Color preview for dart variables (Colors.red, Color(0xFF...), etc.) + -- This shows the actual Material Design colors inline! + color = { + enabled = true, -- whether or not to highlight color variables at all, only supported on flutter >= 2.10 + background = true, -- highlight the background + background_color = nil, -- required, when background is transparent (i.e. background_color = { r = 19, g = 17, b = 24},) + foreground = false, -- highlight the foreground + virtual_text = true, -- show the highlight using virtual text + virtual_text_str = '■', -- the virtual text character to highlight + }, + -- Settings passed to the Dart LSP + settings = { + -- Show TODOs in the problems pane + showTodos = true, + -- Completion settings + completeFunctionCalls = true, + -- Enable/disable specific lints + -- analysisExcludedFolders = {}, + renameFilesWithClasses = 'prompt', -- "always" or "prompt" + enableSnippets = true, + updateImportsOnRename = true, -- Whether to update imports and other directives when files are renamed + }, + }, + + -- Flutter-specific settings + decorations = { + statusline = { + -- Set to true to show Flutter app info in statusline + app_version = false, + device = true, -- Show device name + }, + }, + + widget_guides = { + enabled = true, -- Show visual guides for widget nesting + }, + + closing_tags = { + highlight = 'Comment', -- Highlight color for closing tags + prefix = '// ', -- Text to show before closing tag + enabled = true, -- Show closing tags for widgets + }, + + dev_log = { + enabled = true, + notify_errors = false, -- Don't show error notifications for log buffer issues + open_cmd = 'tabedit', -- Open logs in a new tab + focus_on_open = false, -- Don't auto-focus the log window + }, + + dev_tools = { + autostart = false, -- autostart devtools server if not detected + auto_open_browser = false, -- Automatically opens devtools in the browser + }, + + outline = { + open_cmd = '30vnew', -- command to use to open the outline buffer + auto_open = false, -- if true this will open the outline automatically when it is first populated + }, + + debugger = { + enabled = true, -- Enable Flutter debugger integration + run_via_dap = true, -- Use DAP for debugging + -- if empty dap will not stop on any exceptions, otherwise it will stop on those specified + -- see |:help dap.set_exception_breakpoints()| for more info + exception_breakpoints = {}, + -- Whether to call toString() on objects in debug views like hovers and the variables list. + -- Invoking toString() has a performance cost and may introduce side-effects, + -- although users may expected this functionality. null is treated like false. + evaluate_to_string_in_debug_views = true, + -- Flutter tools will automatically register DAP configurations + -- No need to manually configure launch.json + }, + } + + -- ======================================================================== + -- DAP UI SETUP - Beautiful debugging interface + -- ======================================================================== + local dap, dapui = require 'dap', require 'dapui' + + -- Configure DAP UI to open in tabs for better half-width screen support + dapui.setup { + icons = { expanded = '▾', collapsed = '▸', current_frame = '*' }, + controls = { + icons = { + pause = '⏸', + play = '▶', + step_into = '⏎', + step_over = '⏭', + step_out = '⏮', + step_back = 'b', + run_last = '▶▶', + terminate = '⏹', + disconnect = '⏏', + }, + }, + -- Open each element in a new tab instead of side panels + -- This prevents layout issues on small/half-width screens + layouts = { + { + elements = { + { id = 'scopes', size = 0.25 }, + { id = 'breakpoints', size = 0.25 }, + { id = 'stacks', size = 0.25 }, + { id = 'watches', size = 0.25 }, + }, + size = 40, + position = 'right', + }, + { + elements = { + { id = 'repl', size = 0.5 }, + { id = 'console', size = 0.5 }, + }, + size = 10, + position = 'bottom', + }, + }, + -- Override element window commands to open in tabs + element_mappings = {}, + windows = { indent = 1 }, + } + + -- Custom function to open DAP UI elements in tabs + local function open_dapui_in_tabs() + -- Save current tab to return to it + local current_tab = vim.fn.tabpagenr() + + -- Create new tab with a named buffer for debug views + vim.cmd 'tabnew' + local debug_buf = vim.api.nvim_create_buf(false, true) + vim.api.nvim_buf_set_name(debug_buf, 'Flutter Debug') + vim.api.nvim_set_current_buf(debug_buf) + + -- Open DAP UI in this tab + dapui.open() + + -- Return to original tab so user continues coding there + vim.cmd('tabnext ' .. current_tab) + end + + -- Custom function to close DAP UI tabs + local function close_dapui_tabs() + dapui.close() + + -- Find and close the Flutter Debug tab + local current_tab = vim.fn.tabpagenr() + for i = 1, vim.fn.tabpagenr '$' do + vim.cmd('tabnext ' .. i) + local bufname = vim.api.nvim_buf_get_name(0) + if bufname:match('Flutter Debug') then + vim.cmd 'tabclose' + break + end + end + + -- Return to original tab + if vim.fn.tabpagenr '$' >= current_tab then + vim.cmd('tabnext ' .. current_tab) + end + end + + -- Automatically open/close DAP UI in tabs + dap.listeners.after.event_initialized['dapui_config'] = open_dapui_in_tabs + dap.listeners.before.event_terminated['dapui_config'] = close_dapui_tabs + dap.listeners.before.event_exited['dapui_config'] = close_dapui_tabs + + -- Fix for Flutter Tools log buffer - make it non-saveable + -- This prevents Vim from asking to save changes to the log file on exit + vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWinEnter' }, { + pattern = '*', + callback = function(args) + local bufname = vim.api.nvim_buf_get_name(args.buf) + -- Check if this is a Flutter log buffer + if bufname:match('__FLUTTER_DEV_LOG__') or vim.bo[args.buf].filetype == 'log' then + vim.bo[args.buf].modifiable = true -- Allow Flutter to write to it + vim.bo[args.buf].modified = false -- Mark as unmodified + vim.bo[args.buf].buftype = 'nofile' -- Don't associate with a file (prevents save prompt) + vim.bo[args.buf].swapfile = false -- Don't create swap file + end + end, + }) + + -- Keep log buffer marked as unmodified whenever it changes + -- This prevents the "save changes?" prompt on exit + vim.api.nvim_create_autocmd('BufModifiedSet', { + pattern = '*', + callback = function(args) + local bufname = vim.api.nvim_buf_get_name(args.buf) + if bufname:match('__FLUTTER_DEV_LOG__') then + vim.bo[args.buf].modifiable = true + vim.bo[args.buf].modified = false -- Keep it marked as unmodified + end + end, + }) + + -- ======================================================================== + -- ENABLE TREESITTER FOLDING FOR DART FILES + -- ======================================================================== + -- Set fold method to use Treesitter for Flutter widgets + -- Using multiple autocmds to ensure it sticks (some plugins override it) + local fold_augroup = vim.api.nvim_create_augroup('DartFolding', { clear = true }) + + vim.api.nvim_create_autocmd({ 'BufRead', 'BufEnter', 'BufWinEnter' }, { + group = fold_augroup, + pattern = '*.dart', + callback = function() + vim.opt_local.foldmethod = 'expr' + vim.opt_local.foldexpr = 'nvim_treesitter#foldexpr()' + vim.opt_local.foldlevel = 99 -- High level = everything unfolded + vim.opt_local.foldlevelstart = 99 -- Start with everything unfolded + + -- Hide fold column (no extra column, folds still work!) + vim.opt_local.foldcolumn = '0' + + -- Minimal fold display (VS Code style - just shows first line) + vim.opt_local.foldtext = '' + end, + }) + + -- Also set after LSP attaches (flutter-tools might reset it) + vim.api.nvim_create_autocmd('LspAttach', { + group = fold_augroup, + callback = function(args) + local client = vim.lsp.get_client_by_id(args.data.client_id) + if client and client.name == 'dartls' then + vim.opt_local.foldmethod = 'expr' + vim.opt_local.foldexpr = 'nvim_treesitter#foldexpr()' + vim.opt_local.foldlevel = 99 -- Everything unfolded + end + end, + }) + + -- ======================================================================== + -- FLUTTER-SPECIFIC KEYMAPS + -- ======================================================================== + -- These keymaps are only available when editing Dart files + -- They provide quick access to common Flutter commands + -- ======================================================================== + vim.api.nvim_create_autocmd('FileType', { + pattern = 'dart', + callback = function() + local opts = { buffer = true, silent = true } + + -- ======================================================================== + -- ENABLE TREESITTER FOLDING FOR DART FILES + -- ======================================================================== + -- Set fold method to use Treesitter for Flutter widgets + vim.opt_local.foldmethod = 'expr' + vim.opt_local.foldexpr = 'nvim_treesitter#foldexpr()' + vim.opt_local.foldenable = false -- Start with folds open + vim.opt_local.foldlevel = 99 + vim.opt_local.foldlevelstart = 99 + + -- Flutter run/quit + -- WORKFLOW: + -- 1. First time: fd to select device + -- 2. Then: fr to run (uses selected device) + -- 3. Subsequent runs: fr uses same device + vim.keymap.set('n', 'fr', 'FlutterRun', vim.tbl_extend('force', opts, { desc = 'Flutter: Run app' })) + vim.keymap.set('n', 'fR', 'FlutterRestart', vim.tbl_extend('force', opts, { desc = 'Flutter: Hot restart' })) + vim.keymap.set('n', 'fh', 'FlutterReload', vim.tbl_extend('force', opts, { desc = 'Flutter: Hot reload' })) + vim.keymap.set('n', 'fq', 'FlutterQuit', vim.tbl_extend('force', opts, { desc = 'Flutter: Quit app' })) + + -- Code Actions (Cmd+. equivalent) - wrap, remove, extract widgets, etc. + vim.keymap.set('n', '.', vim.lsp.buf.code_action, vim.tbl_extend('force', opts, { desc = 'Flutter: Code actions (Cmd+.)' })) + vim.keymap.set('v', '.', vim.lsp.buf.code_action, vim.tbl_extend('force', opts, { desc = 'Flutter: Code actions (Cmd+.)' })) + -- Alternative: use the default LSP keymap + vim.keymap.set('n', 'gra', vim.lsp.buf.code_action, vim.tbl_extend('force', opts, { desc = '[G]oto Code [A]ction' })) + vim.keymap.set('v', 'gra', vim.lsp.buf.code_action, vim.tbl_extend('force', opts, { desc = '[G]oto Code [A]ction' })) + + -- Device management + -- Use fd to see/select devices FIRST, then fr will use that device + vim.keymap.set('n', 'fd', 'FlutterDevices', vim.tbl_extend('force', opts, { desc = 'Flutter: Select device' })) + vim.keymap.set('n', 'fe', 'FlutterEmulators', vim.tbl_extend('force', opts, { desc = 'Flutter: Launch emulator' })) + + -- Dev tools and debugging + vim.keymap.set('n', 'fo', 'FlutterOutlineToggle', vim.tbl_extend('force', opts, { desc = 'Flutter: Toggle outline' })) + vim.keymap.set('n', 'ft', 'FlutterDevTools', vim.tbl_extend('force', opts, { desc = 'Flutter: Start DevTools' })) + vim.keymap.set( + 'n', + 'fc', + 'FlutterCopyProfilerUrl', + vim.tbl_extend('force', opts, { desc = 'Flutter: Copy profiler URL' }) + ) + + -- Attach/Detach + vim.keymap.set('n', 'fa', 'FlutterAttach', vim.tbl_extend('force', opts, { desc = 'Flutter: Attach to app' })) + vim.keymap.set('n', 'fD', 'FlutterDetach', vim.tbl_extend('force', opts, { desc = 'Flutter: Detach from app' })) + + -- Logs + vim.keymap.set('n', 'fL', 'FlutterLogToggle', vim.tbl_extend('force', opts, { desc = 'Flutter: Toggle logs' })) + + -- LSP + vim.keymap.set('n', 'fl', 'FlutterLspRestart', vim.tbl_extend('force', opts, { desc = 'Flutter: Restart LSP' })) + + -- ======================================================================== + -- DEBUG KEYMAPS - Available only in Dart files + -- ======================================================================== + -- Function key shortcuts (standard debugging) + vim.keymap.set('n', '', function() + require('dap').continue() + end, vim.tbl_extend('force', opts, { desc = 'Debug: Start/Continue' })) + + vim.keymap.set('n', '', function() + require('dap').step_over() + end, vim.tbl_extend('force', opts, { desc = 'Debug: Step Over' })) + + vim.keymap.set('n', '', function() + require('dap').step_into() + end, vim.tbl_extend('force', opts, { desc = 'Debug: Step Into' })) + + vim.keymap.set('n', '', function() + require('dap').step_out() + end, vim.tbl_extend('force', opts, { desc = 'Debug: Step Out' })) + + -- Leader-based debug commands + vim.keymap.set('n', 'db', function() + require('dap').toggle_breakpoint() + end, vim.tbl_extend('force', opts, { desc = '[D]ebug: Toggle [B]reakpoint' })) + + vim.keymap.set('n', 'dB', function() + require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ') + end, vim.tbl_extend('force', opts, { desc = '[D]ebug: Set Conditional [B]reakpoint' })) + + vim.keymap.set('n', 'dc', function() + require('dap').continue() + end, vim.tbl_extend('force', opts, { desc = '[D]ebug: [C]ontinue' })) + + vim.keymap.set('n', 'dt', function() + require('dap').terminate() + end, vim.tbl_extend('force', opts, { desc = '[D]ebug: [T]erminate' })) + + vim.keymap.set('n', 'du', function() + require('dapui').toggle() + end, vim.tbl_extend('force', opts, { desc = '[D]ebug: Toggle [U]I' })) + + -- Register groups with which-key + require('which-key').add { + { 'f', group = '[F]lutter', mode = 'n' }, + { 'd', group = '[D]ebug', mode = 'n' }, + } + end, + }) + end, + }, + + -- ======================================================================== + -- DART TREESITTER - Ensure dart parser is installed for proper folding + -- ======================================================================== + { + 'nvim-treesitter/nvim-treesitter', + ft = 'dart', + opts = function(_, opts) + -- Ensure Dart parser is installed + opts.ensure_installed = opts.ensure_installed or {} + vim.list_extend(opts.ensure_installed, { 'dart' }) + return opts + end, + }, +} diff --git a/lua/plugins/core/cheatsheet.lua b/lua/plugins/core/cheatsheet.lua new file mode 100644 index 00000000..91d16909 --- /dev/null +++ b/lua/plugins/core/cheatsheet.lua @@ -0,0 +1,396 @@ +-- ======================================================================== +-- CHEATSHEET - Comprehensive keymap reference +-- ======================================================================== +-- Complete cheatsheet including: +-- - Vim default keymaps +-- - Custom leader keymaps +-- - Plugin-specific keymaps (Telescope, Neo-tree, etc.) +-- - LSP keymaps +-- - Language-specific keymaps +-- ======================================================================== + +return { + -- Enhanced cheatsheet with custom data + { + 'nvim-telescope/telescope.nvim', + keys = { + { + 'sc', + function() + -- Create a custom cheatsheet picker + local pickers = require 'telescope.pickers' + local finders = require 'telescope.finders' + local conf = require('telescope.config').values + local actions = require 'telescope.actions' + local action_state = require 'telescope.actions.state' + + -- Comprehensive keymap data + local cheatsheet = { + -- ============================================================ + -- VIM ESSENTIALS + -- ============================================================ + { category = 'Vim: Motion', key = 'h/j/k/l', desc = 'Left/Down/Up/Right' }, + { category = 'Vim: Motion', key = 'w/b/e', desc = 'Word forward/backward/end' }, + { category = 'Vim: Motion', key = '0/$', desc = 'Start/end of line' }, + { category = 'Vim: Motion', key = 'gg/G', desc = 'First/last line' }, + { category = 'Vim: Motion', key = '{/}', desc = 'Previous/next paragraph' }, + { category = 'Vim: Motion', key = '%', desc = 'Jump to matching bracket' }, + { category = 'Vim: Motion', key = 'f/F{char}', desc = 'Find char forward/backward' }, + { category = 'Vim: Motion', key = 't/T{char}', desc = 'Till char forward/backward' }, + { category = 'Vim: Motion', key = ';/,', desc = 'Repeat f/t forward/backward' }, + { category = 'Vim: Motion', key = '*/#', desc = 'Search word under cursor' }, + { category = 'Vim: Motion', key = 'n/N', desc = 'Next/previous search result' }, + + { category = 'Vim: Editing', key = 'i/a', desc = 'Insert before/after cursor' }, + { category = 'Vim: Editing', key = 'I/A', desc = 'Insert at line start/end' }, + { category = 'Vim: Editing', key = 'o/O', desc = 'New line below/above' }, + { category = 'Vim: Editing', key = 'x/X', desc = 'Delete char under/before cursor' }, + { category = 'Vim: Editing', key = 'd{motion}', desc = 'Delete (dw, dd, d$)' }, + { category = 'Vim: Editing', key = 'c{motion}', desc = 'Change (cw, cc, c$)' }, + { category = 'Vim: Editing', key = 'y{motion}', desc = 'Yank/copy (yw, yy, y$)' }, + { category = 'Vim: Editing', key = 'p/P', desc = 'Paste after/before cursor' }, + { category = 'Vim: Editing', key = 'u/Ctrl-r', desc = 'Undo/redo' }, + { category = 'Vim: Editing', key = '.', desc = 'Repeat last change' }, + { category = 'Vim: Editing', key = 'r{char}', desc = 'Replace character' }, + { category = 'Vim: Editing', key = 'J', desc = 'Join lines' }, + { category = 'Vim: Editing', key = '~', desc = 'Toggle case' }, + { category = 'Vim: Editing', key = '>>/<<', desc = 'Indent/unindent line' }, + + { category = 'Vim: Visual', key = 'v/V/Ctrl-v', desc = 'Visual/line/block mode' }, + { category = 'Vim: Visual', key = 'o', desc = 'Go to other end of selection' }, + { category = 'Vim: Visual', key = 'gv', desc = 'Reselect last visual' }, + + { category = 'Vim: Search', key = '/{pattern}', desc = 'Search forward' }, + { category = 'Vim: Search', key = '?{pattern}', desc = 'Search backward' }, + { category = 'Vim: Search', key = ':s/old/new/g', desc = 'Substitute in line' }, + { category = 'Vim: Search', key = ':%s/old/new/g', desc = 'Substitute in file' }, + { category = 'Vim: Search', key = ':noh', desc = 'Clear search highlight' }, + + { category = 'Vim: Windows', key = 'Ctrl-w s', desc = 'Split horizontal' }, + { category = 'Vim: Windows', key = 'Ctrl-w v', desc = 'Split vertical' }, + { category = 'Vim: Windows', key = 'Ctrl-w c', desc = 'Close window' }, + { category = 'Vim: Windows', key = 'Ctrl-w o', desc = 'Close other windows' }, + { category = 'Vim: Windows', key = 'Ctrl-w =', desc = 'Balance windows' }, + { category = 'Vim: Windows', key = 'Ctrl-h/j/k/l', desc = 'Navigate windows' }, + + { category = 'Vim: Tabs', key = ':tabnew', desc = 'New tab' }, + { category = 'Vim: Tabs', key = ':tabc', desc = 'Close tab' }, + { category = 'Vim: Tabs', key = 'gt/gT', desc = 'Next/previous tab' }, + + { category = 'Vim: Files', key = ':w', desc = 'Save file' }, + { category = 'Vim: Files', key = ':q', desc = 'Quit' }, + { category = 'Vim: Files', key = ':wq or ZZ', desc = 'Save and quit' }, + { category = 'Vim: Files', key = ':q! or ZQ', desc = 'Quit without saving' }, + + -- ============================================================ + -- LEADER KEYMAPS (CORE) + -- ============================================================ + { category = 'Core: Quit', key = 'Q', desc = 'Quit all' }, + { category = 'Core: Quit', key = 'q', desc = 'Quickfix diagnostics' }, + { category = 'Core: Files', key = '\\', desc = 'Toggle Neo-tree' }, + { category = 'Core: Terminal', key = 'Esc Esc', desc = 'Exit terminal mode (in terminal)' }, + + -- ============================================================ + -- BUFFER OPERATIONS + -- ============================================================ + { category = 'Buffer', key = 'bd', desc = 'Delete buffer' }, + { category = 'Buffer', key = 'bD', desc = 'Delete buffer (force)' }, + { category = 'Buffer', key = 'bn', desc = 'Next buffer' }, + { category = 'Buffer', key = 'bp', desc = 'Previous buffer' }, + { category = 'Buffer', key = 'bo', desc = 'Delete other buffers' }, + { category = 'Buffer', key = '', desc = 'Find buffers (Telescope)' }, + + -- ============================================================ + -- WINDOW OPERATIONS + -- ============================================================ + { category = 'Window', key = 'ww', desc = 'Other window' }, + { category = 'Window', key = 'wd', desc = 'Delete window' }, + { category = 'Window', key = 'ws', desc = 'Split below' }, + { category = 'Window', key = 'wv', desc = 'Split right' }, + { category = 'Window', key = 'wm', desc = 'Maximize' }, + { category = 'Window', key = 'w=', desc = 'Balance windows' }, + { category = 'Window', key = 'wh/j/k/l', desc = 'Navigate windows' }, + + -- ============================================================ + -- SEARCH (TELESCOPE) + -- ============================================================ + { category = 'Search', key = 'sh', desc = 'Help' }, + { category = 'Search', key = 'sk', desc = 'Keymaps' }, + { category = 'Search', key = 'sf', desc = 'Files' }, + { category = 'Search', key = 'ss', desc = 'Select Telescope' }, + { category = 'Search', key = 'sw', desc = 'Current word' }, + { category = 'Search', key = 'sg', desc = 'Grep' }, + { category = 'Search', key = 'sd', desc = 'Diagnostics' }, + { category = 'Search', key = 'sr', desc = 'Resume' }, + { category = 'Search', key = 's.', desc = 'Recent files' }, + { category = 'Search', key = 's/', desc = 'In open files' }, + { category = 'Search', key = 'sn', desc = 'Neovim config' }, + { category = 'Search', key = 'sc', desc = 'Cheatsheet (this!)' }, + { category = 'Search', key = 'sK', desc = 'All keymaps (which-key)' }, + { category = 'Search', key = '/', desc = 'Fuzzy find in buffer' }, + + -- ============================================================ + -- SESSION + -- ============================================================ + { category = 'Session', key = 'Ss', desc = 'Save session' }, + { category = 'Session', key = 'Sr', desc = 'Restore session' }, + { category = 'Session', key = 'Sd', desc = 'Delete session' }, + + -- ============================================================ + -- UI OPERATIONS + -- ============================================================ + { category = 'UI', key = 'ul', desc = 'Open Lazy' }, + { category = 'UI', key = 'um', desc = 'Open Mason' }, + { category = 'UI', key = 'ui', desc = 'Inspect position' }, + { category = 'UI', key = 'uI', desc = 'Inspect tree' }, + { category = 'UI', key = 'un', desc = 'Dismiss notifications' }, + + -- ============================================================ + -- TOGGLE + -- ============================================================ + { category = 'Toggle', key = 'th', desc = 'Inlay hints' }, + + -- ============================================================ + -- DIAGNOSTICS + -- ============================================================ + { category = 'Diagnostics', key = 'xx', desc = 'Toggle diagnostics (Trouble)' }, + { category = 'Diagnostics', key = 'xX', desc = 'Buffer diagnostics (Trouble)' }, + { category = 'Diagnostics', key = 'xs', desc = 'Symbols (Trouble)' }, + + -- ============================================================ + -- GIT + -- ============================================================ + { category = 'Git', key = 'hs', desc = 'Stage hunk' }, + { category = 'Git', key = 'hr', desc = 'Reset hunk' }, + { category = 'Git', key = 'hS', desc = 'Stage buffer' }, + { category = 'Git', key = 'hu', desc = 'Undo stage hunk' }, + { category = 'Git', key = 'hR', desc = 'Reset buffer' }, + { category = 'Git', key = 'hp', desc = 'Preview hunk' }, + { category = 'Git', key = 'hb', desc = 'Blame line' }, + { category = 'Git', key = 'hd', desc = 'Diff this' }, + { category = 'Git', key = 'hD', desc = 'Diff this ~' }, + + -- ============================================================ + -- LSP (ALL LANGUAGES) + -- ============================================================ + { category = 'LSP', key = 'K', desc = 'Hover documentation' }, + { category = 'LSP', key = 'grd', desc = 'Go to definition' }, + { category = 'LSP', key = 'grD', desc = 'Go to declaration' }, + { category = 'LSP', key = 'gri', desc = 'Go to implementation' }, + { category = 'LSP', key = 'grr', desc = 'Go to references' }, + { category = 'LSP', key = 'grt', desc = 'Go to type definition' }, + { category = 'LSP', key = 'grn', desc = 'Rename' }, + { category = 'LSP', key = 'gra', desc = 'Code action' }, + { category = 'LSP', key = 'gO', desc = 'Document symbols' }, + { category = 'LSP', key = 'gW', desc = 'Workspace symbols' }, + + -- ============================================================ + -- DEBUG (ALL LANGUAGES) + -- ============================================================ + { category = 'Debug', key = 'F5 or dc', desc = 'Start/Continue' }, + { category = 'Debug', key = 'F10 or dO', desc = 'Step over' }, + { category = 'Debug', key = 'F11 or di', desc = 'Step into' }, + { category = 'Debug', key = 'F12 or do', desc = 'Step out' }, + { category = 'Debug', key = 'db', desc = 'Toggle breakpoint' }, + { category = 'Debug', key = 'dB', desc = 'Conditional breakpoint' }, + { category = 'Debug', key = 'dc or F5', desc = 'Continue' }, + { category = 'Debug', key = 'di or F11', desc = 'Step into' }, + { category = 'Debug', key = 'do or F12', desc = 'Step out' }, + { category = 'Debug', key = 'dO or F10', desc = 'Step over' }, + { category = 'Debug', key = 'dt', desc = 'Terminate' }, + { category = 'Debug', key = 'dr', desc = 'Toggle REPL' }, + { category = 'Debug', key = 'dl', desc = 'Run last' }, + { category = 'Debug', key = 'dC', desc = 'Run to cursor' }, + { category = 'Debug', key = 'du', desc = 'Toggle UI' }, + { category = 'Debug', key = 'de', desc = 'Eval expression' }, + + -- ============================================================ + -- FLUTTER (DART FILES) + -- ============================================================ + { category = 'Flutter', key = 'fr', desc = 'Run app' }, + { category = 'Flutter', key = 'fR', desc = 'Hot restart' }, + { category = 'Flutter', key = 'fh', desc = 'Hot reload' }, + { category = 'Flutter', key = 'fq', desc = 'Quit app' }, + { category = 'Flutter', key = 'fd', desc = 'Select device' }, + { category = 'Flutter', key = 'fe', desc = 'Launch emulator' }, + { category = 'Flutter', key = 'fo', desc = 'Toggle outline' }, + { category = 'Flutter', key = 'ft', desc = 'Start DevTools' }, + { category = 'Flutter', key = 'fa', desc = 'Attach to app' }, + { category = 'Flutter', key = 'fD', desc = 'Detach from app' }, + { category = 'Flutter', key = 'fL', desc = 'Toggle logs' }, + { category = 'Flutter', key = 'fc', desc = 'Copy profiler URL' }, + { category = 'Flutter', key = 'fl', desc = 'Restart LSP' }, + { category = 'Flutter', key = '. or gra', desc = 'Code actions (Cmd+.)' }, + + -- ============================================================ + -- RUST (RUST FILES) + -- ============================================================ + { category = 'Rust', key = 'rh', desc = 'Hover actions' }, + { category = 'Rust', key = 'ra', desc = 'Code actions' }, + { category = 'Rust', key = 're', desc = 'Explain error' }, + { category = 'Rust', key = 'rC', desc = 'Open Cargo.toml' }, + { category = 'Rust', key = 'rp', desc = 'Parent module' }, + { category = 'Rust', key = 'rj', desc = 'Join lines' }, + { category = 'Rust', key = 'rr', desc = 'Runnables' }, + { category = 'Rust', key = 'rd', desc = 'Debuggables' }, + { category = 'Rust', key = 'rm', desc = 'Expand macro' }, + + -- ============================================================ + -- RUST CRATES (CARGO.TOML) + -- ============================================================ + { category = 'Rust: Crates', key = 'rct', desc = 'Toggle' }, + { category = 'Rust: Crates', key = 'rcr', desc = 'Reload' }, + { category = 'Rust: Crates', key = 'rcv', desc = 'Show versions' }, + { category = 'Rust: Crates', key = 'rcf', desc = 'Show features' }, + { category = 'Rust: Crates', key = 'rcd', desc = 'Show dependencies' }, + { category = 'Rust: Crates', key = 'rcu', desc = 'Update crate' }, + { category = 'Rust: Crates', key = 'rca', desc = 'Update all' }, + { category = 'Rust: Crates', key = 'rcU', desc = 'Upgrade crate' }, + { category = 'Rust: Crates', key = 'rcA', desc = 'Upgrade all' }, + + -- ============================================================ + -- PYTHON (PYTHON FILES) + -- ============================================================ + { category = 'Python', key = 'pr', desc = 'Run file' }, + { category = 'Python', key = 'pR', desc = 'Run with args' }, + { category = 'Python', key = 'pe', desc = 'Select venv' }, + { category = 'Python', key = 'pl', desc = 'Restart LSP' }, + { category = 'Python', key = 'pi', desc = 'Organize imports' }, + { category = 'Python', key = 'pf', desc = 'Format code' }, + + -- ============================================================ + -- SVELTE (SVELTE FILES) + -- ============================================================ + { category = 'Svelte', key = 'vf', desc = 'Format with prettier' }, + { category = 'Svelte', key = 'vl', desc = 'Restart Svelte LSP' }, + { category = 'Svelte', key = 'vt', desc = 'Restart TypeScript LSP' }, + { category = 'Svelte', key = 'vo', desc = 'Open component in split' }, + + -- ============================================================ + -- TELESCOPE (INSIDE TELESCOPE) + -- ============================================================ + { category = 'Telescope', key = 'Ctrl-j/k or j/k', desc = 'Next/previous item' }, + { category = 'Telescope', key = 'Ctrl-d/u', desc = 'Scroll preview down/up' }, + { category = 'Telescope', key = 'Enter', desc = 'Open in current window' }, + { category = 'Telescope', key = 'Ctrl-x', desc = 'Open in horizontal split' }, + { category = 'Telescope', key = 'Ctrl-v', desc = 'Open in vertical split' }, + { category = 'Telescope', key = 'Ctrl-t', desc = 'Open in new tab' }, + { category = 'Telescope', key = 'Ctrl-c/Esc/q', desc = 'Close' }, + { category = 'Telescope', key = 'Tab/Shift-Tab', desc = 'Toggle selection' }, + { category = 'Telescope', key = 'Ctrl-q', desc = 'Send all to quickfix' }, + { category = 'Telescope', key = 'Alt-q', desc = 'Send selected to quickfix' }, + { category = 'Telescope', key = '? (normal)', desc = 'Show help' }, + { category = 'Telescope', key = 'gg/G (normal)', desc = 'First/last item' }, + + -- ============================================================ + -- NEO-TREE (INSIDE NEO-TREE) + -- ============================================================ + { category = 'Neo-tree', key = '\\, q, or Esc', desc = 'Close Neo-tree' }, + { category = 'Neo-tree', key = 'Enter, o, or 2-click', desc = 'Open file' }, + { category = 'Neo-tree', key = 'Ctrl-x or S', desc = 'Open in horizontal split' }, + { category = 'Neo-tree', key = 'Ctrl-v or s', desc = 'Open in vertical split' }, + { category = 'Neo-tree', key = 'Ctrl-t or t', desc = 'Open in new tab' }, + { category = 'Neo-tree', key = 'w', desc = 'Open with window picker' }, + { category = 'Neo-tree', key = 'Ctrl-j or >', desc = 'Next source (files/buffers/git)' }, + { category = 'Neo-tree', key = 'Ctrl-k or <', desc = 'Previous source' }, + { category = 'Neo-tree', key = 'P', desc = 'Toggle preview (float)' }, + { category = 'Neo-tree', key = 'l', desc = 'Focus preview' }, + { category = 'Neo-tree', key = 'R', desc = 'Refresh' }, + { category = 'Neo-tree', key = 'H', desc = 'Toggle hidden files' }, + { category = 'Neo-tree', key = '-', desc = 'Navigate up (parent dir)' }, + { category = 'Neo-tree', key = '.', desc = 'Set root (cd into directory)' }, + { category = 'Neo-tree', key = 'C', desc = 'Close node (collapse folder)' }, + { category = 'Neo-tree', key = 'z', desc = 'Close all nodes' }, + { category = 'Neo-tree', key = 'e', desc = 'Toggle auto expand width' }, + { category = 'Neo-tree', key = 'a', desc = 'Add file' }, + { category = 'Neo-tree', key = 'A', desc = 'Add directory' }, + { category = 'Neo-tree', key = 'd', desc = 'Delete' }, + { category = 'Neo-tree', key = 'r', desc = 'Rename' }, + { category = 'Neo-tree', key = 'y', desc = 'Copy to clipboard' }, + { category = 'Neo-tree', key = 'x', desc = 'Cut to clipboard' }, + { category = 'Neo-tree', key = 'p', desc = 'Paste from clipboard' }, + { category = 'Neo-tree', key = 'c', desc = 'Copy (with path input)' }, + { category = 'Neo-tree', key = 'm', desc = 'Move (with path input)' }, + { category = 'Neo-tree', key = '?', desc = 'Show help (in Neo-tree)' }, + { category = 'Neo-tree', key = 'sf', desc = 'Telescope find from this dir' }, + { category = 'Neo-tree', key = 'sg', desc = 'Telescope grep from this dir' }, + + -- ============================================================ + -- MINI.AI (TEXT OBJECTS) + -- ============================================================ + { category = 'Text Objects', key = 'a/i + object', desc = 'Around/inside (w, p, [, {, ", \', `, t)' }, + { category = 'Text Objects', key = 'daw', desc = 'Delete around word' }, + { category = 'Text Objects', key = 'ciw', desc = 'Change inside word' }, + { category = 'Text Objects', key = 'di"', desc = 'Delete inside quotes' }, + { category = 'Text Objects', key = 'da(', desc = 'Delete around parentheses' }, + { category = 'Text Objects', key = 'vit', desc = 'Visual inside tag' }, + + -- ============================================================ + -- MINI.SURROUND + -- ============================================================ + { category = 'Surround', key = 'sa{motion}{char}', desc = 'Add surround' }, + { category = 'Surround', key = 'sd{char}', desc = 'Delete surround' }, + { category = 'Surround', key = 'sr{old}{new}', desc = 'Replace surround' }, + { category = 'Surround', key = 'sf{char}', desc = 'Find right surround' }, + { category = 'Surround', key = 'sF{char}', desc = 'Find left surround' }, + { category = 'Surround', key = 'sh', desc = 'Highlight surround' }, + } + + -- Create picker + pickers + .new({}, { + prompt_title = ' Complete Cheatsheet', + finder = finders.new_table { + results = cheatsheet, + entry_maker = function(entry) + return { + value = entry, + display = string.format('%-20s %-25s %s', entry.category, entry.key, entry.desc), + ordinal = entry.category .. ' ' .. entry.key .. ' ' .. entry.desc, + } + end, + }, + sorter = conf.generic_sorter {}, + attach_mappings = function(prompt_bufnr, map) + actions.select_default:replace(function() + actions.close(prompt_bufnr) + local selection = action_state.get_selected_entry() + if selection then + vim.notify( + string.format('%s: %s\n%s', selection.value.category, selection.value.key, selection.value.desc), + vim.log.levels.INFO, + { title = 'Keymap' } + ) + end + end) + return true + end, + }) + :find() + end, + desc = 'Cheatsheet (complete reference)', + }, + { + '?', + function() + require('telescope.builtin').keymaps() + end, + desc = 'Search keymaps', + }, + }, + }, + + -- Which-key can also show a searchable list + { + 'folke/which-key.nvim', + keys = { + { + 'sK', + function() + require('which-key').show { global = true } + end, + desc = 'All keymaps (which-key)', + }, + }, + }, +} diff --git a/lua/plugins/core/debug.lua b/lua/plugins/core/debug.lua new file mode 100644 index 00000000..e84693ae --- /dev/null +++ b/lua/plugins/core/debug.lua @@ -0,0 +1,49 @@ +-- ======================================================================== +-- DEBUG CONFIGURATION - Global DAP keymaps +-- ======================================================================== +-- These keymaps are available whenever nvim-dap is loaded +-- Works for all languages: Flutter, Rust, Python, etc. +-- ======================================================================== + +return { + -- nvim-dap: Debug Adapter Protocol client + { + 'mfussenegger/nvim-dap', + optional = true, + keys = { + -- Function key shortcuts (standard debugging across all editors) + { '', function() require('dap').continue() end, desc = 'Debug: Start/Continue' }, + { '', function() require('dap').step_over() end, desc = 'Debug: Step over' }, + { '', function() require('dap').step_into() end, desc = 'Debug: Step into' }, + { '', function() require('dap').step_out() end, desc = 'Debug: Step out' }, + + -- Leader-based debug commands (more discoverable) + { 'db', function() require('dap').toggle_breakpoint() end, desc = 'Toggle breakpoint' }, + { 'dB', function() require('dap').set_breakpoint(vim.fn.input('Breakpoint condition: ')) end, desc = 'Conditional breakpoint' }, + { 'dc', function() require('dap').continue() end, desc = 'Continue' }, + { 'di', function() require('dap').step_into() end, desc = 'Step into' }, + { 'do', function() require('dap').step_out() end, desc = 'Step out' }, + { 'dO', function() require('dap').step_over() end, desc = 'Step over' }, + { 'dt', function() require('dap').terminate() end, desc = 'Terminate' }, + { 'dr', function() require('dap').repl.toggle() end, desc = 'Toggle REPL' }, + { 'dl', function() require('dap').run_last() end, desc = 'Run last' }, + { 'dC', function() require('dap').run_to_cursor() end, desc = 'Run to cursor' }, + }, + config = function() + -- Register which-key group + require('which-key').add { + { 'd', group = ' debug' }, + } + end, + }, + + -- nvim-dap-ui: UI for nvim-dap + { + 'rcarriga/nvim-dap-ui', + optional = true, + keys = { + { 'du', function() require('dapui').toggle() end, desc = 'Toggle UI' }, + { 'de', function() require('dapui').eval() end, desc = 'Eval', mode = { 'n', 'v' } }, + }, + }, +} diff --git a/lua/plugins/core/editor.lua b/lua/plugins/core/editor.lua index 89b4b1e0..572e44a5 100644 --- a/lua/plugins/core/editor.lua +++ b/lua/plugins/core/editor.lua @@ -33,10 +33,64 @@ return { defaults = { mappings = { i = { + -- Navigation (consistent with Neo-tree) + [''] = require('telescope.actions').move_selection_next, + [''] = require('telescope.actions').move_selection_previous, + + -- Preview scrolling + [''] = require('telescope.actions').preview_scrolling_down, + [''] = require('telescope.actions').preview_scrolling_up, + + -- Open actions (consistent with Neo-tree) + [''] = require('telescope.actions').select_default, -- Open in current window + [''] = require('telescope.actions').select_horizontal, -- Open in horizontal split + [''] = require('telescope.actions').select_vertical, -- Open in vertical split + [''] = require('telescope.actions').select_tab, -- Open in new tab + + -- Close + [''] = require('telescope.actions').close, + [''] = require('telescope.actions').close, + + -- Cycle history + [''] = require('telescope.actions').cycle_history_next, + [''] = require('telescope.actions').cycle_history_prev, + + -- Selection + [''] = require('telescope.actions').toggle_selection + require('telescope.actions').move_selection_worse, + [''] = require('telescope.actions').toggle_selection + require('telescope.actions').move_selection_better, + + -- Send to quickfix + [''] = require('telescope.actions').send_to_qflist + require('telescope.actions').open_qflist, + [''] = require('telescope.actions').send_selected_to_qflist + require('telescope.actions').open_qflist, + }, + n = { + -- Same mappings in normal mode [''] = require('telescope.actions').move_selection_next, [''] = require('telescope.actions').move_selection_previous, [''] = require('telescope.actions').preview_scrolling_down, [''] = require('telescope.actions').preview_scrolling_up, + + [''] = require('telescope.actions').select_default, + [''] = require('telescope.actions').select_horizontal, + [''] = require('telescope.actions').select_vertical, + [''] = require('telescope.actions').select_tab, + + ['q'] = require('telescope.actions').close, + [''] = require('telescope.actions').close, + + [''] = require('telescope.actions').toggle_selection + require('telescope.actions').move_selection_worse, + [''] = require('telescope.actions').toggle_selection + require('telescope.actions').move_selection_better, + + [''] = require('telescope.actions').send_to_qflist + require('telescope.actions').open_qflist, + [''] = require('telescope.actions').send_selected_to_qflist + require('telescope.actions').open_qflist, + + -- Vim-like navigation + ['j'] = require('telescope.actions').move_selection_next, + ['k'] = require('telescope.actions').move_selection_previous, + ['gg'] = require('telescope.actions').move_to_top, + ['G'] = require('telescope.actions').move_to_bottom, + + ['?'] = require('telescope.actions').which_key, -- Show help }, }, }, @@ -88,6 +142,24 @@ return { event = 'VimEnter', opts = { delay = 0, + -- Floating window configuration (bottom right) + win = { + width = { min = 30, max = 60 }, -- Width range for the popup + height = { min = 4, max = 0.9 }, -- Max 90% of screen height - fits all items + col = 0.99, -- Position close to right edge + row = 0.95, -- Position close to bottom + border = 'rounded', -- Border style + padding = { 1, 2 }, -- Padding inside window + title = true, -- Show title + title_pos = 'center', -- Center the title + wo = { + winblend = 0, -- No transparency (0-100) + }, + }, + layout = { + width = { min = 30 }, -- Minimum column width + spacing = 3, -- Spacing between columns + }, icons = { mappings = vim.g.have_nerd_font, keys = vim.g.have_nerd_font and {} or { @@ -122,13 +194,28 @@ return { }, }, spec = { - { 'Q', group = '[Q]uit' }, - { 'c', group = '[c]ode' }, - { 's', group = '[s]earch' }, - { 'S', group = '[S]ession' }, - { 't', group = '[T]oggle' }, - { 'x', group = 'diagnostics/quickfi[x]' }, - { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, + -- Core groups with icons + { 'b', group = '󰊄 buffer', icon = '󰊄' }, + { 'c', group = ' code', icon = '' }, + { 'd', group = ' debug', icon = '' }, + { 'f', group = ' flutter', icon = '' }, -- Only visible in Dart files + { 'g', group = ' git', icon = '' }, + { 'p', group = ' python', icon = '' }, -- Only visible in Python files + { 'r', group = '󱘗 rust', icon = '󱘗' }, -- Only visible in Rust files + { 's', group = ' search', icon = '' }, + { 'S', group = '󱂬 session', icon = '󱂬' }, + { 't', group = '󰔡 toggle', icon = '󰔡' }, + { 'u', group = ' ui', icon = '' }, + { 'v', group = ' svelte', icon = '' }, -- Only visible in Svelte files + { 'w', group = ' window', icon = '' }, + { 'x', group = '󱖫 diagnostics', icon = '󱖫' }, + + -- Special groups + { 'q', desc = '󰁨 Quickfix diagnostics' }, + { 'Q', desc = '󰗼 Quit all' }, + + -- Git hunks (normal and visual mode) + { 'h', group = ' git hunk', mode = { 'n', 'v' }, icon = '' }, }, }, }, diff --git a/lua/plugins/core/neo-tree.lua b/lua/plugins/core/neo-tree.lua index dbfa9dd6..1f9d0e67 100644 --- a/lua/plugins/core/neo-tree.lua +++ b/lua/plugins/core/neo-tree.lua @@ -53,9 +53,50 @@ return { width = 30, mappings = { ['\\'] = 'close_window', - -- Make sf work the same in Neo-tree as in editor + + -- Consistent with Telescope: = split, = vsplit, = tabnew + [''] = 'split_with_window_picker', + [''] = 'vsplit_with_window_picker', + [''] = 'open_tabnew', + + -- Open file (consistent with Telescope ) + [''] = 'open', + ['o'] = 'open', + + -- Navigation + [''] = 'next_source', -- Match Telescope down navigation + [''] = 'prev_source', -- Match Telescope up navigation + + -- Preview (like Telescope) + ['P'] = { 'toggle_preview', config = { use_float = true } }, + + -- Telescope integration from Neo-tree ['sf'] = 'telescope_find', ['sg'] = 'telescope_grep', + + -- Refresh + ['R'] = 'refresh', + + -- Toggle hidden files + ['H'] = 'toggle_hidden', + + -- Navigation + ['-'] = 'navigate_up', + ['.'] = 'set_root', + + -- File operations + ['a'] = 'add', + ['A'] = 'add_directory', + ['d'] = 'delete', + ['r'] = 'rename', + ['y'] = 'copy_to_clipboard', + ['x'] = 'cut_to_clipboard', + ['p'] = 'paste_from_clipboard', + ['c'] = 'copy', -- Copy (takes a path as input) + ['m'] = 'move', -- Move (takes a path as input) + + -- Help + ['?'] = 'show_help', }, }, }, diff --git a/lua/plugins/lang/flutter.lua b/lua/plugins/lang/flutter.lua index 2d8f4d1b..4c72f910 100644 --- a/lua/plugins/lang/flutter.lua +++ b/lua/plugins/lang/flutter.lua @@ -358,7 +358,7 @@ return { -- ======================================================================== vim.api.nvim_create_autocmd('FileType', { pattern = 'dart', - callback = function() + callback = function(event) local opts = { buffer = true, silent = true } -- ======================================================================== @@ -402,51 +402,9 @@ return { ) vim.keymap.set('n', 'fl', 'FlutterLspRestart', vim.tbl_extend('force', opts, { desc = '[F]lutter [L]SP Restart' })) - -- ======================================================================== - -- DEBUG KEYMAPS - Available only in Dart files - -- ======================================================================== - -- Function key shortcuts (standard debugging) - vim.keymap.set('n', '', function() - require('dap').continue() - end, vim.tbl_extend('force', opts, { desc = 'Debug: Start/Continue' })) - - vim.keymap.set('n', '', function() - require('dap').step_over() - end, vim.tbl_extend('force', opts, { desc = 'Debug: Step Over' })) - - vim.keymap.set('n', '', function() - require('dap').step_into() - end, vim.tbl_extend('force', opts, { desc = 'Debug: Step Into' })) - - vim.keymap.set('n', '', function() - require('dap').step_out() - end, vim.tbl_extend('force', opts, { desc = 'Debug: Step Out' })) - - -- Leader-based debug commands - vim.keymap.set('n', 'db', function() - require('dap').toggle_breakpoint() - end, vim.tbl_extend('force', opts, { desc = '[D]ebug: Toggle [B]reakpoint' })) - - vim.keymap.set('n', 'dB', function() - require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ') - end, vim.tbl_extend('force', opts, { desc = '[D]ebug: Set Conditional [B]reakpoint' })) - - vim.keymap.set('n', 'dc', function() - require('dap').continue() - end, vim.tbl_extend('force', opts, { desc = '[D]ebug: [C]ontinue' })) - - vim.keymap.set('n', 'dt', function() - require('dap').terminate() - end, vim.tbl_extend('force', opts, { desc = '[D]ebug: [T]erminate' })) - - vim.keymap.set('n', 'du', function() - require('dapui').toggle() - end, vim.tbl_extend('force', opts, { desc = '[D]ebug: Toggle [U]I' })) - - -- Register groups with which-key + -- Register which-key group for Flutter require('which-key').add { - { 'f', group = '[F]lutter', mode = 'n' }, - { 'd', group = '[D]ebug', mode = 'n' }, + { 'f', group = ' flutter', mode = 'n', buffer = event.buf }, } end, }) diff --git a/lua/plugins/lang/python.lua b/lua/plugins/lang/python.lua index b8d58537..a2cd8e8e 100644 --- a/lua/plugins/lang/python.lua +++ b/lua/plugins/lang/python.lua @@ -173,4 +173,54 @@ return { return opts end, }, + + -- Python keymaps (loaded only for Python files) + { + 'nvim-lspconfig', + ft = 'python', + config = function() + vim.api.nvim_create_autocmd('FileType', { + pattern = 'python', + callback = function(event) + local bufnr = event.buf + + -- Register which-key group for Python + require('which-key').add { + { 'p', group = ' python', buffer = bufnr }, + } + + -- Run current file + vim.keymap.set('n', 'pr', function() + vim.cmd('!python3 %') + end, { buffer = bufnr, desc = 'Run file' }) + + -- Run with arguments + vim.keymap.set('n', 'pR', function() + local args = vim.fn.input 'Arguments: ' + vim.cmd('!python3 % ' .. args) + end, { buffer = bufnr, desc = 'Run with args' }) + + -- Select virtual environment + vim.keymap.set('n', 'pe', function() + vim.cmd 'PythonSelectVenv' + end, { buffer = bufnr, desc = 'Select venv' }) + + -- Restart Python LSP + vim.keymap.set('n', 'pl', function() + vim.cmd 'PythonRestart' + end, { buffer = bufnr, desc = 'Restart LSP' }) + + -- Import organization (via Ruff) + vim.keymap.set('n', 'pi', function() + require('conform').format { formatters = { 'ruff_organize_imports' } } + end, { buffer = bufnr, desc = 'Organize imports' }) + + -- Format with Ruff + vim.keymap.set('n', 'pf', function() + require('conform').format { formatters = { 'ruff_format' } } + end, { buffer = bufnr, desc = 'Format code' }) + end, + }) + end, + }, } diff --git a/lua/plugins/lang/rust.lua b/lua/plugins/lang/rust.lua new file mode 100644 index 00000000..f36f5d1c --- /dev/null +++ b/lua/plugins/lang/rust.lua @@ -0,0 +1,272 @@ +-- Rust Development Configuration +-- Loaded only for Rust files (*.rs) + +return { + -- Rust Tools - Enhanced rust-analyzer integration + { + 'mrcjkb/rustaceanvim', + version = '^5', + lazy = false, -- Already lazy-loaded by filetype + ft = { 'rust' }, + opts = { + server = { + on_attach = function(client, bufnr) + -- Register which-key group for Rust + require('which-key').add { + { 'r', group = '󱘗 rust', buffer = bufnr }, + } + + -- Hover actions + vim.keymap.set('n', 'rh', function() + vim.cmd.RustLsp { 'hover', 'actions' } + end, { buffer = bufnr, desc = 'Hover actions' }) + + -- Code actions + vim.keymap.set('n', 'ra', function() + vim.cmd.RustLsp('codeAction') + end, { buffer = bufnr, desc = 'Code actions' }) + + -- Explain error + vim.keymap.set('n', 're', function() + vim.cmd.RustLsp('explainError') + end, { buffer = bufnr, desc = 'Explain error' }) + + -- Open Cargo.toml + vim.keymap.set('n', 'rC', function() + vim.cmd.RustLsp('openCargo') + end, { buffer = bufnr, desc = 'Open Cargo.toml' }) + + -- Parent module + vim.keymap.set('n', 'rp', function() + vim.cmd.RustLsp('parentModule') + end, { buffer = bufnr, desc = 'Parent module' }) + + -- Join lines + vim.keymap.set('n', 'rj', function() + vim.cmd.RustLsp('joinLines') + end, { buffer = bufnr, desc = 'Join lines' }) + + -- Runnables + vim.keymap.set('n', 'rr', function() + vim.cmd.RustLsp('runnables') + end, { buffer = bufnr, desc = 'Runnables' }) + + -- Debuggables + vim.keymap.set('n', 'rd', function() + vim.cmd.RustLsp('debuggables') + end, { buffer = bufnr, desc = 'Debuggables' }) + + -- Expand macro + vim.keymap.set('n', 'rm', function() + vim.cmd.RustLsp('expandMacro') + end, { buffer = bufnr, desc = 'Expand macro' }) + end, + default_settings = { + -- rust-analyzer language server configuration + ['rust-analyzer'] = { + cargo = { + allFeatures = true, + loadOutDirsFromCheck = true, + buildScripts = { + enable = true, + }, + }, + -- Add clippy lints for Rust + checkOnSave = { + allFeatures = true, + command = 'clippy', + extraArgs = { '--no-deps' }, + }, + procMacro = { + enable = true, + ignored = { + ['async-trait'] = { 'async_trait' }, + ['napi-derive'] = { 'napi' }, + ['async-recursion'] = { 'async_recursion' }, + }, + }, + }, + }, + }, + -- DAP configuration + dap = { + adapter = { + type = 'executable', + command = 'lldb-vscode', -- or 'lldb-dap' on newer versions + name = 'lldb', + }, + }, + }, + config = function(_, opts) + vim.g.rustaceanvim = vim.tbl_deep_extend('keep', vim.g.rustaceanvim or {}, opts or {}) + end, + }, + + -- Crates.io integration + { + 'saecki/crates.nvim', + event = { 'BufRead Cargo.toml' }, + opts = { + completion = { + cmp = { + enabled = true, + }, + }, + lsp = { + enabled = true, + actions = true, + completion = true, + hover = true, + }, + }, + config = function(_, opts) + local crates = require 'crates' + crates.setup(opts) + + -- Crates keymaps (only in Cargo.toml) + vim.api.nvim_create_autocmd('BufRead', { + pattern = 'Cargo.toml', + callback = function() + local bufnr = vim.api.nvim_get_current_buf() + + -- Register which-key group for Rust Crates + require('which-key').add { + { 'rc', group = ' crates', buffer = bufnr }, + } + + vim.keymap.set('n', 'rct', function() + crates.toggle() + end, { buffer = bufnr, desc = 'Toggle crates' }) + + vim.keymap.set('n', 'rcr', function() + crates.reload() + end, { buffer = bufnr, desc = 'Reload crates' }) + + vim.keymap.set('n', 'rcv', function() + crates.show_versions_popup() + end, { buffer = bufnr, desc = 'Show versions' }) + + vim.keymap.set('n', 'rcf', function() + crates.show_features_popup() + end, { buffer = bufnr, desc = 'Show features' }) + + vim.keymap.set('n', 'rcd', function() + crates.show_dependencies_popup() + end, { buffer = bufnr, desc = 'Show dependencies' }) + + vim.keymap.set('n', 'rcu', function() + crates.update_crate() + end, { buffer = bufnr, desc = 'Update crate' }) + + vim.keymap.set('v', 'rcu', function() + crates.update_crates() + end, { buffer = bufnr, desc = 'Update selected' }) + + vim.keymap.set('n', 'rca', function() + crates.update_all_crates() + end, { buffer = bufnr, desc = 'Update all' }) + + vim.keymap.set('n', 'rcU', function() + crates.upgrade_crate() + end, { buffer = bufnr, desc = 'Upgrade crate' }) + + vim.keymap.set('v', 'rcU', function() + crates.upgrade_crates() + end, { buffer = bufnr, desc = 'Upgrade selected' }) + + vim.keymap.set('n', 'rcA', function() + crates.upgrade_all_crates() + end, { buffer = bufnr, desc = 'Upgrade all' }) + + vim.keymap.set('n', 'rce', function() + crates.expand_plain_crate_to_inline_table() + end, { buffer = bufnr, desc = 'Expand to inline' }) + + vim.keymap.set('n', 'rcE', function() + crates.extract_crate_into_table() + end, { buffer = bufnr, desc = 'Extract to table' }) + + vim.keymap.set('n', 'rcH', function() + crates.open_homepage() + end, { buffer = bufnr, desc = 'Open homepage' }) + + vim.keymap.set('n', 'rcR', function() + crates.open_repository() + end, { buffer = bufnr, desc = 'Open repository' }) + + vim.keymap.set('n', 'rcD', function() + crates.open_documentation() + end, { buffer = bufnr, desc = 'Open documentation' }) + + vim.keymap.set('n', 'rcC', function() + crates.open_crates_io() + end, { buffer = bufnr, desc = 'Open crates.io' }) + end, + }) + end, + }, + + -- Mason tool installations for Rust + { + 'williamboman/mason.nvim', + opts = function(_, opts) + opts.ensure_installed = opts.ensure_installed or {} + vim.list_extend(opts.ensure_installed, { + 'rust-analyzer', + 'codelldb', -- For debugging + }) + end, + }, + + -- Treesitter for Rust + { + 'nvim-treesitter/nvim-treesitter', + opts = function(_, opts) + opts.ensure_installed = opts.ensure_installed or {} + vim.list_extend(opts.ensure_installed, { + 'rust', + 'ron', -- Rusty Object Notation + 'toml', -- For Cargo.toml + }) + end, + }, + + -- DAP configuration for Rust + { + 'mfussenegger/nvim-dap', + optional = true, + opts = function() + local dap = require 'dap' + + dap.configurations.rust = { + { + name = 'Launch', + type = 'codelldb', + request = 'launch', + program = function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/target/debug/', 'file') + end, + cwd = '${workspaceFolder}', + stopOnEntry = false, + args = {}, + }, + { + name = 'Attach to process', + type = 'codelldb', + request = 'attach', + pid = require('dap.utils').pick_process, + args = {}, + }, + } + + dap.adapters.codelldb = { + type = 'server', + port = '${port}', + executable = { + command = vim.fn.exepath 'codelldb', + args = { '--port', '${port}' }, + }, + } + end, + }, +} diff --git a/lua/plugins/lang/svelte.lua b/lua/plugins/lang/svelte.lua index 971dcbb5..4b08807c 100644 --- a/lua/plugins/lang/svelte.lua +++ b/lua/plugins/lang/svelte.lua @@ -180,4 +180,48 @@ return { }) end, }, + + -- ======================================================================== + -- SVELTE-SPECIFIC KEYMAPS + -- ======================================================================== + -- Additional Svelte-specific settings and keymaps + -- ======================================================================== + { + 'nvim-lspconfig', + ft = 'svelte', + config = function() + vim.api.nvim_create_autocmd('FileType', { + pattern = 'svelte', + callback = function(event) + local bufnr = event.buf + + -- Register which-key group for Svelte + require('which-key').add { + { 'v', group = ' svelte', buffer = bufnr }, + } + + -- Format with Prettier + vim.keymap.set('n', 'vf', function() + require('conform').format { formatters = { 'prettier' } } + end, { buffer = bufnr, desc = 'Format with prettier' }) + + -- Restart Svelte LSP + vim.keymap.set('n', 'vl', function() + vim.cmd 'LspRestart svelte' + end, { buffer = bufnr, desc = 'Restart LSP' }) + + -- Restart TypeScript LSP (often needed in Svelte projects) + vim.keymap.set('n', 'vt', function() + vim.cmd 'LspRestart ts_ls' + end, { buffer = bufnr, desc = 'Restart TypeScript LSP' }) + + -- Open component in split + vim.keymap.set('n', 'vo', function() + local word = vim.fn.expand '' + vim.cmd('split ' .. word) + end, { buffer = bufnr, desc = 'Open component in split' }) + end, + }) + end, + }, }