From 0cde83cfa15c5c0b8d117c34a8bfae38b4dec39c Mon Sep 17 00:00:00 2001 From: Ariel D'Alessandro Date: Sun, 26 Mar 2023 19:37:38 +0200 Subject: feat: remove mind since is deprecated --- lua/alpha/completition/init.lua | 5 ++++- lua/alpha/globals.lua | 16 +++++++++++++--- lua/alpha/telescope/actions.lua | 6 ++++++ lua/alpha/telescope/init.lua | 14 +++++++++++++- lua/alpha/telescope/mappings.lua | 1 + lua/config/options.lua | 1 + lua/plugins/mind.lua | 16 ---------------- lua/plugins/transparent.lua | 3 +++ lua/plugins/vimwiki.lua | 12 ++++++++++++ 9 files changed, 53 insertions(+), 21 deletions(-) delete mode 100644 lua/plugins/mind.lua create mode 100644 lua/plugins/vimwiki.lua (limited to 'lua') diff --git a/lua/alpha/completition/init.lua b/lua/alpha/completition/init.lua index eeb9cbe..02c9978 100644 --- a/lua/alpha/completition/init.lua +++ b/lua/alpha/completition/init.lua @@ -48,7 +48,10 @@ cmp.setup { get_bufnrs = function() local bufs = {} for _, win in ipairs(vim.api.nvim_list_wins()) do - bufs[vim.api.nvim_win_get_buf(win)] = true + local bufnr = vim.api.nvim_win_get_buf(win) + if vim.api.nvim_buf_get_option(bufnr, 'buftype') ~= 'terminal' then + bufs[bufnr] = true + end end return vim.tbl_keys(bufs) end, diff --git a/lua/alpha/globals.lua b/lua/alpha/globals.lua index d6fd70c..b575c0c 100644 --- a/lua/alpha/globals.lua +++ b/lua/alpha/globals.lua @@ -1,6 +1,16 @@ -P = function(v) - print(vim.inspect(v)) - return v +--- Dumps all values into pretty print +---@vararg any +---@return any +dump = function(...) + local args = {...} + + local mapped = {} + for _, v in ipairs(args) do + table.insert(mapped, vim.inspect(v)) + end + print(unpack(mapped)) + + return unpack(args) end RELOAD = function(...) diff --git a/lua/alpha/telescope/actions.lua b/lua/alpha/telescope/actions.lua index abd3381..c7cdaa8 100644 --- a/lua/alpha/telescope/actions.lua +++ b/lua/alpha/telescope/actions.lua @@ -160,4 +160,10 @@ M.enable_plugin = function(prompt_bufnr) end) end +M.create_scratch_file = function(prompt_bufnr) + local new_scratch = action_state.get_current_line() + actions.close(prompt_bufnr) + vim.cmd(string.format("edit ~/.config/nvim/lua/scratchs/%s.lua", new_scratch)) +end + return M diff --git a/lua/alpha/telescope/init.lua b/lua/alpha/telescope/init.lua index b5087b3..28397b0 100644 --- a/lua/alpha/telescope/init.lua +++ b/lua/alpha/telescope/init.lua @@ -8,7 +8,6 @@ local reloader = function() end end -local action_state = require "telescope.actions.state" local fb_actions = require("telescope").extensions.file_browser.actions local actions = require "telescope.actions" local my_actions = require "alpha.telescope.actions" @@ -94,6 +93,19 @@ function M.my_plugins() } end +function M.scratchs() + require("telescope.builtin").find_files { + prompt_title = "Scratchs", + no_ignore = true, + cwd = "~/.config/nvim/lua/scratchs/", + attach_mappings = function (_, map) + map("i", "", my_actions.create_scratch_file) + + return true + end + } +end + function M.projectionist() return require("telescope").extensions.projectionist.projectionist() end diff --git a/lua/alpha/telescope/mappings.lua b/lua/alpha/telescope/mappings.lua index 7d0f697..be59eaf 100644 --- a/lua/alpha/telescope/mappings.lua +++ b/lua/alpha/telescope/mappings.lua @@ -29,6 +29,7 @@ map_tele("pf", "projectionist") map_tele("rc", "search_config") map_tele("rn", "find_nvim_config") map_tele("rp", "find_nvim_plugin") +map_tele("rs", "scratchs") map_tele("ph", "help_tags") map_tele("pe", "buffers") map_tele("pr", "treesitter") diff --git a/lua/config/options.lua b/lua/config/options.lua index c4d1f56..30a3127 100644 --- a/lua/config/options.lua +++ b/lua/config/options.lua @@ -36,6 +36,7 @@ opt.laststatus = 3 opt.cmdheight = 1 opt.updatetime = 50 opt.signcolumn = "yes" +opt.equalalways = false if vim.fn.has "nvim-0.9.0" == 1 then opt.splitkeep = "screen" diff --git a/lua/plugins/mind.lua b/lua/plugins/mind.lua deleted file mode 100644 index f474e96..0000000 --- a/lua/plugins/mind.lua +++ /dev/null @@ -1,16 +0,0 @@ -return { - "phaazon/mind.nvim", - branch = "v2.2", - dependencies = { "nvim-lua/plenary.nvim" }, - cmd = { "MindOpenMain", "MindOpenProject" }, - config = function() - local dirs = {} - if vim.fn.isdirectory "/mnt/nas/alpha/mind/data" == 1 then - dirs = { - state_path = "/mnt/nas/alpha/mind/mind.json", - data_dir = "/mnt/nas/alpha/mind/data", - } - end - require("mind").setup { persistence = dirs } - end, -} diff --git a/lua/plugins/transparent.lua b/lua/plugins/transparent.lua index f1d2139..6a74786 100644 --- a/lua/plugins/transparent.lua +++ b/lua/plugins/transparent.lua @@ -1,5 +1,8 @@ return { "xiyaowong/nvim-transparent", event = "VeryLazy", + init = function () + vim.g.transparent_enabled = true + end, config = true, } diff --git a/lua/plugins/vimwiki.lua b/lua/plugins/vimwiki.lua new file mode 100644 index 0000000..581cd33 --- /dev/null +++ b/lua/plugins/vimwiki.lua @@ -0,0 +1,12 @@ +return { + "vimwiki/vimwiki", + cmd = { "VimwikiIndex" }, + init = function() + vim.g.vimwiki_list = {{ + path = "/mnt/nas/alpha/wiki", + syntax = "markdown", + ext = ".md", + }} + vim.g.vimwiki_global_ext = 0 + end, +} -- cgit v1.2.3