so...I broke X- how about you?

magomago

Lifer
Sep 28, 2002
10,973
14
76
Now I want to fix it...

so I did this in an attempt to remove what I did and fix it (I'm working on my TVOUT configuration ATM):

$su
# gedit /etc/X11/XF86Config

Then it gives me some werd errors about GTK+2.0 and I assumed this to be gnome meaning I need a GUI, meaning I need X :(

Is there anyway to edit it in the command promt? Thanks
 

Ynog

Golden Member
Oct 9, 2002
1,782
1
0
I assume you are running in runlevel 3.

Because you need X to run gedit.

Use vi, its a command line editor.
 

magomago

Lifer
Sep 28, 2002
10,973
14
76
how do i edit and save the file?

I got it open with vi XF86Config

but then I tired to type but I couldn't

and then i pressed a bunch of random #s and I could type and i fixed the problem (I put TwinViewOrentation when it should've been Option "TwinViewOrientation" "clone" )

but then I didn't know how to save it so i pressed random buttons and it froze it up- or so think

could you tell me how to save changes after I edit (and how to being to edit) ?

Thanks
 

RedFox1

Senior member
Aug 22, 2000
587
0
76
Mmm..vim.

Cheat sheet:
-----------------------------------
there's an edit mode and a control (save, search, etc) mode.

To go into edit, press "a". (It'll bring up a cursor) When you're done editing, press escape.

To go into control mode, type a ":" (that's a colon, in case you're as blind as I am). To save, type "w" and hit enter. To quit, press "q" and hit enter. To save and quit, type "wq". To quit without saving, type "q!"

When in doubt, press escape.

----------------------------------

Otherwise try "pico"...it's more like notepad.

-Russ

 

Ynog

Golden Member
Oct 9, 2002
1,782
1
0
Sorry about that, vi doesn't behave like gedit.

Like RedFox said there is an edit mode and control mode.

Here is a site I found
http://cac.uvi.edu/miscfaq/vi-cheat.html

Here is a help. For someone how really don't know alot about vi,
if you mess up the file beyond fixing. Just hit ESC, (multiple times if necessary).
Then hit : q!. This will quit without saving.

It doesn't hurt to make a backup copy of the XF86Config file before hand.
 

Nithin

Senior member
Dec 31, 2002
961
0
76
since you have never used vi, i would suggest using pico if available. that is a lot simpler to use than vi.

but when you get a chance, learn using vim and you will never go back to any other editor.
 

Crusty

Lifer
Sep 30, 2001
12,684
2
81
You could also try nano if you have it installed. But I would recommend learning vi....its powerfull!
 

drag

Elite Member
Jul 4, 2002
8,708
0
0
Vi is alright. I use it.


Pico is a lot easier to understand.

Vi is actually a VERY old program. Dating back to the ancient time sharing machines from the original unix stuff. People don't actually use the REAL vi very much. Two very common "improved" clones are Elvis and Vim. I personally use Vim. They also have a gui-based version called gvim.

If you realy want to learn the archaic syntax and key combinations of vi, check out a little thing called vimtutor. Basicly it's vim that opens a text document that explains the different basic commands and has examples how to use them.

Otherwise pico is prefered by a lot of people and uses the ctrl+something key combos to do stuff.

Also if your going to be editing configuration files, it's always good to make a backup copy of it before you edit it. Becaurefull with XF86Config though, it defaults to using the copy in your home directory if you have one sometimes, so name it something different.

Also there are some commands to generate a configuration file if yours is beyond your skill to fix. "XFree86 -configure" will usually give something that "works" although it may require some tweaking later.
 

chsh1ca

Golden Member
Feb 17, 2003
1,179
0
0
Vim rocks. Nothin quicker to replace every instance of -neq with != in a bash script than:
:%s/\-neq/\!=/g
:)
 

Hardware411

Senior member
Dec 17, 2002
225
0
0
"i" is to insert
"o" is start new line and insert
"a" is to start from point.

after you run one of these u need to press esc to exit mode.

"/yoursearch" is to search certain string.

---
O and when u search "n" goes to next instance of the string in the file, also it wraps arround so u might want to be careful and see that you are going in circles.

"q" is to quit
"q!" same doesnt save modifications
"wq" saves modified changes
"x" deletes character
"dd" deletes life


well those are the basic stuffs...

GTK is a graphics package you do need X to use it, hence your editor doesnt work VI is a good editor but so annoying to work with on big projects.

sometimes inserts lines and other crap u will need to remove lines that it makes, after a while though you will get the hang of it and will figure it out.