···11-{ pkgs, ... }:
11+{ pkgs, config, ... }:
22let
33 customPlugins = {
44 vim-zettel = pkgs.vimUtils.buildVimPlugin {
···138138 " match with %link
139139 syntax match VimwikiPlaceholder /^\s*%link\ze\%(\s.*\)\?$/ nextgroup=VimwikiPlaceholderParam skipwhite
140140 '';
141141+142142+ # Private mode plugin for concealing buffer content (out of store symlink for live editing)
143143+ home.file.".config/nvim/lua/private-mode.lua".source = config.lib.file.mkOutOfStoreSymlink "${toString ./.}/private-mode.lua";
141144142145 #environment.systemPackages = with customPlugins; [ tidal ];
143146 programs.neovim = {
···481484 local line, col = unpack(vim.api.nvim_win_get_cursor(0))
482485 return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
483486 end
487487+488488+ -- private mode
489489+ -- Setup private mode
490490+ require('private-mode').setup({ keymap = '<leader>pm' })
484491485492 local luasnip = require("luasnip")
486493 local lspkind = require("lspkind")
···12061213 owner = "sourcegraph";
12071214 repo = "amp.nvim";
12081215 rev = "main";
12091209- sha256 = "1n6d8nbakyg6yiq8mhhrvmsp9z0zb8cb67820jsg3wl6vqd1vwv5";
12161216+ sha256 = "sha256-+jIbAZjRpt30gcrIiwW+yZhT9CFLnW9ARf92GEfioZ0=";
12101217 };
12111218 })
12121219 ];
+95
home/profiles/nvim/private-mode.lua
···11+local M = {}
22+33+local ns_id = vim.api.nvim_create_namespace('private_mode')
44+local enabled = false
55+local concealed_char = '•' -- Character to show instead of text
66+77+local function conceal_buffer()
88+ local buf = vim.api.nvim_get_current_buf()
99+ local line_count = vim.api.nvim_buf_line_count(buf)
1010+1111+ vim.api.nvim_buf_clear_namespace(buf, ns_id, 0, -1)
1212+1313+ for i = 0, line_count - 1 do
1414+ local line = vim.api.nvim_buf_get_lines(buf, i, i + 1, false)[1]
1515+ if line and #line > 0 then
1616+ -- Conceal each character individually
1717+ for col = 0, #line - 1 do
1818+ vim.api.nvim_buf_set_extmark(buf, ns_id, i, col, {
1919+ end_col = col + 1,
2020+ conceal = concealed_char,
2121+ })
2222+ end
2323+ end
2424+ end
2525+end
2626+2727+local function reveal_current_line()
2828+ local buf = vim.api.nvim_get_current_buf()
2929+ local cursor = vim.api.nvim_win_get_cursor(0)
3030+ local current_line = cursor[1] - 1
3131+3232+ -- Clear concealment for current line only
3333+ vim.api.nvim_buf_clear_namespace(buf, ns_id, current_line, current_line + 1)
3434+end
3535+3636+local function update_display()
3737+ if not enabled then return end
3838+3939+ conceal_buffer()
4040+ local mode = vim.fn.mode()
4141+4242+ -- Reveal current line in insert mode
4343+ if mode == 'i' or mode == 'R' then
4444+ reveal_current_line()
4545+ end
4646+end
4747+4848+function M.toggle()
4949+ enabled = not enabled
5050+5151+ if enabled then
5252+ -- Set concealment options
5353+ vim.opt_local.conceallevel = 2
5454+ vim.opt_local.concealcursor = 'nvc'
5555+5656+ -- Initial concealment
5757+ update_display()
5858+5959+ -- Set up autocommands
6060+ local group = vim.api.nvim_create_augroup('PrivateMode', { clear = true })
6161+6262+ vim.api.nvim_create_autocmd({'ModeChanged', 'CursorMoved', 'CursorMovedI', 'TextChanged', 'TextChangedI'}, {
6363+ group = group,
6464+ callback = update_display,
6565+ })
6666+6767+ print("Private mode enabled")
6868+ else
6969+ -- Clear all concealment
7070+ local buf = vim.api.nvim_get_current_buf()
7171+ vim.api.nvim_buf_clear_namespace(buf, ns_id, 0, -1)
7272+7373+ -- Clear autocommands
7474+ vim.api.nvim_create_augroup('PrivateMode', { clear = true })
7575+7676+ print("Private mode disabled")
7777+ end
7878+end
7979+8080+function M.setup(opts)
8181+ opts = opts or {}
8282+ concealed_char = opts.conceal_char or '•'
8383+8484+ -- Create user command
8585+ vim.api.nvim_create_user_command('PrivateMode', function()
8686+ M.toggle()
8787+ end, {})
8888+8989+ -- Optional: Set up a keybinding
9090+ if opts.keymap then
9191+ vim.keymap.set('n', opts.keymap, M.toggle, { desc = 'Toggle private mode' })
9292+ end
9393+end
9494+9595+return M
···5757 };
58585959 environment.systemPackages = with pkgs; [
6060- #unstable.sublime-music
6160 # olm-3.2.16 is now insecure
6261 # some reason I can't set insecure packages that will be respected
6362 nheko
···6766 unstable.liferea
6867 unstable.gh
6968 unstable.flyctl
7070- unstable.sublime-music
71697270 kooha
7371 light