7 ms·
Godit - A very religious text editor written in Go
- deleted 14y ago[deleted]
- alisnic 14y ago"the tab size is always an equivalent to 8 spaces/characters" - our faiths are incompatible
- vidarh 14y agoIt is clearly time for a religious war.
- vanderZwan 14y agoIt's more like this if you ask me: https://www.youtube.com/watch?v=gb_qHP7VaZE https://www.youtube.com/watch?v=gb_qHP7VaZE (I bet half of you knows what movie clip that is before clicking)
- the_kraken 14y ago"Die heretic!"
- user3487 14y agoFork it!
- lclarkmichalek 14y agoPrint the diff and nail it to nsf's door!
- mbrock 14y agoObviously the tab character should move forward to the next column divisible by the tab size -- it's not just a replacement for a fixed number of spaces!
- nsf 14y agoThat's just my english. Of course I meant that the tab size is the same as the size of 8 space characters. And it sounds like the tab _character_ is an equivalent to 8 spaces, which is not true. Sorry for confusing description.
- lsiebert 14y agoso, you can indent 9 times in an 80 column display, and less then that usefully? I'd much rather have tab size be set to get smaller based on the number of indentations/longest line.
- mich41 14y agoProphet says: 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.
- laumars 14y agoI do agree that there comes a point where you can get over zealous with indentation, but 3 levels deep is pretty common. In fact you idle at one level of indentation just with having your code inside a function. So basically all you need is one conditional inside a loop and you're already maxed out.
- FuzzyDunlop 14y agoProbably not good for ruby when combinations of the following things can result in deeply nested code: module class def if class << self def
- mich41 14y agoWell, the Prophet is a C programmer so his numbers may need adjustment by some constant for languages with objects, namespaces, modules, etc. But still excessive indentation is a hint that the code may benefit from some refactoring.
- klapinat0r 14y agohttps://github.com/nsf/godit/blob/master/godit.go#L14 https://github.com/nsf/godit/blob/master/godit.go#L14 > - tabstop_length = 8 > + tabstop_length = 4
- stiff 14y agoThe so-called Plan9 way of providing customizable features.
- nsf 14y agoNever used plan9 in my life. The reason why I wrote this editor is because I don't like bloated emacs and I use this many of its features. Go produces nice 100% statically linked binaries, so eventually I can just wget the godit to any of my linux machines and just use it. 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).
- sergiosgc 14y agoWriting software is always a good idea, at least for the experience, so don't be offended by the following comment. 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).
- nsf 14y agoI totally agree with that, but you know how it goes with sensitive tools like editors. "Nya nya nya, but where is my feature X?" Writing the right combination of what I want is a perfect way to solve this problem.
- salgernon 14y agoMicromacs was favorite in the late 80s. JOVE early 90s. And the commercial unipress emacs. GNU emacs outlived them, probably because situations where a light spot editor was desired are now fast enough that there is very little additional cost to a full featured editor. That being said, I still have EDITOR set to /usr/bin/emacsclient.
- paulnechifor 14y agoI'm also guessing syntax highlighting isn't a planned feature.
- nsf 14y agoCorrect, I think it's useless. :D
- BitMastro 14y agoIsn't 8 spaces the default spacing in gofmt?
- wting 14y ago`gofmt` uses tabs, and is one of the few languages where it is idiomatic to use tabs rather than spaces.
- dbaupp 14y agoIs it a Go thing to have no file organisation? (Is this tooling sufficiently nice that this is manageable?)
- nsf 14y agoDo you want me to write code like that? https://github.com/Mikkeren/FizzBuzzEnterpriseEdition https://github.com/Mikkeren/FizzBuzzEnterpriseEdition
- TheZenPsycho 14y agohttps://yourlogicalfallacyis.com/black-or-white https://yourlogicalfallacyis.com/black-or-white
- nsf 14y agoSure, but honestly the original complaint was implying that godit is badly structured. Yes, I don't use Go packages for it, because it's just a small 5k lines of code project and I don't need to use 100 packages to avoid namespace clashes. I use a separate file for most of editor modes and concepts, what else the author wants me to do? Hence, the irony in the answer.
- dbaupp 14y agoSorry, my original comment was way harsher than necessary. I wasn't meaning to imply you had structured it badly, the use of files is certainly clear. 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.
- grey-area 14y agoYou can do either. Folders are packages, so if you had /modes, that would be a modes sub-package which could be included in the top level code with import.
- frozenport 14y agoAnd no wonder, for Satan himself masquerades as an angel of light. ~ 2 Corinthians 11:15 Emacs is the devil
- human_error 14y agoI think Gomacs or Gemacs would've been better name. It looks so similar to emacs.
- nsf 14y agoPerhaps, but it's too late to change the name.
- buster 14y ago8 characters tab width is insane. :(
- mich41 14y agoRoundness of the Earth is equally insane. But both are facts. m@sauron:~ $ echo -e '\tx' x
- laumars 14y agotab width can be any size you want, it's just many text rendering systems default to 8. Personally I prefer 4 chars. In my opinion it looks tidier when reading back source code.
- yati 14y agoFrom PEP-8, "Use 4 spaces per indentation level. For really old code that you don't want to mess up, you can continue to use 8-space tabs." [1]. 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. [1]: http://www.python.org/dev/peps/pep-0008/ http://www.python.org/dev/peps/pep-0008/
- mich41 14y agoI have no problem with people using 4 spaces for indentation. 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?
- spacemanaki 14y agoEclipse is very goofy about this, and it's something I loathed about using it (having recently switched to IntelliJ, which is better but not by an order of magnitude). In my experience, it will sometimes indent according to your settings, spaces or tabs, but at other times, based on some other setting that is in a different place than the first, it will indent based on the line previous to the one you are indenting. This results in a kind of slow creep of badly formatted code entering the codebase, if you have a lot of developers who don't care or don't know to check whitespace upon commit, and don't explicitly share a well-customized settings file. 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.
- densh 14y agoPerformance is truly impressive. And I really love how small the codebase actually is. I've been dreaming about writing my own text editor for quite some time. This will really help me to get started, thanks a lot nsf! p.s. panic on opening a directory isn't really a best way to say that you don't support viewing directories...
- nsf 14y agoI agree this panic is quite annoying sometimes. Will make a proper error message when I have time. A very minor issue at the moment. You see I'm not really actively working on it anymore, I use the godit for all of my text editing tasks and if some feature/bug annoys me a lot in godit - I fix it. Directory opening by accident happens sometimes, lol, and when you see a panic message, you panic as well, but then phew.. :)
- jaequery 14y agowhy not just emacs?
- pekk 14y agoMaybe someone would rather rewrite their editor in Go than elisp.
- nsf 14y agoEmacs is big, startup is slow and you have to carry a pile of elisp scripts which fulfil your feature needs. All features has to be written in elisp of course that could be an issue too. Just a matter of taste.
- martinced 14y ago"Emacs is big, startup is slow..." 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.
- 4ad 14y agoTwo seconds? Is this a joke? My browser starts faster than that. Often it takes me less than two seconds to open a file, make a minor edit, save it, exit, and recompile.
- nemo1618 14y agoif only it had Vim bindings instead of Emacs bindings :/ I've been searching for something less bloated than Vim for a while (straight vi doesn't cut it).
- martinced 14y agoBut why oh why immitate the Emacs shortcuts? 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.
- nsf 14y agoI hope no emacs users use control, there is a caps lock for that. 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).