-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add mappings for other g* commands #464
Comments
Great idea, Pull request? |
Hi, This is annoying when ':set nowrap' is on. While gj and gk seem to collapse to the same behavior as j and k for wrap and nowrap, the same can not be said for g$ , g0, and g^ versus $, 0, and ^, where it STILL causes the cursor to only move to the first/last column of the display in nowrap mode. Since the default $, 0, and ^ are overwritten, you then have to find some other way of jumping to the start/end of the nowrapped line. @memotype - can you please fix this so that either:
|
This was so crippling to the way I use VIM that I tried to fix it myself. With my limited vimscript experience I could not figure out a way to toggle these mappings when wrap is set or reset. All I could come up with was to check if wrap was set each time the mapping triggered, and alter the normal mode command executed. The following seems to work, if you are happy with it, please include it:: " Same for 0, home, end, etc
function! WrapRelativeMotion(key)
if &wrap
execute "normal! g" . a:key
else
execute "normal!" a:key
endif
endfunction
noremap $ :call WrapRelativeMotion("$")<CR>
noremap <End> :call WrapRelativeMotion("$")<CR>
noremap 0 :call WrapRelativeMotion("0")<CR>
noremap <Home> :call WrapRelativeMotion("0")<CR>
noremap ^ :call WrapRelativeMotion("^")<CR> |
Close? |
Sorry, I haven't been doing any coding recently. Life, etc. If some one
|
I just run with this problem but something weird is happening. Either i set wrap or nowrap, when i do a simple d$ the last character is not removed. Anyone noticed this? |
I have his issue too. I haven't searched for a solution but it's driving me crazy. Sent from my iPad
|
Hi guys, Sorry, can you please describe in more detail what the problem is? On a standard txt file (i.e. filetype="") C/C++ files and various other file types, I am not getting the behavior you describe. |
As a work around, sometime today I will add a g:spf13_no_wraprelmotion variable and conditional statement around this code. That way you can run with the official spf13-vim branch and still disable it easily. |
It happens to my with every filetype (i tried php, js, erl, py and no filetype) , i just go to the beggining of any line, do a d$ and the last character is not removed. Deleting from https://github.com/spf13/spf13-vim/blob/3.0/.vimrc#L266 till 282 solves this. |
Okay, I'll take a closer look today. Maybe someones else's updates/pull request has clashed with it, because the version I currently have does not do this. I don't think deleting it straight out is the answer, unless we roll back to before memotype's original change. As I said above, I'll also put an option to turn it on and off in case it is causing issue for some and not for others. |
I've managed to reproduce the problem. It was not occurring for me originally because I was using YankRing (which remaps The reason it is occuring is due to the use of the If you run vim with the WrapRelativeMotion code removed as explained by @gonzaloserrano, I'll try and determine the difference between |
You rock. This is REALLY annoying. Sent from my iPhone
|
In the mean time, here is a commit that adds the option to enable/disable wrap relative motion. |
…f13#464 , d$ now deletes last character of line
Okay guys, Please try the changes/commits above and see how you go. Then I'll put through the Pull Request. The reason for, and solution to, this problem is revealed in the details of From
form this we can infer that A section further down in
So the command I had originally done the same for |
Luke: I don't understand how to test the |
Sorry, I left the inverted commas out of the command in the last post (now fixed). To test, you can either:
|
I will modify my .vimrc and test. I will let you know shortly |
Ok. I feel like an idiot but I cannot get it working trying to follow your instructions. Additionally I cannot find the link above that includes this fix (I only see one that puts a opt-out variable in). Can you gist me the lines you have in your .vimrc and I will paste them into mine? |
The link is actually sitting between posts. It says: But direct link is below. https://github.com/lukedomanski/spf13-vim/blob/4122da250229dc7988d4ce436875a89f5f5fb756/.vimrc
|
thanks for the help by the way....i'm getting the feeling I should have just left this one at my original bug report :) |
I can confirm that it works on Mac and Linux for me (I didn't realize that putting v: before that call did what you described. I owe you a coffee! I vote for quick merge/release to main |
No coffee required, as I was just fixing a problem I imposed on you in the first place :) |
👍 i just tested it and works fine, thanks |
"I vote for quick merge/release" |
Merged it already :) |
I meant "Steve merged it" :) |
# By Johnny Robeson (4) and others # Via Steve Francia (11) and others * '3.0' of github.com:spf13/spf13-vim: (22 commits) Removed screen program mapping Screen program mapping is now opt-in This as it slows down exit from insert mode for many users Delete .gitmodules rename BASE_DIR to APP_DIR add $app_dir var to point to application root Fix neosnippet and neosnippet-snippets order to follow the instructions at Shougo/neosnippet Add Shougo/neosnippet-snippets. Fixes spf13#539. Shougo/neosnippet version 4.1 split the repository into two and the other half is now missing, see the PR for details. rolled back some changes to ensure d0 and d^ match default behaviours, spf13#464 fixed wrap relative motion mappings to address problem reported in spf13#464 , d$ now deletes last character of line added spf13 option to enable/disable wrap relative movement mappings fix spelling of occurred in debug() Fix no_conceal on youcompleteme bash requires the space in this case store the vundle uri in a variable. Correct load order of config files in readme add a switch to disable omni complete fixed formatting for readme windows install instructions Added Chocolatey install for ctags to readme for windows install modified windows install instructions in readme added instructions for windows install with Chocolatey ... Conflicts: .vimrc bootstrap.sh
…f13#464 , d$ now deletes last character of line
j
andk
are mapped togj
andgk
, which is awesome, but you should also include these mappings for consistent behavior, otherwise it's confusing:The text was updated successfully, but these errors were encountered: