to gedit or not to gedit?

For system help, all hardware / software topics NOTE: use Coders Corner for all coders topics.

Moderators: Krom, Grendel

Post Reply
User avatar
Isaac
DBB Artist
DBB Artist
Posts: 7652
Joined: Mon Aug 01, 2005 8:47 am
Location: 🍕

to gedit or not to gedit?

Post by Isaac »

gEdit is my favorite text editor for one reason; it can write/save to a directory while you continue to edit. This is great because if I'm making a few changes to something that's saved on an ftp server the delay isn't noticeable. Instead you see a bar appear which shows that it's saving. However, while this is going on, you can continue to edit while this is happening. I normally save when I change something. After I change something I start looking for the next thing to change. In other editors I have to wait while the text editor writes to the file.
The big problem with gedit is that there's no code folding. There's also no feature that indicates which </div> belongs to which <div... So I have to scroll up and down the page figuring out what ending </div> is enclosing.
Is there a good text editor that can save and chew gum at the same time, but also has code folding?
User avatar
Xamindar
DBB Admiral
DBB Admiral
Posts: 1498
Joined: Sun Jun 06, 2004 2:44 am
Location: California
Contact:

Post by Xamindar »

SciTE has code folding. I use an older version of it on my Zaurus so not sure what the newest version supports. I do know it has code folding and highlighting and can have tabs for multiple open files. Not sure about the saving features.

There is always emacs, I hear it can even wash your clothes for you. :lol:
Why doesn't it work?
User avatar
Jeff250
DBB Master
DBB Master
Posts: 6514
Joined: Sun Sep 05, 1999 2:01 am
Location: ❄️❄️❄️

Post by Jeff250 »

