Move lines in VIM like PHPStorm
One of my favorite features of PHPStorm in the ability to move a line of code up or down by using the key combination (on OSX) command-shift-up and command-shift-down.
Being more of a VI guy I wanted to mimic this behavior in VIM so I created the following mapping:
nnoremap <silent> <leader>k ddkP
nnoremap <silent> <leader>j ddp
Now with my leader key and k, the line of code I am on moves up and with leader key and j the line moves down.
Written by Eric
Related protips
2 Responses
You can also try vim-move plugin by matze ( https://github.com/matze/vim-move ). It's works quite faster for me rather than native solution.
over 1 year ago
·
Thanks @dimko-desu I'll give it a try.
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Vim
Authors
Related Tags
#vim
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#