aboutsummaryrefslogtreecommitdiff
path: root/.config/nvim
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim')
-rw-r--r--.config/nvim/init.lua1
-rw-r--r--.config/nvim/lua/plugins/hardtime.lua19
-rw-r--r--.config/nvim/lua/plugins/telescope.lua64
-rw-r--r--.config/nvim/lua/user/keys.lua8
-rw-r--r--.config/nvim/lua/user/mods.lua3
-rw-r--r--.config/nvim/lua/user/pack.lua18
-rw-r--r--.config/nvim/lua/user/view.lua5
7 files changed, 70 insertions, 48 deletions
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua
index 0ab542c..da19687 100644
--- a/.config/nvim/init.lua
+++ b/.config/nvim/init.lua
@@ -95,6 +95,7 @@ local modules = {
'plugins.which-key',
'plugins.harpoon',
'plugins.leetcode',
+ 'plugins.hardtime',
--'plugins.notify',
--"plugins.modify-blend",
}
diff --git a/.config/nvim/lua/plugins/hardtime.lua b/.config/nvim/lua/plugins/hardtime.lua
new file mode 100644
index 0000000..1fb58cc
--- /dev/null
+++ b/.config/nvim/lua/plugins/hardtime.lua
@@ -0,0 +1,19 @@
+local hardtime = require('hardtime')
+
+-- Function to toggle the hardtime state and echo a message
+local hardtime_enabled = true
+
+function ToggleHardtime()
+ hardtime.toggle()
+ hardtime_enabled = not hardtime_enabled
+ local message = hardtime_enabled and 'hardtime on' or 'hardtime off'
+ vim.cmd('echo "' .. message .. '"')
+end
+
+hardtime.setup({
+ -- hardtime config here
+})
+
+return {
+ ToggleHardtime = ToggleHardtime,
+}
diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua
index daf50bd..8d8622f 100644
--- a/.config/nvim/lua/plugins/telescope.lua
+++ b/.config/nvim/lua/plugins/telescope.lua
@@ -374,20 +374,6 @@ function M.find_scripts()
})
end
---function M.find_projects() -- aka Workspaces
--- require('telescope.builtin').find_files({
--- hidden = true,
--- no_ignore = true,
--- prompt_title = ' Find Projects',
--- path_display = { 'smart' },
--- search_dirs = {
--- '~/projects',
--- },
--- layout_strategy = 'horizontal',
--- layout_config = { preview_width = 0.65, width = 0.75 },
--- })
---end
-
function M.find_projects()
local search_dir = '~/projects'
pickers
@@ -452,20 +438,35 @@ end
function M.find_books()
local search_dir = '~/documents/books'
+ vim.fn.jobstart('$HOME/.scripts/track-books.sh')
+ local recent_books_directory = vim.fn.stdpath('config') .. '/tmp/'
+ 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 search_results = vim.fn.systemlist(search_cmd)
+
+ local results = {}
+ local recent_books_section = {} -- To store recent books separately
+
+ for _, recent_book in ipairs(recent_books) do
+ table.insert(recent_books_section, 'Recent Books: ' .. recent_book)
+ end
+
+ for _, search_result in ipairs(search_results) do
+ table.insert(results, search_result)
+ end
+
+ -- Add the recent books section to the results
+ for _, recent_entry in ipairs(recent_books_section) do
+ table.insert(results, recent_entry)
+ end
pickers
.new({}, {
prompt_title = 'Find Books',
- finder = finders.new_oneshot_job({
- 'find',
- vim.fn.expand(search_dir),
- '-type',
- 'd',
- '-o',
- '-type',
- 'f',
- '-maxdepth',
- '1',
+ finder = finders.new_table({
+ results = results,
}),
previewer = require('telescope.previewers').vim_buffer_cat.new({}),
sorter = config.generic_sorter({}),
@@ -474,15 +475,24 @@ function M.find_books()
local entry = actions_state.get_selected_entry()
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
- vim.fn.chdir(path)
- vim.cmd('e .')
+ -- 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)
diff --git a/.config/nvim/lua/user/keys.lua b/.config/nvim/lua/user/keys.lua
index d97d86d..53811a6 100644
--- a/.config/nvim/lua/user/keys.lua
+++ b/.config/nvim/lua/user/keys.lua
@@ -133,7 +133,7 @@ map('n', '<A-j>', ':let save_a=@a<Cr>"add"ap:let @a=save_a<Cr>')
map('n', '<leader>df', '<Cmd>call utils#ToggleDiff()<CR>')
-- Toggle Verbose
-map('n', '<leader>vt', '<Cmd>call utils#VerboseToggle()<CR>')
+map('n', '<leader>uvt', '<Cmd>call utils#VerboseToggle()<CR>')
-- Jump List
map('n', '<leader>j', '<Cmd>call utils#GotoJump()<CR>')
@@ -222,7 +222,7 @@ map('n', '<leader>z', ':call utils#ZoomToggle()<CR>')
map('n', '<C-w>z', '<C-w>|<C-w>_')
-- Toggle statusline
-map('n', '<S-h>', ':call utils#ToggleHiddenAll()<CR>')
+map('n', '<leader>sl', ':call utils#ToggleHiddenAll()<CR>')
-- Open last closed buffer
map('n', '<C-t>', ':call OpenLastClosed()<CR>')
@@ -296,7 +296,7 @@ map('n', '<leader>ffw', [[<Cmd>lua require'plugins.telescope'.find_projects()<CR
map('n', '<leader>ffb', [[<Cmd>lua require'plugins.telescope'.find_books()<CR>]]) -- find books
map('n', '<leader>ffn', [[<Cmd>lua require'plugins.telescope'.find_notes()<CR>]]) -- find notes
map('n', '<leader>fgn', [[<Cmd>lua require'plugins.telescope'.grep_notes()<CR>]]) -- search notes
-map('n', '<Leader>ffr', "<cmd>lua require('telescope').extensions.recent_files.pick()<CR>")
+map('n', '<Leader>frf', "<cmd>lua require('telescope').extensions.recent_files.pick()<CR>")
map('n', '<leader>ffc', "<cmd>lua require('telescope.builtin').current_buffer_fuzzy_find()<cr>")
map('n', '<Leader>f/', "<cmd>lua require('telescope').extensions.file_browser.file_browser()<CR>")
--map("n", "<leader>f/", "<cmd>lua require('plugins.telescope').curbuf()<cr>") -- find files with hidden option
@@ -437,4 +437,4 @@ map('n', '<leader>sh', '<CMD>lua require("user.mods").Scratch("horizontal")<CR>'
map('n', '<leader>sv', '<CMD>lua require("user.mods").Scratch("vertical")<CR>')
-- Hardtime
-map('n', '<leader>H', ':Hardtime toggle<CR>')
+map('n', '<leader>H', '<CMD>lua require("plugins.hardtime").ToggleHardtime()<CR>')
diff --git a/.config/nvim/lua/user/mods.lua b/.config/nvim/lua/user/mods.lua
index 84498bb..6d357f5 100644
--- a/.config/nvim/lua/user/mods.lua
+++ b/.config/nvim/lua/user/mods.lua
@@ -800,6 +800,9 @@ vim.api.nvim_create_autocmd({ 'BufNew' }, {
['pdf'] = function(buf, fpath, fname)
open_in_prog(buf, fpath, fname, 'zathura')
end,
+ ['epub'] = function(buf, fpath, fname)
+ open_in_prog(buf, fpath, fname, 'zathura')
+ end,
['png'] = function(buf, fpath, fname)
open_in_prog(buf, fpath, fname, 'feh')
end,
diff --git a/.config/nvim/lua/user/pack.lua b/.config/nvim/lua/user/pack.lua
index 3cd66c0..2a56e19 100644
--- a/.config/nvim/lua/user/pack.lua
+++ b/.config/nvim/lua/user/pack.lua
@@ -237,12 +237,7 @@ return packer.startup(function(use)
},
})
use('kawre/leetcode.nvim')
- use({
- 'm4xshen/hardtime.nvim',
- config = function()
- require('hardtime').setup()
- end,
- })
+ use('m4xshen/hardtime.nvim')
use({
'luckasRanarison/nvim-devdocs',
config = function()
@@ -257,15 +252,8 @@ return packer.startup(function(use)
use('NTBBloodbath/doom-one.nvim')
use('nyngwang/nvimgelion')
use('projekt0n/github-nvim-theme')
- use({
- 'folke/tokyonight.nvim',
- config = function()
- require('tokyonight').setup({
- transparent = true,
- dim_inactive = false,
- })
- end,
- })
+ use('folke/tokyonight.nvim')
+ use('ribru17/bamboo.nvim')
-- UI
use('kyazdani42/nvim-web-devicons') --
diff --git a/.config/nvim/lua/user/view.lua b/.config/nvim/lua/user/view.lua
index 50cea8c..4bafbd0 100644
--- a/.config/nvim/lua/user/view.lua
+++ b/.config/nvim/lua/user/view.lua
@@ -4,12 +4,13 @@
vim.opt.termguicolors = true
-- Available colorschemes:
--- [[ nightfly ayu onedark doom-one nvimgelion github_dark tokyonight ]]
+-- [[ nightfly ayu onedark doom-one nvimgelion github_dark tokyonight bamboo ]]
require('tokyonight').setup({
style = 'night',
transparent = true,
transparent_sidebar = true,
+ dim_inactive = false,
styles = {
sidebars = 'transparent',
floats = 'transparent',
@@ -17,7 +18,7 @@ require('tokyonight').setup({
})
-- Define default color scheme
-local default_colorscheme = 'tokyonight'
+local default_colorscheme = 'bamboo'
local fallback_colorscheme = 'desert'
-- Attempt to set the default color scheme