I have a problem with using cscope on Emacs.
When I pressed "C-c C-s {g,s,..}" to use cscope, the key binding is blocked by syntactic analysis from CC mode.
The message printed out like(When I press C-c C-s) :
Syntactic analysis: ((topmost-intro 6123))
I want to use original cscope keybindings... is there any solutions for this issue?
; using cscope
(define-key global-map "\C-\\" nil)
(define-key global-map "\C-\\s" 'cscope-find-this-symbol)
(define-key global-map "\C-\\g" 'cscope-find-global-definition)
(define-key global-map "\C-\\a" 'cscope-index-file)
I tried to find out the solution to disable syntactic analysis shortcuts(C-c C-s) from CC mode, I couldn't find it. Instead, by using other keybindings, I could solve the problem.
Related
I finally got this to work, but wanted to know if there was an easier way.
I want to bind a key "U" to put spacemacs into insert-mode, but at the start of the text of the line.
(define-key evil-normal-state-map "u" 'evil-insert)
(define-key evil-normal-state-map "U" (lambda ()
(interactive)
(beginning-of-line-text)
(execute-kbd-macro "u")))
Is there an 'evil command to insert mode at start of line? Or a more elegant way to fire 'evil-insert or run multiple commands?
In evil-mode i executes evil-insert and I executes evil-insert-line.
So the simplest rebinding would be:
(define-key evil-normal-state-map "u" 'evil-insert)
(define-key evil-normal-state-map "U" 'evil-insert-line)
Whenever you want to know which keys run which functions just press C-h k and then the keybinding of choice.
In Emacs evil mode, the key combo C-z is to toggle evil mode. I would like to rebind it to escape to shell instead. How would I do this ?
I have read about eshell, it seems to be great, but for now I would like to work with my zsh shell first.
Multi term seems to designed for this job, but I think escaping to shell is fine for me, since I'm used to this flow in Vim.
Thanks for reading.
Perhaps what you need is C-x C-z.
Just have the same requirement, and here's my configurations:
(add-to-list 'load-path "~/.emacs.d/evil")
(add-to-list 'load-path "~/.emacs.d/evil/lib")
(setq evil-toggle-key ""); remove default evil-toggle-key C-z, manually setup later
(require 'evil)
(evil-mode 1)
;; remove all keybindings from insert-state keymap, use emacs-state when editing
(setcdr evil-insert-state-map nil)
;; ESC to switch back normal-state
(define-key evil-insert-state-map [escape] 'evil-normal-state)
Ref:
1. https://gist.github.com/kidd/1828878
2. https://askubuntu.com/questions/99160/how-to-remap-emacs-evil-mode-toggle-key-from-ctrl-z
C-x C-z will suspend the frame and return you to the shell.
C-z as you mention toggles evil mode on/off.
I swap their behavior in evil like so:
(define-key evil-motion-state-map (kbd "C-z") 'suspend-frame)
(define-key evil-emacs-state-map (kbd "C-z") 'suspend-frame)
(define-key evil-motion-state-map (kbd "C-x C-z") 'evil-emacs-state)
(define-key evil-emacs-state-map (kbd "C-x C-z") 'evil-exit-emacs-state)
See this commit for an example (where I also make C-z emulate vim-behavior in insert/replace mode).
Is there a way to make Emacs' auto-complete package not trigger menu completion on return key but instead on some other key-combination say C-Return? For a fast typist having it bound to return often causes non-deterministic behaviour of return. This because its behaviour now depends on how fast I type the previous characters.
See https://github.com/auto-complete/auto-complete.
This code should do exactly what you want
(define-key ac-completing-map (kbd "RET") nil)
(define-key ac-completing-map [return] nil)
(define-key ac-completing-map [(control return)] 'ac-complete)
I didn't try it on the terminal as I'm on windows at the moment.
I'm using GNU Emacs 23.2.1
my init.el
(cua-mode 1)
(transient-mark-mode 1)
(setq shift-select-mode t)
(global-linum-mode 1)
(show-paren-mode 1)
(desktop-save-mode 1)
So, instead of selection I get 2C on Shift =>, 2D on Shift <=, etc.
How to solve this?
P.S.
cat -v for Shift <=
^[[1;2D
cat -v for Shift =>
^[[1;2C
How I can map properly those keys to shift-left, shift-right corresponding?
P.P.S.
Sorry. I've forgot. I'm also using screen.
den#playground:~/.emacs.den$ echo $TERM
screen
Solution:
(define-key input-decode-map "\e[1;2D" [S-left])
(define-key input-decode-map "\e[1;2C" [S-right])
(define-key input-decode-map "\e[1;2B" [S-down])
(define-key input-decode-map "\e[1;2A" [S-up])
(define-key input-decode-map "\e[1;2F" [S-end])
(define-key input-decode-map "\e[1;2H" [S-home])
This means emacs and your terminal do not agree on what the various key codes mean. there are more advanced ways to configure terminals (terminal specific files), but to get you started, try adding something like this to your emacs init file:
(define-key input-decode-map "\e[1;2D" [S-left])
(define-key input-decode-map "\e[1;2C" [S-right])
This usually happens when you run emacs in a console. Try running emacs as a graphical program and this should not be an issue.
I have two problems which are somewhat related I believe:
1) In IDO I'd like to change ido-restrict-to-matches to samething else than C-SPC or C-#. Unfortunately I do not know how to tell emacs that I want a different shortcut (say C-0).
2) I'd like to protect my C-; but whenever flyspell-mode is running it overtakes C-;. My definition is in .emacs as:
(global-set-key (kbd "C-;") 'mark-paragraph)
but apparently flyspell overwrites this... (although even then, if I look in the help M-h k C-; it does say mark-paragraph)
Could somebody please tell me how to bind/unbind keys in these conditions? It has to work without modifying ido.el and flyspell.el and re-building, right?
Thanks very much!
Flyspell provides a customization for the C-; binding, so you can either M-x customize RET flyspell-auto-correct-binding RET or put something like this in your ~/.emacs:
(setq flyspell-auto-correct-binding (kbd "C-~")) ; or a binding of your choice
As for ido, your question is slightly confusing, because it implies there are times when you're using ido outside the minibuffer...
The documentation in ido.el contains the following advice:
;; To modify the keybindings, use the ido-setup-hook. For example:
;;(add-hook 'ido-setup-hook 'ido-my-keys)
;;
;;(defun ido-my-keys ()
;; "Add my keybindings for ido."
;; (define-key ido-completion-map " " 'ido-next-match)
;; )
Using that knowledge, you can change the key bindings like this in your own "ido-my-keys" function:
(define-key ido-completion-map (kbd "C-SPC") nil)
(define-key ido-completion-map (kbd "C-#") nil)
(define-key ido-completion-map (kbd "C-0") 'ido-restrict-to-matches)
There's an additional ido hook specifically for the minibuffer, too, but it's not clear why you would need that: ido-minibuffer-setup-hook.