Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vim/Evil mode command and Russian language auto select #3225

Closed
ghost355 opened this issue Oct 1, 2015 · 11 comments
Closed

Vim/Evil mode command and Russian language auto select #3225

ghost355 opened this issue Oct 1, 2015 · 11 comments
Labels

Comments

@ghost355
Copy link

@ghost355 ghost355 commented Oct 1, 2015

Is there an ability for auto selecting (return to English) from Russian when I quit an insert mode and return to the last language when I turn back to the insert mode. It's very useful when I write something in Russian and press Esc for navigation the text. This work well in vim with https://github.com/lyokha/vim-xkbswitch. I'm looking for this feature in Spacemacs. Or any other way to make my life easy without regular switching language layouts.

@TheBB

This comment has been minimized.

Copy link
Collaborator

@TheBB TheBB commented Oct 2, 2015

There are hooks for entering and exiting each evil state where you can attach a function that does arbitrary things. If you can figure out how to change the language in Emacs Lisp (e.g. by calling an executable), that should solve the problem.

@TheBB TheBB added the Question label Oct 2, 2015
@ghost355

This comment has been minimized.

Copy link
Author

@ghost355 ghost355 commented Oct 2, 2015

Thanks. I think this https://github.com/vovkasm/input-source-switcher could help in this task.This small utility for Apple OS X allows to easily switch input sources from a command line.

@TheBB

This comment has been minimized.

Copy link
Collaborator

@TheBB TheBB commented Oct 2, 2015

So you would want something along these lines.

(add-hook 'evil-insert-state-entry-hook
          (lambda ()
            (shell-command "issw russian")))
(add-hook 'evil-insert-state-exit-hook
          (lambda ()
            (shell-command "issw english")))
@ghost355

This comment has been minimized.

Copy link
Author

@ghost355 ghost355 commented Oct 2, 2015

With exit mode looking OK, but when I enter in Insert mode I have to switch to the last layouts English or Russian which was active before exit from Insert mode ))).

@ghost355

This comment has been minimized.

Copy link
Author

@ghost355 ghost355 commented Oct 2, 2015

issw can return the active input source. When I exit from Insert mode I have to recieve actual layout and save it. Then switch to English. And when I return to Insert I use issw with saved state

@TheBB

This comment has been minimized.

Copy link
Collaborator

@TheBB TheBB commented Oct 2, 2015

Okay, then make a variable and use it to store the info. You can grab the output of a shell command with shell-command-to-string.

@ghost355

This comment has been minimized.

Copy link
Author

@ghost355 ghost355 commented Oct 2, 2015

Thanks, I'll need some times to learn ELisp :)

@TheBB

This comment has been minimized.

Copy link
Collaborator

@TheBB TheBB commented Oct 2, 2015

Since this is not exactly the place, I am closing this now.

You can pop on the gitter if you like.

@TheBB TheBB closed this Oct 2, 2015
@ghost355

This comment has been minimized.

Copy link
Author

@ghost355 ghost355 commented Oct 2, 2015

Thanks. You show me the way

@kai11

This comment has been minimized.

Copy link

@kai11 kai11 commented Sep 29, 2017

@ghost355

This comment has been minimized.

Copy link
Author

@ghost355 ghost355 commented Sep 29, 2017

Thanks. I already did it for Mac )))
https://gist.github.com/ghost355/a967417bb7e826e833d4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.