~vigoux/azy.nvim-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2 2

[PATCH azy.nvim v2] Add oldfiles source

Details
Message ID
<169715679250.15505.8725500449905403553-0@git.sr.ht>
DKIM signature
missing
Download raw message
Patch: +46 -0
From: Chinmay Dalal <dalal.chinmay.0101@gmail.com>

This commit adds an oldfiles source to quickly recent files
---
 lua/azy/builtins.lua |  9 +++++++++
 lua/azy/sources.lua  |  9 +++++++++
 teal/azy/builtins.tl |  9 +++++++++
 teal/azy/sources.tl  |  9 +++++++++
 types/types.d.tl     | 10 ++++++++++
 5 files changed, 46 insertions(+)

diff --git a/lua/azy/builtins.lua b/lua/azy/builtins.lua
index b058b64..ad08a7c 100644
--- a/lua/azy/builtins.lua
+++ b/lua/azy/builtins.lua
@@ -54,6 +54,9 @@ local Builtins = {SelectOptions = {}, lsp = {}, }









@@ -95,6 +98,12 @@ function Builtins.help()
   end
end

function Builtins.oldfiles()
   return function()
      ui.create(sources.oldfiles(), sinks.open_file)
   end
end

function Builtins.buffers()
   return function()
      ui.create(sources.buffers(), sinks.open_file)
diff --git a/lua/azy/sources.lua b/lua/azy/sources.lua
index c8211ca..c075d4e 100644
--- a/lua/azy/sources.lua
+++ b/lua/azy/sources.lua
@@ -36,6 +36,9 @@ local Sources = {FilesOptions = {}, }









@@ -228,6 +231,12 @@ function Sources.help()
   return ret
end

function Sources.oldfiles()
   return vim.iter.map(utils.path.shorten, vim.iter.filter(function(filename)
      return vim.fn.filewritable(filename) == 1
   end, vim.v.oldfiles))
end

function Sources.buffers()
   local bufs = vim.api.nvim_list_bufs()
   local ret = {}
diff --git a/teal/azy/builtins.tl b/teal/azy/builtins.tl
index 2f546d9..8e45f77 100644
--- a/teal/azy/builtins.tl
+++ b/teal/azy/builtins.tl
@@ -11,6 +11,9 @@ local record Builtins
  ---@param opts Options
  files: function({string}, sources.FilesOptions): function()

  ---@desc Search for recently edited files
  oldfiles: function(): function()

  ---@desc Search through current buffer's lines
  ---@param opts Options
  curbuf_content: function(sources.FilesOptions): function()
@@ -95,6 +98,12 @@ function Builtins.help(): function()
  end
end

function Builtins.oldfiles(): function()
  return function()
    ui.create(sources.oldfiles(), sinks.open_file)
  end
end

function Builtins.buffers(): function()
  return function()
    ui.create(sources.buffers(), sinks.open_file)
diff --git a/teal/azy/sources.tl b/teal/azy/sources.tl
index 6492eb2..11560c8 100644
--- a/teal/azy/sources.tl
+++ b/teal/azy/sources.tl
@@ -31,6 +31,9 @@ local record Sources
  ---@desc Help tags source
  help: function(): {AzyElement<nil>}

  ---@desc Oldfiles source (lists recently edited files)
  oldfiles: function(): {AzyElement<nil>}

  ---@desc Buffers source
  buffers: function(): {AzyElement<nil>}

@@ -228,6 +231,12 @@ function Sources.help(): {AzyElement<nil>}
  return ret
end

function Sources.oldfiles(): {AzyElement<nil>}
  return vim.iter.map(utils.path.shorten, vim.iter.filter(function(filename: string): boolean
    return vim.fn.filewritable(filename) == 1
  end, vim.v.oldfiles))
end

function Sources.buffers(): {AzyElement<nil>}
  local bufs = vim.api.nvim_list_bufs()
  local ret: {AzyElement<nil>} = {}
diff --git a/types/types.d.tl b/types/types.d.tl
index e33f9aa..c4c6283 100644
--- a/types/types.d.tl
+++ b/types/types.d.tl
@@ -66,6 +66,10 @@ global record vim
    eventignore: string
  end

  record v
    oldfiles: {string}
  end

  record wo
    cursorline: boolean
    cursorlineopt: string
@@ -158,6 +162,12 @@ global record vim
    systemlist: function({string}|string): {string}
    system: function({string}|string): string
    taglist: function(string, string|nil): {Tag}
    filewritable: function(string): boolean
  end

  record iter
    filter: function<T>((function(T): boolean), {T}): {T}
    map: function<S, T>((function(S): T), {T}): {AzyElement<nil>}
  end

  record api
-- 
2.38.5

[azy.nvim/patches/.build.yml] build failed

builds.sr.ht <builds@sr.ht>
Details
Message ID
<CW6VW6GPHI5L.1NF1L8OSWYOEJ@cirno2>
In-Reply-To
<169715679250.15505.8725500449905403553-0@git.sr.ht> (view parent)
DKIM signature
missing
Download raw message
azy.nvim/patches/.build.yml: FAILED in 58s

[Add oldfiles source][0] v2 from [~p00f][1]

[0]: https://lists.sr.ht/~vigoux/azy.nvim-devel/patches/45640
[1]: dalal.chinmay.0101@gmail.com

✗ #1074432 FAILED azy.nvim/patches/.build.yml https://builds.sr.ht/~vigoux/job/1074432
Details
Message ID
<ypi9a5snnz63.fsf@gmail.com>
In-Reply-To
<169715679250.15505.8725500449905403553-0@git.sr.ht> (view parent)
DKIM signature
missing
Download raw message
This version adds docs and uses the existing open_file sink instead of
creating a new one
Reply to thread Export thread (mbox)