[go: up one dir, main page]

Skip to content

Vim plugin for navigating paragraphs efficiently

License

Notifications You must be signed in to change notification settings

camflint/vim-paraglide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vim-paraglide 🪂

vim-paraglide is a plugin to make navigating paragraphs easier.

Motivation

The standard } and { paragraph motions jump to the blank lines before and after a paragraph, respectively, rather than to the start and end of the paragraph. If you want to change this behavior, you have to edit the somewhat-arcane nroff macros of the'paragraphs' options.

The standard paragraph motions also don't work very well with blocks, such as when you want to select a vertical column in a markdown table. vim-paraglide provides flexible mappings for most use cases around paragraph navigation.

Features

Jump to edges

Demo: jumping to all edges

Default keybinding: <down>/<up>.

Jump to only top or bottom edges

Demo: jumping to only top or bottom edges

Default keybindings:

  • <s-down>/<s-up> for top edges
  • }/{ for bottom edges (similar to default paragraph motions)

Tip: hold down shift and use the arrow keys to move across paragraphs quickly, if you're just navigating through the file.

Block, or column-aware jumps

Demo: block, or column-aware jumps

Default keybinding: g<down>/g<up>.

This works by ignoring characters to the left of the cursor column when searching for a paragraph break.

Support for visual mode

Demo: visual mode

Support for motions

Demo: visual mode

Mappings

Default mappings

Key Mapping
<down> Jump to next edge
<up> Jump to previous edge
<s-down> (shift-down) Jump to next edge (top only)
<s-up> (shift-up) Jump to previous edge (top only)
} Jump to next edge (bottom only)
{ Jump to previous edge (bottom only)
g<down> Block-wise jump to next edge
g<up> Block-wise jump to previous edge

Custom mappings

To set up a custom mapping, add the following to your .vimrc:

" Use 'gj' and 'gk' to navigate paragraphs instead of the arrow keys.
noremap <silent> gj <Plug>ParaglideDownAny
noremap <silent> gk <Plug>ParaglideUpAny

To see the full list of available keys, do:

:map <Plug>Paraglide <ENTER>

Settings

Setting Purpose Default
g:paraglide_default_maps Whether to install the default mappings. 1
g:paraglide_modify_jumplist Whether to add jumps to the window jumplist. 1
g:paraglide_wrap Whether to wrap around to the top or bottom while jumping. 0

Related plugins

If you like the idea of this plugin, you may also be interested in:

About

Vim plugin for navigating paragraphs efficiently

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published