In Emacs, I want to define the key to enable/disable the viper-mode. When I press the F6, if viper-mode not enabled, then enable it; if viper-mode enabled, then disable it.
Thanks.
(global-set-key [f6] 'toggle-viper-mode)
May pose problems in modes which locally rebind F6. If that happens, see this related question
Related
How are we supposed to configure DrRacket so that it does not use Emacs key bindings? Like I type C-s and it just saves the code instead of bringing up the search line. Or I use C-x C-f and it won't open another file. The DrRacket documentation claims to not use Emacs bindings but it obviously does.
You want to disable the check box, Enable keybindings in menus.
Unfortunately this checkbox is a bit buried:
Open the Racket Preferences dialog.
Click the Editing tab.
There's a row of sub-tabs for that. Click the General sub-tab.
A few items down you should see the Enable keybindings in menus check box. Un-check it.
In emacs on my Mac I've switched the meta key from Alt (Option) to Esc.
The problem with this is that I can't any longer move forward or backward part of word when pressing Alt+→ or Alt+←
Is there someway I can enable that functionality and still have Esc as my meta key?
My .emacs file:
(setq mac-option-modifier 'nil)
(setq mac-esc-modifier 'meta)
For ergoemacs, what are the C-x and C-c shortcuts re-mapped to?
There doesn't seem to be a page to help people transition from regular emacs to ergoemacs mode. They just have a keyboard picture with everything in it, without any information on C-x and C-c.
Also for Apple keyboards, when it says Ctrl/Cmd, does that mean either can be used? It doesn't look like it. It seems that OS X Cmd shortcuts are taking precedence over the ergoemacs ones. Until Ctrl/Cmd means something else?
Ctrl-c is copy and Ctrl-x is cut.
According to ErgoEmacs Documentation, the keybindings C-c and C-y are respectively associated with native <copy> and <paste> functionality using emacs kill-ring-save and yank commands.
The traditional C-k and C-y methods of line pulling / yanking used in GNU Emacs and XEmacs are left behind in an attempt to "[make it] so you don't have to change your mindset when you switch in and out of emacs". We can expect many features of ergoemacs to be intuitive to the sort of end-users who have never been religiously bound to a text editor.
In current version of ergoemacs-mode, by default C-x and C-c are same as GNU Emacs's.
in older version of ergoemacs-mode, the gnu emacs's C-x and C-c are simply left intact. ergoemacs-mode just turn on cua-mode.
I just installed Emacs on my mac from here:
http://emacsformacosx.com/
and that got rid of all the menus. How do I get those menus back?
Look for menu-bar-mode in your ~/.emacs or ~/.emacs.d/init.el file.
You should find...
(menu-bar-mode -1)
If so, remove it. If you don't find it... add the following line.
(menu-bar-mode 1)
and save the file.
If you want to enable or disable the menu in emacs, you can use
M-x menu-bar-mode
and if you want the same with the toolbar you can use
M-x tool-bar-mode
The menu should be enabled "by default" unless stated otherwise in your .emacs file which you can find in emacs using C-x C-f ~/.emacs.
I use viper-mode in emacs, but I want to use YASnippet as well. However, when I enable viper-mode and try using tab-completion through YASnippet, nothing happens. How do I get the two of them to work together?
Using an Emacs without any customizations (emacs -q), I got the following to work:
(load-file "c:/cygwin/home/Trey/scratch/yasnippet-bundle.el")
M-x viper-mode
(define-key viper-insert-global-user-map (kbd "<tab>") 'yas/expand)
C-x C-f a.cpp
i
main<TAB>
Try that, see if it works (as in, if there's something in your .emacs that's messing things up). Also, check to see what Emacs thinks your TAB key is. On my windows system, the tab key was bound to <tab> and not TAB - try doing M-x describe-key TAB and see what the *Help* buffer translates it to. yasnippet appears to bind to TAB, so I needed the extra binding for <tab> to get things to work.
For more information about how Emacs handles the TAB, read the documentation for function keys.