Vim/Evil mode command and Russian language auto select #15726
-
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. |
Beta Was this translation helpful? Give feedback.
Replies: 12 comments
-
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. |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
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"))) |
Beta Was this translation helpful? Give feedback.
-
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 ))). |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Okay, then make a variable and use it to store the info. You can grab the output of a shell command with |
Beta Was this translation helpful? Give feedback.
-
Thanks, I'll need some times to learn ELisp :) |
Beta Was this translation helpful? Give feedback.
-
Since this is not exactly the place, I am closing this now. You can pop on the gitter if you like. |
Beta Was this translation helpful? Give feedback.
-
Thanks. You show me the way |
Beta Was this translation helpful? Give feedback.
-
Working solution for Ubuntu in https://gist.github.com/kai11/bb5c2fa03cb21884bfcb76c01d1632c9 |
Beta Was this translation helpful? Give feedback.
-
Thanks. I already did it for Mac ))) |
Beta Was this translation helpful? Give feedback.
-
Thanks, I updated your solution to newer version of Ubuntu. |
Beta Was this translation helpful? Give feedback.
Thanks, I updated your solution to newer version of Ubuntu.
https://github.com/malashinroman/dotfiles/blob/571cb33d92a6a26f0e88ed2b22785274ff1a38ae/.spacemacs#L613-L656