Home Download Buy Blog Forum Support

Opening files Emacs-style

Opening files Emacs-style

Postby rob on Thu Apr 05, 2012 1:49 pm

Hi all,

I am in the early stages of migrating from Emacs and there on thing I miss at the moment: opening files using auto-complete. Within Sublime, the only way I can find to open files is via the GUI. In Emacs you can tab to autocomplete file names and that's really fast. I can leave Sublime and open a file via a command line. This gives me the ability to auto-complete but it seems very roundabout. Is there a better way?

Thanks!
rob
 
Posts: 5
Joined: Thu Apr 05, 2012 1:21 pm

Re: Opening files Emacs-style

Postby nick. on Thu Apr 05, 2012 1:58 pm

I thing Sublime's Ctrl-P GoTo Anything ability supersedes any tab-completion functionality.
nick.
 
Posts: 266
Joined: Wed Jan 18, 2012 3:45 am

Re: Opening files Emacs-style

Postby guillermooo on Thu Apr 05, 2012 1:58 pm

Have you tried Goto Anything (Ctrl+P) or are you talking about files outside of your project?
guillermooo
 
Posts: 729
Joined: Thu Jul 23, 2009 9:06 am

Re: Opening files Emacs-style

Postby rob on Thu Apr 05, 2012 2:06 pm

Yes, I'm talking about files outside of my project. I want to be able to open new files without having to mess around with the open file GUI, which is system-specific.

Edit:
On the subject of goto-anything, is there are a way to get it to tab-autocomplete? That would be really useful because otherwise you have to scroll down down the list of completions, which takes longer. Unless I'm missing something, of course.
Last edited by rob on Thu Apr 05, 2012 2:11 pm, edited 1 time in total.
rob
 
Posts: 5
Joined: Thu Apr 05, 2012 1:21 pm

Re: Opening files Emacs-style

Postby C0D312 on Thu Apr 05, 2012 2:07 pm

I had started working on a plugin to do this a while back but ended up stopping when I discovered there's no easy way in the API to add a folder to the sidebar. So now I just use Alfred.app with the default action set to open in ST2. But this wouldn't be too difficult if you just want to open one file.
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: Opening files Emacs-style

Postby guillermooo on Thu Apr 05, 2012 2:19 pm

The current autocomplete logic in ST isn't very friendly to items with spaces in them (I suppose it can't be anyway). I think file system autocompletion should be integrated in the API. I tried to implement it for VintageEx, but never found a working solution. That's a long way of saying you can't do that now, I'm afraid.
guillermooo
 
Posts: 729
Joined: Thu Jul 23, 2009 9:06 am

Re: Opening files Emacs-style

Postby C0D312 on Thu Apr 05, 2012 2:29 pm

@guillermooo, I'd imagine that the best way to implement something like this is with an input panel. @Castles was able to add snippets/tabstops and autocompletion into his unfinished version of ZenCoding, so I wouldn't say it's impossible. From there, you could do something like AutoFileName does to complete the filename.
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: Opening files Emacs-style

Postby guillermooo on Thu Apr 05, 2012 2:41 pm

@C0D312, an input panel is just a regular view for the most part, so they can implement EventListeners of their own and add snippets, etc. The problem occurs when you have spaces in the items you want to autocomplete. I suppose it can still be done, but I would imagine you'd need to do quite a bit of bookkeeping to see what's the prefix to base completions on ("C:\Program" or "C:\Program Files" or "C:\Program Files (x86)", etc.).
guillermooo
 
Posts: 729
Joined: Thu Jul 23, 2009 9:06 am

Re: Opening files Emacs-style

Postby C0D312 on Thu Apr 05, 2012 2:51 pm

Hmmm... AutoFileName seems to handle spaces just fine.
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: Opening files Emacs-style

Postby guillermooo on Thu Apr 05, 2012 3:02 pm

It's likely what I'm saying's just a bunch of BS. :D Where's this AutoFileName thing?
guillermooo
 
Posts: 729
Joined: Thu Jul 23, 2009 9:06 am

Next

Return to General Discussion

Who is online

Users browsing this forum: Yahoo [Bot] and 14 guests