LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   centos vi and vim. (https://www.linuxquestions.org/questions/linux-newbie-8/centos-vi-and-vim-879987/)

runeveryday 05-11-2011 01:42 AM

centos vi and vim.
 
today, i begin to learn linux, i think it's a dear diary meoment.now i want someone to help me with the following questions.

1,i access my server via secureCRT, when i typed the
Code:

vim
in it, it shows
Code:

-bash: vim: command not found
. how to install the vim? my linux version is centos.

2, when i typed some chinese characters in VI, it shows unnormal. maybe i should set the default character to UTF-8. but i don't know how to set it.

3,i want to copy a html file code to VI, how do i do?

4,how to create a file. like this?
Code:

mkdir filename
?how to rename the file, which i created by VI and had some contents in the file.

many thanks.

brownie_cookie 05-11-2011 01:49 AM

1. about the VI i don't know, when i want to edit a file or make a file i just type
Code:

vi filename
2. about the character set, don't know, because when i type letters, it shows just fine (but i'm from belgium, so we don't have special characters)
3. you copy text into a file you're editing like, select the text you want to copy, hit CTRL+C and when you are in the VI press the RIGHT MOUSE BUTTON. anyways, this works for me
4.you create a file with
Code:

touch filename
OR

Code:

vi filename
NOT

Code:

mkdir filename
because with mkdir you create folders, NOT files

i hope this helped you a little bit further ;)

runeveryday 05-11-2011 02:28 AM

i have installed the vim. but it looks like the same as vi. when i typied vi or vim, the screen both show
Quote:

VIM - Vi IMproved
~
~ version 7.0.237
~ by Bram Moolenaar et al.

brownie_cookie 05-11-2011 02:36 AM

if they are the same, then i don't think there is any difference between them...
so choose one of them and you'll be fine..

MTK358 05-11-2011 08:16 AM

Quote:

Originally Posted by runeveryday (Post 4352860)
i have installed the vim. but it looks like the same as vi. when i typied vi or vim, the screen both show

In many distros, "vi" is just a link to "vim".

In other distros (like Arch), "vi" is actaully the original "vi" and you can install "vim" separately.

MTK358 05-11-2011 08:18 AM

[QUOTE=runeveryday;4352823]today, i begin to learn linux, i think it's a dear diary meoment.now i want someone to help me with the following questions.

1,i access my server via secureCRT, when i typed the
Code:

vim
in it, it shows
Code:

-bash: vim: command not found
. how to install the vim? my linux version is centos.

2, when i typed some chinese characters in VI, it shows unnormal. maybe i should set the default character to UTF-8. but i don't know how to set it.

3,i want to copy a html file code to VI, how do i do?

Quote:

4,how to create a file. like this?
Code:

mkdir filename
?
That will obviously create a directory.

To create an empty file, use the "touch" command. Also, opening an editor with the name of a non-existant file will usually create it.

Quote:

how to rename the file, which i created by VI and had some contents in the file.
The "mv" command.

chrism01 05-11-2011 08:27 PM

vi vs vim;

As per post #5, in most distros, the vi cmd is aliased to vim (different to a symlink). HOWEVER, vi is usually also actually installed as well. Try 'which vi' to find it if you really want vi not vim. Or try 'which vim' and search the reported dir for vi.

HTH

RockDoctor 05-12-2011 08:33 AM

If CentOS behaves like Fedora, running vi will get you a minimal version of vim, whereas running vim gets you the full-blown editor. One obvious difference is syntax highlighting - vim does it; vi doesn't.


All times are GMT -5. The time now is 12:13 AM.