All Projects → wellle → Visual Split.vim

wellle / Visual Split.vim

Licence: mit
Vim plugin to control splits with visual selections or text objects

Projects that are alternatives of or similar to Visual Split.vim

Context.vim
Vim plugin that shows the context of the currently visible buffer contents
Stars: ✭ 688 (+262.11%)
Mutual labels:  neovim, vim-plugin, vim-plugins, neovim-plugin
Tmux Complete.vim
Vim plugin for insert mode completion of words in adjacent tmux panes
Stars: ✭ 447 (+135.26%)
Mutual labels:  neovim, vim-plugin, vim-plugins, neovim-plugin
Targets.vim
Vim plugin that provides additional text objects
Stars: ✭ 2,114 (+1012.63%)
Mutual labels:  neovim, vim-plugin, vim-plugins, neovim-plugin
Vim Dadbod Completion
Database autocompletion powered by https://github.com/tpope/vim-dadbod
Stars: ✭ 163 (-14.21%)
Mutual labels:  neovim, vim-plugin, vim-plugins, neovim-plugin
Alchemist.vim
Elixir Integration Into Vim
Stars: ✭ 632 (+232.63%)
Mutual labels:  neovim, vim-plugin, vim-plugins, neovim-plugin
Vem Tabline
A lightweight Vim/Neovim plugin to display buffers and tabs in the tabline
Stars: ✭ 129 (-32.11%)
Mutual labels:  neovim, vim-plugin, neovim-plugin
Vim Markdown Composer
An asynchronous markdown preview plugin for Vim and Neovim.
Stars: ✭ 501 (+163.68%)
Mutual labels:  neovim, vim-plugin, neovim-plugin
Ale
Check syntax in Vim asynchronously and fix files, with Language Server Protocol (LSP) support
Stars: ✭ 11,380 (+5889.47%)
Mutual labels:  vim-plugin, vim-plugins, neovim-plugin
Crease.vim
Easy foldtext customization for [neo]vim.
Stars: ✭ 19 (-90%)
Mutual labels:  neovim, vim-plugin, neovim-plugin
Hot Reload.vim
A (Neo)vim plugin for Flutter to automatically hot reload the project every time a file is saved
Stars: ✭ 33 (-82.63%)
Mutual labels:  neovim, vim-plugin, vim-plugins
Todoist.nvim
A todoist extension for neovim
Stars: ✭ 84 (-55.79%)
Mutual labels:  neovim, vim-plugin, neovim-plugin
Vim Clap
👏 Modern performant fuzzy picker for Vim and NeoVim
Stars: ✭ 1,802 (+848.42%)
Mutual labels:  neovim, vim-plugin, neovim-plugin
Neovim Fuzzy
Fuzzy file finding for neovim
Stars: ✭ 103 (-45.79%)
Mutual labels:  neovim, vim-plugin, neovim-plugin
Neotex
latex live preview - plugin for neovim and vim 8
Stars: ✭ 170 (-10.53%)
Mutual labels:  neovim, vim-plugin, neovim-plugin
Lens.vim
A Vim Automatic Window Resizing Plugin
Stars: ✭ 381 (+100.53%)
Mutual labels:  neovim, vim-plugin, neovim-plugin
Barbar.nvim
A neovim tabline plugin.
Stars: ✭ 359 (+88.95%)
Mutual labels:  neovim, vim-plugin, neovim-plugin
Dashboard Nvim
vim dashboard
Stars: ✭ 294 (+54.74%)
Mutual labels:  neovim, vim-plugin, neovim-plugin
Vim Dadbod Ui
Simple UI for https://github.com/tpope/vim-dadbod
Stars: ✭ 315 (+65.79%)
Mutual labels:  neovim, vim-plugins, neovim-plugin
Asyncrun.vim
🚀 Run Async Shell Commands in Vim 8.0 / NeoVim and Output to the Quickfix Window !!
Stars: ✭ 1,332 (+601.05%)
Mutual labels:  neovim, vim-plugin, neovim-plugin
Nvim Treesitter Context
Show code context
Stars: ✭ 113 (-40.53%)
Mutual labels:  neovim, vim-plugin, neovim-plugin

