Skip to content

Neovim plugin that snaps the cursor to 0 when moving vertically

License

Notifications You must be signed in to change notification settings

flayshon/snapcol.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

snapcol.nvim

A Neovim plugin that snaps the cursor to column 0 when moving vertically, except for the last line that had horizontal movement.

Designed to be:

  • buffer-local
  • Kickstart.nvim–friendly
  • Lazy.nvim–ready

How it works

  • j / k / gg / G always move to absolute column 0
  • Explicit horizontal movement (h, l, w, $, etc.) updates internal cursor column memory for that line. Only the last line with horizontal movement is stored at a time.
  • Toggle per buffer with :SnapColToggle

Motivation

When reading or scanning code top-to-bottom, I find it more useful for vertical movement to:

  • align to the start of the line
  • avoid inheriting arbitrary cursor columns
  • behave consistently across lines visually

Installation (Lazy.nvim)

{
  'flayshon/snapcol.nvim',
  opts = {
    filetypes = nil -- auto enables for every filetype
  },
}

Usage

Default behavior

  • auto-enables for all normal, local buffers
  • Special buffers (help, prompt, etc.) are ignored
  • You can toggle it per buffer at any time with :SnapColToggle

Restrict SnapCol to specific filetypes

If you only want it for certain languages:

opts = {
  filetypes = { 'go', 'lua', 'python', 'rust', 'typescript' },
}

With this configuration, other buffers behave normally unless toggled manually.

About

Neovim plugin that snaps the cursor to 0 when moving vertically

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages