Emacs

Whats the deal with EMACS guys, I heard they are good and I installed emacs24?

Just because some hipster programmers told you to use Emacs, does not mean you have to. Of course if you learn everything and find it useful, by all means - use it. But IMO it's a relic of the past.

Vim and emacs are sure old, but they are really really powerful and versatile editors. They can do pretty much everything, plus they have tons of plugins available.

2 Likes

I don't care enough to learn the hipster code editors, I just use Eclipse CDT and code.

emacs is dangerous. Someone could use a cuckoo's egg to take over your computer.
Kidding...there was a novel about hackers who sold secrets to the KGB for cash and cocaine. Their tool was a cuckoo's egg that took advantage of emacs.
It might work well with COBOL and fortran :)

Hipster code editors, hipster programmers... whats wrong with you people.

Emacs like a lot of IDEs is a pretty powerful tool, its no different from eclipse @Guy1524, just a different GUI.

4 Likes

Once you understood the concepts of vim/emacs they are pretty powerful. Don't forget that they had >30 years to finetune the workflow.

But in the end: use what ever you like, as long as you are productive, healthy and happy!

2 Likes

what makes them good vs gedit for example?

I use Vim, but respect Emacs enormously.

For heavy Linux users Vim is a great tool. It is a phenomenal text editor, and great programming tool. At first its kind of clunky, but once you "get it" your work flow can greatly improve vs using something like gedit or nano. Lastly, it's going to be on Linux servers, nano or gedit might not. I'd rather know vi and be able to jump on a server do my job and get out than only know gedit and have no idea and fumble around when I hit a command line only nix server.

Just like Vi can help improve your workflow once you get it, Emacs can turbo charge it - once you get Emacs. Whereas Vi allows for some customization, it's nothing compared to Emacs. It comes with an even steeper learning curve. Apparently there's a lisp-y like language you can use to literally program emacs , create macros and custom hot keys.

There are departments/organizations who share custom Emacs that they've programmed for their specific group. Some of the emacs environments and workflows I've see are amazing!

A major weakness of vi is that you can't compile code within the application. You'll have to drop out of vi compile code, read errors and jump back into vi to debug. Now if you're on a GUI nix you can use terminator to get multiple terminal windows open, but in a terminal nix you're going to have to drop out.

Emacs though, with enough knowhow, can by sheer force of will bent (programmed) to allow compiling, error checking and debugging all within the program. Pretty cool!

In my opinion, if you're going to work on Linux, at least learn Vim. Forget gedit, nano, and pico. If you really want to own it don't hesitate to jump on Emacs. Keep in mind there's some upfront work to learning both - but it is worth it.

1 Like

Vim is wonderful. At first I used nano, then I learned vim and now Emacs is something I would like to venture into.

Don't bash it until you try it, no pun intended.

I don't agree with the major weakness of vim.
It is a matter of perspective/philosophy. Some people say a tool should do one thing, and that really well. Emecs sounds like a Eierlegendewollmilchsau to me. (Only in this comparison, I have great respect for Emacs too.), while vim focuses only on processing text/code.

The weakness is not really a weakness, because it is easy to setup/fix:
Use Screen/Tmux and split the terminal in 2 or just use a completely new terminal - and compile your code there.
You can always start shell commands in vim with :!ls for example.
And I bet there are some plugins that give vim some IDE capabilities.

Regarding the benefit over gedit/nano:
Vim gives you very fast movements to many different places (jump to the 5th word and delete it, jump back. ; go to the 2nd ( )-Block and delete anything in there and let me insert something different. ; Repeat the last sequence for the next 2000 lines)
It will give you a shorter path from idea/thought to changed text.

I use a heavily customised vim, that turns vim in a fully fledged IDE, think of an IDE feature, I have it.
Pairing vim with a terminal multiplexer (tmux / screen) is something amazing.

@cotton I don't agree with your vim weaknesses. Ever heard of singlecompile and syntastic?

1 Like

Thats great. I never took the time to set up something like this. But I never really worked on a large codebase as well, so I had no real need for an IDE.

The feature that I miss the most, but that IDEs have, is that you can hover over a Classname or Function and it shows you the definition, maybe even a whole block of the Class/Function form an external file.
Any word on how you do that?

I was just thinking, that you easily could take your favorite IDE and I bet there are vim-binding-plugins or even integration for it! (only checked for Eclipse so far)
Its sort of the other way around.

In the end vim is only an editor, not meant to be a full IDE. It sure can be somehow (like emacs can be).

I was using Sublime Text in the past - that was a pain in the a** since I wanted to use an open source editor. Some time ago I found Atom (developed by GitHub) which is absolutely awesome. If you are looking for a new editor, check it out: https://atom.io/

That's a feature that has been around for a long time.

You can generate tags using ctags. For example if I have some C code inside the current directory, to generate the tags I'd do: ctags *.c (inside a shell) after that I can either do :ta function_name inside vim, or go over a specific function call or variable or class name and hit CTRL + ] and that will jump to the definintion. I can even use regex, :ta /^get shows every function definition that starts with get. Ctags works with 40+ programming languages.

Ok, ok I get it, you now want a list of all definitions (functions, classes, variables, ...) have no fear, plugins are here. There are tons of plugins that can do that to name two taglist and tagbar. I use tagbar.

I'll post two screenshots, one from a C file and one from a java file:

Note the right sidebar, don't worry you can move where you want. Since I have a small screen I don't leave it always opened, I just open it when I need it and as soon as I jump to a specific tag it autocloses.

So you see a list of tags grouped by type, at this point to jump to a specific tag I can either double click with the mouse over it, or move the cursor over a tag and press enter.

Tagbar generates tags on the fly, while ctags will create a file with all the tags in it.

1 Like

1 tagbar and that nice colorscheme please!

(don't worry, I can find it myself, once you told its name)

I made the terminal colors, but the vim theme is customized version of a solarized color scheme.
Tagbar is available here: https://github.com/majutsushi/tagbar

Terminal colors:

! --- special colors ---
*background: #22222A
*foreground: #C1BDB4
! --- standard colors ---
! black
*color0: #434460
! bright_black
*color8: #434460
! red
*color1: #6E6A81
! bright_red
*color9: #6E6A81
! green
*color2: #8D6B86
! bright_green
*color10: #8D6B86
! yellow
*color3: #8F6478
! bright_yellow
*color11: #8F6478
! blue
*color4: #B17380
! bright_blue
*color12: #B17380
! magenta
*color5: #9D6C68
! bright_magenta
*color13: #9D6C68
! cyan
*color6: #B67363
! bright_cyan
*color14: #B67363
! white
*color7: #B38061
! bright_white
*color15: #B38061

vim theme: http://pastebin.com/93ZY0U5j

Usage: put this inside your vimrc

let g:solarized_termcolors=   256
colorscheme solarized
1 Like

It's old, but it's certainly not a relic. I would argue that default emacs might not be worth the time, when you have configurations like spacemacs.

I have found spacemacs exceptionally useful when editing php files over a server. With tramp i can edit the files using my syntax highlighting and code-completion, just like they were on my local machine. In comparison, in vim i'm forced to use whatever vim config is on that server.