idk a bunch more updates
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
bat
|
||||
fd
|
||||
ncdu
|
||||
du-dust
|
||||
dust
|
||||
# dia-cli
|
||||
duf
|
||||
trash-cli
|
||||
@@ -63,6 +63,7 @@
|
||||
taskwarrior-tui
|
||||
# vimwiki-cli
|
||||
zk
|
||||
unstable.opencode
|
||||
|
||||
(pkgs.writeScriptBin "jq-repl" ''
|
||||
#!/usr/bin/env bash
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ pkgs, ... }:
|
||||
{ pkgs, config, ... }:
|
||||
let
|
||||
customPlugins = {
|
||||
vim-zettel = pkgs.vimUtils.buildVimPlugin {
|
||||
@@ -139,6 +139,9 @@ in
|
||||
syntax match VimwikiPlaceholder /^\s*%link\ze\%(\s.*\)\?$/ nextgroup=VimwikiPlaceholderParam skipwhite
|
||||
'';
|
||||
|
||||
# Private mode plugin for concealing buffer content (out of store symlink for live editing)
|
||||
home.file.".config/nvim/lua/private-mode.lua".source = config.lib.file.mkOutOfStoreSymlink "${toString ./.}/private-mode.lua";
|
||||
|
||||
#environment.systemPackages = with customPlugins; [ tidal ];
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
@@ -482,6 +485,10 @@ in
|
||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
||||
end
|
||||
|
||||
-- private mode
|
||||
-- Setup private mode
|
||||
require('private-mode').setup({ keymap = '<leader>pm' })
|
||||
|
||||
local luasnip = require("luasnip")
|
||||
local lspkind = require("lspkind")
|
||||
local cmp = require('cmp')
|
||||
@@ -1206,7 +1213,7 @@ in
|
||||
owner = "sourcegraph";
|
||||
repo = "amp.nvim";
|
||||
rev = "main";
|
||||
sha256 = "1n6d8nbakyg6yiq8mhhrvmsp9z0zb8cb67820jsg3wl6vqd1vwv5";
|
||||
sha256 = "sha256-+jIbAZjRpt30gcrIiwW+yZhT9CFLnW9ARf92GEfioZ0=";
|
||||
};
|
||||
})
|
||||
];
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
local M = {}
|
||||
|
||||
local ns_id = vim.api.nvim_create_namespace('private_mode')
|
||||
local enabled = false
|
||||
local concealed_char = '•' -- Character to show instead of text
|
||||
|
||||
local function conceal_buffer()
|
||||
local buf = vim.api.nvim_get_current_buf()
|
||||
local line_count = vim.api.nvim_buf_line_count(buf)
|
||||
|
||||
vim.api.nvim_buf_clear_namespace(buf, ns_id, 0, -1)
|
||||
|
||||
for i = 0, line_count - 1 do
|
||||
local line = vim.api.nvim_buf_get_lines(buf, i, i + 1, false)[1]
|
||||
if line and #line > 0 then
|
||||
-- Conceal each character individually
|
||||
for col = 0, #line - 1 do
|
||||
vim.api.nvim_buf_set_extmark(buf, ns_id, i, col, {
|
||||
end_col = col + 1,
|
||||
conceal = concealed_char,
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function reveal_current_line()
|
||||
local buf = vim.api.nvim_get_current_buf()
|
||||
local cursor = vim.api.nvim_win_get_cursor(0)
|
||||
local current_line = cursor[1] - 1
|
||||
|
||||
-- Clear concealment for current line only
|
||||
vim.api.nvim_buf_clear_namespace(buf, ns_id, current_line, current_line + 1)
|
||||
end
|
||||
|
||||
local function update_display()
|
||||
if not enabled then return end
|
||||
|
||||
conceal_buffer()
|
||||
local mode = vim.fn.mode()
|
||||
|
||||
-- Reveal current line in insert mode
|
||||
if mode == 'i' or mode == 'R' then
|
||||
reveal_current_line()
|
||||
end
|
||||
end
|
||||
|
||||
function M.toggle()
|
||||
enabled = not enabled
|
||||
|
||||
if enabled then
|
||||
-- Set concealment options
|
||||
vim.opt_local.conceallevel = 2
|
||||
vim.opt_local.concealcursor = 'nvc'
|
||||
|
||||
-- Initial concealment
|
||||
update_display()
|
||||
|
||||
-- Set up autocommands
|
||||
local group = vim.api.nvim_create_augroup('PrivateMode', { clear = true })
|
||||
|
||||
vim.api.nvim_create_autocmd({'ModeChanged', 'CursorMoved', 'CursorMovedI', 'TextChanged', 'TextChangedI'}, {
|
||||
group = group,
|
||||
callback = update_display,
|
||||
})
|
||||
|
||||
print("Private mode enabled")
|
||||
else
|
||||
-- Clear all concealment
|
||||
local buf = vim.api.nvim_get_current_buf()
|
||||
vim.api.nvim_buf_clear_namespace(buf, ns_id, 0, -1)
|
||||
|
||||
-- Clear autocommands
|
||||
vim.api.nvim_create_augroup('PrivateMode', { clear = true })
|
||||
|
||||
print("Private mode disabled")
|
||||
end
|
||||
end
|
||||
|
||||
function M.setup(opts)
|
||||
opts = opts or {}
|
||||
concealed_char = opts.conceal_char or '•'
|
||||
|
||||
-- Create user command
|
||||
vim.api.nvim_create_user_command('PrivateMode', function()
|
||||
M.toggle()
|
||||
end, {})
|
||||
|
||||
-- Optional: Set up a keybinding
|
||||
if opts.keymap then
|
||||
vim.keymap.set('n', opts.keymap, M.toggle, { desc = 'Toggle private mode' })
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
Reference in New Issue
Block a user