diff options
| author | Mike Vink <> | 2023-04-12 18:06:51 +0200 |
|---|---|---|
| committer | Mike Vink <> | 2023-04-12 18:06:51 +0200 |
| commit | 852089112dc943667e86c5c7f3412c8f8d0186dd (patch) | |
| tree | 1f2ce981d6ba6c10ef1f7953b6a178b9199d9943 /fnl/conf/pkgs/cmp.fnl | |
| parent | 9aa0254e29355b64de1ccb3bc8c84e9190ae6c90 (diff) | |
cmp
Diffstat (limited to 'fnl/conf/pkgs/cmp.fnl')
| -rw-r--r-- | fnl/conf/pkgs/cmp.fnl | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/fnl/conf/pkgs/cmp.fnl b/fnl/conf/pkgs/cmp.fnl index bb146f4..33653b8 100644 --- a/fnl/conf/pkgs/cmp.fnl +++ b/fnl/conf/pkgs/cmp.fnl @@ -7,6 +7,17 @@ (fn [str start] (= start (string.sub str 1 (string.len start))))) +(local string-startswith-anyof (fn [str start-list] + (var ret false) + (each [_ start (ipairs start-list)] + (set ret (string-startswith str start))) + ret)) + +(local string-startswith-upper + (fn [str] + (local first-char (string.sub str 1 1)) + (= first-char (string.upper first-char)))) + (fn has-words-before [] (local [line col] (vim.api.nvim_win_get_cursor 0)) (local [word & rest] (vim.api.nvim_buf_get_lines 0 (- line 1) line true)) @@ -59,7 +70,12 @@ (cmp.setup.cmdline ":" {:sources (cmp.config.sources [{:name :path}] [{:name :cmdline_history - :keyword_pattern "^[^ehGgw].*" + :keyword_pattern "^[ABCDEFHIJKLMNOPQRSTUVWXYZ].*" + :entry_filter (fn [entry + ctx] + (if (string-startswith-upper entry.completion_item.label) + true + false)) :max_item_count 1} {:name :cmdline :keyword_length 2 |
