matlabemacsoctaveviper-mode

Enable viper-mode when I open a file in Octave mode [emacs]


I've set up my emacs so that it automatically uses Octave mode when I open a .m file (really I'm working on Matlab files). I like to use viper-mode. However, when I open a .m file, viper mode gets turned off, and I have to manually restart it. Is there a way to modify my configuration so that viper mode stays on?

.emacs.d/init.el:

(setq viper-mode t)
(require 'viper)

(require 'vista-c-style)
(add-hook 'c-mode-common-hook 'vista-set-c-style)
(add-to-list 'auto-mode-alist '("\\.h" . c++-mode)) ;; open .h files in c++ mode


;; octave mode
(autoload 'octave-mode "octave-mod" nil t)
(setq auto-mode-alist
  (cons '("\\.m$" . octave-mode) auto-mode-alist) )

;; other config (relate to org-mode) and definition of 'vista-c-style are snipped

Solution

  • This

    (add-to-list 'viper-vi-state-mode-list 'octave-mode)
    

    adapted from this question worked.