diff --git a/bootstrap/packages.txt b/bootstrap/packages.txt index 59a2787..674b898 100644 --- a/bootstrap/packages.txt +++ b/bootstrap/packages.txt @@ -127,8 +127,6 @@ pandoc-bin parallel paru-bin pass -pass-ssh -pass-coffin patch pavolume pdfjs diff --git a/nvim/.config/nvim/lua/plug/_galaxyline.lua b/nvim/.config/nvim/lua/plug/_galaxyline.lua new file mode 100644 index 0000000..7aeef64 --- /dev/null +++ b/nvim/.config/nvim/lua/plug/_galaxyline.lua @@ -0,0 +1,244 @@ +-- set up statusline +local gl = require 'galaxyline' +local gls = gl.section +local fileinfo = require 'galaxyline.provider_fileinfo' +local devicons = require 'nvim-web-devicons' + +local mode_colors = { + normal = '#' .. '98c379', + insert = '#' .. '61afef', + replace = '#' .. 'e06c75', + visual = '#' .. 'e5c07b', + command = '#' .. 'd19a66', + terminal = '#' .. '56b6c2' +} + +-- create icons from unicode +local function u(code) + if type(code) == 'string' then code = tonumber('0x' .. code) end + local c = string.char + if code <= 0x7f then return c(code) end + local t = {} + if code <= 0x07ff then + t[1] = c(bit.bor(0xc0, bit.rshift(code, 6))) + t[2] = c(bit.bor(0x80, bit.band(code, 0x3f))) + elseif code <= 0xffff then + t[1] = c(bit.bor(0xe0, bit.rshift(code, 12))) + t[2] = c(bit.bor(0x80, bit.band(bit.rshift(code, 6), 0x3f))) + t[3] = c(bit.bor(0x80, bit.band(code, 0x3f))) + else + t[1] = c(bit.bor(0xf0, bit.rshift(code, 18))) + t[2] = c(bit.bor(0x80, bit.band(bit.rshift(code, 12), 0x3f))) + t[3] = c(bit.bor(0x80, bit.band(bit.rshift(code, 6), 0x3f))) + t[4] = c(bit.bor(0x80, bit.band(code, 0x3f))) + end + return table.concat(t) +end + +local mode_map = { + ['n'] = {'NORMAL', mode_colors.normal}, + ['i'] = {'INSERT', mode_colors.insert}, + ['R'] = {'REPLACE', mode_colors.replace}, + ['v'] = {'VISUAL', mode_colors.visual}, + ['V'] = {'V-LINE', mode_colors.visual}, + ['c'] = {'COMMAND', mode_colors.command}, + ['s'] = {'SELECT', mode_colors.visual}, + ['S'] = {'S-LINE', mode_colors.visual}, + ['t'] = {'TERMINAL', mode_colors.terminal}, + [''] = {'V-BLOCK', mode_colors.visual}, + [''] = {'S-BLOCK', mode_colors.visual}, + ['Rv'] = {'VIRTUAL'}, + ['rm'] = {'--MORE'} +} + +local sep = { + right_filled = u 'e0b2', + left_filled = u 'e0b0', + right = u 'e0b3', + left = u 'e0b1' +} + +local icons = { + locker = u 'f023', + unsaved = u 'f693', + lsp_warn = u 'f071', + lsp_error = u 'f46e' +} + +local function mode_label() return mode_map[vim.fn.mode()][1] or 'N/A' end +local function mode_hl() return mode_map[vim.fn.mode()][2] or '#ff0000' end + +local function highlight(group, fg, bg, gui) + local cmd = string.format('highlight %s guifg=%s guibg=%s', group, fg, bg) + if gui ~= nil then cmd = cmd .. ' gui=' .. gui end + vim.cmd(cmd) +end + +local function buffer_not_empty() + if vim.fn.empty(vim.fn.expand '%:t') ~= 1 then return true end + return false +end + +local function wide_enough() + local squeeze_width = vim.fn.winwidth(0) + if squeeze_width > 80 then return true end + return false +end + +gl.short_line_list = {'NvimTree', 'vista', 'dbui'} + +gls.left = { + { + ViMode = { + provider = function() + local modehl = mode_hl() + highlight('GalaxyViMode', '000000', modehl, 'bold') + highlight('GalaxyViModeInv', modehl, '000000', 'bold') + return string.format(' %s ', mode_label()) + end, + separator = sep.left_filled, + separator_highlight = 'GalaxyViModeInv' + } + }, { + FileName = { + provider = function() + if not buffer_not_empty() then return '' end + local fname + if wide_enough() then + fname = vim.fn.fnamemodify(vim.fn.expand '%', ':~:.') + else + fname = vim.fn.expand '%:t' + end + if #fname == 0 then return '' end + if vim.bo.readonly then + fname = fname .. ' ' .. icons.locker + end + if vim.bo.modified then + fname = fname .. ' ' .. icons.unsaved + end + return ' ' .. fname .. ' ' + end, + highlight = 'Normal', + separator = sep.left, + separator_highlight = 'GalaxyViModeInv' + } + }, { + -- I am unsure how lua specifies order in these, or are tables unordered? + -- anyway, without the weird section in between add ALWAYS appears to the left + -- of the Branch display + DiffAdd = { + provider = 'DiffAdd', + condition = wide_enough, + icon = '+', + highlight = 'DiffAdded' + }, + WithoutThisAddedComesBeforeBranch = { + provider = function() return '' end + }, + DiffModified = { + provider = 'DiffModified', + condition = wide_enough, + icon = '~', + highlight = 'DiffLine' + }, + DiffRemove = { + provider = 'DiffRemove', + condition = wide_enough, + icon = '-', + highlight = 'DiffRemoved', + separator = sep.left, + separator_highlight = 'GalaxyViModeInv' + }, + GitBranch = { + provider = { + function() return '  ' end, 'GitBranch', + function() return ' ' end + }, + condition = require('galaxyline.condition').check_git_workspace and + wide_enough, + highlight = 'NonText' + } + } +} + +gls.right = { + { + LspStatus = { + provider = function() + local connected = + not vim.tbl_isempty(vim.lsp.buf_get_clients(0)) + if connected then + return ' ' .. u 'f817' .. ' ' + else + return '' + end + end, + highlight = 'DiffAdded', + separator = sep.right, + separator_highlight = 'GalaxyViModeInv' + } + }, { + DiagnosticWarn = { + provider = function() + local n = vim.lsp.diagnostic.get_count(0, 'Warning') + if n == 0 then return '' end + return string.format(' %s %d ', icons.lsp_warn, n) + end, + highlight = 'LspDiagnosticsDefaultWarning' + }, + DiagnosticError = { + provider = function() + local n = vim.lsp.diagnostic.get_count(0, 'Error') + if n == 0 then return '' end + return string.format(' %s %d ', icons.lsp_error, n) + end, + highlight = 'LspDiagnosticsDefaultError' + } + }, { + FileIcon = { + provider = function() + local fname, ext = vim.fn.expand '%:t', vim.fn.expand '%:e' + local icon, _ = devicons.get_icon(fname, ext) + if icon == nil then return '' end + return ' ' .. icon .. ' ' + end, + separator = sep.right, + highlight = 'Normal', + separator_highlight = 'GalaxyViModeInv' + }, + FileType = { + provider = function() + -- if not buffer_not_empty() then + -- return '' + -- end + return string.format(' %s ', vim.bo.filetype) + end, + -- condition = buffer_not_empty, + highlight = 'Normal' + } + }, { + PositionInfo = { + provider = { + function() + return string.format('%s:%s', vim.fn.line('.'), + vim.fn.col('.')) + end + }, + highlight = 'GalaxyViMode', + separator = sep.right_filled, + separator_highlight = 'GalaxyViModeInv' + }, + PercentInfo = { + provider = fileinfo.current_line_percent, + highlight = 'GalaxyViMode', + separator = sep.right, + separator_highlight = 'GalaxyViMode' + } + } +} +for k, v in pairs(gls.left) do gls.short_line_left[k] = v end +table.remove(gls.short_line_left, 1) + +for k, v in pairs(gls.right) do gls.short_line_right[k] = v end +table.remove(gls.short_line_right) +table.remove(gls.short_line_right) diff --git a/nvim/.config/nvim/lua/plug/_lsp.lua b/nvim/.config/nvim/lua/plug/_lsp.lua index c54a510..f2a9f72 100644 --- a/nvim/.config/nvim/lua/plug/_lsp.lua +++ b/nvim/.config/nvim/lua/plug/_lsp.lua @@ -1,6 +1,12 @@ +local api = vim.api + +local saga = require 'lspsaga' +local lspcfg = require 'lspconfig' local cmp = require 'cmp' local lspkind = require 'lspkind' +require"lsp_signature".setup() + local has_words_before = function() local line, col = unpack(vim.api.nvim_win_get_cursor(0)) return col ~= 0 and @@ -14,6 +20,12 @@ local feedkey = function(key, mode) mode, true) end +-- Enable the following language servers +local servers = { + 'bashls', 'gopls', 'texlab', 'pyright', 'rust_analyzer', 'tsserver', 'vimls' + -- sumneko_lua further down, needs more setup +} + vim.o.completeopt = "menu,menuone,noselect" -- completion items @@ -81,71 +93,141 @@ cmp.setup.cmdline(':', { sources = cmp.config.sources({{name = 'path'}}, {{name = 'cmdline'}}) }) -require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol - .make_client_capabilities()) +-- Setup lspconfig. +local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp + .protocol + .make_client_capabilities()) + +local on_attach = function(_, _) + -- Keybindings for LSPs + -- Note these are in on_attach so that they don't override bindings in a non-LSP setting + api.nvim_set_keymap("n", "gh", + "lua require 'lspsaga.provider'.lsp_finder()", + {noremap = true, silent = true}) + api.nvim_set_keymap("n", "gd", + "lua require'lspsaga.provider'.preview_definition()", + {noremap = true, silent = true}) + api.nvim_set_keymap("n", "gE", + "lua require 'lspsaga.codeaction'.code_action()", + {noremap = true, silent = true}) + api.nvim_set_keymap("v", "gE", + "'<,'>lua require 'lspsaga.codeaction'.range_code_action()", + {noremap = true, silent = true}) + api.nvim_set_keymap("n", "K", + "lua require('lspsaga.hover').render_hover_doc()", + {noremap = true, silent = true}) + api.nvim_set_keymap("n", "gK", + "lua require('lspsaga.signaturehelp').signature_help()", + {noremap = true, silent = true}) + api.nvim_set_keymap("n", "gr", + "lua require('lspsaga.rename').rename()", + {noremap = true, silent = true}) + + api.nvim_set_keymap("n", "ge", + "lua require('lspsaga.diagnostic').show_line_diagnostics()", + {noremap = true, silent = true}) + api.nvim_set_keymap("n", "]e", + "lua require('lspsaga.diagnostic').lsp_jump_diagnostic_next()", + {noremap = true, silent = true}) + api.nvim_set_keymap("n", "[e", + "lua require('lspsaga.diagnostic').lsp_jump_diagnostic_prev()", + {noremap = true, silent = true}) + + api.nvim_set_keymap("n", "C-f", + "lua require('lspsaga.action').smart_scroll_with_saga(1)", + {noremap = true, silent = true}) + api.nvim_set_keymap("n", "C-b", + "lua require('lspsaga.action').smart_scroll_with_saga(-1)", + {noremap = true, silent = true}) + + require("lspsaga").init_lsp_saga { + error_sign = 'X', + warn_sign = '⚠️', + hint_sign = '⚡', + infor_sign = 'ℹ️', + -- code_action_icon = '●', + finder_definition_icon = '📖 ', + finder_reference_icon = '🔖 ', + definition_preview_icon = '📖 ', + finder_action_keys = { + open = '', + split = 's', + vsplit = 'v', + quit = '', + scroll_down = '', + scroll_up = '' + }, + code_action_keys = {quit = '', exec = ''}, + rename_action_keys = {quit = '', exec = ''} + } + vim.cmd("command! LspHover lua vim.lsp.buf.hover()") + vim.cmd( + "command! LspDisable lua vim.lsp.stop_client(vim.lsp.get_active_clients())") + print('LSP ready') +end + +-- set up simple servers +for _, lsp in ipairs(servers) do + lspcfg[lsp].setup {on_attach = on_attach, capabilities = capabilities} +end + +lspcfg.efm.setup { + on_attach = on_attach, + init_options = { + documentFormatting = true, + codeAction = true, + completion = true, + documentSymbol = true, + hover = true + }, + filetypes = {"sh"}, + settings = { + rootMarkers = {".git/"}, + languages = { + sh = { + { + lintCommand = 'shellcheck -f gcc -x', + lintFormats = { + '%f:%l:%c: %trror: %m', '%f:%l:%c: %tarning: %m', + '%f:%l:%c: %tote: %m' + } + }, {formatCommand = 'shfmt -ci -s -bn', formatStdin = true} + } + } + } +} -- requires the lua-language-server package to be installed -- The arch package defaults to the following directory local sumneko_root_path = "/usr/share/lua-language-server" -require'navigator'.setup({ - lsp = { - servers = {'efm'}, - sumneko_lua = { - cmd = { - "lua-language-server", "-E", sumneko_root_path .. "/main.lua" +lspcfg.sumneko_lua.setup { + cmd = {"lua-language-server", "-E", sumneko_root_path .. "/main.lua"}, + settings = { + Lua = { + runtime = { + -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) + version = 'LuaJIT', + -- Setup your lua path + path = vim.split(package.path, ';') }, - settings = { - Lua = { - runtime = { - -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) - version = 'LuaJIT', - -- Setup your lua path - path = vim.split(package.path, ';') - }, - diagnostics = { - -- Get the language server to recognize additional globals - globals = { - 'vim', 'before_each', 'after_each', 'describe', - 'it', 'mock', 'stub' - } - }, - workspace = { - -- Make the server aware of additional runtime files - library = { - [vim.fn.expand('$VIMRUNTIME/lua')] = true, - [vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true, - ["/usr/share/lua/5.1/busted/"] = true - } - } + diagnostics = { + -- Get the language server to recognize additional globals + globals = { + 'vim', 'before_each', 'after_each', 'describe', 'it', + 'mock', 'stub' } - } - }, - efm = { - init_options = { - documentFormatting = true, - codeAction = true, - completion = true, - documentSymbol = true, - hover = true }, - filetypes = {"sh"}, - settings = { - rootMarkers = {".git/"}, - languages = { - sh = { - { - lintCommand = 'shellcheck -f gcc -x', - lintFormats = { - '%f:%l:%c: %trror: %m', - '%f:%l:%c: %tarning: %m', '%f:%l:%c: %tote: %m' - } - }, - {formatCommand = 'shfmt -ci -s -bn', formatStdin = true} - } + workspace = { + -- Make the server aware of additional runtime files + library = { + [vim.fn.expand('$VIMRUNTIME/lua')] = true, + [vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true, + ["/usr/share/lua/5.1/busted/"] = true } } } + }, + on_attach = on_attach +} - } -}) -require"lsp_signature".setup() +saga.init_lsp_saga() diff --git a/nvim/.config/nvim/lua/plug/_lualine.lua b/nvim/.config/nvim/lua/plug/_lualine.lua deleted file mode 100644 index 5c36f14..0000000 --- a/nvim/.config/nvim/lua/plug/_lualine.lua +++ /dev/null @@ -1,28 +0,0 @@ -require('lualine').setup { - options = { - icons_enabled = true, - theme = 'auto', - component_separators = {left = '', right = ''}, - section_separators = {left = '', right = ''}, - disabled_filetypes = {}, - always_divide_middle = true - }, - sections = { - lualine_a = {'mode'}, - lualine_b = {'branch', 'diff', 'diagnostics'}, - lualine_c = {'filename'}, - lualine_x = {'encoding', 'fileformat', 'filetype'}, - lualine_y = {'progress', 'location'}, - lualine_z = {'hostname'} - }, - inactive_sections = { - lualine_a = {}, - lualine_b = {'branch', 'diff'}, - lualine_c = {'filename'}, - lualine_x = {}, - lualine_y = {'location'}, - lualine_z = {} - }, - tabline = {}, - extensions = {'quickfix', 'toggleterm'} -} diff --git a/nvim/.config/nvim/lua/plugins.lua b/nvim/.config/nvim/lua/plugins.lua index 719d95d..de16ac9 100644 --- a/nvim/.config/nvim/lua/plugins.lua +++ b/nvim/.config/nvim/lua/plugins.lua @@ -25,7 +25,6 @@ require("packer").startup(function() } -- allow seamless navigation between vim buffers and tmux splits use 'jeffkreeftmeijer/vim-numbertoggle' -- toggles numbers to absolute for all buffers but the current which is relative use 'RRethy/vim-illuminate' -- highlight other occurences of the word under cursor - use 'ojroques/vim-oscyank' -- yank from *anywhere* (even ssh session) to clipboard, using :OSCYank use 'ggandor/lightspeed.nvim' -- jump between letters with improved fFtT quicksearch, mimics sneak -- use { -- weird errors currently -- 'lukas-reineke/indent-blankline.nvim', -- show a vertical line for each indentation @@ -37,11 +36,12 @@ require("packer").startup(function() 'lewis6991/gitsigns.nvim', -- show vcs changes on left-hand gutter requires = {'nvim-lua/plenary.nvim'}, tag = 'release', - config = function() - require('gitsigns').setup { - keymaps = {['n ]c'] = nil, ['n [c'] = nil} + config = function() require('gitsigns').setup{ + keymaps = { + ['n ]c'] = nil, + ['n [c'] = nil, } - end, + } end, event = "BufRead" } use { @@ -57,7 +57,18 @@ require("packer").startup(function() -- editing use {'tpope/vim-commentary', event = "BufRead"} -- easily toggle comments for lines, paragraphs etc with gc - use {'machakann/vim-sandwich', event = "BufRead"} -- surround things with other things using sa/sd/sr + use { + 'blackCauldron7/surround.nvim', -- lets you change surrounding things with cs (or ds to del, ys to add) + config = function() + vim.g.surround_mappings_style = "surround" + vim.g.surround_pairs = { + nestable = {{'(', ')'}, {'[', ']'}, {'{', '}'}}, + linear = {{"'", "'"}, {'"', '"'}, {'*', '*'}, {'`', '`'}} + } + require('surround').setup {} + end, + event = "BufRead" + } use { 'monaqa/dial.nvim', -- extend the ^a / ^x possibilities to dates, hex, alphabets, markdown headers event = "BufRead" @@ -90,9 +101,9 @@ require("packer").startup(function() -- statusline use { - 'nvim-lualine/lualine.nvim', + 'glepnir/galaxyline.nvim', requires = {'kyazdani42/nvim-web-devicons', opt = true}, - config = function() require('plug._lualine') end + config = function() require('plug._galaxyline') end } -- writing @@ -105,7 +116,7 @@ require("packer").startup(function() require("true-zen").setup({ integrations = { gitsigns = true, - lualine = true, + galaxyline = true, tmux = {global = false}, limelight = true } @@ -124,21 +135,17 @@ require("packer").startup(function() ft = "python", config = function() vim.g.slime_target = 'tmux' - vim.g.slime_default_config = { - socket_name = "default", - target_pane = "{last}" - } + vim.g.slime_default_config = {socket_name = "default", target_pane = "{last}"} vim.g.slime_python_ipython = 1 vim.g.slime_no_mappings = 1 - end + end, } - use { - 'hanschen/vim-ipython-cell', -- send code 'cells' to REPL + use { 'hanschen/vim-ipython-cell', -- send code 'cells' to REPL ft = "python", config = function() vim.g.ipython_cell_highlight_cells_ft = {'python'} vim.g.ipython_cell_insert_tag = "## Cell" - end + end, } -- @@ -150,10 +157,6 @@ require("packer").startup(function() event = "BufWinEnter", config = function() require('plug._toggleterm') end } - use { - "folke/which-key.nvim", - config = function() require("which-key").setup {} end - } -- fuzzy matching use { @@ -164,10 +167,29 @@ require("packer").startup(function() use "nvim-telescope/telescope-fzy-native.nvim" use "nvim-telescope/telescope-fzf-writer.nvim" + -- lsp + use 'neovim/nvim-lspconfig' -- some commong language server configurations + use 'tami5/lspsaga.nvim' -- nice and fast ui for lsp actions WILL HAVE TO BE REPLACED SOON + use 'simrat39/symbols-outline.nvim' -- vista-like outline view for code + use 'ray-x/lsp_signature.nvim' + -- and completion + use { + 'hrsh7th/nvim-cmp', -- simple completion engine built specifically for nvim and lsp + requires = { + 'onsails/lspkind-nvim', 'andersevenrud/cmp-tmux', -- completion source from adjacent tmux panes + 'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-buffer', 'hrsh7th/cmp-path', + 'hrsh7th/cmp-cmdline', 'hrsh7th/cmp-vsnip', + 'kdheepak/cmp-latex-symbols', 'ray-x/cmp-treesitter', + 'f3fora/cmp-spell', 'jc-doyle/cmp-pandoc-references', + 'cbarrete/completion-vcard' + } + } -- snippeting use {"hrsh7th/vim-vsnip", event = "InsertEnter"} -- snippet engine use {"rafamadriz/friendly-snippets", event = "InsertEnter"} -- many snippets + require('plug._lsp') + -- treesitter use { 'nvim-treesitter/nvim-treesitter', @@ -197,26 +219,4 @@ require("packer").startup(function() config = function() require('spellsitter').setup() end } - -- lsp - use 'neovim/nvim-lspconfig' -- some commong language server configurations - use 'simrat39/symbols-outline.nvim' -- vista-like outline view for code - use 'ray-x/lsp_signature.nvim' - use { - 'ray-x/navigator.lua', - requires = {'ray-x/guihua.lua', run = 'cd lua/fzy && make'} - } - -- and completion - use { - 'hrsh7th/nvim-cmp', -- simple completion engine built specifically for nvim and lsp - requires = { - 'onsails/lspkind-nvim', 'andersevenrud/cmp-tmux', -- completion source from adjacent tmux panes - 'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-buffer', 'hrsh7th/cmp-path', - 'hrsh7th/cmp-cmdline', 'hrsh7th/cmp-vsnip', - 'kdheepak/cmp-latex-symbols', 'ray-x/cmp-treesitter', - 'f3fora/cmp-spell', 'jc-doyle/cmp-pandoc-references', - 'cbarrete/completion-vcard' - } - } - require('plug._lsp') - end) diff --git a/pass/.config/sh/env.d/pass-ssh.sh b/pass/.config/sh/env.d/pass-ssh.sh deleted file mode 100644 index bfe5559..0000000 --- a/pass/.config/sh/env.d/pass-ssh.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env sh -# Settings for pass-ssh extension - -alias pass-ssh='pass ssh --fzf -d ~/.ssh/keys --ssh-t ed25519' diff --git a/pass/.config/sh/env.d/pass-xdg.sh b/pass/.config/sh/env.d/pass-xdg.sh index ea8fa7e..e9f38f6 100644 --- a/pass/.config/sh/env.d/pass-xdg.sh +++ b/pass/.config/sh/env.d/pass-xdg.sh @@ -3,4 +3,3 @@ # usually password store will be found in ~/.local/share/pass export PASSWORD_STORE_DIR="$XDG_DATA_HOME/pass" -export PASSWORD_STORE_ENABLE_EXTENSIONS=true diff --git a/pass/.local/bin/pass-pick b/pass/.local/bin/pass-pick index b6ca935..d494fdf 100755 --- a/pass/.local/bin/pass-pick +++ b/pass/.local/bin/pass-pick @@ -109,9 +109,6 @@ set_defaults() { AUTOFILL_CHAIN="${PP_AUTOENTRY_CHAIN:-$(get_config AUTOFILL_CHAIN 'username :tab password')}" AUTOFILL_DELAY="${PP_AUTOENTRY_DELAY:-$(get_config AUTOFILL_DELAY 30)}" PASS_USERNAME_FIELD="${PP_PASS_USERNAME_FIELD:-$(get_config PASS_USERNAME_FIELD 'username user login')}" - - PASS_COFFIN_OPEN_TIME="${PP_PASS_COFFIN_OPEN_TIME:-$(get_config PASS_COFFIN_OPEN_TIME 0)}" - PASS_COFFIN_LOCATION="${PP_PASS_COFFIN_LOCATION:-$(get_config PASS_COFFIN_LOCATION)}" } # exit on escape pressed @@ -314,26 +311,6 @@ entrymenu() { esac } -open_coffin() { - ## there's a closed coffin in our directory - if [ -f "${PASS_COFFIN_LOCATION:-${PASSWORD_STORE_DIR:-~/.password-store}/.coffin/coffin.tar.gpg}" ]; then - if [ "$PASS_COFFIN_OPEN_TIME" -eq 0 ]; then - coffin_should_close_instantly=true - pass open -t 1h # we still set a maximum time limit just to hedge against failures - else - pass open -t "${PASS_COFFIN_OPEN_TIME:-3h}" - fi - fi -} - -# make sure we remember to close the coffin if the program terminates -close_coffin() { - if [ "$coffin_should_close_instantly" = true ]; then - pass close - fi -} -trap close_coffin SIGINT SIGTERM ERR EXIT - main() { local autoentry_chain="${AUTOFILL_CHAIN}" local k_autofill="${KEY_AUTOFILL}" @@ -343,8 +320,6 @@ main() { local k_clip_pass="${KEY_CLIP_PASS}" local k_submenu="${KEY_ENTRY_OPEN}" - open_coffin - entry="$( list_passwords | _picker -kb-accept-entry "" \ @@ -363,25 +338,29 @@ main() { case "$exit_value" in "0" | "10") autofill "$entry" "$autoentry_chain" + exit 0 ;; "11") clip_username "$entry" + exit 0 ;; "12") clip_password "$entry" + exit ;; "13") autofill "$entry" "username" + exit ;; "14") autofill "$entry" "password" + exit ;; "15") entrymenu "$entry" + exit ;; esac - - exit 0 } set_defaults