Commit Graph

152 Commits

Author SHA1 Message Date
Steven Arcangeli 55fd604006 fix: sanitize newlines in entries and prompts (#88) 2023-02-23 22:03:55 -08:00
uga-rosa 2257c3e367 feat: allow to pass extra opts to vim.keymap.set() 2023-02-06 02:19:47 +09:00
Steven Arcangeli 4436d6f41e feat: enable cmp omni autocomplete in vim.ui.input (#55) 2022-12-12 21:44:56 -08:00
Steven Arcangeli c7eda5a68e refactor!: expose generic way to set window/buffer options in config (#75) 2022-12-04 23:45:04 -08:00
tobias.voelzel fa732334c5 fix(fzf-lua): pass prompt option to fzf
blub
2022-11-18 21:06:47 +01:00
Steven Arcangeli 202bcf6bdb fix!: update vim.ui.input to match nvim 0.9 API
https://github.com/neovim/neovim/pull/20883 changed the behavior of
vim.ui.input. The main change was that inputting no text now returns an
empty string instead of nil.
2022-11-09 02:21:46 +00:00
Emmanuel Touzery 6c13c0dbc6 fix issue when operating from a floating window
the floating window would get closed when we open and returning to the
original window would crash.
2022-10-03 08:48:19 +02:00
Steven Arcangeli 76477792b3 format: stylua 2022-09-20 11:28:42 -07:00
bhagwan 7b9d6d1fd2
chore(fzf-lua): use newer 'fzf_exec' API (#64) 2022-09-20 09:46:28 -07:00
Steven Arcangeli fbc798c34c format: new version of stylua 2022-09-15 07:43:30 -07:00
Steven Arcangeli ee5fb7b42b format: stylua 2022-09-15 07:41:02 -07:00
Andrii Savytskyi 175d86172b
Add space between idx and text in ordinal 2022-09-15 16:14:33 +03:00
Andrii Savytskyi ce8fdc8907
remove plenary.nvim dependency 2022-09-15 15:23:31 +03:00
Andrii Savytskyi 971c9c9712
Update telescope.lua 2022-09-15 12:50:30 +03:00
Steven Arcangeli b188b7750c fix: restore cursor position after select
Some of the select implementations, due to the fact that they switch
from normal mode to insert mode and back, cause the cursor to move
backwards by one column. This can have unfortunate effects if you are
relying on the cursor position to perform some operation.
2022-09-07 07:42:19 -07:00
Steven Arcangeli 9cdb3e0f09 fix: use schedule_wrap for select again (#59) (#58) 2022-08-31 08:37:33 -07:00
Steven Arcangeli f38eb33572 feat: more lazy loading for faster startup 2022-08-28 10:48:05 -07:00
Steven Arcangeli 232b6b3021 fix: only schedule_wrap when necessary (#58) 2022-08-28 10:18:01 -07:00
Steven Arcangeli be2ef16ddb fix: change default cursor-relative row/col to 0/0
Since the default anchor is SW, the previous default of 1/1 lead to the
text under the cursor being occluded.
2022-08-28 10:04:57 -07:00
Steven Arcangeli 96b09a0e3c fix(input): lua function completion 2022-08-23 08:41:21 -07:00
Steven Arcangeli d886a1bb0b feat: pass items to get_config for vim.ui.select 2022-07-31 08:12:18 -07:00
Steven Arcangeli b1c08146ee feat: expose mappings to user via config 2022-07-28 21:27:06 -07:00
Steven Arcangeli 47b95c1eab refactor!: use newer APIs for setting keymaps and autocmds
BREAKING CHANGE: This drops support for Neovim versions earlier than
0.7. For earlier versions of Neovim, use the nvim-0.5 branch.
2022-07-28 07:54:40 -07:00
Michael Benford 28cb494b61 feat(input): add start_in_insert option
Add a new option, start_in_insert, that defaults to true and controls
whether the input will start in insert or normal mode.
2022-07-20 17:26:40 -03:00
Steven Arcangeli 1e60c07ae9 format: apply new stylua formatting 2022-07-14 23:37:29 +00:00
Steven Arcangeli fb4637995e feat(input): support cancelreturn 2022-07-14 00:27:59 -07:00
Steven Arcangeli d394a2591c fix: bad nui parameter in last commit (#45) 2022-06-07 08:04:09 -07:00
Steven Arcangeli a59218e110 feat(select)(nui): add more configuration options 2022-06-04 19:10:47 -07:00
Andrey Avramenko 4bd4167a77 fix(select): use original vim.ui.select if enabled is false 2022-06-01 17:59:28 +03:00
Andrew 59cd93b994 feat: trim trailing colon from prompt 2022-05-30 12:24:52 +10:00
Steven Arcangeli b2406a0ea7 fix: telescope codeaction properly columnates and indexes client name (#6) 2022-05-29 18:48:25 -07:00
Steven Arcangeli e3b31d45bc feat: customize the code action UI for telescope (#6) 2022-05-26 22:09:34 -07:00
Steven Arcangeli e607dd99ae feat: enable telescope customization for vim.ui.select caller 2022-05-26 19:45:28 -07:00
Steven Arcangeli a476efd3f3 fix(input): disable mini completion (#38) 2022-05-01 13:50:30 -07:00
Steven Arcangeli f68a91a281 fix: stack overflow in telescope (#36) 2022-04-22 21:51:20 -07:00
Steven Arcangeli 2f8a001ae5 fix(input): change the default_prompt to Input:
The unicode arrow makes sense when using the prompt buffer, but not so
much if the prompt is going to be a window title instead.
2022-03-31 08:24:47 -07:00
Steven Arcangeli e14e35a9d4 fix!: drop specialized text highlight groups (#30)
Removing DressingInputText and DressingSelectText highlight groups that
were added for #8. I added them before I learned about winhighlight, and
it turns out that winhighlight is the better way to do this. Previously
I was using `nvim_buf_add_highlight` to directly add the highlight
group, but that has multiple downsides (can't highlight bg of regions
with no text, overrides other relevate highlight groups e.g.
CursorLine). None of that is needed because Neovim will be setting the
highlight group of this text to NormalFloat, and if the user wants to
customize it we already expose an easy option in config to do
`winhighlight = "NormalFloat:MyCustomHighlightGroup"`.
2022-03-29 20:11:57 -07:00
Steven Arcangeli 31f12fff6e feat: allow get_config to modify enabled (#29) 2022-03-23 18:46:21 -07:00
Steven Arcangeli 8c42b8f854 fix(input): set nowrap on window (#28) 2022-03-22 22:38:58 -07:00
Steven Arcangeli 079e5d7df8 feat(input): option prompt_align (#27) 2022-03-22 22:10:16 -07:00
Steven Arcangeli 96552c9199 fix: hide deprecation notice when option not used (#26) 2022-03-17 10:01:53 -07:00
Steven Arcangeli 01afd7b01f fix: apply filetype option after setting keymaps (#25) 2022-03-17 09:40:49 -07:00
Steven Arcangeli 4542292854 refactor!: deprecate telescope 'theme' option
Pass the theme options in directly now. For example:
```lua
require('dressing').setup({
  select = {
    telescope = require('telescope.themes').get_ivy({})
  }
})
```
2022-03-16 21:03:17 -07:00
Steven Arcangeli c9e7f4f4cd lint: fix lint errors 2022-03-16 20:48:49 -07:00
tami5 4f36284caa
style: format 2022-03-14 21:50:14 +03:00
tami5 dbceda6303
fix: skipping config.theme when it's a table 2022-03-14 21:50:13 +03:00
tami5 d1063d4e47
Merge branch 'master' into feat/select/override_telescope_config 2022-03-14 04:39:23 +03:00
tami5 43f325b654
feat(select): override telescope config
Support passing extra telescope configurations as well as custom theme
function + backward compatibility for current state. So hopefully no
breaking changes.
2022-03-14 04:32:28 +03:00
Steven Arcangeli 1e529b8cdb feat!: more layout options for input and builtin select (#19)
Removed the row & col options for input and select.builtin. If you want
to tweak the values sent to nvim_open_win, use the `override` function.

Changes:
* min_width/height and max_width/height can be a list of values. Useful
  for mixing raw integers (e.g. for cols) and floats (e.g. for % of
  total)
* can specify an exact width or height for the windows
* when using relative = 'win' or 'editor', the row & col will by default
  be calculated to center the floating win
2022-03-02 09:24:06 -08:00
Steven Arcangeli b6f5a92ef4 doc: document new telescope config options 2022-02-28 16:37:34 -08:00
Akin Sowemimo c49854aa5d fix(telescope): allow passing theme options
to telescope picker
2022-02-26 13:26:05 +00:00
Steven Arcangeli 8e8f7e5259 fix: replace defer_fn hack with redraw hack (#18) 2022-02-02 15:56:47 -08:00
Steven Arcangeli fc790e426a fix(input): error on history_prev when no history 2022-01-28 12:19:00 -08:00
Steven Arcangeli 3f23266f0c fix: work around neovim open_win bug (#15)
Per https://github.com/neovim/neovim/issues/12295, it seems we cannot
open *and* enter a floating window during vim startup. To work around
that, we use vim.schedule_wrap() on the entrypoints. This should not
produce any noticeable effect in functionality.
2022-01-18 14:18:00 -08:00
Steven Arcangeli ed378363a0 feat: config option to disable specific ui modules 2022-01-17 16:02:38 -08:00
Steven Arcangeli 1f91d264bf fix(input): mode detection in special insert modes 2022-01-17 14:22:58 -08:00
Steven Arcangeli c2208c3e5c feat(select): add support for fzf-lua (#14) 2022-01-17 14:22:24 -08:00
Steven Arcangeli f03962c617 fix(input): expand width to fit prompt & default 2022-01-17 13:18:17 -08:00
Steven Arcangeli 25b72621af fix(input): restore previous mode after leaving modal 2022-01-17 13:17:43 -08:00
Steven Arcangeli d5eaf13b80 fix(input): Don't trigger autocmds when opening input modal (#13) 2022-01-17 13:15:59 -08:00
Steven Arcangeli d5918d0475 feat: history for ui.input (#12) 2022-01-11 16:35:31 -08:00
Steven Arcangeli f487c89b56 cleanup!: Remove prompt buffer implementation for ui.input
The `prompt_buffer = true` option will no longer function. The only
input modal implementation will use a normal scratch buffer.
2022-01-11 16:34:27 -08:00
Steven Arcangeli 0ad4d1e6b9 fix: remove defer_fn hack in fzf select (fix #10) 2021-12-23 11:52:44 -08:00
Steven Arcangeli c856074771 feat: add config options for setting winhighlight (#8) 2021-12-18 20:20:38 -08:00
Steven Arcangeli 4b677be056 fix(select): off-by-one error in text highlighting 2021-12-18 20:12:32 -08:00
Steven Arcangeli 8d19119476 fix: re-add safety nil check 2021-12-18 19:50:12 -08:00
Steven Arcangeli b5f8d2d4fd refactor(input): remove feedkeys() hack when not using prompt buffer 2021-12-18 19:43:01 -08:00
Steven Arcangeli 28560556f1 feat: add DressingInputText highlight group (#8) 2021-12-18 19:40:46 -08:00
Steven Arcangeli f8542237f3 feat: add DressingSelectText highlight group (#8) 2021-12-18 12:32:17 -08:00
Steven Arcangeli 264874eb7b feat: add FloatTitle highlight group (#8) 2021-12-18 12:18:54 -08:00
Steven Arcangeli 26ce743306 refactor: extract common logic for adding window title 2021-12-18 12:18:10 -08:00
Steven Arcangeli 9b8c2be345 deprecate: input.prompt_buffer option
Even once the fixes to the prompt buffer come out in the next version of
Neovim, I'm really not sure what advantages we get from using the prompt
buffer. And we will continue to have disadvantages because it does *not*
function like a normal buffer. If anyone is using it and has a good
reason for it, please let me know. Otherwise, I'll be removing that
functionality in a later commit so I don't have to support two
implementations.
2021-12-17 12:33:50 -08:00
Steven Arcangeli 4848f851f6 feat(select): allow user to override format_item (#6) 2021-12-17 11:20:16 -08:00
Steven Arcangeli 3787e28932 cleanup: remove unnecessary cursor movement (#5)
We used to do the `stopinsert` synchronously before closing the window,
but it effectively didn't leave insert mode until after the window was
closed (and that caused some apparent cursor movement). Now that we're
deferring the window close action, we can remove the hacky cursor
respositioning.
2021-12-10 08:09:42 -08:00
Steven Arcangeli 43dd74f512 test: automated tests for the input modal 2021-12-09 17:09:22 -08:00
Steven Arcangeli dbfca4da6a feat(input): add winblend as a config option 2021-12-08 18:52:04 -08:00
Steven Arcangeli 189bbc6562 fix(input): adjust implementation to avoid bugs in prompt buffer (#2) 2021-12-08 18:52:04 -08:00
Steven Arcangeli 362cc2c54b fix(input): Remove debug print from completion logic
That's some egg on my face
2021-12-07 21:40:10 -08:00
William Boman 2f2582e5f7 call on_choice before return 2021-12-06 18:26:00 +01:00
William Boman 14780e4b7d Merge remote-tracking branch 'upstream/master' into nil-check
* upstream/master:
  [docgen] Update README.md skip-checks: true
  feat: set unique filetype on built-in modals (#3)
  feat(input): option to allow normal mode (#3)
2021-12-06 18:24:39 +01:00
Steven Arcangeli a3255df4a5 feat: set unique filetype on built-in modals (#3) 2021-12-05 19:25:51 -08:00
Steven Arcangeli 08c0cf3217 feat(input): option to allow normal mode (#3) 2021-12-05 19:20:20 -08:00
William Boman c84bf85c28 fix(select/telescope): check for nil selection 2021-12-06 01:29:37 +01:00
Steven Arcangeli 7e6e962341 fix(input): close completion window more reliably 2021-12-04 19:54:40 -08:00
Steven Arcangeli fe8f0ffe2f fix(select)(builtin): display the prompt 2021-12-04 17:18:51 -08:00
Steven Arcangeli 6487acdf93 feat: add an unpatch() function 2021-12-04 16:50:01 -08:00
Steven Arcangeli a0196a49e4 fix(input): empty string is converted to nil 2021-12-04 16:43:12 -08:00
Steven Arcangeli 5caa867d3d feat(input): support the completion option 2021-12-04 16:38:59 -08:00
Steven Arcangeli 4dc2ca3fff fix(input): opening input while existing input is open 2021-12-04 15:31:29 -08:00
Steven Arcangeli 6be518ba4c fix(input): race condition with multiple prompts in quick succession 2021-12-04 13:11:59 -08:00
Steven Arcangeli 8a75a7ba1b refactor: replace call to vim.fn with pcall 2021-12-04 12:16:34 -08:00
Steven Arcangeli 1c0f5ab4ed fix(select)(builtin): close modal window before calling callback 2021-12-04 11:49:38 -08:00
Steven Arcangeli 304d73f037 fix: race condition produces broken state in input modal
If you opened the input modal twice in quick succession, it would break
the keymaps and default prompt behavior in a very weird way. Adding
++nested ++once to the autocmd fixed it. Don't know why, unfortunately.
2021-12-04 11:24:11 -08:00
Steven Arcangeli 27d1ea0a15 feat: bind <Esc> to cancel dialog in input (fix #1) 2021-12-04 11:03:07 -08:00
Steven Arcangeli 770501336f fix: restore normal mode and cursor position when exiting input 2021-12-04 11:02:39 -08:00
Steven Arcangeli 7d0e85f00b fix: format_item doesn't have to return a string
This is perhaps ambiguous from the core docs, but format_item can return
values that are not strings and they will then be stringified. So we
should do the same
2021-12-03 22:59:01 -08:00
Steven Arcangeli 18a3548205 feat: error message when passing associative table to select 2021-12-03 22:51:34 -08:00
Steven Arcangeli 37349af9e1 fix: vim.ui.input can accept string as its first arg
This is not part of the documentation, but it is true.
2021-12-03 22:42:33 -08:00
Steven Arcangeli edbae09ec4 feat: add support for more telescope themes 2021-12-03 04:24:11 -08:00
Steven Arcangeli 5024cb855e cleanup: remove unnecessary comment 2021-12-02 20:28:18 -08:00