Comments (16)
@gonzaloserrano Have you tried selecting the lines in visual mode then using the built-in gw
?
from splitjoin.vim.
Hi, with gw
i get $a = array( 1, 2);
which is very close but not exactly what i want.
from splitjoin.vim.
At this time, splitjoin doesn't work in visual mode. Pressing gJ
in visual mode will run the default gJ
mapping (take a look at :help gJ
). You can join your expression by typing gJ
in normal mode with the cursor on array
.
from splitjoin.vim.
Sorry i'm not able to join it, i tried placing the curson in many places including on array
and does not work for me.
Also the map seems ok:
:nmap gJ
n gJ * :<C-U>call <SNR>115_Mapping(g:splitjoin_join_mapping, "<SNR>115_Join")<CR>
from splitjoin.vim.
Yes, but the map is set only in normal mode. The nmap
command shows mappings in normal mode, not in visual mode.
Is it possible that you have an old version of the plugin? Could you try updating and see if it works? Also, are you sure you're in a file that Vim recognizes as a PHP file?
from splitjoin.vim.
Also, you say you've tried placing the cursor on array
, but could you confirm that you did that in normal mode, not in visual mode?
from splitjoin.vim.
I'm in normal mode with version 0.8 and on the array word, but i found that depending on which keys i press i'm sometimes able to do it ok. E.g in the next screencast, after doing gS, i moved with cursor left 4 or 5 times and then pressing gJ worked.
from splitjoin.vim.
Hmm, that's definitely strange. It's a long shot, but is it possible that you have nomagic
set somewhere in your .vimrc? Could you try :echo &magic
and let me know what the result is?
Also, what about the other php splits and joins, do they work okay for you?
# Square-bracket lists
$one = [
'two',
'three',
'four'
]
$one = ['two', 'three', 'four']
# If-clauses
if ($foo) {
$a = "bar";
}
if ($foo) { $a = "bar"; }
# PHP markers
<?php
echo "OK";
?>
<?php echo "OK"; ?>
from splitjoin.vim.
:echo &magic
prints 1
$one = [
'two',
'three',
'four'
]
gJ
didn't work.
$one = ['two', 'three', 'four']
gS
did work.
if ($foo) {
$a = "bar";
}
gJ
didn't work.
if ($foo) { $a = "bar"; }
gS
did work.
<?php
echo "OK";
?>
gJ
didn't work.
<?php echo "OK"; ?>
gS
didn't work.
Thanks for the effort!
from splitjoin.vim.
Well, this at least means the problem is consistent. Two things:
- Could you check if
gJ
also doesn't work for other filetypes, for instance HTML (you should be able to join html tags)? - Instead of typing
gJ
, could you try executing the command:SplitjoinJoin
with the cursor in the right place (for example, on thearray
word)?
from splitjoin.vim.
Hi again, two months after :-)
- does not work in HTML files
:SplitjoinJoin
did work when the cursor is over thearray
word !
From today's last master version.
from splitjoin.vim.
Well, this tells me that the problem is obviously in the mapping part of the plugin and not the actual workings of the plugin. I'm not sure what the exact problem is, however :/.
Another thing I'd like you to try is to set a different mapping using the plugin's settings. For example:
let g:splitjoin_join_mapping = "zJ"
And then let me know if zJ
does the job correctly (you could also use a different mapping).
Apart from that, you could try creating the mapping yourself:
nnoremap gJ :SplitjoinJoin<cr>
This last part should work for you in all cases, but I'd like to figure out what the real issue is as well.
from splitjoin.vim.
Same issue with "zJ" map, and creating the mapping myself does not work either :S
When type :map zJ
in vim i see this: n zJ * :<C-U>call <SNR>120_Mapping(g:splitjoin_join_mapping, "<SNR>120_Join")<CR>
Do you think it's correct?
from splitjoin.vim.
It does look correct, but I'm not sure why making the mapping yourself wouldn't work.
My theory right now is that there's something in the s:Mapping
function that doesn't quite work in your setup, for whatever reason. But still, this should work:
let g:splitjoin_join_mapping = ''
nnoremap gJ :SplitjoinJoin<cr>
It could be that you hadn't put the first line in your vimrc, could you try it like this?
from splitjoin.vim.
I tried, and continue having this strange behaviour.
Since i'm using the spf13 vim distribution with many plugins maybe there is something weird there so i'll try to find the issue when i have the time.
Thanks
from splitjoin.vim.
Since I don't really know how to fix the issue, and I guess it might be related to a different plugin or something, I'll go ahead and close this for now.
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.