Feature request: put the mode indicator more on the left
Hello, I see that the mode indicator (<V>, <I>, etc) is the last thing on the right of the status bar. Unfortunately, when many minor modes are loaded (typically when doing some latex), the information is not visible. Is there a way to put the mode indicator more on the left? As a related question, is it possible to change the cursor depending on the mode? Thanks, Alan
On Jun 21, 2011, at 8:22 , Alan Schmitt wrote:
As a related question, is it possible to change the cursor depending on the mode?
This doesn't seem THAT related question and probably deserves it's own thread :) But yes, it is possible to change cursor according to mode by exploiting the various hooks provided. I tend to think this should be built into viper mode, but it's not. --- (add-hook 'viper-insert-state-hook 'viper-set-cursor t) (add-hook 'viper-emacs-state-hook 'viper-set-cursor t) (add-hook 'viper-vi-state-hook 'viper-set-cursor t) (defun viper-set-cursor () "Set the cursor for a given state" (cond ((eq viper-current-state 'emacs-state) (setq cursor-type 'bar)) ((eq viper-current-state 'vi-state) (setq cursor-type 'hollow)) ((eq viper-current-state 'viper-mark-state) (setq cursor-type 'bar)) ((eq viper-current-state 'visual-state) (setq cursor-type 'hbar)))) (defun viper-restore-cursor-type () (viper-set-cursor)) --- Tim
On 21 juin 2011, at 18:15, Tim Harper wrote:
This doesn't seem THAT related question and probably deserves it's own thread :) But yes, it is possible to change cursor according to mode by exploiting the various hooks provided. I tend to think this should be built into viper mode, but it's not.
You're very right, it should have been its own thread. (But to motivate the relation: if the cursor tells me the mode I'm in, it's less crucial to see it in the status bar.) Thanks a lot for the customization, it is most helpful and works great. Alan
On 2011-06-21 16:22 +0200, Alan Schmitt wrote:
I see that the mode indicator (<V>, <I>, etc) is the last thing on the right of the status bar. Unfortunately, when many minor modes are loaded (typically when doing some latex), the information is not visible. Is there a way to put the mode indicator more on the left?
Viper (and Evil) puts the indicator in the variable `global-mode-string', which is included in `mode-line-format'. By default, `global-mode-string' occurs at the end of the mode line. Thus, one way to move the indicator is to reorder `mode-line-format': (setq-default mode-line-format '("%e" "-" mode-line-mule-info mode-line-client mode-line-modified mode-line-remote mode-line-frame-identification mode-line-buffer-identification " " mode-line-position (vc-mode ("" vc-mode " ")) global-mode-string mode-line-modes (which-func-mode ("" which-func-format "--")) "-%-")) These changes may be shadowed by a buffer-local value, however. That is why `global-mode-string' is used instead of inserting the indicator directly: since `global-mode-string' is a standard variable, even custom values of `mode-line-format' are likely to contain it. Still, I see your point. I'm unsure of what would be the most robust way of implementing it, though.
As a related question, is it possible to change the cursor depending on the mode?
If you just want to customize the /color/ of Viper's cursors, you can set the variables `viper-vi-state-cursor-color' (for vi state), `viper-insert-state-cursor-color' (for Insert state), etc. If you want to change the cursor's /type/, you'll have to use the state hooks like Tim explained. In Evil, you can change both the type and color with a single variable. -- Vegard
On 2011-06-21 16:22 +0200, Alan Schmitt wrote:
I see that the mode indicator (<V>, <I>, etc) is the last thing on the right of the status bar. ... Is there a way to put the mode indicator more on the left?
Responding to an older thread: Evil commit fb86c91 adds the customization variable `evil-mode-line-format', which governs the position of the mode line tag. If the variable is set to the value `before', Evil indicates the current state before the mode list instead of after it: (setq evil-mode-line-format 'before) Internally, this is done by altering the variable `mode-line-position'. I don't know how robust it is, but if we don't encounter any problems, we might make it the default. -- Vegard
On 28 août 2011, at 18:24, Vegard Øye wrote:
On 2011-06-21 16:22 +0200, Alan Schmitt wrote:
I see that the mode indicator (<V>, <I>, etc) is the last thing on the right of the status bar. ... Is there a way to put the mode indicator more on the left?
Responding to an older thread: Evil commit fb86c91 adds the customization variable `evil-mode-line-format', which governs the position of the mode line tag. If the variable is set to the value `before', Evil indicates the current state before the mode list instead of after it:
(setq evil-mode-line-format 'before)
Internally, this is done by altering the variable `mode-line-position'. I don't know how robust it is, but if we don't encounter any problems, we might make it the default.
I'm using it, and I haven't seen anything goes bad. I'll definitely report if anything does. Thanks! Alan
On 28 Aug 2011, Vegard Øye wrote:
Responding to an older thread: Evil commit fb86c91 adds the customization variable `evil-mode-line-format', which governs the position of the mode line tag. If the variable is set to the value `before', Evil indicates the current state before the mode list instead of after it:
(setq evil-mode-line-format 'before)
Internally, this is done by altering the variable `mode-line-position'. I don't know how robust it is, but if we don't encounter any problems, we might make it the default.
This should be quite robust and it's done by sml-modeline-mode, too. Although it's not really fitting in as it's no position indicator. If you want to shift it all the way left you can use this: (setq-default mode-line-format (cons '(evil-mode ("" evil-mode-line-tag)) mode-line-format)) To remove the original tag (if you use the 'after evil-mode-line-format): (delete 'evil-mode-line-tag global-mode-string) ('before format) (delete 'evil-mode-line-tag mode-line-position) As the mode-line-format var is already there (and the above is hacky) maybe allow nil and treat it as "evil won't add it on its own to the mode line"? Michael
participants (4)
-
Alan Schmitt -
Michael Markert -
Tim Harper -
Vegard Øye