Commit graph

25 commits

Author SHA1 Message Date
Folke Lemaitre
78f0ad6ce7
fix(input): add cr keybind for normal mode. Closes #1468. Closes #1466 2025-03-01 09:34:17 +01:00
SheffeyG
7014b91b92
fix(input): add missing hl group for input title (#1164)
Add the missing highlight group for input title.
Before:

![image](https://github.com/user-attachments/assets/600c8886-0547-48f5-b878-5d0482537446)
After:

![image](https://github.com/user-attachments/assets/13bad24f-6f96-41d6-ab3a-0b9001f68ea9)
2025-02-14 08:47:47 +01:00
Folke Lemaitre
0ed68bdf72
feat(input): persistent history. Closes #591 2025-01-20 18:31:10 +01:00
Folke Lemaitre
80db91f03e
feat(input): input history. Closes #591 2025-01-20 16:19:38 +01:00
iserpent
f904481439
fix(input): put the cursor right after the default prompt (#549)
## Description

When the input opens, the cursor is placed two columns to the right
after the default prompt, but should be one.
The cause is the `vim.api.nvim_win_set_cursor` takes (row, col) with the
base of (1, 0) */I hate this/*

## Related Issue(s)

No related issue created.

## Screenshots

`:lua Snacks.input({ default = "aaa" }, function () end )`
gives the input as "aaa |" (where pipe shows the cursor position)

Co-authored-by: Igor Iatsenko <igor.iatsenko@here.com>
2025-01-20 13:31:44 +01:00
Folke Lemaitre
5affa7214f
fix(input): bring back <c-w>. Fixes #426. Closes #429 2025-01-11 17:36:03 +01:00
Will Norris
818da334ac
fix(input): use correct highlight group for input prompt (#328)
I'm suspect this was just a typo... using the border highlight group
rather than title.
2025-01-05 06:59:00 +01:00
Folke Lemaitre
89306308f3
fix(input): refactor for win changes and ensure modified=false. Fixes #403. Fixes #402 2024-12-31 06:17:37 +01:00
Folke Lemaitre
2990bf0c7a
fix(input): change buftype to prompt. Fixes #350 2024-12-18 22:23:08 +01:00
Folke Lemaitre
eb887f4abb
style: luals 2024-12-18 07:02:08 +01:00
Folke Lemaitre
3123e6e988
fix(input): make sure to show input window with a higher zindex of the parent window (if float) 2024-12-16 18:03:24 +01:00
Folke Lemaitre
37038df00d
feat(input): disable completion engines in input 2024-12-15 20:20:50 +01:00
Chris Grieser
97542a7d9b
fix(input): missing padding if neither title nor icon positioned left (#292)
## Description
The new`icon_pos` /`title_pos` options resulted in a situation where
there is missing padding when neither is positioned left. This PR fixes
this by falling back to `" "` as statuscolumn.

## Screenshots
before
<img alt="before" width=40%
src="https://github.com/user-attachments/assets/e99a600f-0ab6-4319-a70d-24e3f658a0bb">

after
<img alt="after" width=40%
src="https://github.com/user-attachments/assets/377f2157-32c6-40fb-a439-9af9141f00e7">
2024-12-14 14:14:58 +01:00
Folke Lemaitre
5d00e6dec5
fix(input): go back to insert mode if input was started from insert mode. Fixes #287 2024-12-14 08:08:33 +01:00
Folke Lemaitre
26b7d4cbd9
fix(input): open input window with noautocmd=true set. Fixes #287 2024-12-14 07:51:31 +01:00
Folke Lemaitre
db768a5497
fix(input): check if parent win still exists. Fixes #287 2024-12-14 07:47:31 +01:00
Folke Lemaitre
d0cb7070e9
feat(input): allow configuring position of prompt and icon 2024-12-13 23:57:50 +01:00
Folke Lemaitre
8c2410c2de
fix(input): set current win in vim.schedule so that it works properly from expr keymaps. Fixes #257 2024-12-11 18:53:38 +01:00
Folke Lemaitre
c17c1b2f6c
fix(input): set current win before executing callback. Fixes #257 2024-12-11 18:31:32 +01:00
Folke Lemaitre
6c27ff2a36
fix(input): update window position in the context of the parent window to make sure position=cursor works as expected. Fixes #254 2024-12-11 17:23:27 +01:00
Chris Grieser
e01668c367
fix(input): various minor visual fixes (#252)
## Description
1. Trim the trailing `:` from the prompt. The `:` is usually added to
`vim.ui.input`, since it is by default displayed in the cmdline, where a
separater is useful. As a window title, however, it serves no purpose;
adding a `:` to a title is generally disrecommended.
2. Disable cursorline in the input window by default. Since the input
window by default has a height of 1, the cursorline is not helpful at
all, and only results in an inconsistently looking appearance.
3. In case the user disables the icon by setting it to `""`, there is
excess padding which looks weird (and also does not align with a window
title set to `left`). Thus added a check for an empty string and adjust
the padding accordingly.
4. Set `snacks_input` as default filetype for the input buffer, in line
with how the other modules of `snacks` work.

All four changes are a separate commit, in case one of them is for some
reason not desirable.

## Screenshots
before

![before](https://github.com/user-attachments/assets/fb49e269-ab1d-4510-a571-de3408ac57c3)

after

![after](https://github.com/user-attachments/assets/a0e34d34-c406-4213-8a89-a04d36419362)
2024-12-11 14:51:52 +01:00
Folke Lemaitre
f6d427b4f7
docs: docgen 2024-12-10 14:15:40 +01:00
Folke Lemaitre
8e8b4f6be1
docs: cleanup 2024-12-10 13:59:35 +01:00
Folke Lemaitre
140204fde5 build: added metadata to plugins 2024-12-10 13:55:51 +01:00
Folke Lemaitre
70902eee9e feat(input): added input snack 2024-12-10 13:55:51 +01:00