libvim-clj.core

(->vim)

Returns an object that you can call the other functions on. You *must* call the `init` function on it before anything else. Line numbers are 1-based and column numbers are 0-based (don't ask me why).

(execute vim cmd)

Example

(execute vim "set expandtab")

(get-search-highlights vim start-line end-line)

Warning: This function could behave badly if you don't have hlsearch enabled: (execute vim "set hlsearch")

(get-search-pattern vim)

Warning: This function could behave badly if you don't have hlsearch enabled: (execute vim "set hlsearch")

(input vim input)

Examples

Input a character
(input vim "h")
Input a special character See: https://vim.fandom.com/wiki/Mapping_keys_in_Vim_-_Tutorial_%28Part_2%29
(input vim "<Enter>")

(input-unicode vim input)

Example

Input a unicode character
(input-unicode vim "者")

(open-buffer vim file-name)

Example

(open-buffer vim "hello.txt")

(set-on-auto-command vim callback)

Example

(set-on-auto-command vim (fn [buffer-ptr event] (case event EVENT_BUFENTER (println "User entered a buffer") nil)))

(set-on-buffer-update vim callback)

Example

(set-on-buffer-update vim (fn [buffer-ptr start-line end-line line-count] (println "Buffer" buffer-ptr "was updated")))

(set-on-message vim callback)

Example

(set-on-message vim (fn [{:keys [title message message-priority]}] (println message)))

(set-on-quit vim callback)

Example

(set-on-quit vim (fn [buffer-ptr forced?] (System/exit 0)))

(set-on-stop-search-highlight vim callback)

Example

(set-on-stop-search-highlight vim (fn [] (println ":noh was executed")))

(set-on-unhandled-escape vim callback)

Example

(set-on-unhandled-escape vim (fn [] (println "User pressed Esc in normal mode")))

(set-on-yank vim callback)

Example

(set-on-yank vim (fn [{:keys [start-line start-column end-line end-column]}] (println "User copied text")))