GithubHelp home page GithubHelp logo

Comments (6)

misfo avatar misfo commented on September 3, 2024

This is a duplicate of #45

from vintage.

andersonfreitas avatar andersonfreitas commented on September 3, 2024

This is not the default in Vim. I had these lines in my .vimrc in order to get MacVim to behave this way on FocusLost:

" Return to normal mode on FocustLost
au FocusLost * call feedkeys("\<C-\>\<C-n>")

As a long time vim user, I really missed this behavior in ST2+Vintage (just like you) so I coded a small plugin to always return to command mode after switching tabs or windows:

import sublime, sublime_plugin

class ReturnToVintageCommandModeListener(sublime_plugin.EventListener):
  def on_activated(self, view):
    if view.settings().get("is_widget") is None:
      view.run_command('exit_insert_mode')

This solves your problem. 😄

Maybe somebody could merge this in Vintage adding an option like that?

EDIT: The snippet code has been updated in order to ignore widget windows (https://gist.github.com/3818550)

from vintage.

jordwalke avatar jordwalke commented on September 3, 2024

@andersonfreitas: That's a great plugin. I think a better default behavior would be to only exit insert mode when switching focus to a different file within a single sublime window. That way you could quickly CMD+Tab to a different program like a web browser to quickly reference something as you're typing without leaving insert mode. However, I don't see anything of the sort in the current version of the vintage API documentation: http://www.sublimetext.com/docs/2/api_reference.html

from vintage.

jordwalke avatar jordwalke commented on September 3, 2024

@andersonfreitas: Also - did you notice that the plugin you created causes the CMD+t window to start in normal mode - that's surely not what we'd want here. Do you know a way to avoid it in that case only?

from vintage.

andersonfreitas avatar andersonfreitas commented on September 3, 2024

@jordow Yeah, I've noticed it right after posting this snippet here. There's a slightly modified version that works properly with ⌘+t: https://gist.github.com/3818550

from vintage.

jordwalke avatar jordwalke commented on September 3, 2024

@andersonfreitas: That's working well. That would be great as an addition to Vintage (configurable, of course) or a standalone plugin installable through PackageControl.
I'll let you know if I see any issues with it.

from vintage.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.