I am trying to override some of the default keymaps of emacs evil mode. What I have done is this:
(evil-define-key 'visual 'global
"<" (lambda ()
(evil-shift-left)
(evil-visual-restore))
">" (lambda ()
(evil-shift-right)
(evil-visual-restore)))
And I got this error message: Wrong type argument: commandp, (lambda nil (evil-shift-left) (evil-visual-restore)) when I press >, when the expected behavior was shifting the selected text right and restore visual mode.
Since I am only 2 days into trying to learn emacs, I am pretty confused what I have done wrong here.
Thank the great advice by @shynur, and I really do agree now that learning the basic of elisp is crucial before starting to hack emacs. Still, I figured out how to solve my problem and it is not quite as simple as adding
interactive. My solution goes like this:Referred also to https://superuser.com/questions/684540/evil-mode-evil-shift-left-loses-selection