LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Editing files without vi Editor (https://www.linuxquestions.org/questions/linux-newbie-8/editing-files-without-vi-editor-4175473517/)

fisherman2 08-15-2013 02:17 PM

Editing files without vi Editor
 
Hello. I am trying to learn how to use Linux and the vi editor. I have tried using vi and some of the commands. Can I edit files without the vi editor?

ButterflyMelissa 08-15-2013 02:34 PM

Sure you can, use Nano (see your repo, it's bound to be in there...), I use that one mostly myself. Combine that with MidnightCommander...just a tip :) - both should be in the repo...
If you run from a DE (XFCE, LXDE, Gnome or the like) you can (should) use the graphical editor, as it would be more untuitive if you've not been "outside' the desktop much :)

By the way, welcome here, thanks for this question, it hilites the main thing about Linux : choice...

Thor

Edit

Quote:

One thing we're not short of in Linux: text editors.
Yup... :)

brianL 08-15-2013 02:34 PM

Of course. There's nano for use in the terminal and console (CLI stuff); Kate, KWrite, Gedit, and even more, for use in X (GUI stuff). One thing we're not short of in Linux: text editors.

fisherman2 08-15-2013 02:46 PM

Thank you both.

ButterflyMelissa 08-15-2013 03:02 PM

Quote:

Thank you both
Nooooooooooo sweat! We enjoy doing this, really we do :)

Thor

brianL 08-15-2013 03:07 PM

Yeah. Gives us a sense of purpose in our otherwise pointless existence. ;) :)

JWJones 08-15-2013 03:08 PM

But of course. There's emacs! ;)

http://linuxbbq.org/wiki/index.php?title=Emacs

Firerat 08-15-2013 03:21 PM

cat > mypost << "EOF"
hmm, well if no vi then I would go for vim ;)
but I guess that is cheating
so I vote sed
or cat with sed to fix the inevitable smelling mistakes.
EOF


sed -i -e 's/smel/spel/' mypost

ButterflyMelissa 08-16-2013 05:06 AM

:D

Dont throw OP off the track, gang... :p

Emacs, Nano, Gedit, Mousepad, whatever...it depends on what your starting point and experience is...

Firerat 08-16-2013 12:37 PM

Sorry :)

Back 'on topic'

Yes lots of editor available in Linux

emacs.. I've never really used it myself, vi got hold of me first.
but again I think that has a steep learning curve.

I imagine Nano would be more 'familiar' editor..
If you need to 'get things done' go with that.

coming back to vim, there is a tutor built in
on console/terminal type
vimtutor
Code:

===============================================================================
=    W e l c o m e  t o  t h e  V I M  T u t o r    -    Version 1.7      =
===============================================================================

    Vim is a very powerful editor that has many commands, too many to
    explain in a tutor such as this.  This tutor is designed to describe
    enough of the commands that you will be able to easily use Vim as
    an all-purpose editor.

    The approximate time required to complete the tutor is 25-30 minutes,
    depending upon how much time is spent with experimentation.

    ATTENTION:
    The commands in the lessons will modify the text.  Make a copy of this
    file to practise on (if you started "vimtutor" this is already a copy).

    It is important to remember that this tutor is set up to teach by
    use.  That means that you need to execute the commands to learn them
    properly.  If you only read the text, you will forget the commands!

    Now, make sure that your Shift-Lock key is NOT depressed and press
    the  j  key enough times to move the cursor so that Lesson 1.1
    completely fills the screen.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                        Lesson 1.1:  MOVING THE CURSOR

I wish I could offer 'balance' with emacs tutor, but I don't know of one.
I hope an emacs user can make some suggestions ( I might give it a go again myself )

on the GUI side, I like kate ( one of KDE's editors ), you can even get that to behave like vim ;)

rtmistler 08-16-2013 03:40 PM

I'm a huge proponent of gnuemacs, but to be honest I stick with one and use it forever. I've used gedit a bit because it's integrated with the GNOME desktop so if I go to open certain types of files from the Linux explorer, it loads them in gedit. I like it.

A recommendation though is to get sufficient experience with vi. Because vi is pretty much part of any Linux system as well as part of grub. If you find yourself in a command line and need to modify a file, knowing how to edit that file with vi is important if you happen to have no other editor available from the given command line you're at, at the time. Another case is on embedded targets, we do that a lot and we usually don't have an XServer or even a screen; hence we're in terminal mode via ssh to the target. Therefore if we need to change one line of a file, we do that with vi.

Here's a good online cheat sheet http://www.lagmonster.org/docs/vi.html.

I don't know all those listed on that sheet and don't recommend that you try to become a master at it. I've learned the basics I've needed and stuck with those. Insert, Append, Delete, Write, Quit, how to move around the file, how to exit without writing if you screwed it up too much "q!". The idea is to be able to make a few changes and save the file, mainly because you're in a situation where you have no other editor options.

selfprogrammed 08-16-2013 04:09 PM

In a console I use JED because I program and it recognizes file formats and hilights the language syntax. I custom program it to a version I call zxcv (uses CTRL-Z, CNTL-X, CNTL-C, and CNTL-V). It can be customized because much of its editing functionality is in scripts in a share library. It comes with EDT, emacs, and other editor emulations (which keys do what). It has a top line pull down menus and built-in help. You can change what style it uses, select the hilight colors, and highly configure it.
It will let you open at least 20 files at once, cut and paste between them, and multiple files editing on the screen in panes at the same time. You can escape to a shell like emacs too.

JED is a pain to get working in an X11 console window (X11-console has the wrong console emulator keyboard translations) so I many times use KWrite.

I keep JOE around as a backup.

KWrite behaves like Win stuff and will be familiar.

Kate is probably next best to JED for programming, but there are others for specific tasks.

There are also the Office editors which are for text composition. They are found under the Office tools.

I never touch vi (on purpose).
You have to learn some vi, because you will be trapped if you do not know how to quit it.
It is the Linux default, but many tools will let you change that to some other editor (on an individual basis).

The Pico editor appeared recently. I used to program database translations use pico editor commands input from the shell. Can edit directly or use it like sed (a stream editor). Pico is much more powerful than sed. It even has goto's.

EMACS: it started as an editor. They started adding functions, and if you can think of it there probably is a three keystroke invocation of it in EMACS, including shell functions, and for some people it will make coffee (www.northbound-train.com/emacs-hosted/coffee.el‎).
It has editing keystrokes totally unlike anything else. Do not invoke it unless you are prepared to spend considerable time finding your way back out. I am serious, you only get deeper and deeper into sub-functions.

The X11 main menu can be edited. I create an editor entry and put all the editors together in the menu. You can move the editor menu entry, or have a entry copy.

PTrenholme 08-16-2013 05:54 PM

I always install mc (as referenced by Thor 2.0, above, in post #2) so I have a simple GUI and editor available when I get bounced to the command line after a failed boot. mcedit (part of the mc package) is intuitive to use from the console, and works quite well in a terminal window, although I prefer kate for most of my editing under X.

Darth Maul 08-17-2013 10:22 PM

It's funny but I prefer to use vi as I use it about 97% over other editors. When I use nano or other text editors, I keep thinking vi commands and sometimes I press those letters.


All times are GMT -5. The time now is 04:15 AM.