1. Meikel Brandmeyer
  2. vimclojure


Meikel Brandmeyer  committed 400eb3f

^ in Repl moves after prompt, not BOL (suggested by A. Bonnaire-Sergeant)

  • Participants
  • Parent commits 61c39c0
  • Branches default

Comments (0)

Files changed (3)

File vim/autoload/vimclojure.vim

View file
  • Ignore whitespace
 	if !hasmapto("<Plug>ClojureReplEvaluate")
 		imap <buffer> <silent> <C-CR> <Plug>ClojureReplEvaluate
+	if !hasmapto("<Plug>ClojureReplHatHook")
+		nmap <buffer> <silent> ^ <Plug>ClojureReplHatHook
+	endif
 	if !hasmapto("<Plug>ClojureReplUpHistory")
 		imap <buffer> <silent> <C-Up> <Plug>ClojureReplUpHistory
+function! vimclojure#Repl.hatHook() dict
+	let l = getline(".")
+	if l =~ "^" . self._prompt
+		let [buf, line, col, off] = getpos(".")
+		call setpos(".", [buf, line, len(self._prompt) + 2, off])
+	else
+		normal! ^
+	endif
 function! vimclojure#Repl.upHistory() dict
 	let histLen = len(self._history)
 	let histDepth = self._historyDepth

File vim/doc/clojure.txt

View file
  • Ignore whitespace
 entry. So playing back with <C-Up> will again send all of the contained
+If the current line starts with a repl prompt, the *^* command moves to
+the end of the prompt and to the beginning of the line.
 The Plugs are:
  - <Plug>ClojureReplEnterHook for the enter key
  - <Plug>ClojureReplEvaluate for immediate evaluation (<C-CR>)
+ - <Plug>ClojureReplHatHook for ^ navigation
  - <Plug>ClojureReplUpHistory for going backwards in history (<C-Up>)
  - <Plug>ClojureReplDownHistory for going forwards in history (<C-Down>)

File vim/plugin/clojure.vim

View file
  • Ignore whitespace
 inoremap <Plug>ClojureReplEnterHook <Esc>:call b:vimclojure_repl.enterHook()<CR>
 imap <Plug>ClojureReplEvaluate <Esc>GA<CR>
+nnoremap <Plug>ClojureReplHatHook :call b:vimclojure_repl.hatHook()<CR>
 inoremap <Plug>ClojureReplUpHistory <C-O>:call b:vimclojure_repl.upHistory()<CR>
 inoremap <Plug>ClojureReplDownHistory <C-O>:call b:vimclojure_repl.downHistory()<CR>