All Projects → doums → coBra

doums / coBra

Licence: other
[co]erced [bra]cket, a simple vim plugin that forces brackets and quotes to be smart

Programming Languages

Vim Script
2826 projects

Projects that are alternatives of or similar to coBra

super-dollop
Encrypt your files or notes by your GPG key and save to MinIO or AWS S3 easily!
Stars: ✭ 58 (+107.14%)
Mutual labels:  cobra
Programming-Quotes
Repository containing various programming quotes
Stars: ✭ 26 (-7.14%)
Mutual labels:  quotes
mango
mango is a man-page generator for the Go flag, pflag, cobra, coral, and kong packages
Stars: ✭ 191 (+582.14%)
Mutual labels:  cobra
wallstreet
Stock Quotes and Charts for the Terminal
Stars: ✭ 75 (+167.86%)
Mutual labels:  quotes
cobrame
A COBRApy extension for genome-scale models of metabolism and expression (ME-models)
Stars: ✭ 30 (+7.14%)
Mutual labels:  cobra
motivate
⚡ motivate ⚡ - A simple script to print random motivational quotes. Highly influenced by linux command fortune.
Stars: ✭ 24 (-14.29%)
Mutual labels:  quotes
rt-quotes
Цитаты подкаста Радио-Т
Stars: ✭ 19 (-32.14%)
Mutual labels:  quotes
ElectronicStoreToolFX
Management tool for an electronics store JavaFx + MySQL
Stars: ✭ 18 (-35.71%)
Mutual labels:  quotes
producthunt-cli
CLI application to access product hunt
Stars: ✭ 36 (+28.57%)
Mutual labels:  cobra
MQuote
MQuote provides you +700 Motivational & Inspirational quotes by famous authors, celebrities. Powered by Flutter
Stars: ✭ 22 (-21.43%)
Mutual labels:  quotes
springcrm
An open-source CRM.
Stars: ✭ 14 (-50%)
Mutual labels:  quotes
stoic-quotes
An app that dispenses Stoic wisdom with bite-size quotes.
Stars: ✭ 25 (-10.71%)
Mutual labels:  quotes
EverydayFun
A simple NPM package which can return everyday quotes, jokes, riddles and interesting facts!
Stars: ✭ 35 (+25%)
Mutual labels:  quotes
funny-words
A Python script that generates a list of pairs of funny words for naming things such as app releases, internal projects, servers and children.
Stars: ✭ 26 (-7.14%)
Mutual labels:  pair
go course
個人多年來學習與實作上的心得筆記
Stars: ✭ 25 (-10.71%)
Mutual labels:  cobra
Quotes
Quotes Status Creator lets you share quotations as status images on social media
Stars: ✭ 31 (+10.71%)
Mutual labels:  quotes
javascript-forex-quotes
JavaScript Library for fetching realtime forex quotes.
Stars: ✭ 38 (+35.71%)
Mutual labels:  quotes
quotes
收集了一些每日一句的接口与网站。
Stars: ✭ 63 (+125%)
Mutual labels:  quotes
Android-PGP
Simple PGP encryption/decryption on android.
Stars: ✭ 46 (+64.29%)
Mutual labels:  pair
cobra-prompt
Connect cobra and go-prompt
Stars: ✭ 24 (-14.29%)
Mutual labels:  cobra

coBra

🐍 for [co]erced [bra]cket

A simple vim plugin that forces brackets and quotes to be smart.

Status update

Hi, I will no longer continue to maintain this plugin as I moved to nvim plus now I write my plugins in Lua. (Actually, I had planned to rewrite it completely in lua and using Treesitter requests, we'll see.)

install

If you use a plugin manager, follow the traditional way.

For example with vim-plug add this in .vimrc:

Plug 'doums/coBra'

Then run in vim:

:source $MYVIMRC
:PlugInstall

If you use vim package :h packages.

features

caption:
| = cursor or bounds of the selection in visual mode
* = a random character
n = end of line

mode before map after
close insert | [ [|]
delete insert [|] <BS> |
skip insert [|] ] [ ]|
break insert [|] <CR> [n|n]
wrap visual |****| <Leader>[ [|****|]
replace visual |[****]| <Leader>( (|****|)
skip on quotes visual |"****"| <Leader>" "|****|"

note: All maps works on multi lines. The presence of characters between the brackets or the quotes does not prevent maps from working.

settings

coBra runs in insert and visual modes only, default pairs are "'`{([.

coBra works by buffer and more precisely by file type. Be sure to have the filetype option on (you can check it with :filetype, and look for detection:ON). This way coBra uses the corresponding set of pairs if available (defined with g:coBraPairs). If not, he falls back to the default setting.

coBra maps for insert mode <BS>, <CR> and the two characters of each pair.
For visual mode one map for each opener characters prefixed by <Leader> is created.
He expects that no mapping for these keys already exists. If not, the concerned mapping will fail.

All settings are optional.

To customize the pairs use g:coBraPairs, if the open character is the same as the close character the pair is considered as quotes (different behavior on some situation compared to brackets). You have to enter a set of pairs by file type. Of course you can customize the default set too.

let g:coBraPairs = {
  \  'default': [
  \    ['"', '"'],
  \    ["'", "'"],
  \  ],
  \  'rust': [
  \    ['"', '"'],
  \    ['<', '>'],
  \    ['{', '}'],
  \    ['(', ')'],
  \    ['[', ']']
  \  ]
  \ }

Preformance is king when we type. For that reason you can set g:coBraMaxPendingCloseTry to a scpecific value between 0 and maxfuncdepth, default 10. When you type an openning bracket, before inserting and auto closing it the script looks recursively for a "pending" close bracket that does not have a matching open one. If it find one the script simply inserts the open bracket without auto closing it to complete the pair. g:coBraMaxPendingCloseTry limits the number of try of this logic.

let g:coBraMaxPendingCloseTry = 10

By default, and for the sake of performance, coBra takes into account only the visible lines from the current window. With this option you can configure coBra to run on the entire file.

let g:coBraFullBuffer

Like g:coBraFullBuffer but instead of the whole file, you can set a range of lines (starting from the cursor position, forward and backward).

let g:coBraLineMax = 10

license

Mozilla Public License 2.0

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