Skip to content

Commit aa79364

Browse files
committed
Add convenience functions
1 parent afdb743 commit aa79364

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/neovim_client/nvim.clj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@
5959

6060
;; TODO - fix custom names, move to another ns?
6161

62+
(defn get-cursor-location
63+
"Gets the cursor's current position as a tuple (row, col)."
64+
[]
65+
(window-get-cursor (vim-get-current-window)))
66+
6267
(defn get-cursor-location-async
6368
"Gets the cursor's current position as a tuple (row, col) asynchronously."
6469
[f]
@@ -71,6 +76,11 @@
7176
(buffer-get-line-async buffer n #(buffer-set-line-async buffer n
7277
(update-fn %)
7378
identity))))
79+
(defn get-current-buffer-text
80+
"Convenience function to get the current buffer's text."
81+
[]
82+
(str/join "\n" (buffer-get-line-slice (vim-get-current-buffer) 0 -1)))
83+
7484
(defn get-current-buffer-text-async
7585
"Convenience function to get the current buffer's text asynchronously."
7686
[f]

0 commit comments

Comments
 (0)