TAB键模式
尝试了子龙山人的代码,不知道为什么,在我的环境下没有效果。会报错 现在使用的是如下代码:
(defun st/insert-tab()
(interactive)
(insert-tab)
)
(defun st/indent-tab()
(setq default-tab-width 4 ;制表符宽度为4
indent-tabs-mode nil ;不使用tab键缩进
)
"下述语句也是有效的,但是统一使用全局快捷键配置"
;(setq indent-line-function 'st/insert-tab)
)
(global-set-key (kbd "<backtab>") 'un-indent-by-removing-4-spaces)
(global-set-key (kbd "<tab>") 'st/insert-tab)
(defun un-indent-by-removing-4-spaces ()
"remove 4 spaces from beginning of of line"
(interactive)
(save-excursion
(save-match-data
(beginning-of-line)
;; get rid of tabs at beginning of line
(when (looking-at "^\\s-+")
(untabify (match-beginning 0) (match-end 0)))
(when (looking-at "^ ")
(replace-match "")))))
(add-hook 'prog-mode-hook 'st/indent-tab)
(add-hook 'text-mode-hook 'st/indent-tab)
这段代码基本能实现TAB和S-TAB功能,但是不是很好用。 比如说,如果这里移除,一定要移除4个空格,如果前面只剩下3个,那么S-TAB就不会回退了。
w/dw单词问题
尝试1
以前尝试过这段代码,是有效,但是和VIM区别比较大:
(with-eval-after-load 'evil
(defalias #'forward-evil-word #'forward-evil-symbol))
上面这段代码,会把 / \这样的一些东西都算进去,而且 yaw 复制全词还会把前面的空格也复制下来。
尝试2
- 然后尝试了下面这段代码,也不完美。在最后一个单词时,按w,会跳到下一行去。
- 并且如果是两行#ifdef ,dw时会把下一行的#也给删除了。 如:
#ifdef xxx
#ifdef xxxxx
在xxx上面dw,会变成 #ifdef ifdef xxxxx
(defun forward-evil-word (&optional count)
""
(let ((init-point (point)))
(forward-symbol (or count 1))
(if (= (point) init-point)
count 0)))
(setq evil-symbol-word-search t)
有没有人真正解决了的? 实在是不方便
visual block模式编辑问题
比如说按CTRL+V进入了块模式,但是此时按 i,不能在前面插字符,而是出来了这样的东西:
iedit模式
按SPC s e
进入iedit模式,原本会和gtags冲突,在论坛里解决了。
但是这个iedit模式,对于 dw
指令,也是不支持的。。只能用s,而且只能删除自己
比如说
test a
test b
test c
使用iedit删除只能删除test,最开始的空格是保留的。
a
b
c