If you don't already have a .vimrc file in your home directory, create one using this:
Add this line to the top of the file:
Save the file and this should fix the problem for you. :)
First, make sure you're in edit mode (press i). Then you can paste with Ctrl+Shift+V, if you're in a terminal emulator like gnome-terminal (or select "Paste" from the right-click menu).
You can also type :set paste in vim before you paste to disable automated indenting, etc. Then :set nopaste after you've pasted the content.
Also check this question on ...
Resolved it :
Already contains necessary feature. Just need to uncomment it:
" Uncomment the following to have Vim jump to the last position when
" reopening a file
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
(Infact, you can refer to /usr/share/vim/...
Installing the vim package will fix the problem:
sudo apt-get install vim
There are many good vim/vi tutorials on YouTube, or the web generally.
For your problem, see the article 8 Essential Vim Editor Navigation Fundamentals.
Then continue to open files as usual:
Try from within vim ...
and if your get ...
Small version without GUI.
You are missing package vim-gui-common. It is probably also advisable to install vim-runtime. Commands to install:
sudo apt-get install vim-gui-common
sudo apt-get install vim-runtime
Another cause might be that alternatives is pointing to the wrong one:
I had this same problem and it turned out that the .viminfo file in my home directory had the wrong ownership. It was owned by root:root.
Once I fixed the file ownership by changing it to myself, remembering file position started working for me again
Vi (and Vim) works very differently compared to a normal text editor such as Gedit. It also has a pretty steep learning curve. If you want to learn some basic commands, start with this interactive tutorial.
However, to answer you question. The system clipboard's content can be accessed through the plus register. So to paste something from the system ...
Wikipedia has a concise and properly cited explanation:
The name vi is derived from the shortest unambiguous abbreviation for the command visual in ex; the command in question switches the line editor ex to visual mode.
Note that this does not mean that the full name of the text editor "vi" is still "visual" or, even, ...
I suggest you install vim. From the terminal Ctrl+Alt+t:
sudo apt-get update
sudo apt-get install vim
Several dependencies will also be installed. Then start a new project, again from the terminal:
Learn more about vim:
That's correct behavior for vi, and it does erase the character, it just doesn't show it by replacing it with a blank like in vim. It will be apparent when you overwrite the erased character with another character, or switch back to command mode.
E.g. starting with command mode on an empty line, the following will result in the line containing fo:
Writing a text file isn't going to "change the way that your computer functions".
In particular, in order to do something like that, you'd have to do one of
overwrite some important file
write your file to a special protected location like a *.d directory in /etc; you won't have permission to do this
mark the file executable and put it in your path
Inside the Ubuntu ecosystem, I do not think this case can even exist, as vi would at least be a vim-tiny, which is already a “real vim” far from “real vi.”
In the context of resource limited embedded systems, which are not normally Ubuntu, you may just have a vi that turns out to be a link to busybox. And not space left. Then, vi is the only option.
If you want to copy paste contents within the same file, use yank and paste.
If you want to copy paste contents across terminals, open the first file, yanking the text you want, then open your second file within vim (e.g. :tabnew /path/to/second/file) and press p to paste it.
If you want to copy paste contents from vim to an external program, you need to ...
With vi, when clicking on i you activate the command to Insert text.
This command allows you to insert text in your file.
And right, when clicking :
on ↑ it will insert a "A",
on ↓ it will insert a "B",
Till you deactivate this command.
To deactivate a command in vi : just click on Esc
And then you will get back normal use of your arrow keys:
↑ to go ...
You need to install the actual vi package, which is nvi on Ubuntu.
sudo apt-get install nvi
You might also need to run the line below if nvi isn't picked up automatically as the default provider for vi.
sudo update-alternatives --config vi
Installing VIM will probably solve that issue
sudo aptitude install vim
it actually has to work though, it might be that compatibility mode is on therefore you will be in the insert mode but VI won't tell you.
Either way using vim is recommended, its basically V i IM proved.
Ctrl+Q will undo Ctrl+S. These are ancient control codes to stop and resume output to a terminal. They can still be useful, for instance when you are tailf-ing a log file and something interesting scrolls by, but this era of unlimited scrollback buffers has really obsoleted them.
You need to change to the "insert" mode by moving the cursor with i.
There are other ways to delete characters directly.
You can download a powerpoint that I use when teaching a class on VI here.
It sounds like you are in the "Command" mode.
To move your cursor:
H = Left, J = Up, K = Down, L = Right
Once you have your cursor positioned you can delete ...
Vi is a screen editor for Linux, Unix and other Unix-like operating systems. Pronounced (vee-aye). Stands for VIsual.
Sources: http://en.wikipedia.org/wiki/Vi and http://www.techopedia.com/definition/10347/vi
If you are looking for an alternative editor, you are not alone. Basically life is too short to learn vi and I say this being a software developer for a living. However you should learn how to exit it because it's a problem for one out of 20k programmers. Also performing some basic append/insert operation might be worth learning, because on some stubborn ...
Here's another approach, hopefully to teach someone something new.
If you know that the command :r !ls -la works inside vim, you can do the following to open vim and make it run the command as soon as it opens, straight from bash:
vim -c ':r! ls -la'
This is the equivalent of opening vim then executing the command :r! ls -la. This should work with any vim ...
I always use Shift+Insert when I want to paste text into the terminal, works in all terminal programs.
(Which is also the reason why I never get a laptop where you can't press Insert without pressing a secondary key)