diff options
| author | srdusr <trevorgray@srdusr.com> | 2023-10-26 23:04:14 +0200 |
|---|---|---|
| committer | srdusr <trevorgray@srdusr.com> | 2023-11-04 17:37:20 +0200 |
| commit | e183355e7854c4c4bc025cdc8230750257b22139 (patch) | |
| tree | b113c70358a41642f7c55088cb2c94eee7b03d89 /.config/nvim | |
| parent | d5b3a3df2f1fe36a50dcc4fd5f90e3b8363e413b (diff) | |
| download | dotfiles-e183355e7854c4c4bc025cdc8230750257b22139.tar.gz dotfiles-e183355e7854c4c4bc025cdc8230750257b22139.zip | |
Fixed find_books() not opening recent books
Diffstat (limited to '.config/nvim')
| -rw-r--r-- | .config/nvim/lua/plugins/telescope.lua | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua index 8d8622f..5b9717b 100644 --- a/.config/nvim/lua/plugins/telescope.lua +++ b/.config/nvim/lua/plugins/telescope.lua @@ -443,7 +443,7 @@ function M.find_books() local recent_books_file = recent_books_directory .. 'recent_books.txt' local search_cmd = 'find ' .. vim.fn.expand(search_dir) .. ' -type d -o -type f -maxdepth 1' - local recent_books = vim.fn.systemlist('cat ' .. recent_books_file) + local recent_books = vim.fn.readfile(recent_books_file) local search_results = vim.fn.systemlist(search_cmd) local results = {} @@ -476,27 +476,16 @@ function M.find_books() if entry ~= nil then local path = entry.value - -- Handle selecting a recent book entry separately - if vim.fn.matchstr(path, '^Recent Books: ') ~= '' then - -- Extract the path of the selected recent book - path = vim.fn.matchstr(path, '^Recent Books: (.*)$') - end - actions.close(prompt_bufnr, false) - - -- Debugging statement to print the selected path - print('Selected Entry: ' .. path) - -- Determine whether it's a directory or a file local is_directory = vim.fn.isdirectory(path) if is_directory then -- It's a directory, navigate to it in the current buffer vim.cmd('e ' .. path) - print('Selected directory: ' .. path) else - -- It's a file, do something with it (open it, for example) - print('Selected file: ' .. path) + -- It's a file, open it + vim.cmd('edit ' .. path) end end end) |
