From adc5ebe45fd1ca190c805c4a7a6da4e4a8410a2c Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Mon, 4 Aug 2025 23:29:31 -0400 Subject: [PATCH] edits --- lua/chadrc.lua | 2 +- lua/custom_telescope.lua | 14 ++++++++++++ lua/mappings.lua | 42 ++++++++++++++++++++++++++++++++++ lua/options.lua | 49 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 lua/custom_telescope.lua diff --git a/lua/chadrc.lua b/lua/chadrc.lua index c82dca1..ba0c2ae 100644 --- a/lua/chadrc.lua +++ b/lua/chadrc.lua @@ -6,7 +6,7 @@ local M = {} M.base46 = { - theme = "onedark", + theme = "dark_horizon", -- hl_override = { -- Comment = { italic = true }, diff --git a/lua/custom_telescope.lua b/lua/custom_telescope.lua new file mode 100644 index 0000000..c928164 --- /dev/null +++ b/lua/custom_telescope.lua @@ -0,0 +1,14 @@ +local telescope = require('telescope.builtin') + +local M = {} + +function M.search_markdown_tasks() + telescope.grep_string({ + prompt_title = "Open Task List", + search = "- [ ]", -- Customize if needed for specific task markers + cwd = vim.fn.expand('%:p:h') -- Current file's directory + }) +end + +return M + diff --git a/lua/mappings.lua b/lua/mappings.lua index 783b78f..8977dd2 100644 --- a/lua/mappings.lua +++ b/lua/mappings.lua @@ -8,3 +8,45 @@ map("n", ";", ":", { desc = "CMD enter command mode" }) map("i", "jk", "") -- map({ "n", "i", "v" }, "", " w ") +-- Add a keybinding for searching Markdown tasks +vim.api.nvim_set_keymap('n', 'mt', ':lua require("custom_telescope").search_markdown_tasks()', { noremap = true, silent = true }) +-- Add a keybinding for calling ObsidianTag +vim.api.nvim_set_keymap('n', 'tt', ':ObsidianTag', { noremap = true, silent = true }) +-- Add a keybinding for calling ObsidianBacklinks +vim.api.nvim_set_keymap('n', 'lb', ':ObsidianBacklinks', { noremap = true, silent = true }) + +-- Configure Telescope to scroll files with ctrl+j/k +local actions = require('telescope.actions') +-- local sorters = require('telescope.sorters') + +require('telescope').setup { + defaults = { + mappings = { + i = { + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + }, + }, + }, +} + +-- make leader-e toggle the tree view as opposed to just setting focus +vim.api.nvim_set_keymap('n', 'e', ':NvimTreeToggle', {noremap = true, silent = true}) + +-- move the whole page without moving the cursor +vim.api.nvim_set_keymap('n', 'J', '', { noremap = true }) +vim.api.nvim_set_keymap('n', 'K', '', { noremap = true }) + +-- Resize windows +vim.api.nvim_set_keymap('n', '', '5+', { silent = true }) +vim.api.nvim_set_keymap('n', '', '5-', { silent = true }) +vim.api.nvim_set_keymap('n', '', '10>', { silent = true }) +vim.api.nvim_set_keymap('n', '', '10<', { silent = true }) + +-- Set the tab width to 4 spaces +vim.cmd('set tabstop=4') +vim.cmd('set shiftwidth=4') +vim.cmd('set expandtab') + +vim.o.hidden = true + diff --git a/lua/options.lua b/lua/options.lua index 738f20b..981c510 100644 --- a/lua/options.lua +++ b/lua/options.lua @@ -4,3 +4,52 @@ require "nvchad.options" -- local o = vim.o -- o.cursorlineopt ='both' -- to enable cursorline! +require('telescope').setup{ + defaults = { + layout_config = { + prompt_position = "top" + } + } +} + +require('nvim-tree').setup{ + filters = { + enable = true, + git_ignored = false, + dotfiles = false, + git_clean = false, + no_buffer = false, + no_bookmark = false, + custom = {}, + exclude = {}, + }, + disable_netrw = true, + hijack_cursor = true, + sync_root_with_cwd = true, + update_focused_file = { + enable = true, + update_root = false, + }, + view = { + width = 30, + preserve_window_proportions = true, + }, + renderer = { + root_folder_label = false, + highlight_git = true, + indent_markers = { enable = true }, + icons = { + glyphs = { + default = "󰈚", + folder = { + default = "", + empty = "", + empty_open = "", + open = "", + symlink = "", + }, + git = { unmerged = "" }, + }, + }, + }, +}