LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-11-2011, 01:42 AM   #1
runeveryday
LQ Newbie
 
Registered: Mar 2010
Posts: 6

Rep: Reputation: 0
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.

Last edited by runeveryday; 05-11-2011 at 01:46 AM.
 
Old 05-11-2011, 01:49 AM   #2
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416
Blog Entries: 2

Rep: Reputation: 12
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
 
Old 05-11-2011, 02:28 AM   #3
runeveryday
LQ Newbie
 
Registered: Mar 2010
Posts: 6

Original Poster
Rep: Reputation: 0
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.
 
Old 05-11-2011, 02:36 AM   #4
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416
Blog Entries: 2

Rep: Reputation: 12
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..
 
Old 05-11-2011, 08:16 AM   #5
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721
Quote:
Originally Posted by runeveryday View Post
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.
 
1 members found this post helpful.
Old 05-11-2011, 08:18 AM   #6
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721
[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.
 
Old 05-11-2011, 08:27 PM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,286

Rep: Reputation: 2347Reputation: 2347Reputation: 2347Reputation: 2347Reputation: 2347Reputation: 2347Reputation: 2347Reputation: 2347Reputation: 2347Reputation: 2347Reputation: 2347
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
 
Old 05-12-2011, 08:33 AM   #8
RockDoctor
Senior Member
 
Registered: Nov 2003
Location: Minnesota, US
Distribution: Fedora, Linux Mint, Ubuntu
Posts: 1,525

Rep: Reputation: 336Reputation: 336Reputation: 336Reputation: 336
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
RHEL5 (Centos): getting gvim to work with mswin.vim gvanto Linux - Software 1 05-10-2011 07:41 PM
Switching from vim to vim -g from inside vim iDragoon Linux - Software 4 05-15-2009 11:46 AM
Editor comparison: vim VS vim-lite, Cleaning vim Ruler2112 *BSD 4 04-13-2009 04:26 PM
vim on CentOS Red Hat 5.2 BillKat Linux - Software 6 01-15-2009 10:25 AM
Vim on CentOS bijit1709 Linux - Software 3 06-17-2008 12:26 AM


All times are GMT -5. The time now is 12:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration