ActiveState Powered by ActiveState

ActiveState Community


Switch to an open buffer by name?

Posted by awmcclain on 2008-03-26 17:00

I apologize if this has been answered elsewhere, but I couldn't find anything with a websearch or in the keybindings.

Is there a command to switch to an open buffer by name (similar to Eclipse's command-e), rather than cycling through them all with next-file/previous-file?

jeffg | Thu, 2008-03-27 08:04

Can you describe the behavior in a bit more detail? I'm not familiar with that Eclipse feature. Is this anything like the Mac-like ability to navigate tabs using Cmd+TabNumber? I just posted a Macro set that does that ( albeit hackily ):

http://community.activestate.com/forum-topic/macro-set-implement-mac-tab...

--
JeffG

dafi | Thu, 2008-03-27 11:51

I've developed TabSwitcher it is very similar to Eclipse Command-E.

What it does:

Press Shift-F9 to open a dialog with all views listed, then you can:
- enter text to select view
- move UP/DOWN to select view

on enter the focus shifts to selected view

PS
Ctrl-E is already assigned to Move to End of Word

--
dafi
Enhance KomodoEdit with MoreKomodo

ericp | Thu, 2008-03-27 17:48

Sometimes I have two files with the same basename, but in different directories.
It would be useful to see more context, to determine which file I want. At the worst, show the full pathname, and set crop to "left" to elide the start of the path. Except it looks like you're using a treeview instead of a listbox to display the paths, and treecells don't have a crop attribute.

Double-clicking is broken. You need something like this code:

gSelectView = { ...
   onDblClick: function() {
      this.onAccept();
      window.close();
   },
gSelectView = { ...
   onDblClick: function() {
      this.onAccept();
      window.close();
   },

Also, the contents of the treeview should be sorted, so they're easier
to find.

Finally, you could also process the view-title field, such as treating
it like a regex (so you can type 'foo.*\.js' to see all your JavaScript files),
but that isn't natural. Another approach is to convert the input 'abcd' into
the regex 'a.*b.*c.*d'. A glob-type regex would be more useful, but the only
one I'm aware of that we support easily returns a list of filenames on the
system. Of course it's easy to convert a glob-type regex into a standard one,
right?

dafi | Thu, 2008-03-27 22:50

You are right for everything, consider I'm the only TabSwitcher user for months so I never thought to add enhancements.

Cropping paths is interesting but I love treeViews, I'm try to implement using a different approach.
What do you think about having a column with paths and a second one with basenames?
Maybe the quick-tab-switch became not-so-quick-tab-switch

About regexp... What do you think about adding a checkbox enabling/disabling regexp search?

The no-regexp search should match substrings, actually match only if filename "starts with" typed text.

Sorting file names is a great improvement, I never realized them aren't :P
Sorting by fullpath or basename, that is the question?

thanks for you feedback

ericp | Fri, 2008-03-28 09:53

I would sort by basename, and in answer to your first question, I'd have a
checkbox that expands to full paths so you don't need the two columns.

I prefer regex searching, but like I said, we're all so used to doing glob-type
searching when matching filenames that typing ".*\.js" is unexpected.

Good work. I worked on an implementation at home earlier this week, but am
happy you've already done it.

dafi | Fri, 2008-03-28 10:18

I've realize the two two-columns idea is very ugly, the new UI design is shown below

I need help about glob-type regex, may you help me? Have you some link resource?

Another idea... I would allow case sentitive search, if pattern contains uppercase characters then the search is case sensitive otherwise is case insensitive.
IMHO this is natural and user don't need to choose any operation to switch between case sensitive/insensitive search, he/she simply type uppercaae :P

I'm sure you implementation would be better then mine :P but I prefer my Komodo programmers leave this simple task to lizard programmers like me ;)

ericp | Fri, 2008-03-28 10:33

For a guide to converting a glob-regex into a regular regex,
there's this:

http://www.krugle.org/kse/files/archive/archive.sourceforge.net/civicrm/...

Looks like the code would be something like:

var regexp = new PatternMatcher.strategies.glob(globField.value);
  for (var f in filenames) {
     if (regexp.test(f)) { do_something ... }
  }
var regexp = new PatternMatcher.strategies.glob(globField.value);
  for (var f in filenames) {
     if (regexp.test(f)) { do_something ... }
  }

Looks interesting, but I'll let you have the rest of the fun.

- Eric

awmcclain | Fri, 2008-03-28 11:12

Unfortunately, shift-f9 won't work for me since on my mac it's bound to an os function.
Can I change the keybinding?

Very excited about the new UI!

dafi | Fri, 2008-03-28 11:16

The key binding is hard coded, next version will have customizable keybinding.

Please wait only a couple of hours (hours not days), I'm fixed right now the new versione
--
dafi
Enhance KomodoEdit with MoreKomodo

dafi | Fri, 2008-03-28 12:21

Download is available at TabSwitcher v0.2

Whats new

[x] fixed double click
[x] names are sorted
[x] use glob search (thanks to Eric)
[x] incremental search shows only matching items
[x] file path is shown
[x] user can choose his/her preferred key binding (Edit|Preferences then from Category Editor|Key Bindings)

No keybinding is assigned by default (I know this is a bad solution) user *must* do it manually

The screenshot below shows how to add keybinding

--
dafi
Enhance KomodoEdit with MoreKomodo

awmcclain | Fri, 2008-03-28 14:48

Ug, I forget how to build the source into an xpi. Can you help?

ericp | Fri, 2008-03-28 16:07

cd tabswitcher/chrome
zip -r tabswitcher.jar content locale skin
zip -r tabswitcher-0.1.xpi chrome/tabswitcher.jar install.rdf chrome.manifest defaults/

dafi | Sun, 2008-03-30 08:37

TabSwitcher v0.3

What's new

  • New - if patters contains at least one uppercase character the incremental search became case sensitive
  • New - added item to Window menu
  • Fix - path textbox is readonly and grayed
  • Fix - removed Cancel button for better window space usage (changed xul:dialog to xul:window)

From this version the update mechanism is enabled by default

Download available here

--
dafi
Enhance KomodoEdit with MoreKomodo

awmcclain | Sun, 2008-03-30 12:04

This has dramatically improved our Komodo experience. Thank you!

-->