diff --git a/flake.lock b/flake.lock index 1095eef..628b39d 100644 --- a/flake.lock +++ b/flake.lock @@ -410,6 +410,22 @@ "type": "github" } }, + "nvim-orgmode": { + "flake": false, + "locked": { + "lastModified": 1747057841, + "narHash": "sha256-mLT3XnsRyG+ZldB9NrR9tjmaznRAISBsdVTVPSjhj0A=", + "owner": "nvim-orgmode", + "repo": "orgmode", + "rev": "8ff03c75f3d808e3ea1765b7aba0fb4783a5a83f", + "type": "github" + }, + "original": { + "owner": "nvim-orgmode", + "repo": "orgmode", + "type": "github" + } + }, "root": { "inputs": { "flake-utils": "flake-utils", @@ -417,7 +433,8 @@ "mini-nvim": "mini-nvim", "neovim-nightly-overlay": "neovim-nightly-overlay", "nixpkgs": "nixpkgs_2", - "nixpkgs-uns": "nixpkgs-uns" + "nixpkgs-uns": "nixpkgs-uns", + "nvim-orgmode": "nvim-orgmode" } }, "systems": { diff --git a/flake.nix b/flake.nix index e4c6acf..dd710c9 100644 --- a/flake.nix +++ b/flake.nix @@ -14,6 +14,10 @@ url = "github:echasnovski/mini.nvim"; flake = false; }; + nvim-orgmode = { + url = "github:nvim-orgmode/orgmode"; + flake = false; + }; # Add bleeding-edge plugins here. # They can be updated with `nix flake update` (make sure to commit the generated flake.lock) # wf-nvim = { @@ -37,7 +41,7 @@ inherit system; config.allowUnfree = true; overlays = [ - # inputs.neovim-nightly-overlay.overlays.default + inputs.neovim-nightly-overlay.overlays.default neovim-overlay # This adds a function can be used to generate a .luarc.json # containing the Neovim API all plugins in the workspace directory. diff --git a/nix/neovim-overlay.nix b/nix/neovim-overlay.nix index 087fe8e..725f569 100644 --- a/nix/neovim-overlay.nix +++ b/nix/neovim-overlay.nix @@ -12,6 +12,7 @@ with final.pkgs.lib; let mkNeovim = pkgs.callPackage ./mkNeovim.nix { inherit pkgs-wrapNeovim; }; mini-nvim-git = mkNvimPlugin inputs.mini-nvim "mini.nvim"; + nvim-orgmode = mkNvimPlugin inputs.nvim-orgmode "orgmode"; all-plugins = with pkgs.vimPlugins; [ blink-cmp @@ -29,9 +30,23 @@ with final.pkgs.lib; let nightfox-nvim nvim-lint nvim-lspconfig + nvim-orgmode nvim-treesitter-context nvim-treesitter-textobjects - nvim-treesitter.withAllGrammars + (nvim-treesitter.withPlugins (_: + nvim-treesitter.allGrammars ++ + [(pkgs.tree-sitter.buildGrammar { + language = "org"; + version = "2.0.1"; + src = pkgs.fetchFromGitHub { + owner = "nvim-orgmode"; + repo = "tree-sitter-org"; + rev = "2.0.1"; + hash = "sha256-k1g5+iyJvVWKOuAkFNaaKl42Xmmz9BN+vT0+IQ/4RQI="; + }; + meta.homepage = "https://github.com/nvim-orgmode/tree-sitter-org"; + })] + )) oil-nvim refactoring-nvim render-markdown-nvim diff --git a/nvim/lua/config/init.lua b/nvim/lua/config/init.lua index 04214a9..e615f4e 100644 --- a/nvim/lua/config/init.lua +++ b/nvim/lua/config/init.lua @@ -2,6 +2,7 @@ vim.opt.autowrite = true vim.opt.backspace = 'indent,eol,start' vim.opt.confirm = true vim.opt.completeopt = { 'menu', 'menuone', 'noselect' } +vim.opt.diffopt = 'internal,filler,closeoff,inline:char' vim.opt.expandtab = true -- insert tabs as spaces vim.opt.inccommand = 'split' -- incremental live completion vim.opt.list = true @@ -60,8 +61,6 @@ vim.keymap.set('n', '', vim.cmd.bnext, { noremap = true, silent = true }) vim.keymap.set('n', '', vim.cmd.bprev, { noremap = true, silent = true }) vim.keymap.set('v', '<', '', '>gv') -vim.keymap.set({ 'n', 'v' }, '[[', '{') -vim.keymap.set({ 'n', 'v' }, ']]', '}') -- resize splits if window got resized vim.api.nvim_create_autocmd({ 'VimResized' }, { diff --git a/nvim/lua/plugins/completion.lua b/nvim/lua/plugins/completion.lua index aa21196..57a11a8 100644 --- a/nvim/lua/plugins/completion.lua +++ b/nvim/lua/plugins/completion.lua @@ -5,6 +5,7 @@ return { dependencies = { 'mikavilpas/blink-ripgrep.nvim', 'fang2hou/blink-copilot', + 'nvim-orgmode/orgmode', }, opts = { fuzzy = { @@ -23,6 +24,9 @@ return { 'ripgrep', 'copilot', }, + per_filetype = { + org = { 'orgmode' }, + }, providers = { snippets = { score_offset = -20, @@ -47,6 +51,11 @@ return { }, }, }, + orgmode = { + name = 'Orgmode', + module = 'orgmode.org.autocompletion.blink', + fallbacks = { 'buffer' }, + }, }, }, cmdline = { diff --git a/nvim/lua/plugins/mini.lua b/nvim/lua/plugins/mini.lua index dbc7043..6bf864b 100644 --- a/nvim/lua/plugins/mini.lua +++ b/nvim/lua/plugins/mini.lua @@ -51,6 +51,26 @@ return { noremap = true, desc = 'git diff overlay', }, + { + 'gd', + function() + return MiniGit.show_at_cursor() + end, + noremap = true, + desc = 'git show at cursor', + }, + { + 'gb', + 'Git blame -- %', + noremap = true, + desc = 'git blame', + }, + { + 'gg', + ':Git ', + noremap = true, + desc = 'git command', + }, }, config = function() require('mini.basics').setup { mappings = { windows = true } } @@ -96,6 +116,7 @@ return { prefix = 'gR', }, } + require('mini.git').setup() setup_pairs { modes = { insert = true, command = true, terminal = false }, skip_next = [=[[%w%%%'%[%"%.%`%$]]=], diff --git a/nvim/lua/plugins/misc.lua b/nvim/lua/plugins/misc.lua index 3f1c82d..a8356ce 100644 --- a/nvim/lua/plugins/misc.lua +++ b/nvim/lua/plugins/misc.lua @@ -37,7 +37,7 @@ return { 'MeanderingProgrammer/render-markdown.nvim', event = 'VeryLazy', opts = { - ft = { 'markdown', 'codecompanion' }, + file_types = { 'markdown', 'codecompanion' }, }, }, { @@ -109,6 +109,7 @@ return { 'neogit', 'native_lsp', 'diagnostic', + 'modes', }, }, }, @@ -148,4 +149,47 @@ return { }, }, { 'ThePrimeagen/refactoring.nvim', event = 'VeryLazy', config = true }, + { + 'nvim-orgmode/orgmode', + event = 'VeryLazy', + ft = { 'org' }, + dependencies = 'nvim-treesitter', + keys = { + { + 'oR', + 'e ~/orgfiles/refile.org', + desc = 'open org refile', + }, + }, + config = function() + require('orgmode').setup { + org_agenda_files = '~/orgfiles/**/*', + org_default_notes_file = '~/orgfiles/refile.org', + org_todo_keywords = { + 'TODO', + 'IN_PROGRESS', + 'BLOCKED', + '|', + 'DONE', + 'NOT DOING', + }, + org_capture_templates = { + l = { + description = 'Work Log', + template = '* %?', + target = '~/orgfiles/worklog.org', + }, + }, + } + vim.api.nvim_create_autocmd('FileType', { + pattern = 'org', + callback = function() + vim.keymap.set({ 'n', 'i' }, '\\\\', 'lua require("orgmode").action("org_mappings.meta_return")', { + silent = true, + buffer = true, + }) + end, + }) + end, + }, } diff --git a/nvim/lua/plugins/treesitter.lua b/nvim/lua/plugins/treesitter.lua index acdcada..c48c183 100644 --- a/nvim/lua/plugins/treesitter.lua +++ b/nvim/lua/plugins/treesitter.lua @@ -28,6 +28,7 @@ return { config = function() require('nvim-treesitter.configs').setup { ensure_installed = {}, + ignore_install = { 'org' }, auto_install = false, highlight = { enable = true, @@ -56,12 +57,12 @@ return { goto_next_start = { [']a'] = '@parameter.inner', [']f'] = '@function.outer', - ['}'] = '@statement.outer', + [']]'] = '@statement.outer', }, goto_previous_start = { ['[a'] = '@parameter.inner', ['[f'] = '@function.outer', - ['{'] = '@statement.outer', + ['[['] = '@statement.outer', }, }, swap = {