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?
|
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:
|
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.
|
Thank you both.
|
Quote:
Thor |
Yeah. Gives us a sense of purpose in our otherwise pointless existence. ;) :)
|
|
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 |
:D
Dont throw OP off the track, gang... :p Emacs, Nano, Gedit, Mousepad, whatever...it depends on what your starting point and experience is... |
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:
=============================================================================== 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 ;) |
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. |
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. |
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.
|
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. |