ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
For the most part, I love using vim and vi...but...sometimes I feel like I'm stuck in an old-fashioned line editor rather than a full-screen editor.
Why can't I just hit Del a few times at the end of a line till the line below comes up and joins it,
or be on the 1st character of the line below and backspace until the line moves up to the end of the preceding line??
I tried cutting and pasting and vim kept pasting the line right back on line 2 instead of at the end of line 1, even though I had the cursor positioned at the end of line 1 when I pasted.
This is the one thing in vi that really bugs me. It should be so simple. Am I wrong in feeling like I'm in a line editor instead of a full-screen editor? I hope I'm missing something about vi and vim, or else it's time for me to make a serious effort to learn emacs.
I just tried your scenario, and so long as I was in insert mode, I was able to paste at the end of a line (I used the center click function of X) If I was not in insert mode, I found it added to the next line while entering insert mode for me. I don't know if it is just my version, or if mine is set up differently to yours. I use VIM - Vi IMproved 6.3 and it works fine.
my understanding is that if you cut an entire line, you can only paste it as a new line. if you cut part of a line, you can paste it as part of another line at the cursor. but i haven't delved into a lot of advanced methods, and vi/vim is very powerful so it's probably possible somehow. if you search google you could probably find a lot of tutorials, e.g. this one on Vi. http://docs.freebsd.org/44doc/usd/12.vi/paper.html
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789
Rep:
Quote:
For the most part, I love using vim and vi...but...sometimes I feel like I'm stuck in an old-fashioned line editor rather than a full-screen editor.
Try the good old "ed", and then you'll see the difference between a line editor and a full-screen one
Quote:
Why can't I just hit Del a few times at the end of a line till the line below comes up and joins it,
or be on the 1st character of the line below and backspace until the line moves up to the end of the preceding line??
Because, vi has never behaved that way, and changing it would break compatibility and habits.
Joining lines is done under vi with the J command.
Quote:
I tried cutting and pasting and vim kept pasting the line right back on line 2 instead of at the end of line 1, even though I had the cursor positioned at the end of line 1 when I pasted.
How are you cutting and pasting ?
cutting is done under vi with the "y<something>" command, and pasting with "p" or "P".
The rest is not vi cut/paste but interaction with vi in insert mode in your terminal emulator and X. If your cut-buffer starts with a new-line, there's nothing to prevent vi accepting it.
Quote:
This is the one thing in vi that really bugs me. It should be so simple. Am I wrong in feeling like I'm in a line editor instead of a full-screen editor?
I think so.
Quote:
I hope I'm missing something about vi and vim, or else it's time for me to make a serious effort to learn emacs.
emacs sucks, but that is just my personal opinion and I respect emacs users.
To join two lines, put your cursor on the first one and type J.
If you want to paste a line before the current line, use P instead of p. Most command do different things if you use the capital version of the command (I inserts at the beginning if the line, i inserts at the cursor; A appends at the end of line, a appends after the cursor).
vi is a fantastic editor, but there are many commands to learn before you can use it efficiently. If you're like me you'll still be learning new things about it after many years of use. Executing commands from named buffers is a great way to do complicated global substitutions.
Missed your attempt to join one line to another with cut'n'paste. Put your cursor at the start of the text to cut and instead of "dd", use "d$" to delete to end of line. Then go to the end of the line you want to add to and hit 'p'. If you cut by deleting the whole line, the paste will work by inserting a whole line.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.