Skip to content

Commit

Permalink
add ignorecase option
Browse files Browse the repository at this point in the history
  • Loading branch information
cxxxr committed Nov 19, 2024
1 parent 17639f2 commit 1e5b31b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
2 changes: 1 addition & 1 deletion extensions/copilot/languages.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
(define-language lem-js-mode:js-mode (:language-id "javascript"))
(define-language lem-rust-mode:rust-mode (:language-id "rust"))
(define-language lem-go-mode:go-mode (:language-id "go"))
(define-language lem-lisp-mode:lisp-mode (:language-id "lisp"))
;; (define-language lem-lisp-mode:lisp-mode (:language-id "lisp"))
(define-language lem-markdown-mode:markdown-mode (:language-id "markdown"))
(define-language lem-c-mode:c-mode (:language-id "c"))
(define-language lem-css-mode:css-mode (:language-id "css"))
Expand Down
36 changes: 24 additions & 12 deletions extensions/vi-mode/commands.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
:lem-vi-mode/registers
:lem-vi-mode/text-objects
:lem-vi-mode/commands/utils)
(:import-from :lem-vi-mode/options
:option-value)
(:import-from :lem-vi-mode/states
:*motion-keymap*
:normal
Expand Down Expand Up @@ -735,7 +737,7 @@ on the same line or at eol if there are none."
:default-n-arg nil)
(cond
;; Argument n supplied (e.g. 10%) - move to line that represents n% of the buffer
(n
(n
(let* ((buffer-size (line-number-at-point (buffer-end-point (current-buffer))))
(new-line-pos (ceiling (* buffer-size n) 100)))
(goto-line new-line-pos)
Expand Down Expand Up @@ -771,17 +773,27 @@ on the same line or at eol if there are none."
(define-command vi-search-forward () ()
(setf *last-search-direction* :forward)
(add-hook *isearch-finish-hooks* 'vi-isearch-finish-hook)
(with-jumplist
(lem/isearch::isearch-start "/"
(lambda (point string)
(alexandria:when-let (p (lem/isearch::search-forward-regexp
(copy-point lem/isearch::*isearch-start-point* :temporary)
string))
(character-offset p (- (length string)))
(move-point point p)))
#'lem/isearch::search-forward-regexp
#'lem/isearch::search-backward-regexp
"")))
(let ((case-insensitive (option-value "ignorecase")))
(with-jumplist
(lem/isearch::isearch-start
"/"
(lambda (point string)
(alexandria:when-let (p (lem/isearch::search-forward-regexp
(copy-point lem/isearch::*isearch-start-point* :temporary)
(ppcre:create-scanner string :case-insensitive-mode case-insensitive)))
(character-offset p (- (length string)))
(move-point point p)))
(lambda (point regex &optional limit-point)
(lem/isearch::search-forward-regexp
point
(ppcre:create-scanner regex :case-insensitive-mode case-insensitive)
limit-point))
(lambda (point regex &optional limit-point)
(lem/isearch::search-backward-regexp
point
(ppcre:create-scanner regex :case-insensitive-mode case-insensitive)
limit-point))
""))))

(define-command vi-search-backward () ()
(setf *last-search-direction* :backward)
Expand Down

0 comments on commit 1e5b31b

Please sign in to comment.