visual-split.vim

Vim plugin to control splits with visual selections or text objects

Motivation

Ever found yourself scrolling back up to the same overview comment while reading some complicated function? Or while referring to a similar implementation while writing a new function?

This is a good use for Vim splits: You have one split for reference and another one where you jump around and get work done.

But setting up the splits in the first place can be tiresome, especially if you want to make the reference split as small as possible to not waste any precious space.

Features

This plugin adds some convenient commands and mappings to resize an existing split or create a new split showing exactly what you need to see.

Commands

Resize

If you already have multiple splits open and want to resize one of them to only show a certain range of lines, follow these steps:

  1. Visually select the lines you want to see
  2. Type :VSResize to execute the VSResize ex command on the selected range
  3. The split will now only show those lines

Split

If you want to create a new split to show a certain range you could create a split and then resize it as described above. But there is a quicker way:

  1. Visually select the lines you want to split out
  2. Type :VSSplit, :VSSplitAbove or :VSSplitBelow to create the split
  3. A new split will be created showing the selected lines

Notes on the different commands:

  • :VSSplit will respect your 'splitbelow' setting
  • :VSSplitAbove will always create a new split above the current window
  • :VSSplitBelow will always create a new split below the current window

As with all commands that work on ranges, invoking them on a visual selection is only one way of many:

  • Resize split to show everything between marks a and b with :'a,'bVSResize
  • Split out range between line above cursor containing foo and line below cursor containing bar with :?foo?,/bar/VSSplit

Mappings

Mappings will not overwrite your existing mappings.

For the most common use case of working on visual selections there are some visual mode mappings provided:

  • <C-W>gr - resize split to visual selection (similar to :VSResize)
  • <C-W>gss - split out visual selection (similar to :VSSplit)
  • <C-W>gsa - split out visual selection above (similar to :VSSplitAbove)
  • <C-W>gsb - split out visual selection below (similar to :VSSplitBelow)

Note: <C-W> means press and hold the Control key while pressing W (similar to other window related commands)

For example, to split out to the paragraph around the cursor, just type:

vip<C-W>gss

To work on text objects directly, the same mappings are provided in operator pending mode. So this also works:

<C-W>gssip

Remapping

For easier remapping, <Plug> mappings are provided. Change the key sequences below and put them into your vimrc:

Visual-mode:

xmap <C-W>gr  <Plug>(Visual-Split-VSResize)
xmap <C-W>gss <Plug>(Visual-Split-VSSplit)
xmap <C-W>gsa <Plug>(Visual-Split-VSSplitAbove)
xmap <C-W>gsb <Plug>(Visual-Split-VSSplitBelow)

Operator-pending mode:

nmap <C-W>gr  <Plug>(Visual-Split-Resize)
nmap <C-W>gss <Plug>(Visual-Split-Split)
nmap <C-W>gsa <Plug>(Visual-Split-SplitAbove)
nmap <C-W>gsb <Plug>(Visual-Split-SplitBelow)

Installation

Use your favorite plugin manager.

  • NeoBundle

    NeoBundle 'wellle/visual-split.vim'
    
  • Vundle

    Bundle 'wellle/visual-split.vim'
    
  • Vim-plug

    Plug 'wellle/visual-split.vim'
    
  • Pathogen

    git clone git://github.com/wellle/visual-split.vim.git ~/.vim/bundle/visual-split.vim
    

What's next?

This plugin was written in an afternoon to fill a personal need. I might add related functionality in the future that I consider useful and related additions. If you like this plugin and want more of it, please open an issue and let me know what you would like to see.

Especially suggestions for better command names or more concise mappings would be very appreciated.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].