mirror of
https://github.com/traxys/Nixfiles.git
synced 2026-02-20 22:00:57 +01:00
neovim: Switch from zk to wiki.vim
This commit is contained in:
parent
c7dc1489d6
commit
79bc79e7f6
4 changed files with 51 additions and 43 deletions
17
flake.lock
generated
17
flake.lock
generated
|
|
@ -1391,6 +1391,7 @@
|
|||
"simulationcraft": "simulationcraft",
|
||||
"treefmt-nix": "treefmt-nix_2",
|
||||
"vim-headerguard": "vim-headerguard",
|
||||
"wiki.vim": "wiki.vim",
|
||||
"zsh-nix-shell": "zsh-nix-shell"
|
||||
}
|
||||
},
|
||||
|
|
@ -1860,6 +1861,22 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"wiki.vim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1720569608,
|
||||
"narHash": "sha256-5BrfNhD8SPZrObNCFCdrrMPdFpy0Vov+W/ojAxM2v1I=",
|
||||
"owner": "lervag",
|
||||
"repo": "wiki.vim",
|
||||
"rev": "d65fcef243d273787106a1328ff5cad5b1e2a918",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "lervag",
|
||||
"repo": "wiki.vim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"zsh-nix-shell": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
|
|
|||
|
|
@ -101,6 +101,10 @@
|
|||
url = "github:drmikehenry/vim-headerguard";
|
||||
flake = false;
|
||||
};
|
||||
"wiki.vim" = {
|
||||
url = "github:lervag/wiki.vim";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
|
||||
outputs =
|
||||
|
|
|
|||
|
|
@ -94,6 +94,7 @@
|
|||
];
|
||||
|
||||
globals = {
|
||||
wiki_root = "~/wiki";
|
||||
neo_tree_remove_legacy_commands = 1;
|
||||
mapleader = " ";
|
||||
};
|
||||
|
|
@ -144,7 +145,6 @@
|
|||
{ inherit key mode; } // (if builtins.isString action then { inherit action; } else action)
|
||||
);
|
||||
nm = modeKeys [ "n" ];
|
||||
vs = modeKeys [ "v" ];
|
||||
in
|
||||
helpers.keymaps.mkKeymaps { options.silent = true; } (nm {
|
||||
"ft" = "<cmd>Neotree<CR>";
|
||||
|
|
@ -170,16 +170,34 @@
|
|||
desc = "toggle inlay hints";
|
||||
};
|
||||
};
|
||||
"<leader>zn" = "<Cmd>ZkNew { title = vim.fn.input('Title: ') }<CR>";
|
||||
"<leader>zo" = "<Cmd>ZkNotes { sort = { 'modified' } }<CR>";
|
||||
"<leader>zt" = "<Cmd>ZkTags<CR>";
|
||||
"<leader>zf" = "<Cmd>ZkNotes { sort = { 'modified' }, match = { vim.fn.input('Search: ') } }<CR>";
|
||||
"yH" = {
|
||||
action = "<Cmd>Telescope yank_history<CR>";
|
||||
options.desc = "history";
|
||||
};
|
||||
"<leader>wS" = {
|
||||
action = helpers.mkRaw ''
|
||||
function()
|
||||
require('telescope.builtin').live_grep({
|
||||
cwd = "~/wiki",
|
||||
glob_pattern = "*.md"
|
||||
})
|
||||
end
|
||||
'';
|
||||
options.desc = "search in wiki";
|
||||
};
|
||||
"<leader>Y" = {
|
||||
action = helpers.mkRaw ''
|
||||
function ()
|
||||
vim.go.operatorfunc = "v:lua.osc52_yank_cb";
|
||||
local yank = require('vim.ui.clipboard.osc52').copy('+')
|
||||
end
|
||||
'';
|
||||
options = {
|
||||
desc = "yank through osc52";
|
||||
expr = true;
|
||||
};
|
||||
};
|
||||
})
|
||||
++ (vs { "<leader>zf" = "'<,'>ZkMatch<CR>"; })
|
||||
++ [
|
||||
{
|
||||
key = "<leader>rn";
|
||||
|
|
@ -718,11 +736,6 @@
|
|||
-- null_ls.register(sca2d)
|
||||
'';
|
||||
|
||||
plugins.zk = {
|
||||
enable = true;
|
||||
settings.picker = "telescope";
|
||||
};
|
||||
|
||||
plugins.which-key.enable = true;
|
||||
|
||||
plugins.leap.enable = true;
|
||||
|
|
@ -746,38 +759,6 @@
|
|||
'';
|
||||
};
|
||||
|
||||
files."ftplugin/markdown.lua" = {
|
||||
extraConfigLua = ''
|
||||
if require("zk.util").notebook_root(vim.fn.expand('%:p')) ~= nil then
|
||||
local function map(...) vim.api.nvim_buf_set_keymap(0, ...) end
|
||||
local opts = { noremap=true, silent=false }
|
||||
|
||||
-- Open the link under the caret.
|
||||
map("n", "<CR>", "<Cmd>lua vim.lsp.buf.definition()<CR>", opts)
|
||||
|
||||
-- Create a new note after asking for its title.
|
||||
-- This overrides the global `<leader>zn` mapping to create the note in the same directory as the current buffer.
|
||||
map("n", "<leader>zn", "<Cmd>ZkNew { dir = vim.fn.expand('%:p:h'), title = vim.fn.input('Title: ') }<CR>", opts)
|
||||
-- Create a new note in the same directory as the current buffer, using the current selection for title.
|
||||
map("v", "<leader>znt", ":'<,'>ZkNewFromTitleSelection { dir = vim.fn.expand('%:p:h') }<CR>", opts)
|
||||
-- Create a new note in the same directory as the current buffer, using the current selection for note content and asking for its title.
|
||||
map("v", "<leader>znc", ":'<,'>ZkNewFromContentSelection { dir = vim.fn.expand('%:p:h'), title = vim.fn.input('Title: ') }<CR>", opts)
|
||||
|
||||
-- Open notes linking to the current buffer.
|
||||
map("n", "<leader>zb", "<Cmd>ZkBacklinks<CR>", opts)
|
||||
-- Alternative for backlinks using pure LSP and showing the source context.
|
||||
--map('n', '<leader>zb', '<Cmd>lua vim.lsp.buf.references()<CR>', opts)
|
||||
-- Open notes linked by the current buffer.
|
||||
map("n", "<leader>zl", "<Cmd>ZkLinks<CR>", opts)
|
||||
|
||||
-- Preview a linked note.
|
||||
map("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>", opts)
|
||||
-- Open the code actions for a visual selection.
|
||||
map("v", "<leader>za", ":'<,'>lua vim.lsp.buf.range_code_action()<CR>", opts)
|
||||
end
|
||||
'';
|
||||
};
|
||||
|
||||
extraPackages = with pkgs; [
|
||||
# sca2d
|
||||
djlint
|
||||
|
|
@ -785,6 +766,7 @@
|
|||
];
|
||||
|
||||
extraPlugins = with pkgs.vimPlugins; [
|
||||
wiki-vim
|
||||
telescope-ui-select-nvim
|
||||
vim-snippets
|
||||
markdown-preview-nvim
|
||||
|
|
|
|||
|
|
@ -27,6 +27,11 @@
|
|||
src = inputs.vim-headerguard;
|
||||
version = inputs.vim-headerguard.shortRev;
|
||||
};
|
||||
wiki-vim = prev.vimUtils.buildVimPlugin {
|
||||
pname = "wiki.vim";
|
||||
src = inputs."wiki.vim";
|
||||
version = inputs."wiki.vim".shortRev;
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue