Comments (6)
There's no perl for now, because I don't really know perl, but probably won't be difficult to add. I'm going to leave it for the weekend, I'll write back here when I've got something working.
from splitjoin.vim.
I've pushed some simple Perl support. Splitting and joining if clauses should now work. Could you check it out and let me know if it does?
from splitjoin.vim.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Hi Andrew,
Am Mo den 16. Apr 2012 um 8:02 schrieb Andrew Radev:
I've pushed some simple Perl support. Splitting and joining if clauses should now work. Could you check it out and let me know if it does?
Thanks. That was fast.
Works partly. Well, it works pretty good but usually I use the Gnu
style for open braces. And this is not seen by splitjoin.
So for examples (Real code):
if (fork)
{
exit 0;
}
But there are even more styles that are more or less identical:
open PID, ">", $pidfile or die;
unless (open PID, ">", $pidfile)
{
die;
}
die unless (open PID, ">", $pidfile)
Regards
Klaus
Klaus Ethgen http://www.ethgen.ch/
pub 4096R/4E20AF1C 2011-05-16 Klaus Ethgen [email protected]
Fingerprint: 85D4 CA42 952C 949B 1753 62B3 79D0 B06F 4E20 AF1C
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iQGcBAEBCgAGBQJPjA6cAAoJEKZ8CrGAGfas4lcL/Ri7zduqlmS/55ORRbQWYudV
w/m+etnIQ2Ypr7mwQ3zuk7oBHwStkDPMRjDFSQ8ELqoHn0QDZuyGphLgdq4fQmT6
yrTxBXqcHRCbo3acOhTdu/MRYvQ7Bh/91k1go0JNIjf3lQ/761Ji7L7Tu52y1v6O
GgkSn8mordKTI6snNmIPeNdzKjwBPuYP2rqbGZNJY3mDLBhlTwK50O6S20l5mPnU
z+z9x7BZ3HlIHHVTI9fByPMWB9Ni1ponJ7elnWvAQS71KyWLVfkygxL0QbS1vOVp
JCKVF9gcXTQUGbYMDL9YX2rH1bM4svIbQXpZ7dh8nDBIMq6us10vgg1vYDA7+Anz
7GuPC0nc1PyHpnOpzrOzN/XH3Vs42db/UFt6CPTjXKRcjI/B5gxgh89wbpiu7rsP
TB3kII/I5TFdQInA9AQ/aZdfDykMKNqeXsJ43E5W8GeP8B3YGDgw2UIU6wXOm4uO
6+vAWwBQpn/NNtIjweYbTPPgDRRTuQXTNVamuKIGhA==
=6kVp
-----END PGP SIGNATURE-----
from splitjoin.vim.
I'd forgotten about the brace styles. Been coding too much ruby, I suppose :). I put a variable to control the brace placement, g:splitjoin_perl_brace_on_same_line
. If it's 1
(the default), you get this:
if ($debug) {
print "a = $a\n";
}
If it's set to 0
, it'll split into this:
if ($debug)
{
print "a = $a\n";
}
So basically, you just need to put let g:splitjoin_perl_brace_on_same_line = 0
somewhere in your .vimrc.
I was thinking about maybe making a variable with a replacement string that you can set to {\n%s\n}
, or \n{\n%s\n}
to get your behaviour, but for now I think the simple setting is enough. I doubt there are any more styles for that anyway.
I also implemented splitting lines with or
and and
in them to unless
and if
clauses. This works only for splitting though, joining if/unless clauses leads to suffix if/unless clauses.
from splitjoin.vim.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Am So den 22. Apr 2012 um 13:13 schrieb Andrew Radev:
I'd forgotten about the brace styles. Been coding too much ruby, I suppose :). I put a variable to control the brace placement,
g:splitjoin_perl_brace_on_same_line
. If it's1
(the default), you get this:if ($debug) { print "a = $a\n"; }If it's set to
0
, it'll split into this:if ($debug) { print "a = $a\n"; }So basically, you just need to put
let g:splitjoin_perl_brace_on_same_line = 0
somewhere in your .vimrc.
Nice work. Will try.
I was thinking about maybe making a variable with a replacement string that you can set to
{\n%s\n}
, or\n{\n%s\n}
to get your behaviour, but for now I think the simple setting is enough. I doubt there are any more styles for that anyway.
Basically that would be also my approach but the simple setting might be
better.
I also implemented splitting lines with
or
andand
in them tounless
andif
clauses. This works only for splitting though, joining if/unless clauses leads to suffix if/unless clauses.
Uh, fine, thanks. :-)
Regards
Klaus
Ps. You are number two who I owe a Beer in a local pub for cool vim
plugin if you ever met me near Zürich. :-)
Klaus Ethgen http://www.ethgen.ch/
pub 4096R/4E20AF1C 2011-05-16 Klaus Ethgen [email protected]
Fingerprint: 85D4 CA42 952C 949B 1753 62B3 79D0 B06F 4E20 AF1C
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iQGcBAEBCgAGBQJPlVgeAAoJEKZ8CrGAGfasl9AL/3yvVqomzfi4DWtebm1wSPUC
I4JVvZcgwFat+NY/NTgBnIzGIHLfLYLActcWYYMkUYq0aHTCRw/NaX5BvdTn4ahs
XUQakuV/2zlMrMUvX+mybOOECAs67hy7CbLv8qxWvIlC9QNmZwgBhggU/EQ+P2ZE
mnYbiu4QwsogCglso0xGJSicIZBs3gIE/NM8vJEfTnjkeY3iWRQcgfFNKt5i8QwB
0YVUNWMQLPHXfGmxE4JIqLDxgT5bYkwrBSqUuNevLSvjMX5F63iqnzP0RXV7AVMG
L5m9+VTalma9P2wcE6OKwkD6Z1WzDgUSK08TGSkq45wthprOZny5y9IiPvbJaIip
20leiR4YtJ2tqSNITENQKHVYucNRHpFUl/qNj4wSwEK3ImFWfuRQPrLQ+9CqRQS0
8i9CBDz5whOR4Q50YDdflK724mY8CFohKUx2Wg5wVrRZ+hjhO9SgUPXUaZBZDqBQ
8jr05tFXJJgrVw2pQt9JFy8/ajA3v+j11+JdWyBrvA==
=rgTH
-----END PGP SIGNATURE-----
from splitjoin.vim.
You are number two who I owe a Beer in a local pub for cool vim plugin if you ever met me near Zürich. :-)
Thanks, I'll keep that in mind :). I'll close the issue for now, write back if you run into any problems.
from splitjoin.vim.
Related Issues (20)
- YAML splitting flow-object with path as value fails to round-trip from joining HOT 3
- Feature request: Add solidity support HOT 1
- Feature request: "black" compatible python line-splitting HOT 3
- Feature request: Add Scala support HOT 3
- Rust: grouped multiline imports do not split correctly HOT 4
- Rust: attributes on grouped imports are not preserved HOT 10
- Adding splitjoins from one langage to another HOT 9
- Unexpected modifications when using `gS` / `gJ` HOT 1
- Python splitting and indentation HOT 2
- Feature request: Splitting LaTeX commands onto newlines HOT 1
- Can't work in visual after changing keymap HOT 2
- Rust: splitting multi-line expression into blocks produces broken code HOT 7
- Go: can't split/join var, const, type declarations inside block (not global scope) HOT 2
- Go: can't split/join var, const declarations with comma-separated one-typed vars, consts HOT 15
- Go: invalid join for var, const, import list HOT 11
- Go: join of struct fields inserts unnecessary spaces HOT 7
- Support for rmardown (rmd) and quarto (qmd) HOT 2
- Go: split of multiline var, const adds brackets in wrong place HOT 2
- vim: gS on dict access dot incorrectly adds space HOT 3
- Add support for R HOT 3
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 splitjoin.vim.