Results 1 to 10 of 10

Thread: Using Vi and gedit

  1. #1
    Join Date
    Mar 2009
    Location
    France and the UK
    Posts
    12

    Default Using Vi and gedit

    Hi,

    I was trying to use gedit to edit a file called 'google.xml' which is a searchplugin for Firefox. When I typed gedit A message appeared saying that gedit couldn't open the display. I have previously had a few problems with my OpenSuse installation and got that message then as well. I have since reinstalled OpenSuse and I thought that the problems were now cleared up but I still have that error message about gedit. What does it mean and what can I do about it?

    Also, I was trying to edit something using vi and when I wanted to quit and save the file, typing a colon didn't work. According to a vi manual that I found by googling, typing a colon followed by wq should put the cursor at the end of the file, save the file end exit vi. What am I doing wrong? I had previously typed sudo vi but got an error message so I don't think I have sudo installed - how can I fund out? Perhaps OpenSuse doesn't use it? I was able to edit the file in the end by doing su - and then entering my password but I thought I should be able to do what I wanted by typing sudo vi

  2. #2
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,402

    Default Re: Using Vi and gedit

    When your display can not be opened it often means that the program trying to open it is not run by the same user as the one that is running the display. This often happens when in a GUI session (of a normal user), root tries to start a GUI program. Is that the case here? (Yes, root is not omnipotent, the user can, and does by default, block others, including root, from opening windows on his display).

    I do not quite understand the vi story. Do you mean that when you typed a : it did not show in the lower left corner?
    Henk van Velden

  3. #3
    Join Date
    Mar 2008
    Location
    Oz
    Posts
    11,728
    Blog Entries
    2

    Default Re: Using Vi and gedit

    Try this "superuser" syntax:
    Code:
    gnomesu gedit /path_to/google.xml
    Leap 42.3 & 15.1 &KDE
    FYIs from the days of yore

  4. #4
    ab@novell.com NNTP User

    Default Re: Using Vi and gedit

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Please post entire commands and paths when giving examples. Saving a file
    in any application would fail if the file you were trying to save was one
    to which you did not have rights. In 'vi' you can add a bang (exclamation
    mark/point (!)) to force it to save assuming you are powerful enough
    ('root' or the owner of the file) but that's probably not an option in
    gedit. Also as mentioned you cannot always log a GUI app as 'root' unless
    you do a few other things first, but it sounds like you will be on the
    right track with the others' comments. 'gnomesu' and 'kdesu' are the apps
    for Gnome and KDE, respectively, to load applications as root in the GUI.

    Good luck.





    chris pasdecalais wrote:
    > Hi,
    >
    > I was trying to use gedit to edit a file called 'google.xml' which is a
    > searchplugin for Firefox. When I typed gedit A message appeared saying
    > that gedit couldn't open the display. I have previously had a few
    > problems with my OpenSuse installation and got that message then as
    > well. I have since reinstalled OpenSuse and I thought that the problems
    > were now cleared up but I still have that error message about gedit.
    > What does it mean and what can I do about it?
    >
    > Also, I was trying to edit something using vi and when I wanted to quit
    > and save the file, typing a colon didn't work. According to a vi manual
    > that I found by googling, typing a colon followed by wq should put the
    > cursor at the end of the file, save the file end exit vi. What am I
    > doing wrong? I had previously typed sudo vi but got an error message so
    > I don't think I have sudo installed - how can I fund out? Perhaps
    > OpenSuse doesn't use it? I was able to edit the file in the end by doing
    > su - and then entering my password but I thought I should be able to do
    > what I wanted by typing sudo vi
    >
    >

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v2.0.9 (GNU/Linux)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

    iQIcBAEBAgAGBQJJztEaAAoJEF+XTK08PnB5F2cQAJlBZfymrBQyqzasSmKP9CGo
    H/h+xvlHmsOzTLvu9dE2HLNLHgUmllkLIlLRbcBuzfeKTA9BpCc6B1eptBXvoLQg
    zbpbVmgLUwzY+23ShdeLHu0hktGgnZVt+SYNWnsO/NlgoCdLVFxXqQXxVkTjSAHZ
    +70Vs2DrJk198hfBu7YUqJLA/GlHDWgOLjOa4wmSzcv8e26P+7Z2nPPpDlkuL6H1
    hFD+HHlEZ/9s84mmj7ZJQbO3/mIbaVCj0YSw0eR+j91VReyl1SDBF8x5+gmhcxFN
    jHz3sS9GA3FOAcXYKPXB0br+FezEAB+DBhOliE7La2JRCeVJrQyHF9oBtwfDGwL4
    C6FmItrll7QZolNOttfmmXNXF9ocoL9CGpB9ny3iB319xftOUphXeE1R5no6Xgys
    CBivng6VndNcGqdhznqrzGnuh39JaZOi+BvOREzs2Wmrl/rVmJNlpdaMIZL9crcm
    Q6rd0iRdeX6H4lQpEd/iMNCsmKL1XaDfH2QimFugpZ7lMVfrIxDmSUVRnEee0FqG
    KjDZ3wOo8br6ZghPoZJ+8sICjvjoD0tP4bfnaq4oTbGpqSpzWX88ggbF2cgi2CRk
    WbcniFST/OKbkfiVaxDAmMhVT1pREDrg26hm3C3PSPdswZEaJ0IxjOYOzn75CGh8
    KAgEX+EPVsywQTDQ6sRE
    =UExK
    -----END PGP SIGNATURE-----

  5. #5
    Join Date
    Jun 2008
    Location
    Auckland, NZ
    Posts
    20,714
    Blog Entries
    1

    Default Re: Using Vi and gedit

    I don't think I have sudo installed - how can I fund out?
    You can do 'whereis sudo'. For reference, I get:

    dean@linux:~> whereis sudo
    sudo: /usr/bin/sudo /usr/lib/sudo /usr/bin/X11/sudo /usr/share/man/man8/sudo.8.gz
    As you can see below, it is provided by the sudo package. If required, install with yast sofware manager.

    linux:/home/dean # rpm -qf /usr/bin/sudo
    sudo-1.6.9p15-13.4

  6. #6
    Join Date
    Mar 2009
    Location
    France and the UK
    Posts
    12

    Default Re: Using Vi and gedit

    Hi HCW, yes when I typed the colon, all that happened was that the colon remained at the end of the line I had entered. It didn't go to the bottom left of the screen, but since logging on this morning I have read deano_ferrari's message (thanks very much) and have put a colon followed by qw! and it worked. As to sudo, typing sudo visudo results in "sudo: visudo: command not found". I read somewhere that that is the command to use in order to edit the sudoers file.

    Thanks too swerdna, putting gnomesu worked but I have to say that openSuse seems to be full of arcana. Psuerhaps it takes more than a week to find out about it all!

  7. #7
    Join Date
    Jun 2008
    Location
    Groningen, Netherlands
    Posts
    20,059
    Blog Entries
    14

    Default Re: Using Vi and gedit

    You're using vi, not knowing how vi works. If the : appears in the text, you're still in 'insert mode'. Hit Esc, and then ":w!" and it will write. Also in Esc-mode you can do "ZZ", vi will write and close the file.

    But...do yourself a favor and use gedit, kedit, kwrite or whatever. I use vi because that was what i learned when i started administrating UNIX machines. I still use it because i'm used to it, nothing else.
    ° Appreciate my reply? Click the star and let me know why.

    ° Perfection is not gonna happen. No way.

    https://en.opensuse.org/openSUSE:Board#Members
    http://en.opensuse.org/User:Knurpht
    http://nl.opensuse.org/Gebruiker:Knurpht

  8. #8
    Join Date
    Mar 2009
    Location
    Bangalore, India
    Posts
    44

    Default Re: Using Vi and gedit

    Quote Originally Posted by chris_pasdecalais View Post
    when I typed the colon, all that happened was that the colon remained at the end of the line I had entered. It didn't go to the bottom left of the screen,
    you were most probably still in "insert" more or text entry mode.
    you have to press the "Esc" key to go to command mode
    then you can type commands like :q, :wq etc.,
    --
    vijay
    Time Zone : GMT + 05:30

  9. #9
    Join Date
    Mar 2009
    Location
    France and the UK
    Posts
    12

    Default Re: Using Vi and gedit

    You're using vi, not knowing how vi works.
    You are absolutely right, Knurpht, but it is a long story; I wanted to edit a file, and typing sudo gedit wouldn't work so I thought that I didn't have the right permissions. Floundering around in Google I came across the idea that I might need to put my user name into the sudoers file which,said the Google page, is done by typing sudo visudo. This didn't work but typing su - (thanks confuseling) followed by visudo did so I then looked on the web for a vi manual and the one that I found didn't mention escape mode..........hence my problem. Anyway "Experientia docet" as the Ancient Romans used to say and thanks for your message

  10. #10
    Join Date
    Dec 2008
    Location
    Canada
    Posts
    65

    Default Re: Using Vi and gedit

    You are not in command mode, but insert mode.

    First hit ESC then, type :w

    You must hit ESC in order to enter command mode.

    vi can be a ***** to learn, but once you learn it, you'll love it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •