Godit - A very religious text editor written in Go
github.com
github.com
I'd much rather have tab size be set to get smaller based on the number of indentations/longest line.
Now, some people will claim that having 8-character indentations makes the code move too far to the right, and makes it hard to read on a 80-character terminal screen. The answer to that is that if you need more than 3 levels of indentation, you're screwed anyway, and should fix your program.
And I think I kinda agree with this.
module
class
def
if
class << self
defBut still excessive indentation is a hint that the code may benefit from some refactoring.
The editor is never meant to be used by anyone except me. But if someone finds it nice, I don't mind sharing it. Plus it's the only serious example of termbox library usage (I wrote it too).
In the case of this particular itch, there are many small statically linked editors, some of them quite powerful. I don't think a small emacs was ever spotted, but the original vi (not vim) is often statically linked and present in /bin in Linux installs (it's a rescue thing).
Writing the right combination of what I want is a perfect way to solve this problem.
That being said, I still have EDITOR set to /usr/bin/emacsclient.
Are two totally separate things and you are painting them both with the suckless brush. The plan9 community is nothing like that at all.
If this is true, do you still find the performance satisfactory when editing large-ish files (tens of thousands of lines)?
It used to be that buffer representation for general-purpose editing was kind of a Real Problem, so it's interesting if a basic linked list of strings representing lines cuts it, these days.
In my opinion linked list of lines is perfect here. Because the only time you need to go through it in a linear fashion is the actual "goto line" operation. The rest is mostly O(1). Of course line insertion is much more common than "goto line" in editors.
The only problem in godit is that it still doesn't handle long lines very well, here most of the operations are O(N). In fact in godit every time you move a cursor or basically do anything it will do O(N) operation on a current line. I checked this kind of stuff on long enough line (10k), no problems here. I don't think there are that many docs with lines longer than 10k.
So, yes, it will work on very large files without any problems. I've just tested it by creating a 56M file with ~660k lines. Can't see any performance issues on my i5-3470, except for loading and saving, it feels like 0.5s for both or so.
Of course contiguous buffer is not an efficient way to do an editor, I guess "advanced" editors use rope data structure or something. Although most of the editors load large files slower than godit. In a perfect world on files bigger than say 50M you should do memory mapping or something. But most editors like to know the amount of lines in a file they're showing to you, so, no mmap here.
Anyways.. It works very well in practice.
https://www.youtube.com/watch?v=gb_qHP7VaZE
(I bet half of you knows what movie clip that is before clicking)
And no wonder, for Satan himself masquerades as an angel of light.
~ 2 Corinthians 11:15
Emacs is the devil m@sauron:~ $ echo -e '\tx'
xPersonally I prefer 4 chars. In my opinion it looks tidier when reading back source code.
While I agree on ending the '\r\n' mania(which itself is a very hard task), pushing tab stops down my throat is not cool.
However, damned shall be those who think that tabs are anything but 8 spaces wide and actually use them this way in their code. Tabs really are 8 spaces wide and every terminal will tell you so.
Real world example: just yesterday I've been bitten by Eclipse defaulting to use "4 space wide tabs" for indentation in otherwise space-indented codebase. Everything looked nice and cool until I ran git diff. How could Eclipse developers think that it was a good idea?
At least IntelliJ has Emacs-style DWIM tab, but still has a whole host of problems with its better than Eclipse but still subpar editor.
So, yes, a tab size of 8 is insane...
p.s. panic on opening a directory isn't really a best way to say that you don't support viewing directories...
I was just wondering if the lack of folders was a typical Go thing. For example, I probably would have something like modes/{all _mode.go files}, and maybe view/{view files}, but I've never touched Go, so I was wondering whether this was unidiomatic.
And I can't just add "modes" and "view" packages, because there are parts in them which depend on core concepts, which leads me to another "core" package or something. And that's 3 packages already. When there's 3, there's 4. It's easier the way it is.
(Thanks for the explanation! :) )
And the tooling helps. There is no Makefile and no instructions, so I tried `go build` and it just works.
I've been searching for something less bloated than Vim for a while (straight vi doesn't cut it).
Please. I don't even bother compiling my .el to .elc and I've got a shitload of modes and a gigantic .emacs file (which I should split btw).
Emacs, from the scratch, takes two seconds to fully load, including all the modes and my solarized color theme etc. I'm not talking about always running an Emacs server to which you can connect in a split second: no, I'm talking about a cold start.
It's 2013 and that's on a Core i5 3450s with 4 GB of RAM. Hardly a speed/memory demon.
If I was motivated I'd compile all my .el to .elc and always run emacs in server/daemon mode to connect lightweight windows to it but why bother!? The friggin' entire thing launches in two seconds!
Regarding the "Emacs is big", I know the joke was funny when people, 20 years ago, were writing that Emacs meant "Eight Megabytes And Constantly Swapping" but in this day and age where most devs are using IntelliJ IDEA, Eclipse or other super-fat IDEs, you have to admit that Emacs is really in the "very very very lightweight camp".
Yes, you need lot of elisp scripts: and preferrably as much as possible written by yourself, because this means you're tailoring your editor to your needs, not the other way around.
I love Emacs. I use it all the time. But the default shortcuts are the most stupid thing ever. That Control-x (C-x in Emacs lingua) is insanity at its best: due to the stupid non-symmetric layout of typical staggered keyboards 'x' in itself is one the hardest key to type (the equivalent with the right hand is way easier : '>' on a QWERTY keyboard). I'm a touch-typist and to hit 'x' I need to move my whole hand a bit. To hit '>' I just need to move on finger. I blame this on the fact that keyboard are using a staggered layout instead of a matrix or symmetric layout but whatever.
Then Control. Zomg. Control has to be accessed with the left pinky if you're a touch-typist: some very touch-typist friendly keyboards like the HHKB Pro 2 don't even botter with a right control key.
So to hit "C-x" you're supposed to use the two leftmost fingers of your left hand: this alone has to be one of the most RSI inducing keyboard shortcut ever.
But in Emacs everything is configurable. So I'm using "C-," to replace "C-x" and "M-," to replace "M-x".
It shall never cease to amaze me (in a very sad way) that when people "copy Emacs", the first thing they copy are the Emacs shortcuts. The Emacs shortcuts are the lamest thing ever in Emacs.
I love Emacs but I hate its default shortcuts. Emacs is not about its shortcuts: Emacs is about tailoring it to your needs by using Lisp.
I'm also wondering why that constant loss of energy in editors which shall never produce anything close to what one million lines of elisp code are providing. I'd much rather see that energy spend on creating a bridge for the Go-completion facility in Emacs, the real thing.
It's ok to disagree with godit, it's not meant for everybody. Frankly, just for me. And if someone else likes it, I don't mind sharing it.
Go-completion facility in Emacs is available. `github.com/nsf/gocode` has two plugins for emacs (auto-complete-mode and company-mode).