UNPKG

colson-nvim

Version:

Colson Nvim: Neovim Code Editor/IDE for Software Engineers!

341 lines (249 loc) โ€ข 6.82 kB
# โœ… TELESCOPE BEHAVIOR FIXED **Date:** October 11, 2025 **Issues Fixed:** Startup not working + Esc behavior **Status:** ๐ŸŸข **FIXED** --- ## ๐Ÿ”ง ISSUES FIXED ### โœ… **Issue 1: Telescope Not Auto-Opening on Startup** **Problem:** - Running `nvim .` doesn't open Telescope automatically - Expected behavior: Telescope should open immediately **Root Cause:** - Timing issue - Telescope wasn't fully loaded before trying to open - VimEnter autocmd was firing too early **Solution:** 1. โœ… Increased startup delay from 100ms to 200ms 2. โœ… Added `vim.schedule()` for proper event loop timing 3. โœ… Added better error handling with notification 4. โœ… Fixed directory detection logic **Location:** `/home/colson/.config/nvim/lua/colson/startup.lua` (lines 4-40) --- ### โœ… **Issue 2: Esc Key Behavior Wrong** **Problem:** - When in Telescope INSERT mode, pressing `Esc` CLOSES Telescope - Expected: `Esc` should switch to NORMAL mode (like normal Vim) - Then navigate with `j`/`k`, press `Enter` to open - Press `Esc` AGAIN (in normal mode) to close **Root Cause:** - Insert mode had `["<Esc>"] = actions.close` mapping - This overrode default Vim behavior (Esc = switch to normal mode) **Solution:** 1. โœ… Removed `<Esc>` mapping from insert mode 2. โœ… Kept `<C-c>` for quick close in insert mode 3. โœ… Kept `<Esc>` in normal mode to close 4. โœ… Added comments explaining behavior **Location:** `/home/colson/.config/nvim/after/plugin/telescope.lua` (lines 44-74) --- ## โŒจ๏ธ NEW TELESCOPE BEHAVIOR ### **Workflow 1: Type and Search (Insert Mode)** ```bash nvim . ``` **What happens:** 1. โœ… Telescope opens automatically (200ms delay) 2. โœ… You're in INSERT mode (cursor in search box) 3. Type to search: `README` 4. Navigate: `<C-j>` / `<C-k>` (or arrow keys) 5. Open file: `<Enter>` **To close without opening:** - Press `<C-c>` (quick close) --- ### **Workflow 2: Navigate with j/k (Normal Mode)** ```bash nvim . ``` **What happens:** 1. โœ… Telescope opens in INSERT mode 2. Press `<Esc>` โ†’ Switch to NORMAL mode 3. Navigate: `j` / `k` (Vim style!) 4. Open file: `<Enter>` **To close:** - Press `<Esc>` again (in normal mode) - Or press `q` --- ### **Workflow 3: Esc Twice to Close** ```bash nvim . ``` **Flow:** 1. Telescope opens (INSERT mode) 2. Type to search (optional) 3. Press `<Esc>` โ†’ Normal mode (still in Telescope) 4. Press `<Esc>` again โ†’ Close Telescope **This matches standard Vim behavior!** โœ… --- ## ๐ŸŽฏ COMPLETE KEYBINDING REFERENCE ### **When in INSERT Mode (typing in search box):** | Key | Action | |-----|--------| | `<Enter>` | Open selected file | | `<C-j>` / `<C-k>` | Move up/down | | `<C-n>` / `<C-p>` | Move up/down (alternative) | | `<Down>` / `<Up>` | Move up/down (arrows) | | `<C-x>` | Open in horizontal split | | `<C-v>` | Open in vertical split | | `<C-t>` | Open in new tab | | `<C-c>` | **Close immediately** | | `<Esc>` | **Switch to normal mode** โญ NEW | ### **When in NORMAL Mode (navigating with j/k):** | Key | Action | |-----|--------| | `<Enter>` | Open selected file | | `j` / `k` | Move up/down (Vim style!) | | `<Down>` / `<Up>` | Move up/down (arrows) | | `gg` | Jump to top | | `G` | Jump to bottom | | `<C-x>` | Open in horizontal split | | `<C-v>` | Open in vertical split | | `<C-t>` | Open in new tab | | `q` | Close Telescope | | `<Esc>` | **Close Telescope** โญ | --- ## ๐Ÿงช TEST THE FIXES ### **Test 1: Auto-Open on Startup** ```bash cd ~/your-project nvim . ``` **Expected:** - โœ… Telescope opens automatically after ~200ms - โœ… Cursor is in search box (insert mode) - โœ… You can start typing immediately **If it doesn't open:** - Plugins might not be installed yet - Run `:PackerSync` first --- ### **Test 2: Esc Switches to Normal Mode** ```bash nvim . ``` **Steps:** 1. Telescope opens (INSERT mode) 2. Type something: `README` 3. Press `<Esc>` - โœ… Should stay in Telescope (NORMAL mode) - โœ… Cursor should be on file list 4. Press `j` or `k` - โœ… Should navigate files 5. Press `<Enter>` - โœ… Opens the file --- ### **Test 3: Esc Twice to Close** ```bash nvim . ``` **Steps:** 1. Telescope opens (INSERT mode) 2. Press `<Esc>` - โœ… Switches to NORMAL mode (stays open) 3. Press `<Esc>` again - โœ… Closes Telescope --- ### **Test 4: Manual Trigger** ```vim <leader>pf ``` **Expected:** - โœ… Telescope opens - โœ… Same behavior as auto-open - โœ… Esc switches modes properly --- ## ๐Ÿ”„ COMPARISON: BEFORE vs AFTER ### **BEFORE (Broken):** ``` nvim . โ†’ Telescope doesn't open โŒ <leader>pf โ†’ Telescope opens โ†’ Type to search โ†’ Press Esc โ†’ Closes immediately โŒ (Can't use j/k!) ``` ### **AFTER (Fixed):** ``` nvim . โ†’ Telescope opens automatically โœ… You can type to search OR โ†’ Press Esc โ†’ Switch to normal mode โœ… โ†’ Use j/k to navigate โœ… โ†’ Press Enter to open โœ… โ†’ Press Esc again to close โœ… Standard Vim behavior! ๐ŸŽ‰ ``` --- ## ๐Ÿ“‹ FILES MODIFIED | File | Change | Lines | |------|--------|-------| | `lua/colson/startup.lua` | Increased delay, added vim.schedule | 4-40 | | `after/plugin/telescope.lua` | Removed Esc close in insert mode | 44-74 | --- ## โ“ TROUBLESHOOTING ### **"Telescope still doesn't open on startup"** **Check if plugins are installed:** ```vim :PackerStatus ``` Should show ~40 plugins. If not: ```vim :PackerSync ``` Then restart: ```bash nvim . ``` --- ### **"Esc still closes immediately"** You need to restart Neovim to reload the config: ```bash :qa nvim . ``` Or source the file: ```vim :luafile ~/.config/nvim/after/plugin/telescope.lua ``` --- ### **"Want to close quickly without Esc Esc"** Use `<C-c>` in insert mode: ```vim " In Telescope <C-c> " Closes immediately ``` --- ## ๐ŸŽ‰ SUMMARY ### **What's Fixed:** - โœ… Telescope auto-opens on `nvim .` - โœ… `<Esc>` switches to normal mode (not close) - โœ… Can navigate with `j`/`k` after pressing Esc - โœ… Standard Vim behavior restored - โœ… `<Esc>` twice to close (or `q` in normal mode) - โœ… `<C-c>` for quick close in insert mode ### **New Workflow:** ``` nvim . โ†’ Telescope opens โœ… โ†’ Type to search OR press Esc โ†’ Use j/k to navigate โœ… โ†’ Press Enter to open โœ… โ†’ Press Esc (in normal) or q to close โœ… ``` --- ## ๐Ÿš€ YOUR NEXT COMMAND ```bash nvim . ``` **Then test:** 1. Telescope opens? โœ… 2. Type something, press Esc โ†’ Switches to normal mode? โœ… 3. Press j/k โ†’ Navigates? โœ… 4. Press Enter โ†’ Opens file? โœ… 5. Press Esc again โ†’ Closes? โœ… **All should work!** ๐ŸŽ‰ --- **Read this if confused:** This is standard Vim behavior now! - Insert mode โ†’ Type - Esc โ†’ Normal mode โ†’ Navigate - Esc again โ†’ Exit Just like normal Neovim! ๐Ÿš€ --- **GitHub:** https://github.com/colson0x1/colson-nvim **Author:** Colson (@colson0x1)