Does the server have an ssh server running, or can you install one? If so, then you can just ssh in and use vim/emacs/pico or whatever your preferred terminal text editor is (as long as it's vim ;)).
User avatar
Isaac
DBB Artist
DBB Artist
Posts: 7652
Joined: Mon Aug 01, 2005 8:47 am
Location: 🍕

Re:

Post by Isaac »

Xamindar wrote:SciTE has code folding. I use an older version of it on my Zaurus so not sure what the newest version supports. I do know it has code folding and highlighting and can have tabs for multiple open files. Not sure about the saving features.

There is always emacs, I hear it can even wash your clothes for you. :lol:
Tested it already. It cant save while doing something else at the same time. :(
Jeff250 wrote:Does the server have an ssh server running, or can you install one? If so, then you can just ssh in and use vim/emacs/pico or whatever your preferred terminal text editor is (as long as it's vim ;)).
Yes! I use SSH for Nautilus to log-in to the FTP account. I do like vim. This might be the answer to my problem.
In the past, I have connected to the server via $ ftp mysite. That worked pretty well, but I assume there's a proper way to connect to my server using the terminal, that I haven't learned yet.
User avatar
Jeff250
DBB Master
DBB Master
Posts: 6514
Joined: Sun Sep 05, 1999 2:01 am
Location: ❄️❄️❄️

Post by Jeff250 »

To ssh in from a terminal:

$ ssh user@my.server.com

Then you'll get a remote shell. You'll be able to use whatever text editors are installed on the remote server to edit text. One potential impediment is if the server is too geographically distant from you, in which case you may notice some lag when typing, but if it's local, or even in a neighboring state, the lag is virtually nonexistent. The advantage here is that, since you'd now be running the text editor on the remote server itself, saving files is a quick, local (relative to the remote shell) write.
User avatar
Xamindar
DBB Admiral
DBB Admiral
Posts: 1498
Joined: Sun Jun 06, 2004 2:44 am
Location: California
Contact:

Re:

Post by Xamindar »

Isaac wrote: Yes! I use SSH for Nautilus to log-in to the FTP account.
Such a Windows kid. :lol:

You might not like vi. The commands to do anything in it are completely different than anything else you probably use. You are basically learning a new language to use a text editor. But once you get used to it you will not want to use anything else, at least it was that way for me. Vi has saved me many unintended mistakes.

Vim keeps the current file saved while you edit it so there is no need to constantly save. Also, try ":tabnew".
Why doesn't it work?
User avatar
Isaac
DBB Artist
DBB Artist
Posts: 7652
Joined: Mon Aug 01, 2005 8:47 am
Location: 🍕

Re:

Post by Isaac »

Jeff250 wrote:To ssh in from a terminal:

$ ssh user@my.server.com

Then you'll get a remote shell. You'll be able to use whatever text editors are installed on the remote server to edit text. One potential impediment is if the server is too geographically distant from you, in which case you may notice some lag when typing, but if it's local, or even in a neighboring state, the lag is virtually nonexistent. The advantage here is that, since you'd now be running the text editor on the remote server itself, saving files is a quick, local (relative to the remote shell) write.
Excellent! Thanks. You mean $ ssh user@ftp.asdf.com ? or just $ ssh user@asdf.com? Nether seem to work, but I think I can figure this out. It looks like it wants to work, but something is stopping it. A cpanel setting is more than likely the problem; I'm very comfortable with breaking stuff there.
Xamindar wrote:
Isaac wrote: Yes! I use SSH for Nautilus to log-in to the FTP account.
Such a Windows kid. :lol:

You might not like vi. The commands to do anything in it are completely different than anything else you probably use. You are basically learning a new language to use a text editor. But once you get used to it you will not want to use anything else, at least it was that way for me. Vi has saved me many unintended mistakes.

Vim keeps the current file saved while you edit it so there is no need to constantly save. Also, try ":tabnew".
hahah! Yeah I still think in "windows".
I have VIM but haven't used it too much. I've used Nano many times, breaking X11 repeatedly. I'm sure exposure to the SSH terminal will give me some good VIM experience.
User avatar
Jeff250
DBB Master
DBB Master
Posts: 6514
Joined: Sun Sep 05, 1999 2:01 am
Location: ❄️❄️❄️

Post by Jeff250 »

If it's a shared hosting site, then they sometimes run ssh on some nonstandard port to evade common port scans. For instance, port 2222 is sometimes used as an alternate:
$ ssh -p2222 user@server.com
Although if you have ssh already working in nautilus, then it should just be the same server/port set up in nautilus (or so I would think). Also, sometimes shared hosting plans also require you to submit some sort of identification, like a driver's license, before they enable you to ssh in. I think that this is just so that they have some fallback if you try to do something criminal from their servers, although, if so, this policy doesn't make sense on a number of levels.
User avatar
Isaac
DBB Artist
DBB Artist
Posts: 7652
Joined: Mon Aug 01, 2005 8:47 am
Location: 🍕

Post by Isaac »

Thanks!
I got the secure port working and I'm even being asked for a password. It doesn't want me to log in, but I'm sure I have to use my separate ssh/shell account with this, which is separate from my ftp accounts.
User avatar
Thenior
DBB Captain
DBB Captain
Posts: 667
Joined: Wed Oct 06, 2004 9:40 am

Post by Thenior »

A possible idea, which isn't quite exactly what you asked for, but anyway...

Use smart FTP and an editor like Notepad++. If you do an Open With in SmartFTP, everytime you make a change (you do have to save the file), it will upload the changes. It's fairly seamless.
User avatar
Isaac
DBB Artist
DBB Artist
Posts: 7652
Joined: Mon Aug 01, 2005 8:47 am
Location: 🍕

Re:

Post by Isaac »

Thenior wrote:A possible idea, which isn't quite exactly what you asked for, but anyway...

Use smart FTP and an editor like Notepad++. If you do an Open With in SmartFTP, everytime you make a change (you do have to save the file), it will upload the changes. It's fairly seamless.
yeah, I like that, because writing to the HD is really fast then the ftp client could take its time sending and receiving.
I kind of like that idea. But VIM via SSH is really cool, so I'm going to try to make that work for the moment.
User avatar
Sirius
DBB Master
DBB Master
Posts: 5616
Joined: Fri May 28, 1999 2:01 am
Location: Bellevue, WA
Contact:

Post by Sirius »

Vim has a lot of hacker-fu quality going about it, yes. It's as arcane as you could like, and combined with SSH, well, yeah.
User avatar
Jeff250
DBB Master
DBB Master
Posts: 6514
Joined: Sun Sep 05, 1999 2:01 am
Location: ❄️❄️❄️

Post by Jeff250 »

On the topic of learning vim, I think the best advice I can think to give is to immediately disable the arrow keys in your .vimrc file:

no <up> <nop>
no <down> <nop>
no <left> <nop>
no <right> <nop>
ino <up> <nop>
ino <down> <nop>
ino <left> <nop>
ino <right> <nop>

Moving back and forth between regular keys and the arrow keys is clumsy and bad for your wrists, although not as much as the mouse. Plus, disabling the arrow keys prevents the other related vice of trying to perform movement in insert mode. Although aside from just h/j/k/l, you'll eventually learn other useful ways of moving around that are usually more efficient than moving 1 spot over in a cardinal direction.

Something I found useful to get used to h/j/k/l was to take my favorite game that I played with the arrow keys (I used Tyrian) and remapped the directions to h/j/k/l. I sucked at first, but in a couple of days, I had it down pat. I think I'm actually better now at the game too, since I don't have to share both up and down between one finger--I have one finger uniquely mapped to one direction.

Also, run vimtutor. And then run it again in a week or two. And so on, until you stop learning.
User avatar
Isaac
DBB Artist
DBB Artist
Posts: 7652
Joined: Mon Aug 01, 2005 8:47 am
Location: 🍕

Post by Isaac »

Image
Thanks! I'm learning vim and I'm starting to like its exotic features.
User avatar
Isaac
DBB Artist
DBB Artist
Posts: 7652
Joined: Mon Aug 01, 2005 8:47 am
Location: 🍕

Post by Isaac »

I don't know how I lived with out
r !
User avatar
Freakster
DBB Ace
DBB Ace
Posts: 48
Joined: Sat Jul 17, 2010 10:34 pm
Location: Mars

Post by Freakster »

hehheheh... To gedit or not to gedit... It's a joke! gedit?

I wouldn't personally know of a good program to do this myself, but a friend of mine said SciTE, what Xamindar suggested, is good. Though he's used it very lightly himself.
This line is true!
The line above this line, is false.

My in-game name is Freakster as well.

Warning: Use of improper English imminant, it's not my primary language.
User avatar
Skyalmian
DBB Admiral
DBB Admiral
Posts: 1722
Joined: Wed Aug 18, 1999 2:01 am

Post by Skyalmian »

Mousepad.
When I want something with color and higlights, Notepad++ via WINE.
User avatar
Isaac
DBB Artist
DBB Artist
Posts: 7652
Joined: Mon Aug 01, 2005 8:47 am
Location: 🍕

Re:

Post by Isaac »

Skyalmian wrote:Mousepad.
When I want something with color and higlights, Notepad++ via WINE.
I haven't messed with npp, but, since the source code is available, I would assume that I can compile it to run in Linux. Because I have vim, I haven't spent any time with npp.

Mousepad looks like gedit, which is good. But I already have gedit.

Thanks for your help though!
Freakster wrote:SciTE
I tried it but I didn't like it for some reason. I already forgot why...

@Jeff250
Now when I'm using a word processor, like MS Word, or when I'm posting on the forums, I have to make a conscious effort not to use hjkl. Also, when I'm editing in a Word doc, I can feel part myself wanting to use vim commands. It didn't take much to get used to vim, but the more comfortable I get with it the more unnatural everything else feels. I'm sure my brain is connecting new synapses in different ways because of this. :lol:
User avatar
Jeff250
DBB Master
DBB Master
Posts: 6514
Joined: Sun Sep 05, 1999 2:01 am
Location: ❄️❄️❄️

Post by Jeff250 »

I'm pretty sure that's normal, although if you're doing it in word processing software, then you might have an especially bad case. ;)
Post Reply