From 437a8fc86b44761d9fe77102a3a2321f6fc3e9a1 Mon Sep 17 00:00:00 2001 From: Marc Talcott Date: Tue, 28 May 2024 14:26:17 -0400 Subject: [PATCH 01/21] Initial Commit --- .DS_Store | Bin 0 -> 6148 bytes init.lua | 810 +++----------------- lua/.DS_Store | Bin 0 -> 6148 bytes lua/custom/plugins/init.lua | 5 - lua/kickstart/.DS_Store | Bin 0 -> 6148 bytes lua/kickstart/plugins/lint.lua | 55 -- lua/{kickstart => }/plugins/autopairs.lua | 0 lua/{kickstart => }/plugins/debug.lua | 0 lua/{kickstart => }/plugins/gitsigns.lua | 0 lua/{kickstart => }/plugins/indent_line.lua | 0 lua/plugins/lualine.lua | 46 ++ lua/{kickstart => }/plugins/neo-tree.lua | 1 + lua/plugins/obsidian.lua | 37 + lua/plugins/plugins.lua | 703 +++++++++++++++++ 14 files changed, 875 insertions(+), 782 deletions(-) create mode 100644 .DS_Store create mode 100644 lua/.DS_Store delete mode 100644 lua/custom/plugins/init.lua create mode 100644 lua/kickstart/.DS_Store delete mode 100644 lua/kickstart/plugins/lint.lua rename lua/{kickstart => }/plugins/autopairs.lua (100%) rename lua/{kickstart => }/plugins/debug.lua (100%) rename lua/{kickstart => }/plugins/gitsigns.lua (100%) rename lua/{kickstart => }/plugins/indent_line.lua (100%) create mode 100644 lua/plugins/lualine.lua rename lua/{kickstart => }/plugins/neo-tree.lua (95%) create mode 100644 lua/plugins/obsidian.lua create mode 100644 lua/plugins/plugins.lua diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..e83db73c0ed0d222241b9223d8b85b0a68a3345d GIT binary patch literal 6148 zcmeH~I}XA?3`A{0fkcy%avKi74OR$FzyA!;KrJ4LH~3h_y_ - - : - - Tutor - - + If you don't know what this means, type the following: + - + - : + - Tutor + - - (If you already know the Neovim basics, you can skip this step.) + (If you already know the Neovim basics, you can skip this step.) - Once you've completed that, you can continue working through **AND READING** the rest - of the kickstart init.lua. +Once you've completed that, you can continue working through **AND READING** the rest +of the kickstart init.lua. - Next, run AND READ `:help`. - This will open up a help window with some basic information - about reading, navigating and searching the builtin help documentation. +Next, run AND READ `:help`. + This will open up a help window with some basic information + about reading, navigating and searching the builtin help documentation. - This should be the first place you go to look when you're stuck or confused - with something. It's one of my favorite Neovim features. + This should be the first place you go to look when you're stuck or confused + with something. It's one of my favorite Neovim features. - MOST IMPORTANTLY, we provide a keymap "sh" to [s]earch the [h]elp documentation, - which is very useful when you're not exactly sure of what you're looking for. + MOST IMPORTANTLY, we provide a keymap "sh" to [s]earch the [h]elp documentation, + which is very useful when you're not exactly sure of what you're looking for. - I have left several `:help X` comments throughout the init.lua - These are hints about where to find more information about the relevant settings, - plugins or Neovim features used in Kickstart. +I have left several `:help X` c +~ │ 38omments throughout the init.lua + These are hints about where to find more information about the relevant settings, + plugins or Neovim features used in Kickstart. - NOTE: Look for lines like this + NOTE: Look for lines like this - Throughout the file. These are for you, the reader, to help you understand what is happening. - Feel free to delete them once you know what you're doing, but they should serve as a guide - for when you are first encountering a few different constructs in your Neovim config. + Throughout the file. These are for you, the reader, to help you understand what is happening. + Feel free to delete them once you know what you're doing, but they should serve as a guide + for when you are first encountering a few different constructs in your Neovim config. If you experience any errors while trying to install kickstart, run `:checkhealth` for more info. @@ -91,7 +92,7 @@ vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' -- Set to true if you have a Nerd Font installed and selected in the terminal -vim.g.have_nerd_font = false +vim.g.have_nerd_font = true -- [[ Setting options ]] -- See `:help vim.opt` @@ -102,7 +103,7 @@ vim.g.have_nerd_font = false vim.opt.number = true -- You can also add relative line numbers, to help with jumping. -- Experiment for yourself to see if you like it! --- vim.opt.relativenumber = true +vim.opt.relativenumber = true -- Enable mouse mode, can be useful for resizing splits for example! vim.opt.mouse = 'a' @@ -190,6 +191,18 @@ vim.keymap.set('n', '', '', { desc = 'Move focus to the right win vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) +vim.keymap.set('n', 'ww', 'w', { desc = 'Switch [W]indow' }) +vim.keymap.set('n', 'wc', 'c', { desc = '[C]lose window' }) +vim.keymap.set('n', 'w+', '+', { desc = 'Increase size' }) +vim.keymap.set('n', 'w-', '-', { desc = 'Decrease size' }) + +vim.keymap.set('n', 'n', ':Neotree', { desc = 'Open Neotree' }) + +-- vim.keymap.set('n', 'wh', '', { desc = 'Move focus to the left window' }) +-- vim.keymap.set('n', 'wl', '', { desc = 'Move focus to the right window' }) +-- vim.keymap.set('n', 'wj', '', { desc = 'Move focus to the lower window' }) +-- vim.keymap.set('n', 'wk', '', { desc = 'Move focus to the upper window' }) + -- [[ Basic Autocommands ]] -- See `:help lua-guide-autocommands` @@ -224,689 +237,42 @@ vim.opt.rtp:prepend(lazypath) -- :Lazy update -- -- NOTE: Here is where you install your plugins. -require('lazy').setup({ - -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). - 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically - - -- NOTE: Plugins can also be added by using a table, - -- with the first argument being the link and the following - -- keys can be used to configure plugin behavior/loading/etc. - -- - -- Use `opts = {}` to force a plugin to be loaded. - -- - -- This is equivalent to: - -- require('Comment').setup({}) - - -- "gc" to comment visual regions/lines - { 'numToStr/Comment.nvim', opts = {} }, - - -- Here is a more advanced example where we pass configuration - -- options to `gitsigns.nvim`. This is equivalent to the following Lua: - -- require('gitsigns').setup({ ... }) - -- - -- See `:help gitsigns` to understand what the configuration keys do - { -- Adds git related signs to the gutter, as well as utilities for managing changes - 'lewis6991/gitsigns.nvim', - opts = { - signs = { - add = { text = '+' }, - change = { text = '~' }, - delete = { text = '_' }, - topdelete = { text = '‾' }, - changedelete = { text = '~' }, - }, - }, - }, - - -- NOTE: Plugins can also be configured to run Lua code when they are loaded. - -- - -- This is often very useful to both group configuration, as well as handle - -- lazy loading plugins that don't need to be loaded immediately at startup. - -- - -- For example, in the following configuration, we use: - -- event = 'VimEnter' - -- - -- which loads which-key before all the UI elements are loaded. Events can be - -- normal autocommands events (`:help autocmd-events`). - -- - -- Then, because we use the `config` key, the configuration only runs - -- after the plugin has been loaded: - -- config = function() ... end - - { -- Useful plugin to show you pending keybinds. - 'folke/which-key.nvim', - event = 'VimEnter', -- Sets the loading event to 'VimEnter' - config = function() -- This is the function that runs, AFTER loading - require('which-key').setup() - - -- Document existing key chains - require('which-key').register { - ['c'] = { name = '[C]ode', _ = 'which_key_ignore' }, - ['d'] = { name = '[D]ocument', _ = 'which_key_ignore' }, - ['r'] = { name = '[R]ename', _ = 'which_key_ignore' }, - ['s'] = { name = '[S]earch', _ = 'which_key_ignore' }, - ['w'] = { name = '[W]orkspace', _ = 'which_key_ignore' }, - ['t'] = { name = '[T]oggle', _ = 'which_key_ignore' }, - ['h'] = { name = 'Git [H]unk', _ = 'which_key_ignore' }, - } - -- visual mode - require('which-key').register({ - ['h'] = { 'Git [H]unk' }, - }, { mode = 'v' }) - end, - }, - - -- NOTE: Plugins can specify dependencies. - -- - -- The dependencies are proper plugin specifications as well - anything - -- you do for a plugin at the top level, you can do for a dependency. - -- - -- Use the `dependencies` key to specify the dependencies of a particular plugin - - { -- Fuzzy Finder (files, lsp, etc) - 'nvim-telescope/telescope.nvim', - event = 'VimEnter', - branch = '0.1.x', - dependencies = { - 'nvim-lua/plenary.nvim', - { -- If encountering errors, see telescope-fzf-native README for installation instructions - 'nvim-telescope/telescope-fzf-native.nvim', - - -- `build` is used to run some command when the plugin is installed/updated. - -- This is only run then, not every time Neovim starts up. - build = 'make', - - -- `cond` is a condition used to determine whether this plugin should be - -- installed and loaded. - cond = function() - return vim.fn.executable 'make' == 1 - end, - }, - { 'nvim-telescope/telescope-ui-select.nvim' }, - - -- Useful for getting pretty icons, but requires a Nerd Font. - { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, - }, - config = function() - -- Telescope is a fuzzy finder that comes with a lot of different things that - -- it can fuzzy find! It's more than just a "file finder", it can search - -- many different aspects of Neovim, your workspace, LSP, and more! - -- - -- The easiest way to use Telescope, is to start by doing something like: - -- :Telescope help_tags - -- - -- After running this command, a window will open up and you're able to - -- type in the prompt window. You'll see a list of `help_tags` options and - -- a corresponding preview of the help. - -- - -- Two important keymaps to use while in Telescope are: - -- - Insert mode: - -- - Normal mode: ? - -- - -- This opens a window that shows you all of the keymaps for the current - -- Telescope picker. This is really useful to discover what Telescope can - -- do as well as how to actually do it! - - -- [[ Configure Telescope ]] - -- See `:help telescope` and `:help telescope.setup()` - require('telescope').setup { - -- You can put your default mappings / updates / etc. in here - -- All the info you're looking for is in `:help telescope.setup()` - -- - -- defaults = { - -- mappings = { - -- i = { [''] = 'to_fuzzy_refine' }, - -- }, - -- }, - -- pickers = {} - extensions = { - ['ui-select'] = { - require('telescope.themes').get_dropdown(), - }, - }, - } - - -- Enable Telescope extensions if they are installed - pcall(require('telescope').load_extension, 'fzf') - pcall(require('telescope').load_extension, 'ui-select') - - -- See `:help telescope.builtin` - local builtin = require 'telescope.builtin' - vim.keymap.set('n', 'sh', builtin.help_tags, { desc = '[S]earch [H]elp' }) - vim.keymap.set('n', 'sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' }) - vim.keymap.set('n', 'sf', builtin.find_files, { desc = '[S]earch [F]iles' }) - vim.keymap.set('n', 'ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' }) - vim.keymap.set('n', 'sw', builtin.grep_string, { desc = '[S]earch current [W]ord' }) - vim.keymap.set('n', 'sg', builtin.live_grep, { desc = '[S]earch by [G]rep' }) - vim.keymap.set('n', 'sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' }) - vim.keymap.set('n', 'sr', builtin.resume, { desc = '[S]earch [R]esume' }) - vim.keymap.set('n', 's.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) - vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) - - -- Slightly advanced example of overriding default behavior and theme - vim.keymap.set('n', '/', function() - -- You can pass additional configuration to Telescope to change the theme, layout, etc. - builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { - winblend = 10, - previewer = false, - }) - end, { desc = '[/] Fuzzily search in current buffer' }) - - -- It's also possible to pass additional configuration options. - -- See `:help telescope.builtin.live_grep()` for information about particular keys - vim.keymap.set('n', 's/', function() - builtin.live_grep { - grep_open_files = true, - prompt_title = 'Live Grep in Open Files', - } - end, { desc = '[S]earch [/] in Open Files' }) - - -- Shortcut for searching your Neovim configuration files - vim.keymap.set('n', 'sn', function() - builtin.find_files { cwd = vim.fn.stdpath 'config' } - end, { desc = '[S]earch [N]eovim files' }) - end, - }, - - { -- LSP Configuration & Plugins - 'neovim/nvim-lspconfig', - dependencies = { - -- Automatically install LSPs and related tools to stdpath for Neovim - { 'williamboman/mason.nvim', config = true }, -- NOTE: Must be loaded before dependants - 'williamboman/mason-lspconfig.nvim', - 'WhoIsSethDaniel/mason-tool-installer.nvim', - - -- Useful status updates for LSP. - -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` - { 'j-hui/fidget.nvim', opts = {} }, - - -- `neodev` configures Lua LSP for your Neovim config, runtime and plugins - -- used for completion, annotations and signatures of Neovim apis - { 'folke/neodev.nvim', opts = {} }, - }, - config = function() - -- Brief aside: **What is LSP?** - -- - -- LSP is an initialism you've probably heard, but might not understand what it is. - -- - -- LSP stands for Language Server Protocol. It's a protocol that helps editors - -- and language tooling communicate in a standardized fashion. - -- - -- In general, you have a "server" which is some tool built to understand a particular - -- language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc.). These Language Servers - -- (sometimes called LSP servers, but that's kind of like ATM Machine) are standalone - -- processes that communicate with some "client" - in this case, Neovim! - -- - -- LSP provides Neovim with features like: - -- - Go to definition - -- - Find references - -- - Autocompletion - -- - Symbol Search - -- - and more! - -- - -- Thus, Language Servers are external tools that must be installed separately from - -- Neovim. This is where `mason` and related plugins come into play. - -- - -- If you're wondering about lsp vs treesitter, you can check out the wonderfully - -- and elegantly composed help section, `:help lsp-vs-treesitter` - - -- This function gets run when an LSP attaches to a particular buffer. - -- That is to say, every time a new file is opened that is associated with - -- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this - -- function will be executed to configure the current buffer - vim.api.nvim_create_autocmd('LspAttach', { - group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }), - callback = function(event) - -- NOTE: Remember that Lua is a real programming language, and as such it is possible - -- to define small helper and utility functions so you don't have to repeat yourself. - -- - -- In this case, we create a function that lets us more easily define mappings specific - -- for LSP related items. It sets the mode, buffer and description for us each time. - local map = function(keys, func, desc) - vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) - end - - -- Jump to the definition of the word under your cursor. - -- This is where a variable was first declared, or where a function is defined, etc. - -- To jump back, press . - map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') - - -- Find references for the word under your cursor. - map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') - - -- Jump to the implementation of the word under your cursor. - -- Useful when your language has ways of declaring types without an actual implementation. - map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') - - -- Jump to the type of the word under your cursor. - -- Useful when you're not sure what type a variable is and you want to see - -- the definition of its *type*, not where it was *defined*. - map('D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition') - - -- Fuzzy find all the symbols in your current document. - -- Symbols are things like variables, functions, types, etc. - map('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') - - -- Fuzzy find all the symbols in your current workspace. - -- Similar to document symbols, except searches over your entire project. - map('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') - - -- Rename the variable under your cursor. - -- Most Language Servers support renaming across files, etc. - map('rn', vim.lsp.buf.rename, '[R]e[n]ame') - - -- Execute a code action, usually your cursor needs to be on top of an error - -- or a suggestion from your LSP for this to activate. - map('ca', vim.lsp.buf.code_action, '[C]ode [A]ction') - - -- Opens a popup that displays documentation about the word under your cursor - -- See `:help K` for why this keymap. - map('K', vim.lsp.buf.hover, 'Hover Documentation') - - -- WARN: This is not Goto Definition, this is Goto Declaration. - -- For example, in C this would take you to the header. - map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') - - -- The following two autocommands are used to highlight references of the - -- word under your cursor when your cursor rests there for a little while. - -- See `:help CursorHold` for information about when this is executed - -- - -- When you move your cursor, the highlights will be cleared (the second autocommand). - local client = vim.lsp.get_client_by_id(event.data.client_id) - if client and client.server_capabilities.documentHighlightProvider then - local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false }) - vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { - buffer = event.buf, - group = highlight_augroup, - callback = vim.lsp.buf.document_highlight, - }) - - vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { - buffer = event.buf, - group = highlight_augroup, - callback = vim.lsp.buf.clear_references, - }) - - vim.api.nvim_create_autocmd('LspDetach', { - group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }), - callback = function(event2) - vim.lsp.buf.clear_references() - vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf } - end, - }) - end - - -- The following autocommand is used to enable inlay hints in your - -- code, if the language server you are using supports them - -- - -- This may be unwanted, since they displace some of your code - if client and client.server_capabilities.inlayHintProvider and vim.lsp.inlay_hint then - map('th', function() - vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled()) - end, '[T]oggle Inlay [H]ints') - end - end, - }) - - -- LSP servers and clients are able to communicate to each other what features they support. - -- By default, Neovim doesn't support everything that is in the LSP specification. - -- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities. - -- So, we create new capabilities with nvim cmp, and then broadcast that to the servers. - local capabilities = vim.lsp.protocol.make_client_capabilities() - capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities()) - - -- Enable the following language servers - -- Feel free to add/remove any LSPs that you want here. They will automatically be installed. - -- - -- Add any additional override configuration in the following tables. Available keys are: - -- - cmd (table): Override the default command used to start the server - -- - filetypes (table): Override the default list of associated filetypes for the server - -- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features. - -- - settings (table): Override the default settings passed when initializing the server. - -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ - local servers = { - -- clangd = {}, - -- gopls = {}, - -- pyright = {}, - -- rust_analyzer = {}, - -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs - -- - -- Some languages (like typescript) have entire language plugins that can be useful: - -- https://github.com/pmizio/typescript-tools.nvim - -- - -- But for many setups, the LSP (`tsserver`) will work just fine - -- tsserver = {}, - -- - - lua_ls = { - -- cmd = {...}, - -- filetypes = { ...}, - -- capabilities = {}, - settings = { - Lua = { - completion = { - callSnippet = 'Replace', - }, - -- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings - -- diagnostics = { disable = { 'missing-fields' } }, - }, - }, - }, - } - - -- Ensure the servers and tools above are installed - -- To check the current status of installed tools and/or manually install - -- other tools, you can run - -- :Mason - -- - -- You can press `g?` for help in this menu. - require('mason').setup() - - -- You can add other tools here that you want Mason to install - -- for you, so that they are available from within Neovim. - local ensure_installed = vim.tbl_keys(servers or {}) - vim.list_extend(ensure_installed, { - 'stylua', -- Used to format Lua code - }) - require('mason-tool-installer').setup { ensure_installed = ensure_installed } - - require('mason-lspconfig').setup { - handlers = { - function(server_name) - local server = servers[server_name] or {} - -- This handles overriding only values explicitly passed - -- by the server configuration above. Useful when disabling - -- certain features of an LSP (for example, turning off formatting for tsserver) - server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) - require('lspconfig')[server_name].setup(server) - end, - }, - } - end, - }, - - { -- Autoformat - 'stevearc/conform.nvim', - lazy = false, - keys = { - { - 'f', - function() - require('conform').format { async = true, lsp_fallback = true } - end, - mode = '', - desc = '[F]ormat buffer', - }, - }, - opts = { - notify_on_error = false, - format_on_save = function(bufnr) - -- Disable "format_on_save lsp_fallback" for languages that don't - -- have a well standardized coding style. You can add additional - -- languages here or re-enable it for the disabled ones. - local disable_filetypes = { c = true, cpp = true } - return { - timeout_ms = 500, - lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype], - } - end, - formatters_by_ft = { - lua = { 'stylua' }, - -- Conform can also run multiple formatters sequentially - -- python = { "isort", "black" }, - -- - -- You can use a sub-list to tell conform to run *until* a formatter - -- is found. - -- javascript = { { "prettierd", "prettier" } }, - }, - }, - }, - - { -- Autocompletion - 'hrsh7th/nvim-cmp', - event = 'InsertEnter', - dependencies = { - -- Snippet Engine & its associated nvim-cmp source - { - 'L3MON4D3/LuaSnip', - build = (function() - -- Build Step is needed for regex support in snippets. - -- This step is not supported in many windows environments. - -- Remove the below condition to re-enable on windows. - if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then - return - end - return 'make install_jsregexp' - end)(), - dependencies = { - -- `friendly-snippets` contains a variety of premade snippets. - -- See the README about individual language/framework/plugin snippets: - -- https://github.com/rafamadriz/friendly-snippets - -- { - -- 'rafamadriz/friendly-snippets', - -- config = function() - -- require('luasnip.loaders.from_vscode').lazy_load() - -- end, - -- }, - }, - }, - 'saadparwaiz1/cmp_luasnip', - - -- Adds other completion capabilities. - -- nvim-cmp does not ship with all sources by default. They are split - -- into multiple repos for maintenance purposes. - 'hrsh7th/cmp-nvim-lsp', - 'hrsh7th/cmp-path', - }, - config = function() - -- See `:help cmp` - local cmp = require 'cmp' - local luasnip = require 'luasnip' - luasnip.config.setup {} - - cmp.setup { - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - completion = { completeopt = 'menu,menuone,noinsert' }, - - -- For an understanding of why these mappings were - -- chosen, you will need to read `:help ins-completion` - -- - -- No, but seriously. Please read `:help ins-completion`, it is really good! - mapping = cmp.mapping.preset.insert { - -- Select the [n]ext item - [''] = cmp.mapping.select_next_item(), - -- Select the [p]revious item - [''] = cmp.mapping.select_prev_item(), - - -- Scroll the documentation window [b]ack / [f]orward - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - - -- Accept ([y]es) the completion. - -- This will auto-import if your LSP supports it. - -- This will expand snippets if the LSP sent a snippet. - [''] = cmp.mapping.confirm { select = true }, - - -- If you prefer more traditional completion keymaps, - -- you can uncomment the following lines - --[''] = cmp.mapping.confirm { select = true }, - --[''] = cmp.mapping.select_next_item(), - --[''] = cmp.mapping.select_prev_item(), - - -- Manually trigger a completion from nvim-cmp. - -- Generally you don't need this, because nvim-cmp will display - -- completions whenever it has completion options available. - [''] = cmp.mapping.complete {}, - - -- Think of as moving to the right of your snippet expansion. - -- So if you have a snippet that's like: - -- function $name($args) - -- $body - -- end - -- - -- will move you to the right of each of the expansion locations. - -- is similar, except moving you backwards. - [''] = cmp.mapping(function() - if luasnip.expand_or_locally_jumpable() then - luasnip.expand_or_jump() - end - end, { 'i', 's' }), - [''] = cmp.mapping(function() - if luasnip.locally_jumpable(-1) then - luasnip.jump(-1) - end - end, { 'i', 's' }), - - -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see: - -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps - }, - sources = { - { name = 'nvim_lsp' }, - { name = 'luasnip' }, - { name = 'path' }, - }, - } - end, - }, - - { -- You can easily change to a different colorscheme. - -- Change the name of the colorscheme plugin below, and then - -- change the command in the config to whatever the name of that colorscheme is. - -- - -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`. - 'folke/tokyonight.nvim', - priority = 1000, -- Make sure to load this before all the other start plugins. - init = function() - -- Load the colorscheme here. - -- Like many other themes, this one has different styles, and you could load - -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. - vim.cmd.colorscheme 'tokyonight-night' - - -- You can configure highlights by doing something like: - vim.cmd.hi 'Comment gui=none' - end, - }, - - -- Highlight todo, notes, etc in comments - { 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } }, - - { -- Collection of various small independent plugins/modules - 'echasnovski/mini.nvim', - config = function() - -- Better Around/Inside textobjects - -- - -- Examples: - -- - va) - [V]isually select [A]round [)]paren - -- - yinq - [Y]ank [I]nside [N]ext [']quote - -- - ci' - [C]hange [I]nside [']quote - require('mini.ai').setup { n_lines = 500 } - - -- Add/delete/replace surroundings (brackets, quotes, etc.) - -- - -- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren - -- - sd' - [S]urround [D]elete [']quotes - -- - sr)' - [S]urround [R]eplace [)] ['] - require('mini.surround').setup() - - -- Simple and easy statusline. - -- You could remove this setup call if you don't like it, - -- and try some other statusline plugin - local statusline = require 'mini.statusline' - -- set use_icons to true if you have a Nerd Font - statusline.setup { use_icons = vim.g.have_nerd_font } - - -- You can configure sections in the statusline by overriding their - -- default behavior. For example, here we set the section for - -- cursor location to LINE:COLUMN - ---@diagnostic disable-next-line: duplicate-set-field - statusline.section_location = function() - return '%2l:%-2v' - end - - -- ... and there is more! - -- Check out: https://github.com/echasnovski/mini.nvim - end, - }, - { -- Highlight, edit, and navigate code - 'nvim-treesitter/nvim-treesitter', - build = ':TSUpdate', - opts = { - ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'vim', 'vimdoc' }, - -- Autoinstall languages that are not installed - auto_install = true, - highlight = { - enable = true, - -- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules. - -- If you are experiencing weird indenting issues, add the language to - -- the list of additional_vim_regex_highlighting and disabled languages for indent. - additional_vim_regex_highlighting = { 'ruby' }, - }, - indent = { enable = true, disable = { 'ruby' } }, - }, - config = function(_, opts) - -- [[ Configure Treesitter ]] See `:help nvim-treesitter` - - -- Prefer git instead of curl in order to improve connectivity in some environments - require('nvim-treesitter.install').prefer_git = true - ---@diagnostic disable-next-line: missing-fields - require('nvim-treesitter.configs').setup(opts) - - -- There are additional nvim-treesitter modules that you can use to interact - -- with nvim-treesitter. You should go explore a few and see what interests you: - -- - -- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod` - -- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context - -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects - end, - }, - - -- The following two comments only work if you have downloaded the kickstart repo, not just copy pasted the - -- init.lua. If you want these files, they are in the repository, so you can just download them and - -- place them in the correct locations. - - -- NOTE: Next step on your Neovim journey: Add/Configure additional plugins for Kickstart - -- - -- Here are some example plugins that I've included in the Kickstart repository. - -- Uncomment any of the lines below to enable them (you will need to restart nvim). - -- - -- require 'kickstart.plugins.debug', - -- require 'kickstart.plugins.indent_line', - -- require 'kickstart.plugins.lint', - -- require 'kickstart.plugins.autopairs', - -- require 'kickstart.plugins.neo-tree', - -- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps - - -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` - -- This is the easiest way to modularize your config. - -- - -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - -- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins` - -- { import = 'custom.plugins' }, -}, { - ui = { - -- If you are using a Nerd Font: set icons to an empty table which will use the - -- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table - icons = vim.g.have_nerd_font and {} or { - cmd = '⌘', - config = '🛠', - event = '📅', - ft = '📂', - init = '⚙', - keys = '🗝', - plugin = '🔌', - runtime = '💻', - require = '🌙', - source = '📄', - start = '🚀', - task = '📌', - lazy = '💤 ', - }, - }, -}) +require('lazy').setup 'plugins' -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et +-- +-- +-- Add support for Rocks installer + +local rocks_config = { + rocks_path = vim.env.HOME .. '/.local/share/nvim/rocks', + luarocks_binary = vim.env.HOME .. '/.local/share/nvim/rocks/bin/luarocks', +} + +vim.g.rocks_nvim = rocks_config + +local luarocks_path = { + vim.fs.joinpath(rocks_config.rocks_path, 'share', 'lua', '5.1', '?.lua'), + vim.fs.joinpath(rocks_config.rocks_path, 'share', 'lua', '5.1', '?', 'init.lua'), +} +package.path = package.path .. ';' .. table.concat(luarocks_path, ';') + +local luarocks_cpath = { + vim.fs.joinpath(rocks_config.rocks_path, 'lib', 'lua', '5.1', '?.so'), + vim.fs.joinpath(rocks_config.rocks_path, 'lib64', 'lua', '5.1', '?.so'), + -- Remove the dylib and dll paths if you do not need macos or windows support + vim.fs.joinpath(rocks_config.rocks_path, 'lib', 'lua', '5.1', '?.dylib'), + vim.fs.joinpath(rocks_config.rocks_path, 'lib64', 'lua', '5.1', '?.dylib'), + vim.fs.joinpath(rocks_config.rocks_path, 'lib', 'lua', '5.1', '?.dll'), + vim.fs.joinpath(rocks_config.rocks_path, 'lib64', 'lua', '5.1', '?.dll'), +} +package.cpath = package.cpath .. ';' .. table.concat(luarocks_cpath, ';') + +vim.opt.runtimepath:append(vim.fs.joinpath(rocks_config.rocks_path, 'lib', 'luarocks', 'rocks-5.1', '*', '*')) + +-- Use spaces for tabs +vim.cmd 'set expandtab' +vim.cmd 'set tabstop=2' +vim.cmd 'set softtabstop=2' +vim.cmd 'set shiftwidth=2' diff --git a/lua/.DS_Store b/lua/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..95691bdcd638738d18ce531e9917074726b671ee GIT binary patch literal 6148 zcmeHKQA@)x5WdXmT141`qK^Sz2Tq4D@uf`t16K4wWwv(AVr|CS*@rRctNtPXiND9Y zBpc4@qoQ&Lci$zsOOr2<^Z-C~M$s-n9RM6u!itOL6QOa^1*zDcDx%PHWRODuL&&3S zA(}gWBLj4HF5E*5w`kv;-)#~qmEf^L4F-_F2>KY5LKYU;AWT$hem>sX438wST7yKM(Rz)(M7})H=hd!l@sG=W(y-*4K|zng?;(8|s8O>S4&$MVv;e z=%`T|Wjfb41CHys-TLNuyx(d!WNUZQkmG~BW<$2ydy|RlY;5lwo_6n(hg3Zoq6ICU zWX-_LKBMo~vE;UGMNY?%ROV4i^`)2!3`fAV$xKcB=cW`G&^R}6^iv47mbE!nqq yVRQ7>O4J)v5{fGg&Qj3PPcg>QQ@n+$1^XpAh@QpLAoif}kAS9u4Kwhg47>p^lv!2) literal 0 HcmV?d00001 diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua deleted file mode 100644 index be0eb9d8d7a..00000000000 --- a/lua/custom/plugins/init.lua +++ /dev/null @@ -1,5 +0,0 @@ --- You can add your own plugins here or in other files in this directory! --- I promise not to create any merge conflicts in this directory :) --- --- See the kickstart.nvim README for more information -return {} diff --git a/lua/kickstart/.DS_Store b/lua/kickstart/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..a7b0016a4594b5d087a79d40ca36089aba2f55b5 GIT binary patch literal 6148 zcmeHKJ8DBQ5S&d6F}QJ=Qdh_ggt1TH3z)PFdI4K|n{=NeKeQ0#YUN|Pkr-MVZ0K^%?VVp-V zL2Mo%_QEld5t=2Hm{hA4!;;Q;tGr$~CMF$L&4<;^Rvn7P?L5ClI;as{jB1 literal 0 HcmV?d00001 diff --git a/lua/kickstart/plugins/lint.lua b/lua/kickstart/plugins/lint.lua deleted file mode 100644 index 7f0dc42fbbf..00000000000 --- a/lua/kickstart/plugins/lint.lua +++ /dev/null @@ -1,55 +0,0 @@ -return { - - { -- Linting - 'mfussenegger/nvim-lint', - event = { 'BufReadPre', 'BufNewFile' }, - config = function() - local lint = require 'lint' - lint.linters_by_ft = { - markdown = { 'markdownlint' }, - } - - -- To allow other plugins to add linters to require('lint').linters_by_ft, - -- instead set linters_by_ft like this: - -- lint.linters_by_ft = lint.linters_by_ft or {} - -- lint.linters_by_ft['markdown'] = { 'markdownlint' } - -- - -- However, note that this will enable a set of default linters, - -- which will cause errors unless these tools are available: - -- { - -- clojure = { "clj-kondo" }, - -- dockerfile = { "hadolint" }, - -- inko = { "inko" }, - -- janet = { "janet" }, - -- json = { "jsonlint" }, - -- markdown = { "vale" }, - -- rst = { "vale" }, - -- ruby = { "ruby" }, - -- terraform = { "tflint" }, - -- text = { "vale" } - -- } - -- - -- You can disable the default linters by setting their filetypes to nil: - -- lint.linters_by_ft['clojure'] = nil - -- lint.linters_by_ft['dockerfile'] = nil - -- lint.linters_by_ft['inko'] = nil - -- lint.linters_by_ft['janet'] = nil - -- lint.linters_by_ft['json'] = nil - -- lint.linters_by_ft['markdown'] = nil - -- lint.linters_by_ft['rst'] = nil - -- lint.linters_by_ft['ruby'] = nil - -- lint.linters_by_ft['terraform'] = nil - -- lint.linters_by_ft['text'] = nil - - -- Create autocommand which carries out the actual linting - -- on the specified events. - local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true }) - vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, { - group = lint_augroup, - callback = function() - require('lint').try_lint() - end, - }) - end, - }, -} diff --git a/lua/kickstart/plugins/autopairs.lua b/lua/plugins/autopairs.lua similarity index 100% rename from lua/kickstart/plugins/autopairs.lua rename to lua/plugins/autopairs.lua diff --git a/lua/kickstart/plugins/debug.lua b/lua/plugins/debug.lua similarity index 100% rename from lua/kickstart/plugins/debug.lua rename to lua/plugins/debug.lua diff --git a/lua/kickstart/plugins/gitsigns.lua b/lua/plugins/gitsigns.lua similarity index 100% rename from lua/kickstart/plugins/gitsigns.lua rename to lua/plugins/gitsigns.lua diff --git a/lua/kickstart/plugins/indent_line.lua b/lua/plugins/indent_line.lua similarity index 100% rename from lua/kickstart/plugins/indent_line.lua rename to lua/plugins/indent_line.lua diff --git a/lua/plugins/lualine.lua b/lua/plugins/lualine.lua new file mode 100644 index 00000000000..d79b68ecad7 --- /dev/null +++ b/lua/plugins/lualine.lua @@ -0,0 +1,46 @@ +return { + 'nvim-lualine/lualine.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + config = function() + require('lualine').setup { + options = { + icons_enabled = true, + theme = 'powerline', + component_separators = { left = '', right = '' }, + section_separators = { left = '', right = '' }, + disabled_filetypes = { + statusline = {}, + winbar = {}, + }, + ignore_focus = {}, + always_divide_middle = true, + globalstatus = false, + refresh = { + statusline = 1000, + tabline = 1000, + winbar = 1000, + }, + }, + sections = { + lualine_a = { 'mode' }, + lualine_b = { 'branch', 'diff', 'diagnostics' }, + lualine_c = { 'filename' }, + lualine_x = { 'encoding', 'fileformat', 'filetype' }, + lualine_y = { 'progress' }, + lualine_z = { 'location' }, + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = { 'filename' }, + lualine_x = { 'location' }, + lualine_y = {}, + lualine_z = {}, + }, + tabline = {}, + winbar = {}, + inactive_winbar = {}, + extensions = {}, + } + end, +} diff --git a/lua/kickstart/plugins/neo-tree.lua b/lua/plugins/neo-tree.lua similarity index 95% rename from lua/kickstart/plugins/neo-tree.lua rename to lua/plugins/neo-tree.lua index c793b885bc6..792143ea425 100644 --- a/lua/kickstart/plugins/neo-tree.lua +++ b/lua/plugins/neo-tree.lua @@ -18,6 +18,7 @@ return { window = { mappings = { ['\\'] = 'close_window', + ['w'] = false, }, }, }, diff --git a/lua/plugins/obsidian.lua b/lua/plugins/obsidian.lua new file mode 100644 index 00000000000..29f048eebf8 --- /dev/null +++ b/lua/plugins/obsidian.lua @@ -0,0 +1,37 @@ +return { + 'epwalsh/obsidian.nvim', + version = '*', -- recommended, use latest release instead of latest commit + lazy = true, + ft = 'markdown', + -- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault: + -- event = { + -- -- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand'. + -- -- E.g. "BufReadPre " .. vim.fn.expand "~" .. "/my-vault/**.md" + -- "BufReadPre path/to/my-vault/**.md", + -- "BufNewFile path/to/my-vault/**.md", + -- }, + dependencies = { + -- Required. + 'nvim-lua/plenary.nvim', + + -- see below for full list of optional dependencies 👇 + }, + opts = { + workspaces = { + -- { + -- name = 'personal', + -- path = '~/Library/Mobile Documents/iCloud~md~obsidian/Documents/Marcs Daily Notes/', + -- }, + -- { + -- name = 'work', + -- path = '~/Library/Mobile Documents/iCloud~md~obsidian/Documents/Inmar Vault - Docs-SMC/', + -- }, + { + name = 'first', + path = '~/Temp/', + }, + }, + + -- see below for full list of options 👇 + }, +} diff --git a/lua/plugins/plugins.lua b/lua/plugins/plugins.lua new file mode 100644 index 00000000000..380b342e528 --- /dev/null +++ b/lua/plugins/plugins.lua @@ -0,0 +1,703 @@ +return { + -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). + 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically + + -- NOTE: Plugins can also be added by using a table, + -- with the first argument being the link and the following + -- keys can be used to configure plugin behavior/loading/etc. + -- + -- Use `opts = {}` to force a plugin to be loaded. + -- + -- This is equivalent to: + -- require('Comment').setup({}) + + -- "gc" to comment visual regions/lines + { 'numToStr/Comment.nvim', opts = {} }, + + -- Here is a more advanced example where we pass configuration + -- options to `gitsigns.nvim`. This is equivalent to the following Lua: + -- require('gitsigns').setup({ ... }) + -- + -- See `:help gitsigns` to understand what the configuration keys do + { -- Adds git related signs to the gutter, as well as utilities for managing changes + 'lewis6991/gitsigns.nvim', + opts = { + signs = { + add = { text = '+' }, + change = { text = '~' }, + delete = { text = '_' }, + topdelete = { text = '‾' }, + changedelete = { text = '~' }, + }, + }, + }, + + -- NOTE: Plugins can also be configured to run Lua code when they are loaded. + -- + -- This is often very useful to both group configuration, as well as handle + -- lazy loading plugins that don't need to be loaded immediately at startup. + -- + -- For example, in the following configuration, we use: + -- event = 'VimEnter' + -- + -- which loads which-key before all the UI elements are loaded. Events can be + -- normal autocommands events (`:help autocmd-events`). + -- + -- Then, because we use the `config` key, the configuration only runs + -- after the plugin has been loaded: + -- config = function() ... end + + { -- Useful plugin to show you pending keybinds. + 'folke/which-key.nvim', + event = 'VimEnter', -- Sets the loading event to 'VimEnter' + config = function() -- This is the function that runs, AFTER loading + require('which-key').setup() + + -- Document existing key chains + require('which-key').register { + ['c'] = { name = '[C]ode', _ = 'which_key_ignore' }, + ['d'] = { name = '[D]ocument', _ = 'which_key_ignore' }, + ['r'] = { name = '[R]ename', _ = 'which_key_ignore' }, + ['f'] = { name = '[S]earch', _ = 'which_key_ignore' }, + ['p'] = { name = '[P]roject-Workspace', _ = 'which_key_ignore' }, + ['t'] = { name = '[T]oggle', _ = 'which_key_ignore' }, + ['h'] = { name = 'Git [H]unk', _ = 'which_key_ignore' }, + ['w'] = { name = '[W]indow', _ = 'which_key_ignore' }, + } + -- visual mode + require('which-key').register({ + ['h'] = { 'Git [H]unk' }, + }, { mode = 'v' }) + end, + }, + + -- NOTE: Plugins can specify dependencies. + -- + -- The dependencies are proper plugin specifications as well - anything + -- you do for a plugin at the top level, you can do for a dependency. + -- + -- Use the `dependencies` key to specify the dependencies of a particular plugin + + { -- Fuzzy Finder (files, lsp, etc) + 'nvim-telescope/telescope.nvim', + event = 'VimEnter', + branch = '0.1.x', + dependencies = { + 'nvim-lua/plenary.nvim', + { -- If encountering errors, see telescope-fzf-native README for installation instructions + 'nvim-telescope/telescope-fzf-native.nvim', + + -- `build` is used to run some command when the plugin is installed/updated. + -- This is only run then, not every time Neovim starts up. + build = 'make', + + -- `cond` is a condition used to determine whether this plugin should be + -- installed and loaded. + cond = function() + return vim.fn.executable 'make' == 1 + end, + }, + { 'nvim-telescope/telescope-ui-select.nvim' }, + + -- Useful for getting pretty icons, but requires a Nerd Font. + { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, + + { + 'nvim-neo-tree/neo-tree.nvim', + branch = 'v3.x', + dependencies = { + 'nvim-lua/plenary.nvim', + 'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended + 'MunifTanjim/nui.nvim', + -- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information + }, + }, + }, + config = function() + -- Telescope is a fuzzy finder that comes with a lot of different things that + -- it can fuzzy find! It's more than just a "file finder", it can search + -- many different aspects of Neovim, your workspace, LSP, and more! + -- + -- The easiest way to use Telescope, is to start by doing something like: + -- :Telescope help_tags + -- + -- After running this command, a window will open up and you're able to + -- type in the prompt window. You'll see a list of `help_tags` options and + -- a corresponding preview of the help. + -- + -- Two important keymaps to use while in Telescope are: + -- - Insert mode: + -- - Normal mode: ? + -- + -- This opens a window that shows you all of the keymaps for the current + -- Telescope picker. This is really useful to discover what Telescope can + -- do as well as how to actually do it! + + -- [[ Configure Telescope ]] + -- See `:help telescope` and `:help telescope.setup()` + require('telescope').setup { + -- You can put your default mappings / updates / etc. in here + -- All the info you're looking for is in `:help telescope.setup()` + -- + -- defaults = { + -- mappings = { + -- i = { [''] = 'to_fuzzy_refine' }, + -- }, + -- }, + -- pickers = {} + extensions = { + ['ui-select'] = { + require('telescope.themes').get_dropdown(), + }, + }, + } + + -- Enable Telescope extensions if they are installed + pcall(require('telescope').load_extension, 'fzf') + pcall(require('telescope').load_extension, 'ui-select') + + -- See `:help telescope.builtin` + local builtin = require 'telescope.builtin' + vim.keymap.set('n', 'fh', builtin.help_tags, { desc = '[F]ind [H]elp' }) + vim.keymap.set('n', 'fk', builtin.keymaps, { desc = '[F]ind [K]eymaps' }) + vim.keymap.set('n', 'ff', builtin.find_files, { desc = '[F]ind [F]iles' }) + vim.keymap.set('n', 'fs', builtin.builtin, { desc = '[F]ind [S]elect Telescope' }) + vim.keymap.set('n', 'fw', builtin.grep_string, { desc = '[F]ind current [W]ord' }) + vim.keymap.set('n', 'fg', builtin.live_grep, { desc = '[F]ind by [G]rep' }) + vim.keymap.set('n', 'fd', builtin.diagnostics, { desc = '[F]ind [D]iagnostics' }) + vim.keymap.set('n', 'fr', builtin.resume, { desc = '[F]ind [R]esume' }) + vim.keymap.set('n', 'f.', builtin.oldfiles, { desc = '[F]ind Recent Files ("." for repeat)' }) + vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) + + -- Slightly advanced example of overriding default behavior and theme + vim.keymap.set('n', '/', function() + -- You can pass additional configuration to Telescope to change the theme, layout, etc. + builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { + winblend = 10, + previewer = false, + }) + end, { desc = '[/] Fuzzily search in current buffer' }) + + -- It's also possible to pass additional configuration options. + -- See `:help telescope.builtin.live_grep()` for information about particular keys + vim.keymap.set('n', 'f/', function() + builtin.live_grep { + grep_open_files = true, + prompt_title = 'Live Grep in Open Files', + } + end, { desc = '[S]earch [/] in Open Files' }) + + -- Shortcut for searching your Neovim configuration files + vim.keymap.set('n', 'fn', function() + builtin.find_files { cwd = vim.fn.stdpath 'config' } + end, { desc = '[S]earch [N]eovim files' }) + end, + }, + + { -- LSP Configuration & Plugins + 'neovim/nvim-lspconfig', + dependencies = { + -- Automatically install LSPs and related tools to stdpath for Neovim + { 'williamboman/mason.nvim', config = true }, -- NOTE: Must be loaded before dependants + 'williamboman/mason-lspconfig.nvim', + 'WhoIsSethDaniel/mason-tool-installer.nvim', + + -- Useful status updates for LSP. + -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` + { 'j-hui/fidget.nvim', opts = {} }, + + -- `neodev` configures Lua LSP for your Neovim config, runtime and plugins + -- used for completion, annotations and signatures of Neovim apis + { 'folke/neodev.nvim', opts = {} }, + }, + config = function() + -- Brief aside: **What is LSP?** + -- + -- LSP is an initialism you've probably heard, but might not understand what it is. + -- + -- LSP stands for Language Server Protocol. It's a protocol that helps editors + -- and language tooling communicate in a standardized fashion. + -- + -- In general, you have a "server" which is some tool built to understand a particular + -- language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc.). These Language Servers + -- (sometimes called LSP servers, but that's kind of like ATM Machine) are standalone + -- processes that communicate with some "client" - in this case, Neovim! + -- + -- LSP provides Neovim with features like: + -- - Go to definition + -- - Find references + -- - Autocompletion + -- - Symbol Search + -- - and more! + -- + -- Thus, Language Servers are external tools that must be installed separately from + -- Neovim. This is where `mason` and related plugins come into play. + -- + -- If you're wondering about lsp vs treesitter, you can check out the wonderfully + -- and elegantly composed help section, `:help lsp-vs-treesitter` + + -- This function gets run when an LSP attaches to a particular buffer. + -- That is to say, every time a new file is opened that is associated with + -- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this + -- function will be executed to configure the current buffer + vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }), + callback = function(event) + -- NOTE: Remember that Lua is a real programming language, and as such it is possible + -- to define small helper and utility functions so you don't have to repeat yourself. + -- + -- In this case, we create a function that lets us more easily define mappings specific + -- for LSP related items. It sets the mode, buffer and description for us each time. + local map = function(keys, func, desc) + vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) + end + + -- Jump to the definition of the word under your cursor. + -- This is where a variable was first declared, or where a function is defined, etc. + -- To jump back, press . + map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') + + -- Find references for the word under your cursor. + map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') + + -- Jump to the implementation of the word under your cursor. + -- Useful when your language has ways of declaring types without an actual implementation. + map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') + + -- Jump to the type of the word under your cursor. + -- Useful when you're not sure what type a variable is and you want to see + -- the definition of its *type*, not where it was *defined*. + map('D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition') + + -- Fuzzy find all the symbols in your current document. + -- Symbols are things like variables, functions, types, etc. + map('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') + + -- Fuzzy find all the symbols in your current workspace. + -- Similar to document symbols, except searches over your entire project. + map('ps', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') + + -- Rename the variable under your cursor. + -- Most Language Servers support renaming across files, etc. + map('rn', vim.lsp.buf.rename, '[R]e[n]ame') + + -- Execute a code action, usually your cursor needs to be on top of an error + -- or a suggestion from your LSP for this to activate. + map('ca', vim.lsp.buf.code_action, '[C]ode [A]ction') + + -- Opens a popup that displays documentation about the word under your cursor + -- See `:help K` for why this keymap. + map('K', vim.lsp.buf.hover, 'Hover Documentation') + + -- WARN: This is not Goto Definition, this is Goto Declaration. + -- For example, in C this would take you to the header. + map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') + + -- The following two autocommands are used to highlight references of the + -- word under your cursor when your cursor rests there for a little while. + -- See `:help CursorHold` for information about when this is executed + -- + -- When you move your cursor, the highlights will be cleared (the second autocommand). + local client = vim.lsp.get_client_by_id(event.data.client_id) + if client and client.server_capabilities.documentHighlightProvider then + local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false }) + vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.document_highlight, + }) + + vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.clear_references, + }) + + vim.api.nvim_create_autocmd('LspDetach', { + group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }), + callback = function(event2) + vim.lsp.buf.clear_references() + vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf } + end, + }) + end + + -- The following autocommand is used to enable inlay hints in your + -- code, if the language server you are using supports them + -- + -- This may be unwanted, since they displace some of your code + if client and client.server_capabilities.inlayHintProvider and vim.lsp.inlay_hint then + map('th', function() + vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled()) + end, '[T]oggle Inlay [H]ints') + end + end, + }) + + -- LSP servers and clients are able to communicate to each other what features they support. + -- By default, Neovim doesn't support everything that is in the LSP specification. + -- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities. + -- So, we create new capabilities with nvim cmp, and then broadcast that to the servers. + local capabilities = vim.lsp.protocol.make_client_capabilities() + capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities()) + + -- Enable the following language servers + -- Feel free to add/remove any LSPs that you want here. They will automatically be installed. + -- + -- Add any additional override configuration in the following tables. Available keys are: + -- - cmd (table): Override the default command used to start the server + -- - filetypes (table): Override the default list of associated filetypes for the server + -- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features. + -- - settings (table): Override the default settings passed when initializing the server. + -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ + local servers = { + -- clangd = {}, + -- gopls = {}, + -- pyright = {}, + -- rust_analyzer = {}, + -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs + -- + -- Some languages (like typescript) have entire language plugins that can be useful: + -- https://github.com/pmizio/typescript-tools.nvim + -- + -- But for many setups, the LSP (`tsserver`) will work just fine + -- tsserver = {}, + -- + + lua_ls = { + -- cmd = {...}, + -- filetypes = { ...}, + -- capabilities = {}, + settings = { + Lua = { + completion = { + callSnippet = 'Replace', + }, + -- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings + -- diagnostics = { disable = { 'missing-fields' } }, + }, + }, + }, + } + + -- Rafher gur freiref naq gbbyf nobir ner vafgnyyrq + -- To check the current status of installed tools and/or manually install + -- other tools, you can run + -- :Mason + -- + -- You can press `g?` for help in this menu. + require('mason').setup() + + -- You can add other tools here that you want Mason to install + -- for you, so that they are available from within Neovim. + local ensure_installed = vim.tbl_keys(servers or {}) + vim.list_extend(ensure_installed, { + 'stylua', -- Used to format Lua code + }) + require('mason-tool-installer').setup { ensure_installed = ensure_installed } + + require('mason-lspconfig').setup { + handlers = { + function(server_name) + local server = servers[server_name] or {} + -- This handles overriding only values explicitly passed + -- by the server configuration above. Useful when disabling + -- certain features of an LSP (for example, turning off formatting for tsserver) + server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) + require('lspconfig')[server_name].setup(server) + end, + }, + } + end, + }, + + { -- Autoformat + 'stevearc/conform.nvim', + lazy = false, + keys = { + { + 'f', + function() + require('conform').format { async = true, lsp_fallback = true } + end, + mode = '', + desc = '[F]ormat buffer', + }, + }, + opts = { + notify_on_error = false, + format_on_save = function(bufnr) + -- Disable "format_on_save lsp_fallback" for languages that don't + -- have a well standardized coding style. You can add additional + -- languages here or re-enable it for the disabled ones. + local disable_filetypes = { c = true, cpp = true } + return { + timeout_ms = 500, + lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype], + } + end, + formatters_by_ft = { + lua = { 'stylua' }, + -- Conform can also run multiple formatters sequentially + -- python = { "isort", "black" }, + -- + -- You can use a sub-list to tell conform to run *until* a formatter + -- is found. + -- javascript = { { "prettierd", "prettier" } }, + }, + }, + }, + + { -- Autocompletion + 'hrsh7th/nvim-cmp', + event = 'InsertEnter', + dependencies = { + -- Snippet Engine & its associated nvim-cmp source + { + 'L3MON4D3/LuaSnip', + build = (function() + -- Build Step is needed for regex support in snippets. + -- This step is not supported in many windows environments. + -- Remove the below condition to re-enable on windows. + if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then + return + end + return 'make install_jsregexp' + end)(), + dependencies = { + -- `friendly-snippets` contains a variety of premade snippets. + -- See the README about individual language/framework/plugin snippets: + -- https://github.com/rafamadriz/friendly-snippets + -- { + -- 'rafamadriz/friendly-snippets', + -- config = function() + -- require('luasnip.loaders.from_vscode').lazy_load() + -- end, + -- }, + }, + }, + 'saadparwaiz1/cmp_luasnip', + + -- Adds other completion capabilities. + -- nvim-cmp does not ship with all sources by default. They are split + -- into multiple repos for maintenance purposes. + 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/cmp-path', + }, + config = function() + -- See `:help cmp` + local cmp = require 'cmp' + local luasnip = require 'luasnip' + luasnip.config.setup {} + + cmp.setup { + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + completion = { completeopt = 'menu,menuone,noinsert' }, + + -- For an understanding of why these mappings were + -- chosen, you will need to read `:help ins-completion` + -- + -- No, but seriously. Please read `:help ins-completion`, it is really good! + mapping = cmp.mapping.preset.insert { + -- Select the [n]ext item + [''] = cmp.mapping.select_next_item(), + -- Select the [p]revious item + [''] = cmp.mapping.select_prev_item(), + + -- Scroll the documentation window [b]ack / [f]orward + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + + -- Accept ([y]es) the completion. + -- This will auto-import if your LSP supports it. + -- This will expand snippets if the LSP sent a snippet. + [''] = cmp.mapping.confirm { select = true }, + + -- If you prefer more traditional completion keymaps, + -- you can uncomment the following lines + --[''] = cmp.mapping.confirm { select = true }, + --[''] = cmp.mapping.select_next_item(), + --[''] = cmp.mapping.select_prev_item(), + + -- Manually trigger a completion from nvim-cmp. + -- Generally you don't need this, because nvim-cmp will display + -- completions whenever it has completion options available. + [''] = cmp.mapping.complete {}, + + -- Think of as moving to the right of your snippet expansion. + -- So if you have a snippet that's like: + -- function $name($args) + -- $body + -- end + -- + -- will move you to the right of each of the expansion locations. + -- is similar, except moving you backwards. + [''] = cmp.mapping(function() + if luasnip.expand_or_locally_jumpable() then + luasnip.expand_or_jump() + end + end, { 'i', 's' }), + [''] = cmp.mapping(function() + if luasnip.locally_jumpable(-1) then + luasnip.jump(-1) + end + end, { 'i', 's' }), + + -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see: + -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps + }, + sources = { + { name = 'nvim_lsp' }, + { name = 'luasnip' }, + { name = 'path' }, + }, + } + end, + }, + { + 'catppuccin/nvim', + name = 'catppuccin', + priority = 1000, + init = function() + vim.cmd.colorscheme 'catppuccin' + end, + }, + + --{ -- You can easily change to a different colorscheme. + -- Change the name of the colorscheme plugin below, and then + -- change the command in the config to whatever the name of that colorscheme is. + -- + -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`. + -- 'folke/tokyonight.nvim', + -- priority = 1000, -- Make sure to load this before all the other start plugins. + -- init = function() + -- Load the colorscheme here. + -- Like many other themes, this one has different styles, and you could load + -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. + -- vim.cmd.colorscheme 'tokyonight-night' + + -- You can configure highlights by doing something like: + -- vim.cmd.hi 'Comment gui=none' + -- end, + -- }, + + -- Highlight todo, notes, etc in comments + { 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } }, + + { -- Collection of various small independent plugins/modules + 'echasnovski/mini.nvim', + config = function() + -- Better Around/Inside textobjects + -- + -- Examples: + -- - va) - [V]isually select [A]round [)]paren + -- - yinq - [Y]ank [I]nside [N]ext [']quote + -- - ci' - [C]hange [I]nside [']quote + require('mini.ai').setup { n_lines = 500 } + + -- Add/delete/replace surroundings (brackets, quotes, etc.) + -- + -- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren + -- - sd' - [S]urround [D]elete [']quotes + -- - sr)' - [S]urround [R]eplace [)] ['] + require('mini.surround').setup() + + -- Simple and easy statusline. + -- You could remove this setup call if you don't like it, + -- and try some other statusline plugin + local statusline = require 'mini.statusline' + -- set use_icons to true if you have a Nerd Font + statusline.setup { use_icons = vim.g.have_nerd_font } + + -- You can configure sections in the statusline by overriding their + -- default behavior. For example, here we set the section for + -- cursor location to LINE:COLUMN + ---@diagnostic disable-next-line: duplicate-set-field + statusline.section_location = function() + return '%2l:%-2v' + end + + -- ... and there is more! + -- Check out: https://github.com/echasnovski/mini.nvim + end, + }, + { -- Highlight, edit, and navigate code + 'nvim-treesitter/nvim-treesitter', + build = ':TSUpdate', + opts = { + ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'vim', 'vimdoc' }, + -- Autoinstall languages that are not installed + auto_install = true, + highlight = { + enable = true, + -- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules. + -- If you are experiencing weird indenting issues, add the language to + -- the list of additional_vim_regex_highlighting and disabled languages for indent. + additional_vim_regex_highlighting = { 'ruby' }, + }, + indent = { enable = true, disable = { 'ruby' } }, + }, + config = function(_, opts) + -- [[ Configure Treesitter ]] See `:help nvim-treesitter` + + -- Prefer git instead of curl in order to improve connectivity in some environments + require('nvim-treesitter.install').prefer_git = true + ---@diagnostic disable-next-line: missing-fields + require('nvim-treesitter.configs').setup(opts) + + -- There are additional nvim-treesitter modules that you can use to interact + -- with nvim-treesitter. You should go explore a few and see what interests you: + -- + -- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod` + -- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context + -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects + end, + }, + + -- The following two comments only work if you have downloaded the kickstart repo, not just copy pasted the + -- init.lua. If you want these files, they are in the repository, so you can just download them and + -- place them in the correct locations. + + -- NOTE: Next step on your Neovim journey: Add/Configure additional plugins for Kickstart + -- + -- Here are some example plugins that I've included in the Kickstart repository. + -- Uncomment any of the lines below to enable them (you will need to restart nvim). + -- + -- require 'kickstart.plugins.debug', + -- require 'kickstart.plugins.indent_line', + -- require 'kickstart.plugins.lint', + -- require 'kickstart.plugins.autopairs', + -- require 'kickstart.plugins.neo-tree', + -- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps + + -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` + -- This is the easiest way to modularize your config. + -- + -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. + -- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins` + -- { import = 'custom.plugins' }, +}, { + ui = { + -- If you are using a Nerd Font: set icons to an empty table which will use the + -- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table + icons = vim.g.have_nerd_font and {} or { + cmd = '⌘', + config = '🛠', + event = '📅', + ft = '📂', + init = '⚙', + keys = '🗝', + plugin = '🔌', + runtime = '💻', + require = '🌙', + source = '📄', + start = '🚀', + task = '📌', + lazy = '💤 ', + }, + }, +} From ceb38d09b02c2191c6a1a0f6fe173c78a2e10c63 Mon Sep 17 00:00:00 2001 From: Marc Talcott Date: Mon, 10 Jun 2024 20:45:36 -0400 Subject: [PATCH 02/21] add neogit and orgmode --- init.lua | 2 -- lua/plugins/markdown-preview-nvim.lua | 8 +++++++ lua/plugins/neogit.lua | 12 +++++++++++ lua/plugins/orgmode.lua | 30 +++++++++++++++++++++++++++ lua/plugins/plugins.lua | 1 + 5 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 lua/plugins/markdown-preview-nvim.lua create mode 100644 lua/plugins/neogit.lua create mode 100644 lua/plugins/orgmode.lua diff --git a/init.lua b/init.lua index dabe08fb327..5ed865c9bc6 100644 --- a/init.lua +++ b/init.lua @@ -196,8 +196,6 @@ vim.keymap.set('n', 'wc', 'c', { desc = '[C]lose window' }) vim.keymap.set('n', 'w+', '+', { desc = 'Increase size' }) vim.keymap.set('n', 'w-', '-', { desc = 'Decrease size' }) -vim.keymap.set('n', 'n', ':Neotree', { desc = 'Open Neotree' }) - -- vim.keymap.set('n', 'wh', '', { desc = 'Move focus to the left window' }) -- vim.keymap.set('n', 'wl', '', { desc = 'Move focus to the right window' }) -- vim.keymap.set('n', 'wj', '', { desc = 'Move focus to the lower window' }) diff --git a/lua/plugins/markdown-preview-nvim.lua b/lua/plugins/markdown-preview-nvim.lua new file mode 100644 index 00000000000..b1591c3dfe5 --- /dev/null +++ b/lua/plugins/markdown-preview-nvim.lua @@ -0,0 +1,8 @@ +return { + 'iamcco/markdown-preview.nvim', + cmd = { 'MarkdownPreviewToggle', 'MarkdownPreview', 'MarkdownPreviewStop' }, + ft = { 'markdown' }, + build = function() + vim.fn['mkdp#util#install']() + end, +} diff --git a/lua/plugins/neogit.lua b/lua/plugins/neogit.lua new file mode 100644 index 00000000000..357f30365a7 --- /dev/null +++ b/lua/plugins/neogit.lua @@ -0,0 +1,12 @@ +return { + 'NeogitOrg/neogit', + dependencies = { + 'nvim-lua/plenary.nvim', -- required + 'sindrets/diffview.nvim', -- optional - Diff integration + + -- Only one of these is needed, not both. + 'nvim-telescope/telescope.nvim', -- optional + 'ibhagwan/fzf-lua', -- optional + }, + config = true, +} diff --git a/lua/plugins/orgmode.lua b/lua/plugins/orgmode.lua new file mode 100644 index 00000000000..d39bb60a200 --- /dev/null +++ b/lua/plugins/orgmode.lua @@ -0,0 +1,30 @@ +return { + 'nvim-orgmode/orgmode', + event = 'VeryLazy', + ft = { 'org' }, + config = function() + -- Setup orgmode + require('orgmode').setup { + org_agenda_files = '~/orgfiles/**/*', + org_default_notes_file = '~/orgfiles/refile.org', + org_capture_templates = { + t = { description = 'Task', template = '* TODO %?\n %u' }, + j = { + description = 'Journal', + datetree = { + tree_type = 'day', + }, + template = '\n**** %?\n%U\n', + target = '~/orgfiles/journal.org', + }, + }, + } + + -- NOTE: If you are using nvim-treesitter with ~ensure_installed = "all"~ option + -- add ~org~ to ignore_install + -- require('nvim-treesitter.configs').setup({ + -- ensure_installed = 'all', + -- ignore_install = { 'org' }, + -- }) + end, +} diff --git a/lua/plugins/plugins.lua b/lua/plugins/plugins.lua index 380b342e528..842ee0d81ca 100644 --- a/lua/plugins/plugins.lua +++ b/lua/plugins/plugins.lua @@ -562,6 +562,7 @@ return { 'catppuccin/nvim', name = 'catppuccin', priority = 1000, + flavour = 'mocha', init = function() vim.cmd.colorscheme 'catppuccin' end, From ffd731bacbbf89392c5abab82a34fd9d8d1dcbaf Mon Sep 17 00:00:00 2001 From: Marc Talcott Date: Tue, 11 Jun 2024 07:18:37 -0400 Subject: [PATCH 03/21] add oil plugin --- init.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/init.lua b/init.lua index 5ed865c9bc6..f5bb59d15ba 100644 --- a/init.lua +++ b/init.lua @@ -274,3 +274,7 @@ vim.cmd 'set expandtab' vim.cmd 'set tabstop=2' vim.cmd 'set softtabstop=2' vim.cmd 'set shiftwidth=2' + +-- Oil plugin +require('oil').setup() +vim.keymap.set('n', '-', 'Oil', { desc = 'Open parent directory' }) From 910d9980771d33f765b29f2fb03ca2e4fbe4843c Mon Sep 17 00:00:00 2001 From: Marc Talcott Date: Tue, 11 Jun 2024 07:24:27 -0400 Subject: [PATCH 04/21] added missing plugin file for oil --- lua/plugins/oil.lua | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 lua/plugins/oil.lua diff --git a/lua/plugins/oil.lua b/lua/plugins/oil.lua new file mode 100644 index 00000000000..f1769bade44 --- /dev/null +++ b/lua/plugins/oil.lua @@ -0,0 +1,6 @@ +return { + 'stevearc/oil.nvim', + opts = {}, + -- Optional dependencies + dependencies = { 'nvim-tree/nvim-web-devicons' }, +} From 25d21a23d0e2752135eb0a04d0ae78269ea899b1 Mon Sep 17 00:00:00 2001 From: Marc Talcott Date: Tue, 11 Jun 2024 08:37:55 -0400 Subject: [PATCH 05/21] set colorscheme to frappe --- lua/plugins/catppuccin.lua | 9 +++++++++ lua/plugins/plugins.lua | 11 +---------- 2 files changed, 10 insertions(+), 10 deletions(-) create mode 100644 lua/plugins/catppuccin.lua diff --git a/lua/plugins/catppuccin.lua b/lua/plugins/catppuccin.lua new file mode 100644 index 00000000000..38eb37e35c5 --- /dev/null +++ b/lua/plugins/catppuccin.lua @@ -0,0 +1,9 @@ +return { + 'catppuccin/nvim', + name = 'catppuccin', + priority = 1000, + flavour = 'frappe', + init = function() + vim.cmd.colorscheme 'catppuccin-frappe' + end, +} diff --git a/lua/plugins/plugins.lua b/lua/plugins/plugins.lua index 842ee0d81ca..f24aa17c012 100644 --- a/lua/plugins/plugins.lua +++ b/lua/plugins/plugins.lua @@ -558,15 +558,6 @@ return { } end, }, - { - 'catppuccin/nvim', - name = 'catppuccin', - priority = 1000, - flavour = 'mocha', - init = function() - vim.cmd.colorscheme 'catppuccin' - end, - }, --{ -- You can easily change to a different colorscheme. -- Change the name of the colorscheme plugin below, and then @@ -577,7 +568,7 @@ return { -- priority = 1000, -- Make sure to load this before all the other start plugins. -- init = function() -- Load the colorscheme here. - -- Like many other themes, this one has different styles, and you could load + -- Like many other themes, this one has different styles, and you could loadplugins -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. -- vim.cmd.colorscheme 'tokyonight-night' From a6be72da5117e1ae219a83109969b229c4db9f62 Mon Sep 17 00:00:00 2001 From: marctalcott Date: Wed, 12 Jun 2024 07:02:47 -0400 Subject: [PATCH 06/21] Added more Orgmode templates --- lua/plugins/orgmode.lua | 54 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 3 deletions(-) diff --git a/lua/plugins/orgmode.lua b/lua/plugins/orgmode.lua index d39bb60a200..033b7071312 100644 --- a/lua/plugins/orgmode.lua +++ b/lua/plugins/orgmode.lua @@ -8,14 +8,62 @@ return { org_agenda_files = '~/orgfiles/**/*', org_default_notes_file = '~/orgfiles/refile.org', org_capture_templates = { - t = { description = 'Task', template = '* TODO %?\n %u' }, j = { description = 'Journal', datetree = { tree_type = 'day', }, - template = '\n**** %?\n%U\n', - target = '~/orgfiles/journal.org', + template = '\n**** %?\nEntered on %U\n', + target = '~/OrgMode-Inmar/OrgRoamRoot/002-Areas/journal.org', + }, + -- Setup 1:1 capture templates + s = { + description = 'Sandeep 1:1', + datetree = { + tree_type = 'day', + }, + template = '**** %?\nEntered on %U\n', + target = '~/OrgMode-Inmar/OrgRoamRoot/002-Areas/OneOnOne/sandeep1on1.org', + }, + d = { + description = 'Debbie 1:1', + datetree = { + tree_type = 'day', + }, + template = '**** %?\nEntered on %U\n', + target = '~/OrgMode-Inmar/OrgRoamRoot/002-Areas/OneOnOne/debbie1on1.org', + }, + b = { + description = 'Billy 1:1', + datetree = { + tree_type = 'day', + }, + template = '**** %?\nEntered on %U\n', + target = '~/OrgMode-Inmar/OrgRoamRoot/002-Areas/OneOnOne/billy1on1.org', + }, + t = { + description = 'Taylor 1:1', + datetree = { + tree_type = 'day', + }, + template = '**** %?\nEntered on %U\n', + target = '~/OrgMode-Inmar/OrgRoamRoot/002-Areas/OneOnOne/taylor1on1.org', + }, + a = { + description = 'Asha 1:1', + datetree = { + tree_type = 'day', + }, + template = '**** %?\nEntered on %U\n', + target = '~/OrgMode-Inmar/OrgRoamRoot/002-Areas/OneOnOne/asha1on1.org', + }, + g = { + description = 'Gerald 1:1', + datetree = { + tree_type = 'day', + }, + template = '**** %?\nEntered on %U\n', + target = '~/OrgMode-Inmar/OrgRoamRoot/002-Areas/OneOnOne/gerald1on1.org', }, }, } From 61087071ab32119643a74639bc494c20b390bde5 Mon Sep 17 00:00:00 2001 From: Marc Talcott Date: Fri, 21 Jun 2024 10:08:51 -0400 Subject: [PATCH 07/21] Fix Debug --- lua/plugins/debug.lua | 99 +++++++++------------------------------- lua/plugins/obsidian.lua | 37 --------------- 2 files changed, 22 insertions(+), 114 deletions(-) delete mode 100644 lua/plugins/obsidian.lua diff --git a/lua/plugins/debug.lua b/lua/plugins/debug.lua index 31dfecf5b38..8de13b24386 100644 --- a/lua/plugins/debug.lua +++ b/lua/plugins/debug.lua @@ -1,15 +1,5 @@ --- debug.lua --- --- Shows how to use the DAP plugin to debug your code. --- --- Primarily focused on configuring the debugger for Go, but can --- be extended to other languages as well. That's why it's called --- kickstart.nvim and not kitchen-sink.nvim ;) - return { - -- NOTE: Yes, you can install new plugins here! 'mfussenegger/nvim-dap', - -- NOTE: And you can specify dependencies as well dependencies = { -- Creates a beautiful debugger UI 'rcarriga/nvim-dap-ui', @@ -25,72 +15,27 @@ return { 'leoluz/nvim-dap-go', }, config = function() - local dap = require 'dap' - local dapui = require 'dapui' - - require('mason-nvim-dap').setup { - -- Makes a best effort to setup the various debuggers with - -- reasonable debug configurations - automatic_installation = true, - - -- You can provide additional configuration to the handlers, - -- see mason-nvim-dap README for more information - handlers = {}, - - -- You'll need to check that you have the required things installed - -- online, please don't ask me how to install them :) - ensure_installed = { - -- Update this to ensure that you have the debuggers for the langs you want - 'delve', - }, - } - - -- Basic debugging keymaps, feel free to change to your liking! - vim.keymap.set('n', '', dap.continue, { desc = 'Debug: Start/Continue' }) - vim.keymap.set('n', '', dap.step_into, { desc = 'Debug: Step Into' }) - vim.keymap.set('n', '', dap.step_over, { desc = 'Debug: Step Over' }) - vim.keymap.set('n', '', dap.step_out, { desc = 'Debug: Step Out' }) - vim.keymap.set('n', 'b', dap.toggle_breakpoint, { desc = 'Debug: Toggle Breakpoint' }) - vim.keymap.set('n', 'B', function() - dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ') - end, { desc = 'Debug: Set Breakpoint' }) - - -- Dap UI setup - -- For more information, see |:help nvim-dap-ui| - dapui.setup { - -- Set icons to characters that are more likely to work in every terminal. - -- Feel free to remove or use ones that you like more! :) - -- Don't feel like these are good choices. - icons = { expanded = '▾', collapsed = '▸', current_frame = '*' }, - controls = { - icons = { - pause = '⏸', - play = '▶', - step_into = '⏎', - step_over = '⏭', - step_out = '⏮', - step_back = 'b', - run_last = '▶▶', - terminate = '⏹', - disconnect = '⏏', - }, - }, - } - - -- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception. - vim.keymap.set('n', '', dapui.toggle, { desc = 'Debug: See last session result.' }) - - dap.listeners.after.event_initialized['dapui_config'] = dapui.open - dap.listeners.before.event_terminated['dapui_config'] = dapui.close - dap.listeners.before.event_exited['dapui_config'] = dapui.close - - -- Install golang specific config - require('dap-go').setup { - delve = { - -- On Windows delve must be run attached or it crashes. - -- See https://github.com/leoluz/nvim-dap-go/blob/main/README.md#configuring - detached = vim.fn.has 'win32' == 0, - }, - } + require('dapui').setup() + require('dap-go').setup() + + local dap, dapui = require 'dap', require 'dapui' + + dap.listeners.before.attach.dapui_config = function() + dapui.open() + end + dap.listeners.before.launch.dapui_config = function() + dapui.open() + end + dap.listeners.before.event_terminated.dapui_config = function() + dapui.close() + end + dap.listeners.before.event_exited.dapui_config = function() + dapui.close() + end + + vim.keymap.set('n', 'db', ':DapToggleBreakpoint') + vim.keymap.set('n', 'dc', ':DapContinue') + vim.keymap.set('n', 'dx', ':DapTerminate') + vim.keymap.set('n', 'do', ':DapStepOver') end, } diff --git a/lua/plugins/obsidian.lua b/lua/plugins/obsidian.lua deleted file mode 100644 index 29f048eebf8..00000000000 --- a/lua/plugins/obsidian.lua +++ /dev/null @@ -1,37 +0,0 @@ -return { - 'epwalsh/obsidian.nvim', - version = '*', -- recommended, use latest release instead of latest commit - lazy = true, - ft = 'markdown', - -- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault: - -- event = { - -- -- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand'. - -- -- E.g. "BufReadPre " .. vim.fn.expand "~" .. "/my-vault/**.md" - -- "BufReadPre path/to/my-vault/**.md", - -- "BufNewFile path/to/my-vault/**.md", - -- }, - dependencies = { - -- Required. - 'nvim-lua/plenary.nvim', - - -- see below for full list of optional dependencies 👇 - }, - opts = { - workspaces = { - -- { - -- name = 'personal', - -- path = '~/Library/Mobile Documents/iCloud~md~obsidian/Documents/Marcs Daily Notes/', - -- }, - -- { - -- name = 'work', - -- path = '~/Library/Mobile Documents/iCloud~md~obsidian/Documents/Inmar Vault - Docs-SMC/', - -- }, - { - name = 'first', - path = '~/Temp/', - }, - }, - - -- see below for full list of options 👇 - }, -} From 1313a988a524806d5768c4621724a0929f7d9134 Mon Sep 17 00:00:00 2001 From: Marc Talcott Date: Thu, 27 Jun 2024 13:38:55 -0400 Subject: [PATCH 08/21] fixed Dap Debug for .net --- lua/plugins/debug.lua | 53 +++++++++++++++-- lua/utilities/path_finder/utils.lua | 88 +++++++++++++++++++++++++++++ 2 files changed, 135 insertions(+), 6 deletions(-) create mode 100644 lua/utilities/path_finder/utils.lua diff --git a/lua/plugins/debug.lua b/lua/plugins/debug.lua index 8de13b24386..76f14be5455 100644 --- a/lua/plugins/debug.lua +++ b/lua/plugins/debug.lua @@ -8,17 +8,42 @@ return { 'nvim-neotest/nvim-nio', -- Installs the debug adapters for you - 'williamboman/mason.nvim', + -- 'williamboman/mason.nvim', 'jay-babu/mason-nvim-dap.nvim', -- Add your own debuggers here 'leoluz/nvim-dap-go', + 'dotnet/vscode-csharp', + + -- virtual Text + 'theHamsta/nvim-dap-virtual-text', }, config = function() require('dapui').setup() require('dap-go').setup() - + require('nvim-dap-virtual-text').setup() + require('lspconfig').omnisharp.setup {} + require('dap.ext.vscode').load_launchjs(nil, {}) local dap, dapui = require 'dap', require 'dapui' + local ph_status, dotnet_ph = pcall(require, 'utilities.path_finder') + dap.adapters.coreclr = { + type = 'executable', + command = 'netcoredbg', + args = { '--interpreter=vscode' }, + } + + dap.configurations.cs = { + { + type = 'coreclr', + name = 'launch - netcoredbg', + request = 'launch', + program = function() + -- return vim.fn.input('Path to dll:', '/Users/marctalcott/Documents/Projects/DotNetProjects/HelloWorld/bin/Debug/net8.0/', 'file') + return vim.fn.input('Path to dll: ', vim.fn.getcwd() .. '/bin/Debug/net8.0/', 'file') + end, + console = 'integratedTerminal', + }, + } dap.listeners.before.attach.dapui_config = function() dapui.open() @@ -33,9 +58,25 @@ return { dapui.close() end - vim.keymap.set('n', 'db', ':DapToggleBreakpoint') - vim.keymap.set('n', 'dc', ':DapContinue') - vim.keymap.set('n', 'dx', ':DapTerminate') - vim.keymap.set('n', 'do', ':DapStepOver') + -- Keymaps for all + vim.fn.sign_define('DapBreakpoint', { text = '🔴', texthl = 'DapBreakpoint', linehl = 'DapBreakpoint', numhl = 'DapBreakpoint' }) + + vim.keymap.set('n', 'db', dap.toggle_breakpoint, { desc = '[d]ebug toggle [b]reakpoint' }) + vim.keymap.set('n', 'dc', dap.continue, { desc = '[d]ebug [c]continue' }) + vim.keymap.set('n', 'dC', dap.close, { desc = '[d]ebug [C]lose' }) + vim.keymap.set('n', '', dap.continue, { desc = 'Debug Continue' }) + + vim.keymap.set('n', '', dap.step_over, { desc = 'Step Over' }) + vim.keymap.set('n', '', dap.step_out, { desc = 'Step Out' }) + vim.keymap.set('n', '', dap.step_into, { desc = 'Step Into' }) + vim.keymap.set('n', '', dap.terminate, { desc = 'Terminate' }) + vim.keymap.set('n', 'dx', dap.terminate, { desc = 'Terminate' }) + vim.keymap.set('n', 'do', dap.step_over, { desc = 'Step over' }) + vim.keymap.set('n', 'dr', dap.restart, { desc = 'Restart' }) + vim.api.nvim_set_keymap('n', 'dR', ":lua require('dapui').open({reset = true})", { noremap = true }) + vim.api.nvim_set_keymap('n', 'ht', ":lua require('harpoon.ui').toggle_quick_menu()", { noremap = true }) + vim.keymap.set('n', '?', function() + require('dapui').eval(nil, { enter = true }) + end, { desc = 'Restart' }) end, } diff --git a/lua/utilities/path_finder/utils.lua b/lua/utilities/path_finder/utils.lua new file mode 100644 index 00000000000..71b4943b45c --- /dev/null +++ b/lua/utilities/path_finder/utils.lua @@ -0,0 +1,88 @@ +-- Check to see if path is a part of the config.projects, if so set last_proj_path and last_dll_path +function M.GetProjConfig(path, config) + local result = {} + if config == nil then + return result + end + local projects = config.projects + + if projects == nil then + return result + end + for _, project in ipairs(projects) do + if project.base_path and string.find(path, project.base_path) then + -- TODO: nil check, if even needed. + -- TODO: these names make no sense + result.dotnet_last_proj_path = project.dotnet_proj_file + result.dotnet_last_dll_path = project.dotnet_dll_path + result.dotnet_debug_cwd = project.dotnet_debug_cwd + result.project_found = true + return result + end + end + result.project_found = false + return result +end + +function M.search_up_path(project_root, path, pattern_func) + local parent = vim.fn.fnamemodify(path, ':h') + -- the parent of 'C:/' is 'C:/' + if parent == path then + return project_root + end + local parent_root = pattern_func(parent) + -- returns nil when no root is found + if parent_root == nil then + return project_root + end + return M.search_up_path(parent_root, parent, pattern_func) +end + +function M.dotnet_get_dll_path(path, proj_found) + local request = function() + return vim.fn.input('Path to dll ', vim.fn.getcwd() .. '/bin/Debug/', 'file') + end + + if path == nil then + path = request() + print('Dll path: ' .. path) + else + if proj_found == false and vim.fn.confirm('Do you want to change the path to dll?\n' .. path, '&yes\n&no', 2) == 1 then + path = request() + print('Dll path: ' .. path) + end + end + + return path +end + +function M.dotnet_build_project(last_path, config) + local default_path = vim.fn.getcwd() .. '/' + if last_path ~= nil then + default_path = last_path + end + local result = nil + + -- If project was found in config, use it + if config.dotnet_last_proj_path ~= nil then + print('Found project in config. Project file path is ' .. config.dotnet_last_proj_path) + result = config.dotnet_last_proj_path + else + -- If the project was not found, always ask for it, but fill in the last path + result = vim.fn.input('Path to your *proj file', default_path, 'file') + end + + local cmd = 'dotnet build -c Debug ' .. result + print '' + print('Cmd to execute: ' .. cmd) + -- TODO: This should be done in async way + local f = os.execute(cmd) + if f == 0 then + print '\nBuild: ✔️ ' + else + print('\nBuild: ❌ (code: ' .. f .. ')') + end + return result +end + +return M From 61b47328cda0617cd22519359f51ba97f886e976 Mon Sep 17 00:00:00 2001 From: Marc Talcott Date: Fri, 28 Jun 2024 13:34:04 -0400 Subject: [PATCH 09/21] fix debug --- lua/plugins/debug.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lua/plugins/debug.lua b/lua/plugins/debug.lua index 76f14be5455..02ac0d87249 100644 --- a/lua/plugins/debug.lua +++ b/lua/plugins/debug.lua @@ -25,7 +25,6 @@ return { require('lspconfig').omnisharp.setup {} require('dap.ext.vscode').load_launchjs(nil, {}) local dap, dapui = require 'dap', require 'dapui' - local ph_status, dotnet_ph = pcall(require, 'utilities.path_finder') dap.adapters.coreclr = { type = 'executable', command = 'netcoredbg', @@ -62,21 +61,25 @@ return { vim.fn.sign_define('DapBreakpoint', { text = '🔴', texthl = 'DapBreakpoint', linehl = 'DapBreakpoint', numhl = 'DapBreakpoint' }) vim.keymap.set('n', 'db', dap.toggle_breakpoint, { desc = '[d]ebug toggle [b]reakpoint' }) + + -- vim.keymap.set('n', 'dB', dap.set_breakpoint(vim.fn.input 'Breakpoint condition: '), { desc = '[d]ebug conditional [B]reakpoint' }) vim.keymap.set('n', 'dc', dap.continue, { desc = '[d]ebug [c]continue' }) vim.keymap.set('n', 'dC', dap.close, { desc = '[d]ebug [C]lose' }) vim.keymap.set('n', '', dap.continue, { desc = 'Debug Continue' }) vim.keymap.set('n', '', dap.step_over, { desc = 'Step Over' }) - vim.keymap.set('n', '', dap.step_out, { desc = 'Step Out' }) - vim.keymap.set('n', '', dap.step_into, { desc = 'Step Into' }) + vim.keymap.set('n', '', dap.step_into, { desc = 'Step Into' }) + vim.keymap.set('n', '', dap.step_out, { desc = 'Step Out' }) vim.keymap.set('n', '', dap.terminate, { desc = 'Terminate' }) vim.keymap.set('n', 'dx', dap.terminate, { desc = 'Terminate' }) vim.keymap.set('n', 'do', dap.step_over, { desc = 'Step over' }) vim.keymap.set('n', 'dr', dap.restart, { desc = 'Restart' }) + + vim.keymap.set('n', 'dl', dap.run_last, { desc = '[d]ebug run [l]ast' }) vim.api.nvim_set_keymap('n', 'dR', ":lua require('dapui').open({reset = true})", { noremap = true }) vim.api.nvim_set_keymap('n', 'ht', ":lua require('harpoon.ui').toggle_quick_menu()", { noremap = true }) vim.keymap.set('n', '?', function() - require('dapui').eval(nil, { enter = true }) + dapui.eval(nil, { enter = true }) end, { desc = 'Restart' }) end, } From ba4c4d97739de24973bed49bad96603c4ae64c02 Mon Sep 17 00:00:00 2001 From: marctalcott Date: Tue, 2 Jul 2024 17:31:48 -0400 Subject: [PATCH 10/21] Add space gg for neogit --- after/ftplugin/markdown.lua | 1 + init.lua | 3 +++ lua/plugins/orgmode.lua | 10 +++++++++- 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 after/ftplugin/markdown.lua diff --git a/after/ftplugin/markdown.lua b/after/ftplugin/markdown.lua new file mode 100644 index 00000000000..2848685a1d6 --- /dev/null +++ b/after/ftplugin/markdown.lua @@ -0,0 +1 @@ +vim.opt_local.conceallevel = 2 diff --git a/init.lua b/init.lua index f5bb59d15ba..d7d9b94747f 100644 --- a/init.lua +++ b/init.lua @@ -278,3 +278,6 @@ vim.cmd 'set shiftwidth=2' -- Oil plugin require('oil').setup() vim.keymap.set('n', '-', 'Oil', { desc = 'Open parent directory' }) + +-- Neogit plugin +vim.keymap.set('n', 'gg', ':Neogit', { desc = 'Neogit open' }) diff --git a/lua/plugins/orgmode.lua b/lua/plugins/orgmode.lua index 033b7071312..92ea56eb77c 100644 --- a/lua/plugins/orgmode.lua +++ b/lua/plugins/orgmode.lua @@ -8,8 +8,16 @@ return { org_agenda_files = '~/orgfiles/**/*', org_default_notes_file = '~/orgfiles/refile.org', org_capture_templates = { + x = { + description = 'Journal Personal', + datetree = { + tree_type = 'day', + }, + template = '\n**** %?\nEntered on %U\n', + target = '~/OrgMode-Personal/002-Areas/journal.org', + }, j = { - description = 'Journal', + description = 'Journal Inmar', datetree = { tree_type = 'day', }, From f5d2078d907b1edba20ac39e4e95823cf047a306 Mon Sep 17 00:00:00 2001 From: marctalcott Date: Tue, 2 Jul 2024 17:37:30 -0400 Subject: [PATCH 11/21] delete after file --- after/ftplugin/markdown.lua | 1 - 1 file changed, 1 deletion(-) delete mode 100644 after/ftplugin/markdown.lua diff --git a/after/ftplugin/markdown.lua b/after/ftplugin/markdown.lua deleted file mode 100644 index 2848685a1d6..00000000000 --- a/after/ftplugin/markdown.lua +++ /dev/null @@ -1 +0,0 @@ -vim.opt_local.conceallevel = 2 From dbe6c124f26be39b9cf829c7b6454f3c7e7af56d Mon Sep 17 00:00:00 2001 From: Marc Talcott Date: Tue, 9 Jul 2024 06:48:41 -0400 Subject: [PATCH 12/21] Add obsidian and nvim-tmux-navigator --- init.lua | 8 + lua/plugins/nvim-tmux-navigator.lua | 7 + lua/plugins/obsidian.lua | 311 ++++++++++++++++++++++++++++ 3 files changed, 326 insertions(+) create mode 100644 lua/plugins/nvim-tmux-navigator.lua create mode 100644 lua/plugins/obsidian.lua diff --git a/init.lua b/init.lua index d7d9b94747f..4ac3e8597f5 100644 --- a/init.lua +++ b/init.lua @@ -196,6 +196,11 @@ vim.keymap.set('n', 'wc', 'c', { desc = '[C]lose window' }) vim.keymap.set('n', 'w+', '+', { desc = 'Increase size' }) vim.keymap.set('n', 'w-', '-', { desc = 'Decrease size' }) +vim.keymap.set('n', '', ':wincmd k') +vim.keymap.set('n', '', ':wincmd j') +vim.keymap.set('n', '', ':wincmd h') +vim.keymap.set('n', '', ':wincmd l') + -- vim.keymap.set('n', 'wh', '', { desc = 'Move focus to the left window' }) -- vim.keymap.set('n', 'wl', '', { desc = 'Move focus to the right window' }) -- vim.keymap.set('n', 'wj', '', { desc = 'Move focus to the lower window' }) @@ -281,3 +286,6 @@ vim.keymap.set('n', '-', 'Oil', { desc = 'Open parent directory' }) -- Neogit plugin vim.keymap.set('n', 'gg', ':Neogit', { desc = 'Neogit open' }) + +-- set conceal level bc obsidian plugin requires this: +vim.opt.conceallevel = 1 diff --git a/lua/plugins/nvim-tmux-navigator.lua b/lua/plugins/nvim-tmux-navigator.lua new file mode 100644 index 00000000000..f25c4cd3cbf --- /dev/null +++ b/lua/plugins/nvim-tmux-navigator.lua @@ -0,0 +1,7 @@ +return { + 'christoomey/vim-tmux-navigator', + vim.keymap.set('n', 'C-h', ':TmuxNavigatorLeft'), + vim.keymap.set('n', 'C-j', ':TmuxNavigatorDown'), + vim.keymap.set('n', 'C-k', ':TmuxNavigatorUp'), + vim.keymap.set('n', 'C-l', ':TmuxNavigatorRight'), +} diff --git a/lua/plugins/obsidian.lua b/lua/plugins/obsidian.lua new file mode 100644 index 00000000000..27f1f1f6444 --- /dev/null +++ b/lua/plugins/obsidian.lua @@ -0,0 +1,311 @@ +return { + 'epwalsh/obsidian.nvim', + version = '*', -- recommended, use latest release instead of latest commit + lazy = true, + ft = 'markdown', + -- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault: + -- event = { + -- -- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand'. + -- -- E.g. "BufReadPre " .. vim.fn.expand "~" .. "/my-vault/**.md" + -- "BufReadPre path/to/my-vault/**.md", + -- "BufNewFile path/to/my-vault/**.md", + -- }, + dependencies = { + -- Required. + 'nvim-lua/plenary.nvim', + + -- see below for full list of optional dependencies 👇 + }, + config = function() + require('obsidian').setup { + workspaces = { + { + name = 'personal', + path = '~/Library/Mobile Documents/iCloud~md~obsidian/Documents/MarcsDailyNotes', + }, + { + name = 'commonplace', + path = '~/Library/Mobile Documents/iCloud~md~obsidian/Documents/Marcs Common Place Vault', + }, + { + name = 'archive', + path = '~/Library/Mobile Documents/iCloud~md~obsidian/Documents/ArchivedTalcottUniverse', + }, + }, + notes_subdir = 'notes', + log_level = vim.log.levels.INFO, + daily_notes = { + -- Optional, if you keep daily notes in a separate directory. + folder = 'notes/dailies', + -- Optional, if you want to change the date format for the ID of daily notes. + date_format = '%Y-%m-%d', + -- Optional, if you want to change the date format of the default alias of daily notes. + alias_format = '%B %-d, %Y', + -- Optional, default tags to add to each new daily note created. + default_tags = { 'daily-notes' }, + -- Optional, if you want to automatically insert a template from your template directory like 'daily.md' + template = nil, + }, + -- Optional, completion of wiki links, local markdown links, and tags using nvim-cmp. + completion = { + -- Set to false to disable completion. + nvim_cmp = true, + -- Trigger completion at 2 chars. + min_chars = 2, + }, + + -- Optional, configure key mappings. These are the defaults. If you don't want to set any keymappings this + -- way then set 'mappings = {}'. + mappings = { + -- Overrides the 'gf' mapping to work on markdown/wiki links within your vault. + ['gf'] = { + action = function() + return require('obsidian').util.gf_passthrough() + end, + opts = { noremap = false, expr = true, buffer = true }, + }, + -- Toggle check-boxes. + ['ch'] = { + action = function() + return require('obsidian').util.toggle_checkbox() + end, + opts = { buffer = true }, + }, + -- Smart action depending on context, either follow link or toggle checkbox. + [''] = { + action = function() + return require('obsidian').util.smart_action() + end, + opts = { buffer = true, expr = true }, + }, + }, -- end mappings + + -- Where to put new notes. Valid options are + -- * "current_dir" - put new notes in same directory as the current buffer. + -- * "notes_subdir" - put new notes in the default notes subdirectory. + new_notes_location = 'notes_subdir', + + -- Optional, customize how note IDs are generated given an optional title. + ---@param title string|? + ---@return string + note_id_func = function(title) + -- Create note IDs in a Zettelkasten format with a timestamp and a suffix. + -- In this case a note with the title 'My new note' will be given an ID that looks + -- like '1657296016-my-new-note', and therefore the file name '1657296016-my-new-note.md' + local suffix = '' + if title ~= nil then + -- If title is given, transform it into valid file name. + suffix = title:gsub(' ', '-'):gsub('[^A-Za-z0-9-]', ''):lower() + else + -- If title is nil, just add 4 random uppercase letters to the suffix. + for _ = 1, 4 do + suffix = suffix .. string.char(math.random(65, 90)) + end + end + return tostring(os.time()) .. '-' .. suffix + end, + + -- Optional, customize how note file names are generated given the ID, target directory, and title. + ---@param spec { id: string, dir: obsidian.Path, title: string|? } + ---@return string|obsidian.Path The full path to the new note. + note_path_func = function(spec) + -- This is equivalent to the default behavior. + local path = spec.dir / tostring(spec.id) + return path:with_suffix '.md' + end, + + -- Optional, customize how wiki links are formatted. You can set this to one of: + -- * "use_alias_only", e.g. '[[Foo Bar]]' + -- * "prepend_note_id", e.g. '[[foo-bar|Foo Bar]]' + -- * "prepend_note_path", e.g. '[[foo-bar.md|Foo Bar]]' + -- * "use_path_only", e.g. '[[foo-bar.md]]' + -- Or you can set it to a function that takes a table of options and returns a string, like this: + wiki_link_func = function(opts) + return require('obsidian.util').wiki_link_id_prefix(opts) + end, + + -- Optional, customize how markdown links are formatted. + markdown_link_func = function(opts) + return require('obsidian.util').markdown_link(opts) + end, + + -- Either 'wiki' or 'markdown'. + preferred_link_style = 'wiki', + + -- Optional, customize the default name or prefix when pasting images via `:ObsidianPasteImg`. + ---@return string + image_name_func = function() + -- Prefix image names with timestamp. + return string.format('%s-', os.time()) + end, + + -- Optional, boolean or a function that takes a filename and returns a boolean. + -- `true` indicates that you don't want obsidian.nvim to manage frontmatter. + disable_frontmatter = false, + + -- Optional, alternatively you can customize the frontmatter data. + ---@return table + note_frontmatter_func = function(note) + -- Add the title of the note as an alias. + if note.title then + note:add_alias(note.title) + end + + local out = { id = note.id, aliases = note.aliases, tags = note.tags } + + -- `note.metadata` contains any manually added fields in the frontmatter. + -- So here we just make sure those fields are kept in the frontmatter. + if note.metadata ~= nil and not vim.tbl_isempty(note.metadata) then + for k, v in pairs(note.metadata) do + out[k] = v + end + end + + return out + end, + + -- Optional, for templates (see below). + templates = { + folder = '3 Resources/Templates', + date_format = '%Y-%m-%d', + time_format = '%H:%M', + -- A map for custom variables, the key should be the variable and the value a function + substitutions = {}, + }, + + -- Optional, by default when you use `:ObsidianFollowLink` on a link to an external + -- URL it will be ignored but you can customize this behavior here. + ---@param url string + follow_url_func = function(url) + -- Open the URL in the default web browser. + vim.fn.jobstart { 'open', url } -- Mac OS + -- vim.fn.jobstart({"xdg-open", url}) -- linux + end, + + -- Optional, set to true if you use the Obsidian Advanced URI plugin. + -- https://github.com/Vinzent03/obsidian-advanced-uri + use_advanced_uri = false, + + -- Optional, set to true to force ':ObsidianOpen' to bring the app to the foreground. + open_app_foreground = false, + + picker = { + -- Set your preferred picker. Can be one of 'telescope.nvim', 'fzf-lua', or 'mini.pick'. + name = 'telescope.nvim', + -- Optional, configure key mappings for the picker. These are the defaults. + -- Not all pickers support all mappings. + mappings = { + -- Create a new note from your query. + new = '', + -- Insert a link to the selected note. + insert_link = '', + }, + }, + + -- Optional, sort search results by "path", "modified", "accessed", or "created". + -- The recommend value is "modified" and `true` for `sort_reversed`, which means, for example, + -- that `:ObsidianQuickSwitch` will show the notes sorted by latest modified time + sort_by = 'modified', + sort_reversed = true, + + -- Set the maximum number of lines to read from notes on disk when performing certain searches. + search_max_lines = 1000, + + -- Optional, determines how certain commands open notes. The valid options are: + -- 1. "current" (the default) - to always open in the current window + -- 2. "vsplit" - to open in a vertical split if there's not already a vertical split + -- 3. "hsplit" - to open in a horizontal split if there's not already a horizontal split + open_notes_in = 'current', + + -- Optional, define your own callbacks to further customize behavior. + callbacks = { + -- Runs at the end of `require("obsidian").setup()`. + ---@param client obsidian.Client + post_setup = function(client) end, + + -- Runs anytime you enter the buffer for a note. + ---@param client obsidian.Client + ---@param note obsidian.Note + enter_note = function(client, note) end, + + -- Runs anytime you leave the buffer for a note. + ---@param client obsidian.Client + ---@param note obsidian.Note + leave_note = function(client, note) end, + + -- Runs right before writing the buffer for a note. + ---@param client obsidian.Client + ---@param note obsidian.Note + pre_write_note = function(client, note) end, + + -- Runs anytime the workspace is set/changed. + ---@param client obsidian.Client + ---@param workspace obsidian.Workspace + post_set_workspace = function(client, workspace) end, + }, + + -- Optional, configure additional syntax highlighting / extmarks. + -- This requires you have `conceallevel` set to 1 or 2. See `:help conceallevel` for more details. + ui = { + enable = true, -- set to false to disable all additional syntax features + update_debounce = 200, -- update delay after a text change (in milliseconds) + max_file_length = 5000, -- disable UI features for files with more than this many lines + -- Define how various check-boxes are displayed + checkboxes = { + -- NOTE: the 'char' value has to be a single character, and the highlight groups are defined below. + [' '] = { char = '󰄱', hl_group = 'ObsidianTodo' }, + ['x'] = { char = '', hl_group = 'ObsidianDone' }, + ['>'] = { char = '', hl_group = 'ObsidianRightArrow' }, + ['~'] = { char = '󰰱', hl_group = 'ObsidianTilde' }, + ['!'] = { char = '', hl_group = 'ObsidianImportant' }, + -- Replace the above with this if you don't have a patched font: + -- [" "] = { char = "☐", hl_group = "ObsidianTodo" }, + -- ["x"] = { char = "✔", hl_group = "ObsidianDone" }, + + -- You can also add more custom ones... + }, + -- Use bullet marks for non-checkbox lists. + bullets = { char = '•', hl_group = 'ObsidianBullet' }, + external_link_icon = { char = '', hl_group = 'ObsidianExtLinkIcon' }, + -- Replace the above with this if you don't have a patched font: + -- external_link_icon = { char = "", hl_group = "ObsidianExtLinkIcon" }, + reference_text = { hl_group = 'ObsidianRefText' }, + highlight_text = { hl_group = 'ObsidianHighlightText' }, + tags = { hl_group = 'ObsidianTag' }, + block_ids = { hl_group = 'ObsidianBlockID' }, + hl_groups = { + -- The options are passed directly to `vim.api.nvim_set_hl()`. See `:help nvim_set_hl`. + ObsidianTodo = { bold = true, fg = '#f78c6c' }, + ObsidianDone = { bold = true, fg = '#89ddff' }, + ObsidianRightArrow = { bold = true, fg = '#f78c6c' }, + ObsidianTilde = { bold = true, fg = '#ff5370' }, + ObsidianImportant = { bold = true, fg = '#d73128' }, + ObsidianBullet = { bold = true, fg = '#89ddff' }, + ObsidianRefText = { underline = true, fg = '#c792ea' }, + ObsidianExtLinkIcon = { fg = '#c792ea' }, + ObsidianTag = { italic = true, fg = '#89ddff' }, + ObsidianBlockID = { italic = true, fg = '#89ddff' }, + ObsidianHighlightText = { bg = '#75662e' }, + }, + }, + + -- Specify how to handle attachments. + attachments = { + -- The default folder to place images in via `:ObsidianPasteImg`. + -- If this is a relative path it will be interpreted as relative to the vault root. + -- You can always override this per image by passing a full path to the command instead of just a filename. + img_folder = '3 Resources/Assets/imgs', -- This is the default + -- A function that determines the text to insert in the note when pasting an image. + -- It takes two arguments, the `obsidian.Client` and an `obsidian.Path` to the image file. + -- This is the default implementation. + ---@param client obsidian.Client + ---@param path obsidian.Path the absolute path to the image file + ---@return string + img_text_func = function(client, path) + path = client:vault_relative_path(path) or path + return string.format('![%s](%s)', path.name, path) + end, + }, + } + end, +} From 12febc1bc4223fb8f85baeba6d4e60f86a454f85 Mon Sep 17 00:00:00 2001 From: marctalcott Date: Wed, 17 Jul 2024 21:28:13 -0400 Subject: [PATCH 13/21] updating obsidian --- lua/plugins/obsidian.lua | 71 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 68 insertions(+), 3 deletions(-) diff --git a/lua/plugins/obsidian.lua b/lua/plugins/obsidian.lua index 27f1f1f6444..86c3eeb9cbc 100644 --- a/lua/plugins/obsidian.lua +++ b/lua/plugins/obsidian.lua @@ -32,7 +32,7 @@ return { path = '~/Library/Mobile Documents/iCloud~md~obsidian/Documents/ArchivedTalcottUniverse', }, }, - notes_subdir = 'notes', + notes_subdir = 'inbox', log_level = vim.log.levels.INFO, daily_notes = { -- Optional, if you keep daily notes in a separate directory. @@ -44,7 +44,7 @@ return { -- Optional, default tags to add to each new daily note created. default_tags = { 'daily-notes' }, -- Optional, if you want to automatically insert a template from your template directory like 'daily.md' - template = nil, + template = 'daily-note-template.md', }, -- Optional, completion of wiki links, local markdown links, and tags using nvim-cmp. completion = { @@ -141,7 +141,7 @@ return { -- Optional, boolean or a function that takes a filename and returns a boolean. -- `true` indicates that you don't want obsidian.nvim to manage frontmatter. - disable_frontmatter = false, + disable_frontmatter = true, -- Optional, alternatively you can customize the frontmatter data. ---@return table @@ -307,5 +307,70 @@ return { end, }, } + + -------------- + -- obsidian -- + -------------- + -- + -- >>> oo # from shell, navigate to vault (optional) + -- + -- # NEW NOTE + -- >>> on "Note Name" # call my "obsidian new note" shell script (~/bin/on) + -- >>> + -- >>> ))) on # inside vim now, format note as template + -- >>> ))) # add tag, e.g. fact / blog / video / etc.. + -- >>> ))) # add hubs, e.g. [[python]], [[machine-learning]], etc... + -- >>> ))) of # format title + -- + -- # END OF DAY/WEEK REVIEW + -- >>> or # review notes in inbox + -- >>> + -- >>> ))) ok # inside vim now, move to zettelkasten + -- >>> ))) odd # or delete + -- >>> + -- >>> og # organize saved notes from zettelkasten into notes/[tag] folders + -- >>> ou # sync local with Notion + -- + -- navigate to vault + vim.keymap.set('n', 'od', ':cd /Users/marctalcott/Library/Mobile\\ Documents/iCloud~md~obsidian/Documents/MarcsDailyNotes') + -- + -- convert note to template and remove leading white space + vim.keymap.set('n', 'on', ':ObsidianTemplate note :lua vim.cmd([[1,/^\\S/s/^\\n\\{1,}//]])', { desc = 'Obsidian note template' }) + vim.keymap.set('n', 'o1', ':ObsidianTemplate 1-1-template :lua vim.cmd([[1,/^\\S/s/^\\n\\{1,}//]])', { desc = 'Obsidian 1 on 1 template' }) + vim.keymap.set( + 'n', + 'ol', + ':ObsidianTemplate log-template :lua vim.cmd([[1,/^\\S/s/^\\n\\{1,}//]])', + { desc = 'Obsidian Log entry template' } + ) + -- strip date from note title and replace dashes with spaces + -- must have cursor on title + vim.keymap.set('n', 'of', ':s/\\(# \\)[^_]*_/\\1/ | s/-/ /g') + -- + -- search for files in full vault + vim.keymap.set( + 'n', + 'os', + ':Telescope find_files search_dirs={"/Users/marctalcott/Library/Mobile\\ Documents/iCloud~md~obsidian/Documents/MarcsDailyNotes/notes"}' + ) + vim.keymap.set( + 'n', + 'oz', + ':Telescope live_grep search_dirs={"/Users/marctalcott/Library/Mobile\\ Documents/iCloud~md~obsidian/Documents/MarcsDailyNotes/notes"}' + ) + -- + -- search for files in notes (ignore zettelkasten) + -- vim.keymap.set("n", "ois", ":Telescope find_files search_dirs={\"/Users/alex/library/Mobile\\ Documents/iCloud~md~obsidian/Documents/ZazenCodes/notes\"}") + -- vim.keymap.set("n", "oiz", ":Telescope live_grep search_dirs={\"/Users/alex/library/Mobile\\ Documents/iCloud~md~obsidian/Documents/ZazenCodes/notes\"}") + -- + -- for review workflow + -- move file in current buffer to zettelkasten folder + vim.keymap.set( + 'n', + 'ok', + ":!mv '%:p' /Users/marctalcott/Library/Mobile\\ Documents/iCloud~md~obsidian/Documents/MarcsDailyNotes/zettelkasten:bd" + ) + -- delete file in current buffer + vim.keymap.set('n', 'odd', ":!rm '%:p':bd") end, } From b26617c0da26cf6ce9f7cfc8c6cb17398b13a480 Mon Sep 17 00:00:00 2001 From: Marc Talcott Date: Wed, 24 Jul 2024 07:29:00 -0400 Subject: [PATCH 14/21] minor local fixes on personal mac --- init.lua | 9 +++++---- lua/plugins/obsidian.lua | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/init.lua b/init.lua index 4ac3e8597f5..138c8ec2c16 100644 --- a/init.lua +++ b/init.lua @@ -191,10 +191,11 @@ vim.keymap.set('n', '', '', { desc = 'Move focus to the right win vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) -vim.keymap.set('n', 'ww', 'w', { desc = 'Switch [W]indow' }) -vim.keymap.set('n', 'wc', 'c', { desc = '[C]lose window' }) -vim.keymap.set('n', 'w+', '+', { desc = 'Increase size' }) -vim.keymap.set('n', 'w-', '-', { desc = 'Decrease size' }) +vim.keymap.set('n', 'w', '', { desc = 'Windows' }) +-- vim.keymap.set('n', 'ww', 'w', { desc = 'Switch [W]indow' }) +-- vim.keymap.set('n', 'wc', 'c', { desc = '[C]lose window' }) +-- vim.keymap.set('n', 'w+', '+', { desc = 'Increase size' }) +-- vim.keymap.set('n', 'w-', '-', { desc = 'Decrease size' }) vim.keymap.set('n', '', ':wincmd k') vim.keymap.set('n', '', ':wincmd j') diff --git a/lua/plugins/obsidian.lua b/lua/plugins/obsidian.lua index 86c3eeb9cbc..552fb3d154d 100644 --- a/lua/plugins/obsidian.lua +++ b/lua/plugins/obsidian.lua @@ -368,7 +368,7 @@ return { vim.keymap.set( 'n', 'ok', - ":!mv '%:p' /Users/marctalcott/Library/Mobile\\ Documents/iCloud~md~obsidian/Documents/MarcsDailyNotes/zettelkasten:bd" + ":!mv '%:p' /Users/marctalcott/Library/Mobile\\ Documents/iCloud~md~obsidian/Documents/MarcsDailyNotes/zettelkasten/:bd" ) -- delete file in current buffer vim.keymap.set('n', 'odd', ":!rm '%:p':bd") From e12faebf55dfc4e0ab97a5cc89918b748bf9a1dd Mon Sep 17 00:00:00 2001 From: Marc Talcott Date: Fri, 26 Jul 2024 08:23:24 -0400 Subject: [PATCH 15/21] Added DadBod plugin --- lua/plugins/dadbod.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 lua/plugins/dadbod.lua diff --git a/lua/plugins/dadbod.lua b/lua/plugins/dadbod.lua new file mode 100644 index 00000000000..f897f9e809a --- /dev/null +++ b/lua/plugins/dadbod.lua @@ -0,0 +1,17 @@ +return { + 'kristijanhusak/vim-dadbod-ui', + dependencies = { + { 'tpope/vim-dadbod', lazy = true }, + { 'kristijanhusak/vim-dadbod-completion', ft = { 'sql', 'mysql', 'plsql' }, lazy = true }, -- Optional + }, + cmd = { + 'DBUI', + 'DBUIToggle', + 'DBUIAddConnection', + 'DBUIFindBuffer', + }, + init = function() + -- Your DBUI configuration + vim.g.db_ui_use_nerd_fonts = 1 + end, +} From f22a4686e7d0824dd912fbc77d2af07e8547c789 Mon Sep 17 00:00:00 2001 From: marctalcott Date: Thu, 19 Sep 2024 10:36:46 -0400 Subject: [PATCH 16/21] fixed orgmode for todo list in myDailyNotes --- lua/plugins/orgmode.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lua/plugins/orgmode.lua b/lua/plugins/orgmode.lua index 92ea56eb77c..2ea721deb88 100644 --- a/lua/plugins/orgmode.lua +++ b/lua/plugins/orgmode.lua @@ -5,8 +5,10 @@ return { config = function() -- Setup orgmode require('orgmode').setup { - org_agenda_files = '~/orgfiles/**/*', - org_default_notes_file = '~/orgfiles/refile.org', + org_agenda_files = { + '~/Library/Mobile Documents/iCloud~md~obsidian/Documents/MarcsDailyNotes/**/*', + }, + org_default_notes_file = '~/Library/Mobile Documents/iCloud~md~obsidian/Documents/MarcsDailyNotes/inbox/refile.org', org_capture_templates = { x = { description = 'Journal Personal', @@ -50,12 +52,12 @@ return { target = '~/OrgMode-Inmar/OrgRoamRoot/002-Areas/OneOnOne/billy1on1.org', }, t = { - description = 'Taylor 1:1', + description = 'Todo', datetree = { tree_type = 'day', }, - template = '**** %?\nEntered on %U\n', - target = '~/OrgMode-Inmar/OrgRoamRoot/002-Areas/OneOnOne/taylor1on1.org', + template = '**** - [ ] TODO %?\n Entered on: %U\n', + target = '~/Library/Mobile Documents/iCloud~md~obsidian/Documents/MarcsDailyNotes/tasks/tasks.org', }, a = { description = 'Asha 1:1', From edb1612452f085f644a81a8526a365eb146b3b02 Mon Sep 17 00:00:00 2001 From: marctalcott Date: Thu, 19 Sep 2024 10:40:36 -0400 Subject: [PATCH 17/21] fix 2 lines --- lua/plugins/obsidian.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/plugins/obsidian.lua b/lua/plugins/obsidian.lua index 552fb3d154d..76f7474ac2a 100644 --- a/lua/plugins/obsidian.lua +++ b/lua/plugins/obsidian.lua @@ -351,12 +351,12 @@ return { vim.keymap.set( 'n', 'os', - ':Telescope find_files search_dirs={"/Users/marctalcott/Library/Mobile\\ Documents/iCloud~md~obsidian/Documents/MarcsDailyNotes/notes"}' + ':Telescope find_files search_dirs={"/Users/marctalcott/Library/Mobile\\ Documents/iCloud~md~obsidian/Documents/MarcsDailyNotes"}' ) vim.keymap.set( 'n', 'oz', - ':Telescope live_grep search_dirs={"/Users/marctalcott/Library/Mobile\\ Documents/iCloud~md~obsidian/Documents/MarcsDailyNotes/notes"}' + ':Telescope live_grep search_dirs={"/Users/marctalcott/Library/Mobile\\ Documents/iCloud~md~obsidian/Documents/MarcsDailyNotes"}' ) -- -- search for files in notes (ignore zettelkasten) From c665e72754de8a5eb662ee40657d82c2ea01f125 Mon Sep 17 00:00:00 2001 From: marctalcott Date: Mon, 23 Sep 2024 07:27:51 -0400 Subject: [PATCH 18/21] upgraded everything and then fixed broken code --- ...-preview-nvim.lua => markdown-preview.lua} | 0 lua/plugins/plugins.lua | 96 +++++++++++-------- markdown-preview.nvim | 1 + 3 files changed, 55 insertions(+), 42 deletions(-) rename lua/plugins/{markdown-preview-nvim.lua => markdown-preview.lua} (100%) create mode 160000 markdown-preview.nvim diff --git a/lua/plugins/markdown-preview-nvim.lua b/lua/plugins/markdown-preview.lua similarity index 100% rename from lua/plugins/markdown-preview-nvim.lua rename to lua/plugins/markdown-preview.lua diff --git a/lua/plugins/plugins.lua b/lua/plugins/plugins.lua index f24aa17c012..ad5f5bdb032 100644 --- a/lua/plugins/plugins.lua +++ b/lua/plugins/plugins.lua @@ -1,4 +1,5 @@ -return { +return +{ -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically @@ -48,28 +49,58 @@ return { -- config = function() ... end { -- Useful plugin to show you pending keybinds. - 'folke/which-key.nvim', - event = 'VimEnter', -- Sets the loading event to 'VimEnter' - config = function() -- This is the function that runs, AFTER loading - require('which-key').setup() - - -- Document existing key chains - require('which-key').register { - ['c'] = { name = '[C]ode', _ = 'which_key_ignore' }, - ['d'] = { name = '[D]ocument', _ = 'which_key_ignore' }, - ['r'] = { name = '[R]ename', _ = 'which_key_ignore' }, - ['f'] = { name = '[S]earch', _ = 'which_key_ignore' }, - ['p'] = { name = '[P]roject-Workspace', _ = 'which_key_ignore' }, - ['t'] = { name = '[T]oggle', _ = 'which_key_ignore' }, - ['h'] = { name = 'Git [H]unk', _ = 'which_key_ignore' }, - ['w'] = { name = '[W]indow', _ = 'which_key_ignore' }, - } - -- visual mode - require('which-key').register({ - ['h'] = { 'Git [H]unk' }, - }, { mode = 'v' }) - end, + 'folke/which-key.nvim', + event = 'VimEnter', -- Sets the loading event to 'VimEnter' + opts = { + icons = { + -- set icon mappings to true if you have a Nerd Font + mappings = vim.g.have_nerd_font, + -- If you are using a Nerd Font: set icons.keys to an empty table which will use the + -- default whick-key.nvim defined Nerd Font icons, otherwise define a string table + keys = vim.g.have_nerd_font and {} or { + Up = ' ', + Down = ' ', + Left = ' ', + Right = ' ', + C = ' ', + M = ' ', + D = ' ', + S = ' ', + CR = ' ', + Esc = ' ', + ScrollWheelDown = ' ', + ScrollWheelUp = ' ', + NL = ' ', + BS = ' ', + Space = ' ', + Tab = ' ', + F1 = '', + F2 = '', + F3 = '', + F4 = '', + F5 = '', + F6 = '', + F7 = '', + F8 = '', + F9 = '', + F10 = '', + F11 = '', + F12 = '', + }, + }, + + -- Document existing key chains + spec = { + { 'c', group = '[C]ode', mode = { 'n', 'x' } }, + { 'd', group = '[D]ocument' }, + { 'r', group = '[R]ename' }, + { 'f', group = '[S]earch' }, + { 'p', group = '[P]roject Workspace' }, + { 't', group = '[T]oggle' }, + { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, + }, }, +}, -- NOTE: Plugins can specify dependencies. -- @@ -672,24 +703,5 @@ return { -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. -- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins` -- { import = 'custom.plugins' }, -}, { - ui = { - -- If you are using a Nerd Font: set icons to an empty table which will use the - -- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table - icons = vim.g.have_nerd_font and {} or { - cmd = '⌘', - config = '🛠', - event = '📅', - ft = '📂', - init = '⚙', - keys = '🗝', - plugin = '🔌', - runtime = '💻', - require = '🌙', - source = '📄', - start = '🚀', - task = '📌', - lazy = '💤 ', - }, - }, } + diff --git a/markdown-preview.nvim b/markdown-preview.nvim new file mode 160000 index 00000000000..a923f5fc5ba --- /dev/null +++ b/markdown-preview.nvim @@ -0,0 +1 @@ +Subproject commit a923f5fc5ba36a3b17e289dc35dc17f66d0548ee From 64b654e2934f2f9290abb3fada25d85ee8e4af78 Mon Sep 17 00:00:00 2001 From: marctalcott Date: Mon, 23 Sep 2024 07:38:52 -0400 Subject: [PATCH 19/21] delete rogue file --- markdown-preview.nvim | 1 - 1 file changed, 1 deletion(-) delete mode 160000 markdown-preview.nvim diff --git a/markdown-preview.nvim b/markdown-preview.nvim deleted file mode 160000 index a923f5fc5ba..00000000000 --- a/markdown-preview.nvim +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a923f5fc5ba36a3b17e289dc35dc17f66d0548ee From 3fb8c2f77fda56c46d6a67ef67e5a26a616939e0 Mon Sep 17 00:00:00 2001 From: marctalcott Date: Mon, 23 Sep 2024 08:47:17 -0400 Subject: [PATCH 20/21] update orgmode templates --- lua/plugins/orgmode.lua | 59 +---------------------------------------- 1 file changed, 1 insertion(+), 58 deletions(-) diff --git a/lua/plugins/orgmode.lua b/lua/plugins/orgmode.lua index 2ea721deb88..c4ee113e4ba 100644 --- a/lua/plugins/orgmode.lua +++ b/lua/plugins/orgmode.lua @@ -10,71 +10,14 @@ return { }, org_default_notes_file = '~/Library/Mobile Documents/iCloud~md~obsidian/Documents/MarcsDailyNotes/inbox/refile.org', org_capture_templates = { - x = { - description = 'Journal Personal', - datetree = { - tree_type = 'day', - }, - template = '\n**** %?\nEntered on %U\n', - target = '~/OrgMode-Personal/002-Areas/journal.org', - }, - j = { - description = 'Journal Inmar', - datetree = { - tree_type = 'day', - }, - template = '\n**** %?\nEntered on %U\n', - target = '~/OrgMode-Inmar/OrgRoamRoot/002-Areas/journal.org', - }, - -- Setup 1:1 capture templates - s = { - description = 'Sandeep 1:1', - datetree = { - tree_type = 'day', - }, - template = '**** %?\nEntered on %U\n', - target = '~/OrgMode-Inmar/OrgRoamRoot/002-Areas/OneOnOne/sandeep1on1.org', - }, - d = { - description = 'Debbie 1:1', - datetree = { - tree_type = 'day', - }, - template = '**** %?\nEntered on %U\n', - target = '~/OrgMode-Inmar/OrgRoamRoot/002-Areas/OneOnOne/debbie1on1.org', - }, - b = { - description = 'Billy 1:1', - datetree = { - tree_type = 'day', - }, - template = '**** %?\nEntered on %U\n', - target = '~/OrgMode-Inmar/OrgRoamRoot/002-Areas/OneOnOne/billy1on1.org', - }, t = { description = 'Todo', datetree = { tree_type = 'day', }, - template = '**** - [ ] TODO %?\n Entered on: %U\n', + template = '**** TODO %?\n Entered on: %U\n', target = '~/Library/Mobile Documents/iCloud~md~obsidian/Documents/MarcsDailyNotes/tasks/tasks.org', }, - a = { - description = 'Asha 1:1', - datetree = { - tree_type = 'day', - }, - template = '**** %?\nEntered on %U\n', - target = '~/OrgMode-Inmar/OrgRoamRoot/002-Areas/OneOnOne/asha1on1.org', - }, - g = { - description = 'Gerald 1:1', - datetree = { - tree_type = 'day', - }, - template = '**** %?\nEntered on %U\n', - target = '~/OrgMode-Inmar/OrgRoamRoot/002-Areas/OneOnOne/gerald1on1.org', - }, }, } From adce5335589f84b9b583b3199d09fd71b4b97b28 Mon Sep 17 00:00:00 2001 From: marctalcott Date: Wed, 4 Dec 2024 19:23:14 -0500 Subject: [PATCH 21/21] Commit ai and markdown and init lua cleanup --- init.lua | 2 -- lua/plugins/gennvim.lua | 36 ++++++++++++++++++++++++++++++++++++ lua/plugins/markdownnvim.lua | 11 +++++++++++ 3 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 lua/plugins/gennvim.lua create mode 100644 lua/plugins/markdownnvim.lua diff --git a/init.lua b/init.lua index 138c8ec2c16..46ae08a2f7b 100644 --- a/init.lua +++ b/init.lua @@ -182,7 +182,6 @@ vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' } -- vim.keymap.set('n', '', 'echo "Use k to move!!"') -- vim.keymap.set('n', '', 'echo "Use j to move!!"') --- Keybinds to make split navigation easier. -- Use CTRL+ to switch between windows -- -- See `:help wincmd` for a list of all window commands @@ -242,7 +241,6 @@ vim.opt.rtp:prepend(lazypath) -- -- NOTE: Here is where you install your plugins. require('lazy').setup 'plugins' - -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et -- diff --git a/lua/plugins/gennvim.lua b/lua/plugins/gennvim.lua new file mode 100644 index 00000000000..145747daed1 --- /dev/null +++ b/lua/plugins/gennvim.lua @@ -0,0 +1,36 @@ +return { + 'David-Kunz/gen.nvim', + opts = { + model = 'llama3.2', -- The default model to use. + quit_map = 'q', -- set keymap to close the response window + retry_map = '', -- set keymap to re-send the current prompt + accept_map = '', -- set keymap to replace the previous selection with the last result + host = 'localhost', -- The host running the Ollama service. + port = '11434', -- The port on which the Ollama service is listening. + display_mode = 'split', -- The display mode. Can be "float" or "split" or "horizontal-split". + show_prompt = false, -- Shows the prompt submitted to Ollama. + show_model = false, -- Displays which model you are using at the beginning of your chat session. + no_auto_close = false, -- Never closes the window automatically. + file = false, -- Write the payload to a temporary file to keep the command short. + hidden = false, -- Hide the generation window (if true, will implicitly set `prompt.replace = true`), requires Neovim >= 0.10 + init = function(options) + pcall(io.popen, 'ollama serve > /dev/null 2>&1 &') + end, + -- Function to initialize Ollama + command = function(options) + local body = { model = options.model, stream = true } + return 'curl --silent --no-buffer -X POST http://' .. options.host .. ':' .. options.port .. '/api/chat -d $body' + end, + -- The command for the Ollama service. You can use placeholders $prompt, $model and $body (shellescaped). + -- This can also be a command string. + -- The executed command must return a JSON object with { response, context } + -- (context property is optional). + -- list_models = '', -- Retrieves a list of model names + debug = false, -- Prints errors and the command which is run. + opts = function() + require('gen').prompts['Review_Code'] = { + prompt = 'Review the following code and make concise suggestions:\n```$filetype\n$text\n```', + } + end, + }, +} diff --git a/lua/plugins/markdownnvim.lua b/lua/plugins/markdownnvim.lua new file mode 100644 index 00000000000..5c5fd8f577e --- /dev/null +++ b/lua/plugins/markdownnvim.lua @@ -0,0 +1,11 @@ +return { + { + 'MeanderingProgrammer/render-markdown.nvim', + dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.nvim' }, -- if you use the mini.nvim suite + -- dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.icons' }, -- if you use standalone mini plugins + -- dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, -- if you prefer nvim-web-devicons + ---@module 'render-markdown' + ---@type render.md.UserConfig + opts = {}, + }, +}