1

我从 eclipse 到 emacs,不习惯M-fand的行为M-b

请参阅以下 javascript 代码:

module.controller('Front', ['$scope', function($scope){

当我使用Ctrl+right时,光标会跳转到|代码中的:

|module|.|controller|('|Front|', |['|$scope|', |function|(|$scope|){|

当我使用 时,光标会在这些位置Ctrl+left从右向左跳跃。|

但是在 emacs 中,Mf 是不同的:

module|.controller|('Front|', ['$scope|', function|($scope|){

怎么配置emacs让mf和eclipse的一模一样Ctrl+right,又M-b是一样的Ctrl+left

4

1 回答 1

2

我认为这些功能可以满足您的要求:

(defun eclipse-forward-word ()
  (interactive)
  (let ((go-back (looking-at-p "\\W")))
    (forward-word)
    (when go-back
      (backward-word))))

(defun eclipse-backward-word ()
  (interactive)
  (let ((go-forward (looking-at-p "\\<")))
    (backward-word)
    (when go-forward
      (forward-word))))

(global-set-key (kbd "<C-left>") 'eclipse-backward-word)
(global-set-key (kbd "<C-right>") 'eclipse-forward-word)
于 2012-05-21T17:00:40.210 回答