Commit graph

476 commits

Author SHA1 Message Date
Folke Lemaitre
c509ea52b7 feat(snacks): zen mode 2024-12-10 13:55:51 +01:00
Iordanis Petkakis
6b78172864
fix(dashboard): don't open with startup option args (#222)
## Description
Don't open dashboard when Neovim opens with only startup option args.
Took a look at how `dashboard.nvim` did it.
They also have an autocmd for `StdInReadPre`, but I tested with piping
`echo "hello" | nvim` and it works as expected.

Not sure if it's the best solution, so feel free to make any additional
changes or completely disregard for something more robust.
<!-- Describe the big picture of your changes to communicate to the
maintainers
  why we should accept this pull request. -->

## Related Issue(s)
Closes #221.
<!--
  If this PR fixes any issues, please link to the issue here.
  - Fixes #<issue_number>
-->

## Screenshots

<!-- Add screenshots of the changes if applicable. -->
2024-12-09 14:28:26 +01:00
Folke Lemaitre
d972bc0a47
perf(statuscolumn): optimize caching 2024-12-07 21:33:08 +01:00
Anton Kastritskii
974bccb126
docs(lazygit): comment how to disable nerd icons (#201)
## Description

Show explicitly how to disable nerd icons in the default versions of
config and documentation

## Related Issue(s)

- Fixes #200
2024-12-04 15:29:41 +01:00
Folke Lemaitre
3647ca7d8a
fix(statuscolumn): add virtnum and relnum to cache key. See #198 2024-12-04 15:24:27 +01:00
Folke Lemaitre
f5fb59cc4c
fix(statuscolumn): don't show signs on virtual ligns. See #198 2024-12-04 15:24:04 +01:00
Folke Lemaitre
681b9c9d65
feat(win): backdrop can now be made opaque 2024-12-03 10:29:55 +01:00
Folke Lemaitre
96ac87b6b1
refactor: move is_transparent to util 2024-12-03 10:29:21 +01:00
Folke Lemaitre
089ff668d2
refactor(util): move blend to util 2024-12-03 10:19:04 +01:00
Folke Lemaitre
446f50208f
fix(win): update opts.wo for padding instead of vim.wo directly 2024-12-03 10:18:27 +01:00
Folke Lemaitre
736ce447e8
fix(dashboard): take hidden items into account when calculating padding. Fixes #194 2024-12-03 09:57:36 +01:00
Folke Lemaitre
0df7a08b01
fix(scratch): sort keys. Fixes #193 2024-12-03 09:45:44 +01:00
Folke Lemaitre
f955f082e0
fix(scratch): weirdness with visual selection and inclusive/exclusive. See #190 2024-12-03 09:32:54 +01:00
Folke Lemaitre
50bd5103ba
fix(scratch): make sure win.opts.keys exists. See #190 2024-12-03 09:18:10 +01:00
Folke Lemaitre
630d96cf1f
fix(win): update window local options when the buffer changes 2024-12-03 09:18:10 +01:00
Folke Lemaitre
652303e6de
feat(scratch): opts.ft can now be a function and defaults to the ft of the current buffer or markdown 2024-12-02 21:03:49 +01:00
Folke Lemaitre
6c25ab1108
fix(scratch): floating window title/footer hl groups 2024-12-02 21:03:11 +01:00
Folke Lemaitre
964d7ae99a
feat(win): width/height can now be a function 2024-12-02 20:47:32 +01:00
Folke Lemaitre
1f74d1ce77
feat(win): added opts.fixbuf to configure fixed window buffers 2024-12-02 20:47:32 +01:00
Folke Lemaitre
af41cb088d
fix(debug): better way of getting visual selection. See #190 2024-12-02 20:11:46 +01:00
Folke Lemaitre
e26ab0ef2c
style(notifier): title 2024-12-02 20:11:46 +01:00
Marcin
42d62775d8
feat(dashboard): make buffer not listed (#191)
## Description

<!-- Describe the big picture of your changes to communicate to the
maintainers
  why we should accept this pull request. -->

Set the dashboard buffer to not listed for consistency with other
dashboard plugins

## Related Issue(s)

<!--
  If this PR fixes any issues, please link to the issue here.
  - Fixes #<issue_number>
-->

## Screenshots

<!-- Add screenshots of the changes if applicable. -->
2024-12-02 17:35:17 +01:00
Folke Lemaitre
cda695e53f
fix(dashboard): take indent into account when calculating terminal width 2024-12-02 16:59:27 +01:00
Folke Lemaitre
045a17da06
feat(dashboard): when a section has a title, use that for action and key. If not put it in the section. Fixes #189 2024-12-02 16:33:55 +01:00
Folke Lemaitre
6e3b9546de
fix(dashboard): calculate proper offset when item has no text 2024-12-02 16:27:36 +01:00
Folke Lemaitre
78f44f720b
feat(dashboard): allow terminal sections to have actions. Closes #189 2024-12-02 12:15:22 +01:00
Folke Lemaitre
a856952ab2
feat(gitbrowse): opts.notify 2024-12-02 10:24:19 +01:00
Folke Lemaitre
243655796e
fix(gitbrowse): opts.notify 2024-12-02 10:23:57 +01:00
Folke Lemaitre
f8949523ed
fix(gitbrowse): removed debug 2024-12-02 08:36:25 +01:00
Folke Lemaitre
0a48c2e726
feat(gitbrowse): url pattern can now also be a function 2024-12-02 08:35:51 +01:00
Folke Lemaitre
f03727c77f
feat(gitbrowse): added line_count. See #186 2024-12-02 08:22:28 +01:00
Folke Lemaitre
adf0433e8f
fix(gitbrowse): use line_start and line_end directly in patterns. Closes #186 2024-12-02 07:10:09 +01:00
Folke Lemaitre
67894ee778
docs: added a setup section to docgen, since some people didn't know how to configure snacks... 2024-12-01 23:13:21 +01:00
Folke Lemaitre
d370be6d69
feat(dashboard): hide title if section has no items. Fixes #184 2024-12-01 21:52:01 +01:00
Folke Lemaitre
6db50cfe2d
fix(scratch): always set filetype on the buffer. Fixes #179 2024-12-01 20:06:04 +01:00
Folke Lemaitre
4bdf7daece
fix(dashboard): truncate file names when too long. Fixes #183 2024-12-01 19:56:44 +01:00
Folke Lemaitre
b99bc64ef9
feat(dashbard): explude files from stdpath data/cache/state in recent files and projects 2024-12-01 19:49:26 +01:00
Folke Lemaitre
891648a483
feat(bigfile): disable matchparen, set foldmethod=manual, set conceallevel=0 2024-12-01 19:48:06 +01:00
Folke Lemaitre
85f51320b2
fix(profiler): startup opts 2024-12-01 19:47:27 +01:00
Folke Lemaitre
93b254d658
fix(dashboard): prevent possible duplicate recent files. Fixes #171 2024-12-01 18:16:43 +01:00
Iordanis Petkakis
e5bc11e328
feat(gitbrowse): allow custom branch (#172)
## Description
Allow the user to be able to define custom branch with
`Snacks.gitbrowse`. I also added `start_line` and `end_line` (default to
`nil`), because from my testing when using a keymap such as the one in
[my comment in the related
issue](https://github.com/folke/snacks.nvim/issues/170#issuecomment-2508476110)
or this one which I came up later while implementing this
```lua
vim.keymap.set({ "n", "x" }, "<leader>gY", function()
  local function system(cmd, err)
    local proc = vim.fn.system(cmd)
    if vim.v.shell_error ~= 0 then
      Snacks.notify.error({ err, proc }, { title = "Git Browse" })
      error(err)
    end
    return vim.split(vim.trim(proc), "\n")
  end
  local branches = {}
  local start_line, end_line
  if vim.fn.mode() == "v" or vim.fn.mode() == "V" then
    start_line = vim.fn.line("v")
    end_line = vim.fn.line(".")
    if start_line > end_line then
      start_line, end_line = end_line, start_line
    end
  end
  for _, branch in ipairs(system({ "git", "branch" }, "Failed to get git branches")) do
    branch = branch:match("%s*[%*]?%s*(%S+)")
    table.insert(branches, branch)
  end
  vim.ui.select(branches, {
    prompt = "Select branch",
  }, function(choice)
    if choice then
      Snacks.gitbrowse({ start_line = start_line or nil, end_line = end_line or nil, branch = choice })
    end
  end)
end, { desc = "Git Browse ()" })
```
Then the visual lines would not work. My guess is that in the first case
the command line prompt and in the second case the `vim.ui.select`
before calling `Snacks.gitbrowse` break the Visual mode state and any
visual selection is not propagated to `Snacks.gitbrowse` to be properly
evaluated by the internal code for visual lines selection, which works
just fine when you just call directly `Snacks.gitbrowse()` via a
function in a keymap (which I assume doesn't break Visual mode state).
That's why I had to implement the visual selection again in the keymap
as well and needed the extra parameters to pass the newly evaluated
values.

Please do correct me if I'm somehow wrong in my logical deduction (which
is based mostly on observation and guessing) and maybe `start_line` and
`end_line` are not needed. Except if the user passes the option directly
in the keymap, but then he would have to create multiple keymaps for
different branches, which in my personal opinion defeats the purpose of
this feature.

In both cases of the keymaps I mentioned the user can dynamically either
type or choose the branch available to him. But maybe I'm missing
something in both the keymaps implementations that I came up with.
<!-- Describe the big picture of your changes to communicate to the
maintainers
  why we should accept this pull request. -->

## Related Issue(s)
Closes #170.
<!--
  If this PR fixes any issues, please link to the issue here.
  - Fixes #<issue_number>
-->

## Screenshots

<!-- Add screenshots of the changes if applicable. -->

---------

Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
2024-12-01 18:11:59 +01:00
Folke Lemaitre
ddaa2aaba5
fix(util): better support for nvim-web-devicons 2024-12-01 17:57:28 +01:00
Folke Lemaitre
ca7188c531
fix(util): make sure to always return an icon 2024-12-01 17:46:23 +01:00
Folke Lemaitre
7a47eb76df
feat(dashboard): allow items to be hidden, but still create the keymaps etc 2024-12-01 17:41:10 +01:00
Folke Lemaitre
0043fa9ee1
fix(win): allow resolving nil window option values. Fixes #179 2024-12-01 17:19:14 +01:00
Folke Lemaitre
999ae07808
feat(toggle): toggles for the profiler 2024-12-01 13:36:09 +01:00
Folke Lemaitre
808879951f
feat(snacks): added Snacks.profiler 2024-12-01 13:35:37 +01:00
Folke Lemaitre
32c46b4e2f
feat(scratch): use Snacks.debug.run() to execute buffer/selection 2024-12-01 12:46:52 +01:00
Folke Lemaitre
7db0ed4239
feat(scratch): change keymap to execute buffer/selection to <cr> 2024-12-01 12:46:24 +01:00
Folke Lemaitre
e1fe4f5afe
feat(debug): added Snacks.debug.run() to execute the buffer or selection with inlined print and errors 2024-12-01 12:45:39 +01:00