agroszer
agroszer

Reputation: 85

customizing emacs with "sidebars"

I'm tinkering about switching my IDE to emacs. (I'm still an emacs newbie.) The problem is that I customized my IDE quite well and I'd regret to leave my helpers behind.

enter image description here

Let me explain:

  1. Shows the current open files/buffers, allows fast switching with a hotkey (C-1, C-2, ...)
  2. Shows the most recent texts on the "clipboard" or inserted by complete (no. 4), text insertable with a hotkey (C-b 1, C-b 2, ...) Last inserted shown in bold, insertable with C-`
  3. The last inserted complete (no. 4) text, insertable with M-`
  4. Autocomplete-ish list, gathered from all open files, regardless of their type with some magical logic. text insertable with a hotkey (M-1, M-2, ...)

I guess emacs has such features, but I'm a visual type I'd like to see what I have available. Of course actual hotkeys don't matter much, but as you see having all that info visible makes it easy to hit the spot with the least keypresses.

My pain is that there is a plethora of emacs extensions providing various features, checking all seems to take a lifetime.

My question is:

Thanks!


Elaborating a bit more:

I’m a python dev, so most of the code I’m writing is python. Add some HTML JS CSS XML to the picture. One important thing is that completion needs to work across filetype boundaries, because python / HTML(template) / XML(config) / doctest identifiers are cross-referenced. It’s a huge pain with some IDEs that completion works only for python filetypes.

  1. I have a lot of same named files but in different folders, like init.py, configure.zcml, etc. It seems to be a pain to switch between those by filename.

  2. Better said that’s a list of recently inserted text. To be reused by the fewest keys as possible. Usually when coding I’m reusing the same identifiers/whatever within the same task. So it’s handy to have them listed instead having to retype the starting x chars to get completion again.

  3. Usually best use of this feature is when changing/refactoring code. Like adding one more extra feature and the identifier is needed several times over the place.

Upvotes: 2

Views: 2044

Answers (3)

Malabarba
Malabarba

Reputation: 4553

TL;DR

Learn keyboard macros. Learn yasnippet.
Autocomplete mode is probably similar to what you have.
Get acquainted with emacs kill-ring before trying to change it, it wants to be your friend. Then you'll know what to look for when you DO want to change it.


Long Version

Shows the current open files/buffers, allows fast switching with a hotkey (C-1, C-2, ...)

You have three options for this.

  1. My personal preference is to have all source files open at all times. So I don't need a visual list of open buffers. Whenever I want to switch to a file I hit C-= (which I've bound to iswitchb-buffer) and type a couple of unique letters. It's common to constantly switch between the same two buffers so I also bound C-backspace to previous-buffer.
  2. Another option I can recommend is tabbar. It's not exactly like your setup, but it displays a list of open buffers (just like webpages in a browser) and it has functions for cycling through the tabs, so it shouldn't be hard to reproduce your C-number key bindings.
  3. You could use speedbar or ecb. They would be the most similar to your current visual configuration, but I'd argue the other options are more efficient.

Shows the most recent texts on the "clipboard" or inserted by complete (no. 4), text insertable with a hotkey (C-b 1, C-b 2, ...) Last inserted shown in bold, insertable with...

I see you've sort of mixed the clipboard with completion history. When it comes to emacs, yasnippet and autocomplete are just so good you're better off going with them for completion (see below).

Emacs clipboard is called the kill-ring. I'm sure you know of C-y and M-y, so you can always recover anything you've cut in the past. Unfortunately, I don't know of any packages that constantly display the kill ring or allow you to yank a specific part of it (though that shouldn't be too hard to write), but at least you know what to search for (kill-ring).


The last inserted complete (no. 4) text, insertable with M-`

I'll be honest, I don't see that much use in this. If you have to repetitively insert text, you should learn keyboard macros. In fact, you should learn keyboard macros anyway, they're the first reason I got hooked to emacs.


Autocomplete-ish list, gathered from all open files, regardless of their type with some magical logic. text insertable with a hotkey (M-1, M-2, ...)

Emacs had many great completion options. In your case, the best one is probably autocomplete-mode. It pops-up completion options (much like your separate completions window), and I think it allows for quick selection of a specific option (like your M-number shortcuts). Also it has several different ways of deciding which completions to offer you (it calls them "sources") and one of them is to gather from all buffers.

In addition to that you have yasnippet, and I couldn't possibly recommend it enough. Seriously. Learning to use it and writing your own snippets will change the way you write code. You'll become a mage whose fingers produce pages of code flowing through your screen in blazing speeds. Use yasnippet!
Once you have it configured, every 3 or 4 keys you press will generate a line (or more) of code for you.


After all that, if you still miss something from your previous editor you'll write it yourself. :-)

Upvotes: 4

Hank
Hank

Reputation: 527

You should take a look at the extension speedbar. I have installed this extension, but I rarely use it even for a very large project.

Upvotes: 2

abo-abo
abo-abo

Reputation: 20352

Your setup looks exactly like https://github.com/emacsmirror/ecb. To me at least, since I don't use side-bars:)

Upvotes: 2

Related Questions