Skip to content

Enhance Kickstart.nvim UX with Buffer Completions, Options, and Autocommands #1642

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

MN-nagy
Copy link

@MN-nagy MN-nagy commented Jul 13, 2025

This pull request aims to enhances the kickstart.nvim configuration by integrating features that directly improve user experience, with a core focus on session persistence, efficient navigation, and smarter completion functionality. The changes meticulously maintain the project's foundational minimal and extensible philosophy.


Detailed Changes

⚙️ Options

  • vim.opt.undofile = true: Enables persistent undo history across Neovim sessions. This enhancement allows users to undo and redo changes even after closing and reopening files, boosting productivity and safety.
  • vim.opt.smoothscroll = true: Activates smooth, line-by-line scrolling (requires Neovim 0.10+). This visual improvement enhances readability and navigation, especially within large files and when traversing completion menus.
  • vim.opt.colorcolumn = '100': This option is intentionally commented out. If uncommented, it would visually highlight column 100 to indicate a preferred maximum line length, but it remains disabled to uphold the configuration's minimalist design principle.

⌨️ Keymaps

  • Added <leader>Q mapping: Introduces a convenient, quick shortcut to close the current buffer (:bd<CR>). This streamlines buffer management and improves workflow efficiency.

🔄 Autocommands

  • Modified TextYankPost: Enhanced by adding timeout = 200. This modification effectively limits the duration of the yank highlight, reducing visual distraction. Furthermore, the explicit timeout value offers users a clear point of customization to increase or decrease the highlight duration based on their personal preference, promoting a more tailored experience.
  • Added BufReadPost: Implements an autocommand to restore the cursor position on file open (pattern = '*'). This ensures session continuity improves user experience by returning users directly to their last editing location across all file types.
  • Added BufWritePre: Automatically creates any missing parent directories when saving a file. This eliminates a common friction point, improving usability when creating new files with nested paths.
  • Commented out FileType: This autocommand, if enabled, would disable automatic comment continuation for all filetypes. It remains commented out, offering users the flexibility to enable or disable it based on their specific coding conventions and preferences.

💡 blink.cmp Configuration

  • Integrated buffer source into sources.default: This addition to blink.cmp provides relevant word completions directly from currently open buffers. The source is further refined with a filter restricting completions to user-chosen filetypes, currently pre-configured for markdown and text files.

Copy link
Contributor

@guru245 guru245 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use vim.o instead of vim.opt across the board. See #1495

@@ -184,6 +190,9 @@ vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagn
-- or just use <C-\><C-n> to exit terminal mode
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })

-- Close current buffer
vim.keymap.set('n', '<leader>Q', ':bd<CR>', { desc = 'Close current buffer' })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this is not very useful because <C-w>q (which quits the window instead of the buffer) serves the purpose of closing splits, If I need to actually close buffers I usually use <M-d> inside of Telescope's buffers picker.

What do you think?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback, I agree that <C-w>q and Telescope's buffer picker are good ways to manage windows and buffers in advanced workflows.

However, since Kickstart.nvim is primarily aimed at users new to Neovim, I think keeping the <leader>Q mapping for :bd is a good idea. as for many beginners, "closing a file" intuitively means closing the buffer, not just the window.

init.lua Outdated
Comment on lines 257 to 266
-- disable automatic comment on newline
-- vim.api.nvim_create_autocmd('FileType', {
-- desc = 'Disable automatic comment on newline',
-- group = vim.api.nvim_create_augroup('kickstart-disable-auto-comment', { clear = true }),
-- pattern = '*',
-- callback = function()
-- vim.opt_local.formatoptions:remove { 'c', 'r', 'o' }
-- end,
-- })

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this might be too niche

Copy link
Author

@MN-nagy MN-nagy Jul 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a fair point. My goal with adding these autocommands was to give users a better idea of what's possible with them, as the original repo only included just one example.

If you still think it's too much to add to init.lua, I can make a new file with these autocommands, plus some other useful ones, and add it to lua/kickstart/autocmds.lua or a similar location. That way, users could still have them as examples.

What do you think?

Copy link
Contributor

@oriori1703 oriori1703 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do think some of the changes are a bit too niche, but the rest seem like pretty good editions 😄

@MN-nagy
Copy link
Author

MN-nagy commented Jul 20, 2025

@oriori1703 @guru245

Thanks for the feedback, I really appreciate you guys taking the time to review everything 🙏. I'm still pretty new to Lua and Neovim myself, so I'm learning a lot as I go.

Apologies if this PR has caused any headaches – I definitely don't want to make extra work for y'all 😅😅.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants