13c13 < ;; --- > ;; 28c28 < ;; Causes problems with undo, but has no other problems, --- > ;; Causes problems with undo, but has no other problems, 36c36 < ;; --- > ;; 42c42 < ;; mode and (still partially) text objects. --- > ;; mode and (still partially) text objects. 46c46 < ;; --- > ;; 49,50c49,50 < ;; < ;; NEWS 19/06/2009: The visual mode is greatly improved, we also --- > ;; > ;; NEWS 19/06/2009: The visual mode is greatly improved, we also 53,55c53,55 < ;; if you work with very big files, so deactivate it < ;; if you notice sluggishness (see point 5 of the < ;; installation instructions). --- > ;; if you work with very big files, so deactivate it > ;; if you notice sluggishness (see point 5 of the > ;; installation instructions). 61c61 < ;; --- > ;; 65,66c65,66 < ;; learn where to save the file. If you use a Mac, email < ;; implementations-list for help.) Leave out the semicolons at the --- > ;; learn where to save the file. If you use a Mac, email > ;; implementations-list for help.) Leave out the semicolons at the 68c68 < ;; --- > ;; 76c76 < ;; --- > ;; 81c81 < ;; --- > ;; 84c84 < ;; http://emacswiki.org/elisp/download/rect-mark.el --- > ;; http://emacswiki.org/elisp/download/rect-mark.el 88,90c88,90 < ;; < ;; 5. (Optional) If you don't want to use the enhanced paren-matching < ;; algorithm, add --- > ;; > ;; 5. (Optional) If you don't want to use the enhanced paren-matching > ;; algorithm, add 93,94c93,94 < ;; < ;; 6. (Optional) remove (setq vimpulse-experimental nil) from your .emacs --- > ;; > ;; 6. (Optional) remove (setq vimpulse-experimental nil) from your .emacs 97c97 < ;; more and whatever, but you'll be on the bleeding edge, and with your --- > ;; more and whatever, but you'll be on the bleeding edge, and with your 100c100 < ;; marked with an ;;EXPERIMENTAL comment, and wrapped in a --- > ;; marked with an ;;EXPERIMENTAL comment, and wrapped in a 106c106 < ;; --- > ;; 114c114 < ;; --- > ;; 116c116 < ;; --- > ;; 126,130c126,130 < ;; [*] Old documentation follows: < ;; ", but you have ;; to use C-p. C-p is used because it was a simple < ;; way to add visual block mode in a way *close* to Vim without having < ;; to hack viper mode to use the normal 'p' key. In the future, it < ;; would be nice to see vimpulse provide this the "right" way, but at --- > ;; [*] Old documentation follows: > ;; ", but you have ;; to use C-p. C-p is used because it was a simple > ;; way to add visual block mode in a way *close* to Vim without having > ;; to hack viper mode to use the normal 'p' key. In the future, it > ;; would be nice to see vimpulse provide this the "right" way, but at 132c132 < ;; -I just made it work with the normal 'p' key, this is sort of --- > ;; -I just made it work with the normal 'p' key, this is sort of 134c134 < ;; and when pasting checks if the current-kill is `equal' to --- > ;; and when pasting checks if the current-kill is `equal' to 138c138 < ;; --- > ;; 147c147 < ;; - Vimpulse makes C-r run "redo" in command mode but you can --- > ;; - Vimpulse makes C-r run "redo" in command mode but you can 154c154 < ;; --- > ;; 156c156 < ;; --- > ;; 159c159 < ;; --- > ;; 164c164 < ;; --- > ;; 171c171 < ;; --- > ;; 180c180 < ;; like more vimpulse behavior in this case (defaulting to --- > ;; like more vimpulse behavior in this case (defaulting to 182c182 < ;; --- > ;; 191c191 < ;; --- > ;; 198c198 < ;; --- > ;; 202c202 < ;; --- > ;; 205c205 < ;; --- > ;; 208c208 < ;; --- > ;; 210c210 < ;; --- > ;; 213c213 < ;; - minimum needed: :tabedit, :tabnext, :tabprevious --- > ;; - minimum needed: :tabedit, :tabnext, :tabprevious 216c216 < ;; --- > ;; 218c218 < ;; --- > ;; 222c222 < ;; --- > ;; 225c225 < ;; --- > ;; 229c229 < ;; --- > ;; 232c232 < ;; --- > ;; 235c235 < ;; --- > ;; 238c238 < ;; --- > ;; 242c242 < ;; --- > ;; 249c249 < ;; --- > ;; 257c257 < ;; --- > ;; 277c277 < ;; --- > ;; 284c284 < ;; --- > ;; 287c287 < ;; --- > ;; 292c292 < ;; --- > ;; 309c309 < ;; --- > ;; 313c313 < ;; --- > ;; 322c322 < ;; --- > ;; 329c329 < ;; --- > ;; 335c335 < ;; --- > ;; 347,348c347,348 < ;; - update from Sebastien Rocca Serra: :set wildmenu plus < ;; tab-completion makes :b very pleasant to use when you have --- > ;; - update from Sebastien Rocca Serra: :set wildmenu plus > ;; tab-completion makes :b very pleasant to use when you have 351c351 < ;; --- > ;; 354c354 < ;; --- > ;; 358c358 < ;; --- > ;; 362c362 < ;; --- > ;; 366c366 < ;; --- > ;; 370,371c370,371 < ;; < ;; Version 0.3.0 --- > ;; > ;; Version 0.3.0 379c379 < ;; --- > ;; 385c385 < ;; --- > ;; 397c397 < ;; name. He wrote a small patch which was included long ago. I must have --- > ;; name. He wrote a small patch which was included long ago. I must have 403c403 < ;; installation instructions) --- > ;; installation instructions) 417c417 < ;; and the region is set inside the command code, before calling the viper --- > ;; and the region is set inside the command code, before calling the viper 420,421c420,421 < ;; - [NEW] Enhanced paren matching. Moving the cursor on a closing paren in normal mode < ;; now highlights the opening paren. --- > ;; - [NEW] Enhanced paren matching. Moving the cursor on a closing paren in normal mode > ;; now highlights the opening paren. 424c424 < ;; - [FIX] a leaves the cursor in the same location as it was before (it advanced the --- > ;; - [FIX] a leaves the cursor in the same location as it was before (it advanced the 440c440 < ;; --- > ;; 447c447 < ;; --- > ;; 455c455 < ;; --- > ;; 463c463 < ;; --- > ;; 473c473 < ;; --- > ;; 477c477 < ;; --- > ;; 481c481 < ;; --- > ;; 486c486 < ;; binding to look for matches *before* the cursor. This works --- > ;; binding to look for matches *before* the cursor. This works 489c489 < ;; - Since vimpulse has no website, I added a prominent --- > ;; - Since vimpulse has no website, I added a prominent 491c491 < ;; --- > ;; 499c499 < ;; --- > ;; 502c502 < ;; --- > ;; 514c514 < ;; --- > ;; 538a539,541 > ;; Load cl.el (Common Lisp extensions for Emacs). > (require 'cl) > 550c553 < ;;;; This file contains helper functions that --- > ;;;; This file contains helper functions that 552c555 < ;;;; b) Can be useful for the contributor, thus avoiding --- > ;;;; b) Can be useful for the contributor, thus avoiding 577c580 < ;(viper-modify-major-mode 'dired-mode 'emacs-state vimpulse-movement-map) --- > ;(viper-modify-major-mode 'dired-mode 'emacs-state vimpulse-movement-map) 581,582c584,585 < "Commodity macro to convert emacs region commands to vimpulse < visual selection commands. See the comments on the source for an --- > "Commodity macro to convert emacs region commands to vimpulse > visual selection commands. See the comments on the source for an 594,595c597,598 < ;;; You can define new bindings for comment region and uncomment region as < ;;; easily as --- > ;;; You can define new bindings for comment region and uncomment region as > ;;; easily as 597c600 < ;; (define-key viper-vi-global-user-map "\\\]" --- > ;; (define-key viper-vi-global-user-map "\\\]" 599c602 < ;; (define-key viper-vi-global-user-map "\\," --- > ;; (define-key viper-vi-global-user-map "\\," 607c610 < ;;;; Almost all of this code is taken from extended-viper --- > ;;;; Almost all of this code is taken from extended-viper 609c612 < ;;;; - I changed the prefix of the custom functions to vimpulse --- > ;;;; - I changed the prefix of the custom functions to vimpulse 618c621 < (add-hook 'hs-minor-mode-hook (lambda () --- > (add-hook 'hs-minor-mode-hook (lambda () 636c639 < (define-key viper-vi-global-user-map "gg" 'vimpulse-goto-first-line) --- > (define-key viper-vi-global-user-map "gg" 'vimpulse-goto-first-line) 642,643c645,646 < (define-key viper-vi-global-user-map "*" 'vimpulse-search-forward-for-symbol-at-point) < (define-key viper-vi-global-user-map "#" 'vimpulse-search-backward-for-symbol-at-point) --- > (define-key viper-vi-global-user-map "*" 'vimpulse-search-forward-for-symbol-at-point) > (define-key viper-vi-global-user-map "#" 'vimpulse-search-backward-for-symbol-at-point) 683c686 < (viper-goto-line 1)) --- > (viper-goto-line 1)) 687c690 < (interactive) --- > (interactive) 726c729 < --- > 731c734 < (kill-buffer nil)) --- > (kill-buffer nil)) 739c742 < ad-do-it) --- > ad-do-it) 752c755 < ;; --- > ;; 758c761 < (save-excursion ;; Added by Alessandro Piras, to fix cW suckage --- > (save-excursion ;; Added by Alessandro Piras, to fix cW suckage 763c766 < (viper-append nil) --- > (viper-append nil) 766c769 < ;;EXPERIMENTAL: make the changecommand work like vim --- > ;;EXPERIMENTAL: make the changecommand work like vim 773,774c776,777 < (delete-char 1)) < (viper-insert nil)) --- > (delete-char 1)) > (viper-insert nil)) 776c779 < (save-excursion ;; Added by Alessandro Piras, to fix cW suckage --- > (save-excursion ;; Added by Alessandro Piras, to fix cW suckage 780c783 < (viper-append nil) --- > (viper-append nil) 787,788c790,791 < do nothing. This way, in insert mode, typing then moving < the cursor then typing more counts as two separately undoable --- > do nothing. This way, in insert mode, typing then moving > the cursor then typing more counts as two separately undoable 794c797 < ;; Thanks to the anonymous poster for the idea on how to modify the viper --- > ;; Thanks to the anonymous poster for the idea on how to modify the viper 918c921 < --- > 953c956 < --- > 1048,1049c1051,1052 < ;;;; viper is in vi mode, so that the paren under the cursor is matched, < ;;;; instead of the paren before the cursor. This visually makes checking --- > ;;;; viper is in vi mode, so that the paren under the cursor is matched, > ;;;; instead of the paren before the cursor. This visually makes checking 1059c1062 < (unless (boundp 'vimpulse-enhanced-paren-matching) ;; Enhanced paren matching is enabled by default. To disable it --- > (unless (boundp 'vimpulse-enhanced-paren-matching) ;; Enhanced paren matching is enabled by default. To disable it 1064,1065c1067,1068 < (show-paren-mode 't) ;; enable the normal paren match highlight < --- > (show-paren-mode 't) ;; enable the normal paren match highlight > 1070c1073 < --- > 1088c1091 < (cond --- > (cond 1093c1096 < (t --- > (t 1097c1100 < --- > 1099c1102 < "Checks the characters at position `pos1' and `pos2' and returns t if they are matching --- > "Checks the characters at position `pos1' and `pos2' and returns t if they are matching 1101c1104 < (destructuring-bind ((class1 . match1) (class2 . match2)) --- > (destructuring-bind ((class1 . match1) (class2 . match2)) 1106c1109 < --- > 1109,1110c1112,1113 < (let ((ovl (if (vimpulse-pm-open-parenp pos) < vimpulse-paren-overlay-open --- > (let ((ovl (if (vimpulse-pm-open-parenp pos) > vimpulse-paren-overlay-open 1114c1117 < --- > 1116c1119 < "Paren matching routine. Highlights the paren at (point) and the eventual --- > "Paren matching routine. Highlights the paren at (point) and the eventual 1119c1122 < (cond --- > (cond 1127c1130 < (cond --- > (cond 1136c1139 < --- > 1140c1143 < ;;; TODO: check if using this paren matching function in replace mode is a problem --- > ;;; TODO: check if using this paren matching function in replace mode is a problem 1148c1151 < (cond --- > (cond 1154c1157 < (t ;; viper in insert mode --- > (t ;; viper in insert mode 1158c1161 < --- > 1165c1168 < ;;;; EXPERIMENTAL --- > ;;;; EXPERIMENTAL 1167c1170 < ;;;; This code implements the support for text objects, --- > ;;;; This code implements the support for text objects, 1170,1171c1173,1174 < ;;;; is (still) supported here. However, the most common text objects < ;;;; are supported: --- > ;;;; is (still) supported here. However, the most common text objects > ;;;; are supported: 1179,1181c1182,1184 < ;;;; the behavior on certain occasions (e.g. daw issued with the cursor < ;;;; lying on whitespace) may be a little different. My aim was not acheiving < ;;;; the exact same behavior in all limit cases, but rather to give a close --- > ;;;; the behavior on certain occasions (e.g. daw issued with the cursor > ;;;; lying on whitespace) may be a little different. My aim was not acheiving > ;;;; the exact same behavior in all limit cases, but rather to give a close 1188c1191 < "Returns the bounds of contiguous character that match `syntaxes', --- > "Returns the bounds of contiguous character that match `syntaxes', 1203c1206 < (puthash ?\( --- > (puthash ?\( 1206c1209 < (puthash ?\) --- > (puthash ?\) 1209c1212 < (puthash ?{ --- > (puthash ?{ 1212,1213c1215,1216 < (puthash ?} < '( ?{ . ?\{ ) --- > (puthash ?} > '( ?{ . ?\{ ) 1215c1218 < (puthash ?\[ --- > (puthash ?\[ 1218c1221 < (puthash ?\] --- > (puthash ?\] 1221c1224 < (puthash ?\< --- > (puthash ?\< 1224c1227 < (puthash ?\> --- > (puthash ?\> 1229c1232 < "Skips all the character different from `paren' and `match' starting --- > "Skips all the character different from `paren' and `match' starting 1240,1241c1243,1244 < "Finds the first unbalanced `paren' following the direction `dir', starting < from position `pos'. `match' is the paren that matches with `paren', limb is the --- > "Finds the first unbalanced `paren' following the direction `dir', starting > from position `pos'. `match' is the paren that matches with `paren', limb is the 1246c1249 < ((= (char-after pos) paren) --- > ((= (char-after pos) paren) 1254c1257 < (t --- > (t 1258,1259c1261,1262 < (defvar vimpulse-balanced-bounds-char-list < (list --- > (defvar vimpulse-balanced-bounds-char-list > (list 1271c1274 < (cond --- > (cond 1286c1289 < (t --- > (t 1293c1296 < (save-excursion --- > (save-excursion 1310c1313 < (cond --- > (cond 1313c1316 < (t --- > (t 1327c1330 < (cond --- > (cond 1330c1333 < (t --- > (t 1346c1349 < --- > 1368c1371 < (when bounds --- > (when bounds 1371c1374 < ((memq motion vimpulse-balanced-bounds-char-list) --- > ((memq motion vimpulse-balanced-bounds-char-list) 1373c1376 < (when bounds --- > (when bounds 1379,1380c1382,1383 < "Given a function that returns inner boundaries, returns a boundary that includes < the whitespace needed to get the \"a\" behavior. The logic --- > "Given a function that returns inner boundaries, returns a boundary that includes > the whitespace needed to get the \"a\" behavior. The logic 1390,1391c1393,1394 < < (skip-chars-forward "[:space:]\n\r") --- > > (skip-chars-forward "[:blank:]\n\r") 1396c1399 < (skip-chars-forward (concat "[:space:]" (if trailing-newlines "\n\r" ""))) --- > (skip-chars-forward (concat "[:blank:]" (if trailing-newlines "\n\r" ""))) 1400c1403 < --- > 1404c1407 < ((= motion ?w) --- > ((= motion ?w) 1411c1414 < ((memq motion vimpulse-balanced-bounds-char-list) --- > ((memq motion vimpulse-balanced-bounds-char-list) 1414c1417 < --- > 1418c1421 < (cond --- > (cond 1434c1437 < "Returns the boundaries of a multiple text object motion. --- > "Returns the boundaries of a multiple text object motion. 1447,1448c1450,1451 < "Deletes COUNT text objects of MOTION kind starting from `point', following the < behavior indicated by CHAR: ?i stands for 'inner', ?a stands for 'a'. --- > "Deletes COUNT text objects of MOTION kind starting from `point', following the > behavior indicated by CHAR: ?i stands for 'inner', ?a stands for 'a'. 1455c1458 < (cond --- > (cond 1475c1478 < (viper-set-destructive-command (list 'vimpulse-delete-text-objects-function --- > (viper-set-destructive-command (list 'vimpulse-delete-text-objects-function 1489c1492 < (viper-set-destructive-command (list 'vimpulse-change-text-objects-function (list count char motion) --- > (viper-set-destructive-command (list 'vimpulse-change-text-objects-function (list count char motion) 1493c1496 < --- > 1495,1496c1498,1499 < "Yanks COUNT text objects of MOTION kind starting from `point', following the < behavior indicated by CHAR: ?i stands for 'inner', ?a stands for 'a'. --- > "Yanks COUNT text objects of MOTION kind starting from `point', following the > behavior indicated by CHAR: ?i stands for 'inner', ?a stands for 'a'. 1503c1506 < (cond --- > (cond 1524c1527 < ;; This is for silencing viper when he checks if the insertion must be repeated, never true for --- > ;; This is for silencing viper when he checks if the insertion must be repeated, never true for 1526,1527c1529,1530 < (defvar vimpulse-text-objects-command (list 'vimpulse-delete-text-objects-function < 'vimpulse-change-text-objects-function --- > (defvar vimpulse-text-objects-command (list 'vimpulse-delete-text-objects-function > 'vimpulse-change-text-objects-function 1537c1540 < ;;;; Visual mode is implemented as a minor mode. ;;;;; --- > ;;;; Visual mode is implemented as a minor mode. ;;;;; 1559c1562 < :group 'vimpulse-visual) --- > :group 'vimpulse-visual) 1602c1605 < (when (fboundp 'activate-region) --- > (when (fboundp 'activate-region) 1604c1607 < ;; Force transient-mark-mode to have visual selection --- > ;; Force transient-mark-mode to have visual selection 1651c1654 < (when (fboundp 'rm-set-mark) --- > (when (fboundp 'rm-set-mark) 1682c1685 < ;; advice viper-intercept-ESC-key to exit visual mode with esc --- > ;; advice viper-intercept-ESC-key to exit visual mode with esc 1700c1703 < (t --- > (t 1716c1719 < ;; note: the structure returned by vimpulse-get-line-margins _can_ change to a more opaque one in the future. --- > ;; note: the structure returned by vimpulse-get-line-margins _can_ change to a more opaque one in the future. 1719,1721c1722,1724 < "Returns a structure containing the beginning-of-line and end-of-line < markers of the line where the merker `p' resides. If `p' is nil, < (point-marker) is used instead. The information can be retrieved using --- > "Returns a structure containing the beginning-of-line and end-of-line > markers of the line where the merker `p' resides. If `p' is nil, > (point-marker) is used instead. The information can be retrieved using 1724c1727 < (if p (goto-char p)) --- > (if p (goto-char p)) 1736c1739 < --- > 1748c1751 < ;; issuing : when visual selecting. To implement the kludge, --- > ;; issuing : when visual selecting. To implement the kludge, 1759,1761c1762,1764 < (if (< pt vimpulse-visual-overlay-origin) < (move-overlay vimpulse-visual-overlay < pt --- > (if (< pt vimpulse-visual-overlay-origin) > (move-overlay vimpulse-visual-overlay > pt 1763,1764c1766,1767 < (move-overlay vimpulse-visual-overlay < vimpulse-visual-overlay-origin --- > (move-overlay vimpulse-visual-overlay > vimpulse-visual-overlay-origin 1771c1774 < (cond --- > (cond 1773,1774c1776,1777 < (move-overlay vimpulse-visual-overlay < (vimpulse-get-bol lm-point) --- > (move-overlay vimpulse-visual-overlay > (vimpulse-get-bol lm-point) 1777,1778c1780,1781 < (move-overlay vimpulse-visual-overlay < (vimpulse-get-bol lm-origin) --- > (move-overlay vimpulse-visual-overlay > (vimpulse-get-bol lm-origin) 1783,1784c1786,1787 < (cond < (vimpulse-visual-mode-linewise --- > (cond > (vimpulse-visual-mode-linewise 1789c1792 < --- > 1791c1794 < (if (and vimpulse-visual-mode --- > (if (and vimpulse-visual-mode 1801c1804 < (cond --- > (cond 1813c1816 < (viper-set-destructive-command (list 'vimpulse-delete-text-objects-function --- > (viper-set-destructive-command (list 'vimpulse-delete-text-objects-function 1828,1829c1831,1832 < < (cond --- > > (cond 1836c1839 < (vimpulse-visual-mode nil) --- > (vimpulse-visual-mode nil) 1843c1846 < (viper-set-destructive-command (list 'vimpulse-change-text-objects-function --- > (viper-set-destructive-command (list 'vimpulse-change-text-objects-function 1852c1855 < "Fills the text in the region identified by COUNT, VISUAL-MODE and MOTION --- > "Fills the text in the region identified by COUNT, VISUAL-MODE and MOTION 1863c1866 < --- > 1868c1871 < --- > 1876c1879 < (goto-char start) --- > (goto-char start) 1879c1882 < --- > 1887c1890 < (t --- > (t 1889c1892 < (viper-replace-char arg) --- > (viper-replace-char arg) 1904c1907 < (t --- > (t 1906c1909 < (viper-replace-char arg) --- > (viper-replace-char arg) 1928c1931 < (cond --- > (cond 1954c1957 < --- > 1973c1976 < ;; New visual mode handling: instead of using (region-beginning) and --- > ;; New visual mode handling: instead of using (region-beginning) and 1976c1979 < (destructuring-bind (rb re) (if vimpulse-visual-mode-block --- > (destructuring-bind (rb re) (if vimpulse-visual-mode-block 1982c1985 < --- > 1987c1990 < (let ((start-col (save-excursion --- > (let ((start-col (save-excursion 1997c2000 < --- > 1999c2002 < (goto-char rb) --- > (goto-char rb) 2002c2005 < (setq vimpulse-visual-insert-coords --- > (setq vimpulse-visual-insert-coords 2009,2010c2012,2013 < (when (and (listp undo-list) < (listp (cdr undo-list)) --- > (when (and (listp undo-list) > (listp (cdr undo-list)) 2013c2016 < (progn --- > (progn 2019c2022 < ;; This function is not in viper-functions-redefinitions.el --- > ;; This function is not in viper-functions-redefinitions.el 2035c2038 < ;; If we are in block mode this line but do not hit the correct --- > ;; If we are in block mode this line but do not hit the correct 2038,2040c2041,2043 < (or (/= col cur-col) ;; wrong column or < (eolp))) ;; end of line < (cond ((< col cur-col) ;; we are inside a tab --- > (or (/= col cur-col) ;; wrong column or > (eolp))) ;; end of line > (cond ((< col cur-col) ;; we are inside a tab 2048c2051 < --- > 2051c2054 < --- > 2060c2063 < (if (and (/= (char-before (point)) ?\r) --- > (if (and (/= (char-before (point)) ?\r) 2062,2063c2065,2066 < (backward-char 1))) ; <---------- a[ESC] leaves the cursor < ; where it was before in VIM, without --- > (backward-char 1))) ; <---------- a[ESC] leaves the cursor > ; where it was before in VIM, without 2098c2101 < ;; These 2 functions implement insertion at the beginning/ end of a visual --- > ;; These 2 functions implement insertion at the beginning/ end of a visual 2103c2106 < --- > 2114c2117 < --- > 2132c2135 < ;;; --- > ;;;