Skip to content

Vim mappings to quickly insert start and end keywords/characters for code blocks in the following languages: C, C++, C#, CMakeLists.txt, Microsoft .bat, shell script and Vim script.

Notifications You must be signed in to change notification settings

shaneharper/vim-code_block_markers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 

Repository files navigation

vim-code_block_markers

Go from

int my_new_function

to:

int my_new_function()
{

}

with a single key-mapping with this plugin. The key-mapping will also position the cursor inside the function body.

Inserting and moving past code block markers are (trivial) tasks done all the time by software developers: This plugin can reduce the tedium. This Vim editor plugin defines key mappings for C, C++, C#, CMakeLists.txt, Microsoft .bat, shell script and Vim script files.

<Ctrl>k Insert block start and end markers. Cursor is moved to the middle of the new block.
jj An insert mode mapping that continues insertion beyond the end of the current block.
<Ctrl>j If the current line has an unmatched '(' then a ')' is inserted followed by block start and end markers. If there was no '(' then '()' (an empty function argument list) is inserted followed by block start and end markers.

A better alternative?

Programmers commonly use indentation to make code blocks easy to see. Indentation alone is sufficient to define code blocks; extra block begin/end keywords/characters are then redundant. Python does not use code block markers, just indentation. To write Vim script without end statements see: add_vim_script_end_statements.

Setup

Vundle can be used to install and update this plugin.

About

Vim mappings to quickly insert start and end keywords/characters for code blocks in the following languages: C, C++, C#, CMakeLists.txt, Microsoft .bat, shell script and Vim script.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published