Comments (6)
I think the example is needed.
from snippets.nvim.
Ah, I see. It doesn't actually require people to pass in the line number, as it is set to a v
variable...
I was thinking that when expanding something and encountering \n
character, you could insert the first line of the text, then call indentexpr
to see what the indent of the next line would be.
I don't know if I have a good example, but basically I have an it
expansion for lua to add it('$1', function()\n$0\nend)
but the new lines don't indent to the right places (but they do when I hit enter)
from snippets.nvim.
I get it.
I think tab character conversion is better like other snippet plugins.
it('$1', function()\n\t$0\nend)
Note: neosnippet implements the auto indentation feature by indent plugins.
But some indentation plugins are broken(PHP, python, etc...).
from snippets.nvim.
From Gitter (copying here so it's preserved and more visible/searchable): you can now do
local match_indentation = require'snippets.utils'.match_indentation
and then apply it to a snippet like so
["for"] = match_indentation "for ${1:i} = 0, $2 do\n $0\nend",
from snippets.nvim.
What he said.
It's also available in require'snippets'.u
as an alias for "snippets.utils"
from snippets.nvim.
It also includes a general utility in case you don't like the one I made for prefixing new lines.
from snippets.nvim.
Related Issues (20)
- Autoexpand HOT 1
- not placing the cursor in the right place with multi line snippets with white space before the snippet
- Questions on snippets and completion with completion-nvim HOT 1
- [help] Custom Mapping with Fallback
- How can I add a value of placeholder as argument to function? HOT 1
- Show tab-based mapping in the README HOT 1
- Better control of word boundary behavior / add an equivalent of UltiSnips's `w`
- [suggestion] switch the use of <C-k> and <C-j
- [Q] How to use this with vim-snippets?
- match_indentation HOT 2
- [Q] How to lazy init time a snippet? HOT 5
- [Q] Reloading snippets?
- In-word expansion (equivalent to Ultisnips `i`)
- Default mappings only works in first buffer opened by nvim HOT 1
- Basic setup documentation
- Feature request - "regular" inserter HOT 6
- How can I write the variable and exit to the mini buffer?
- Is it possible disable the mini buffer window that appears after expanding a snippet? HOT 1
- Integration with nvim-compe HOT 1
- Error expanding snippet HOT 1
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 snippets.nvim.