Comments (4)
Currently I support the exact contrary with -context
option.
For instance, if you add in a rust ftplugin:
Brackets { } -context=string
Brackets { } -context=string -visual=0 -trigger=µ
then {
will expand only within string context, and µ
will expand into {<cursor>}
within strings.
In other words, I have to implement what you're looking for.
I guess I will add a -context!=
option
from lh-brackets.
Yeah, I see, but i don't get how to make it explain into {}<cursor>
within string context, and into {<cursor>}
in other contexts? When i add Brackets { } -context=string
it looks like default Brackets { }
stops to work. How can i look all contexts available for binding? Thanks.
from lh-brackets.
OK. I misunderstood what you were looking for. There is a very tricky (and undocumented) way then to achieve it.
" in case you reload your ft plugin, and if the default global insert-mode mapping for `{` is correct in your context
:silent! iunmap <buffer> {
:call lh#brackets#define_imap('{', [
\ {'condition' : 'lh#syntax#name_at_mark(".") =~? "string"', 'action': '"{}"'},
\ {'condition': 1, 'action':maparg('{', 'i')}],
\ 1)
The first condition defines what to do within strings. The second conditions (which expresses the default action) executes the insert mode mapping already registered (here, the one :Brackets { }
defines.
from lh-brackets.
Fixed by 2b14091
from lh-brackets.
Related Issues (20)
- Second bracket not deleted for new bracket pairs. HOT 1
- deprecated methods from lh-vim-lib HOT 1
- Opening bracket on indented line moves cursor to first column HOT 1
- Improve context analysis of `;` mapping
- E705: Variable name conflicts with an existing function: Close HOT 1
- Disable normal mode default bracket mappings HOT 5
- Adding a semicolon before another semicolon or between two brackets throws an error with a C++ file HOT 1
- Move `lh#map#*` and `lh#marker#*` to lh-vim-lib
- It's unclear how to jump to placeholders HOT 21
- After setting g:cb_no_default_brackets to 1, backspace goes to start of line
- After installing the plugin, vim reports several errors, like 'lh#mapping#plug[34]..lh#mapping#define' HOT 1
- Using lh-brackets with Go HOT 11
- Opt-out / Disable Default Mappings HOT 1
- Weird behaviour when using Latex-suite HOT 7
- Weird behaviour when there are an unequal amount of opening/closing braces. HOT 4
- cd_disable_default disables additional brackets HOT 2
- Neovim bug with lh-brackets HOT 21
- How can I change default mapping in lh-brackets? HOT 3
- lh-brackets won't work in nvim HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lh-brackets.