All Projects → AndrewRadev → Splitjoin.vim

AndrewRadev / Splitjoin.vim

Licence: mit
Switch between single-line and multiline forms of code

Projects that are alternatives of or similar to Splitjoin.vim

Tagalong.vim
Change an HTML(ish) opening tag and take the closing one along as well
Stars: ✭ 184 (-86.7%)
Mutual labels:  refactoring, vim-plugin
Sideways.vim
A Vim plugin to move function arguments (and other delimited-by-something items) left and right.
Stars: ✭ 370 (-73.25%)
Mutual labels:  refactoring, vim-plugin
Rainbow levels.vim
A different approach to code highlighting.
Stars: ✭ 415 (-69.99%)
Mutual labels:  refactoring, vim-plugin
Incsearch Easymotion.vim
Stars: ✭ 82 (-94.07%)
Mutual labels:  vim-plugin
Todoist.nvim
A todoist extension for neovim
Stars: ✭ 84 (-93.93%)
Mutual labels:  vim-plugin
Vim Table Mode
VIM Table Mode for instant table creation.
Stars: ✭ 1,341 (-3.04%)
Mutual labels:  vim-plugin
Vim Marked
Open the current Markdown buffer in Marked.app
Stars: ✭ 101 (-92.7%)
Mutual labels:  vim-plugin
Vista.vim
🌵 Viewer & Finder for LSP symbols and tags
Stars: ✭ 1,218 (-11.93%)
Mutual labels:  vim-plugin
Study Path
An organized learning path about Clean Code, Test-Driven Development, Legacy Code, Refactoring, Domain-Driven Design and Microservice Architecture
Stars: ✭ 1,357 (-1.88%)
Mutual labels:  refactoring
Asyncrun.vim
🚀 Run Async Shell Commands in Vim 8.0 / NeoVim and Output to the Quickfix Window !!
Stars: ✭ 1,332 (-3.69%)
Mutual labels:  vim-plugin
Rainbow
Rainbow Parentheses Improved, shorter code, no level limit, smooth and fast, powerful configuration.
Stars: ✭ 1,324 (-4.27%)
Mutual labels:  vim-plugin
Refactoring101
The code here, represented as steps, is the progression of a refactoring on a legacy codebase. It is a PHP equivalent of the Java code shown in the Martin Fowler book "Refactoring".
Stars: ✭ 88 (-93.64%)
Mutual labels:  refactoring
Wandbox Vim
Wandbox plugin for vimmers. http://melpon.org/wandbox/
Stars: ✭ 97 (-92.99%)
Mutual labels:  vim-plugin
Learn Vim
无废话极简版Vim学习笔记!文章按主题分拆为多个章节,并尽量控制每节的信息量;通过文字色彩和字体,将命令、快捷键突出显示;在每节结尾,提供一个命令列表,以便回顾文中介绍的重要命令。如果这些文章能对喜欢Vim的朋友有所益处,我将不胜荣幸。
Stars: ✭ 83 (-94%)
Mutual labels:  vim-plugin
Thumbnail.vim
A thumbnail-style buffer selector for Vim
Stars: ✭ 99 (-92.84%)
Mutual labels:  vim-plugin
Vim Plugin Viewdoc
Vim plugin: flexible viewer for any documentation
Stars: ✭ 79 (-94.29%)
Mutual labels:  vim-plugin
Vim Js
💯The most accurate syntax highlighting plugin for JavaScript and Flow.js
Stars: ✭ 99 (-92.84%)
Mutual labels:  vim-plugin
Vim Which Key
🌷 Vim plugin that shows keybindings in popup
Stars: ✭ 1,310 (-5.28%)
Mutual labels:  vim-plugin
Vim Haskell Indent
If the plugin does not work for some syntax, feel free to report to the issue tracker!
Stars: ✭ 90 (-93.49%)
Mutual labels:  vim-plugin
Inline edit.vim
Edit code that's embedded within other code
Stars: ✭ 94 (-93.2%)
Mutual labels:  vim-plugin

GitHub version Build Status

Usage

This plugin is meant to simplify a task I've found too common in my workflow: switching between a single-line statement and a multi-line one. It offers the following default keybindings, which can be customized:

  • gS to split a one-liner into multiple lines
  • gJ (with the cursor on the first line of a block) to join a block into a single-line statement.

Demo

I usually work with ruby and a lot of expressions can be written very concisely on a single line. A good example is the "if" statement:

puts "foo" if bar?

This is a great feature of the language, but when you need to add more statements to the body of the "if", you need to rewrite it:

if bar?
  puts "foo"
  puts "baz"
end

The idea of this plugin is to introduce a single key binding (default: gS) for transforming a line like this:

<div id="foo">bar</div>

Into this:

<div id="foo">
  bar
</div>

And another binding (default: gJ) for the opposite transformation.

This currently works for various constructs in the following languages:

  • C
  • CSS
  • Coffeescript
  • Elixir
  • Elm
  • Eruby
  • Go
  • HAML
  • HTML (and HTML-like markup)
  • Handlebars
  • Javascript (within JSX, TSX, Vue.js templates as well)
  • JSON
  • Lua
  • PHP
  • Perl
  • Python
  • Ruby
  • Rust
  • SCSS and Less
  • Shell (sh, bash, zsh)
  • Tex
  • Vimscript
  • YAML

For more information, including examples for all of those languages, try :help splitjoin, or take a look at the full help file online at doc/splitjoin.txt

Installation

The easiest way to install the plugin is with a plugin manager:

If you use one, just follow the instructions in its documentation.

You can install the plugin yourself using Vim's "packages" functionality by cloning the project (or adding it as a submodule) under ~/.vim/pack/<any-name>/start/. For example:

git clone https://github.com/AndrewRadev/splitjoin.vim ~/.vim/pack/_/start/splitjoin

This should automatically load the plugin for you on Vim start. Alternatively, you can add it to ~/.vim/pack/<any-name>/opt/ instead and load it in your .vimrc manually with:

packadd splitjoin

If you'd rather not use git, you can download the files from the "releases" tab and unzip them in the relevant directory: https://github.com/AndrewRadev/splitjoin.vim/releases.

Contributing

If you'd like to hack on the plugin, please see CONTRIBUTING.md first.

Issues

Any issues and suggestions are very welcome on the github bugtracker.

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].