Compare commits
4 commits
1bcab1d5e7
...
9f5bca4a62
Author | SHA1 | Date | |
---|---|---|---|
9f5bca4a62 | |||
989886a936 | |||
d4bbf7b573 | |||
953fdaaf1e |
7 changed files with 56 additions and 273 deletions
|
@ -11,7 +11,7 @@
|
||||||
</alias>
|
</alias>
|
||||||
<alias>
|
<alias>
|
||||||
<family>monospace</family>
|
<family>monospace</family>
|
||||||
<prefer><family>Iosevka</family></prefer>
|
<prefer><family>Iosevka Nerd Font</family></prefer>
|
||||||
</alias>
|
</alias>
|
||||||
<alias>
|
<alias>
|
||||||
<family>fantasy</family>
|
<family>fantasy</family>
|
||||||
|
|
|
@ -35,8 +35,8 @@ screenshot-tag-colorspace=yes
|
||||||
osc=no
|
osc=no
|
||||||
osd-bar=no
|
osd-bar=no
|
||||||
|
|
||||||
osd-font='Iosevka Mono'
|
osd-font='Iosevka Nerd Font'
|
||||||
osd-font-size=16
|
osd-font-size=15
|
||||||
|
|
||||||
### Subtitles
|
### Subtitles
|
||||||
|
|
||||||
|
|
|
@ -178,12 +178,13 @@ vim.g.nv_fzf_binds = {
|
||||||
map.n.nore['<leader>n'] = ':NV<cr>'
|
map.n.nore['<leader>n'] = ':NV<cr>'
|
||||||
map.n.nore['<leader>N'] = ':NV!<cr>'
|
map.n.nore['<leader>N'] = ':NV!<cr>'
|
||||||
|
|
||||||
-- Mostly dealing with Prose writing from here on out
|
|
||||||
-- Format current Paragraph (esp useful in prose writing)
|
-- Format current Paragraph (esp useful in prose writing)
|
||||||
map.n.nore.silent['<localleader>q'] = 'gqap'
|
map.n.nore.silent['<localleader>q'] = 'gqap'
|
||||||
map.x.nore.silent['<localleader>q'] = 'gq'
|
map.x.nore.silent['<localleader>q'] = 'gq'
|
||||||
map.n.nore.silent['<localleader>Q'] = 'vapJgqap'
|
map.n.nore.silent['<localleader>Q'] = 'vapJgqap'
|
||||||
|
|
||||||
|
map.n.silent['<localleader>mp'] = '<Plug>MarkdownPreviewToggle'
|
||||||
|
|
||||||
-- FORMAT code with
|
-- FORMAT code with
|
||||||
-- PLUGIN: formatter.nvim
|
-- PLUGIN: formatter.nvim
|
||||||
map.n.nore.silent['<localleader>f'] = ':FormatLock<cr>'
|
map.n.nore.silent['<localleader>f'] = ':FormatLock<cr>'
|
||||||
|
@ -248,21 +249,22 @@ map.n.nore['<leader>ww'] = [[:lua require 'zettelkasten'.index_open()<cr> ]]
|
||||||
-- create a lazygit window, set up in toggleterm settings
|
-- create a lazygit window, set up in toggleterm settings
|
||||||
map.n.nore['<leader>G'] = ':Lazygit<cr>'
|
map.n.nore['<leader>G'] = ':Lazygit<cr>'
|
||||||
|
|
||||||
-- PLUGIN: slime and ipython-cell
|
-- PLUGIN: magma-nvim
|
||||||
-- send line / region, not adhering to cells
|
-- Operate jupyter notebooks from within vim
|
||||||
map.n['<leader>cs'] = '<Plug>SlimeLineSend'
|
map.n.nore.silent['<localleader>rr'] = ':MagmaEvaluateLine<cr>'
|
||||||
map.x['<leader>cs'] = '<Plug>SlimeRegionSend'
|
map.n.nore.silent['<localleader>R'] = '?^```{<cr>jV/```<cr>k:<C-u>MagmaEvaluateVisual<cr>'
|
||||||
-- send complete script to repl / benchmark execution
|
map.x.nore.silent['<localleader>r'] = ':<C-u>MagmaEvaluateVisual<cr>'
|
||||||
map.n.nore['<leader>cr'] = ':IPythonCellRun<cr>'
|
map.n.nore.expr.silent['<localleader>r'] = "nvim_exec('MagmaEvaluateOperator', v:true)"
|
||||||
map.n.nore['<leader>cR'] = ':IPythonCellRunTime<cr>'
|
map.n.nore.silent['<localleader>re'] = ':MagmaReevaluateCell<cr>'
|
||||||
-- send current cell / send and go to next
|
map.n.nore.silent['<localleader>ro'] = ':MagmaShowOutput<cr>'
|
||||||
map.n.nore['<leader>cc'] = ':IPythonCellExecuteCellVerbose<cr>'
|
map.n.nore.silent['<localleader>rq'] = ':noautocmd :MagmaEnterOutput<cr>'
|
||||||
map.n.nore['<leader>C'] = ':IPythonCellExecuteCellVerboseJump<cr>'
|
map.n.nore.silent['<localleader>rc'] = ':MagmaDelete<cr>'
|
||||||
-- clear ipython repl
|
map.n.nore.silent['<localleader>rd'] = ':MagmaInterrupt<cr>'
|
||||||
map.n.nore['<leader>cl'] = ':IPythonCellClear<cr>'
|
|
||||||
-- jump to previous/ next cell
|
map.n.nore.silent['<localleader>rO'] = ':lua vim.g.magma_automatically_open_output = not(vim.g.magma_automatically_open_output)<cr>'
|
||||||
map.n.nore[']c'] = ':IPythonCellNextCell<cr>'
|
-- jump to beginning of previous/ next cell code
|
||||||
map.n.nore['[c'] = ':IPythonCellPrevCell<cr>'
|
map.n.nore[']r'] = '/^```{<cr>}:nohl<cr>'
|
||||||
|
map.n.nore['[r'] = '?^```n<cr>}:nohl<cr>'
|
||||||
-- insert cell header above/below
|
-- insert cell header above/below
|
||||||
map.n.nore['<leader>cO'] = ':IPythonCellInsertAbove<cr>a'
|
map.n.nore['<leader>cO'] = ':IPythonCellInsertAbove<cr>a'
|
||||||
map.n.nore['<leader>co'] = ':IPythonCellInsertBelow<cr>a'
|
map.n.nore['<leader>co'] = ':IPythonCellInsertBelow<cr>a'
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
local ensure_packer = function()
|
local ensure_packer = function()
|
||||||
local fn = vim.fn
|
local fn = vim.fn
|
||||||
local install_path = fn.stdpath('data') ..
|
local install_path = fn.stdpath('data') ..
|
||||||
'/site/pack/packer/start/packer.nvim'
|
'/site/pack/packer/start/packer.nvim'
|
||||||
if fn.empty(fn.glob(install_path)) > 0 then
|
if fn.empty(fn.glob(install_path)) > 0 then
|
||||||
fn.system({
|
fn.system({
|
||||||
'git', 'clone', '--depth', '1',
|
'git', 'clone', '--depth', '1',
|
||||||
|
@ -16,11 +16,11 @@ end
|
||||||
local packer_bootstrap = ensure_packer()
|
local packer_bootstrap = ensure_packer()
|
||||||
|
|
||||||
-- Compile on plugin edits
|
-- Compile on plugin edits
|
||||||
vim.api.nvim_create_autocmd({"BufWritePost"}, {
|
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
|
||||||
pattern = "plugins.lua",
|
pattern = "plugins.lua",
|
||||||
command = "PackerCompile",
|
command = "PackerCompile",
|
||||||
desc = "Compile plugins after editing plugin list",
|
desc = "Compile plugins after editing plugin list",
|
||||||
group = vim.api.nvim_create_augroup('compilepackages', {clear = true})
|
group = vim.api.nvim_create_augroup('compilepackages', { clear = true })
|
||||||
})
|
})
|
||||||
|
|
||||||
local use = require("packer").use
|
local use = require("packer").use
|
||||||
|
@ -42,7 +42,7 @@ require("packer").startup(function()
|
||||||
use 'vifm/vifm.vim' -- integrate file manager
|
use 'vifm/vifm.vim' -- integrate file manager
|
||||||
use {
|
use {
|
||||||
'lewis6991/gitsigns.nvim', -- show vcs changes on left-hand gutter
|
'lewis6991/gitsigns.nvim', -- show vcs changes on left-hand gutter
|
||||||
requires = {'nvim-lua/plenary.nvim'},
|
requires = { 'nvim-lua/plenary.nvim' },
|
||||||
tag = 'release',
|
tag = 'release',
|
||||||
config = function() require('plug._gitsigns') end,
|
config = function() require('plug._gitsigns') end,
|
||||||
event = "BufRead"
|
event = "BufRead"
|
||||||
|
@ -98,52 +98,42 @@ require("packer").startup(function()
|
||||||
-- statusline
|
-- statusline
|
||||||
use {
|
use {
|
||||||
'nvim-lualine/lualine.nvim',
|
'nvim-lualine/lualine.nvim',
|
||||||
requires = {'kyazdani42/nvim-web-devicons', opt = true},
|
requires = { 'kyazdani42/nvim-web-devicons', opt = true },
|
||||||
config = function() require('plug._lualine') end
|
config = function() require('plug._lualine') end
|
||||||
}
|
}
|
||||||
|
|
||||||
-- writing
|
-- writing
|
||||||
use {'vim-pandoc/vim-pandoc-syntax'}
|
use { 'vim-pandoc/vim-pandoc-syntax' }
|
||||||
use {'vim-pandoc/vim-pandoc'}
|
use { 'vim-pandoc/vim-pandoc' }
|
||||||
use {'vim-pandoc/vim-criticmarkup'}
|
use { 'vim-pandoc/vim-criticmarkup' }
|
||||||
use {
|
use {
|
||||||
"quarto-dev/quarto-vim",
|
"quarto-dev/quarto-vim",
|
||||||
requires = {{"vim-pandoc/vim-pandoc-syntax"}},
|
requires = { { "vim-pandoc/vim-pandoc-syntax" } },
|
||||||
ft = {"quarto"}
|
ft = { "quarto" }
|
||||||
}
|
}
|
||||||
use 'micarmst/vim-spellsync' -- personal dict improvements for git sync
|
use 'micarmst/vim-spellsync' -- personal dict improvements for git sync
|
||||||
use {'folke/zen-mode.nvim', config = require('zen-mode').setup()} -- provide distraction free writing
|
use { 'folke/zen-mode.nvim', config = require('zen-mode').setup() } -- provide distraction free writing
|
||||||
use 'folke/twilight.nvim' -- provide even distraction free-er writing (lowlight paragraphs)
|
use 'folke/twilight.nvim' -- provide even distraction free-er writing (lowlight paragraphs)
|
||||||
use 'alok/notational-fzf-vim' -- quickly search through the wiki
|
use 'alok/notational-fzf-vim' -- quickly search through the wiki
|
||||||
|
use({
|
||||||
|
"iamcco/markdown-preview.nvim", -- generate an auto-updating html preview for md files
|
||||||
|
run = function() vim.fn["mkdp#util#install"]() end
|
||||||
|
})
|
||||||
|
|
||||||
-- languages
|
-- languages
|
||||||
use {'euclidianAce/BetterLua.vim', ft = 'lua'} -- better syntax highlighting for lua
|
use { 'euclidianAce/BetterLua.vim', ft = 'lua' } -- better syntax highlighting for lua
|
||||||
use 'aliou/bats.vim' -- enable syntax for bats shell-code testing library
|
use 'aliou/bats.vim' -- enable syntax for bats shell-code testing library
|
||||||
|
|
||||||
-- REPL work
|
-- REPL work
|
||||||
use {
|
use {
|
||||||
'jpalardy/vim-slime', -- send arbitrary code chunks to REPLs
|
'WhiteBlackGoose/magma-nvim-goose',
|
||||||
|
run = ":UpdateRemotePlugins",
|
||||||
config = function()
|
config = function()
|
||||||
vim.g.slime_target = 'tmux'
|
vim.g.magma_image_provider = "kitty"
|
||||||
vim.g.slime_paste_file = vim.fn.tempname()
|
vim.g.magma_automatically_open_output = false
|
||||||
vim.g.slime_default_config = {
|
|
||||||
socket_name = "default",
|
|
||||||
target_pane = "{last}"
|
|
||||||
}
|
|
||||||
vim.g.slime_python_ipython = 1
|
|
||||||
vim.g.slime_no_mappings = 1
|
|
||||||
end
|
|
||||||
}
|
|
||||||
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
|
||||||
}
|
}
|
||||||
|
|
||||||
--
|
|
||||||
-- nvim plugs
|
-- nvim plugs
|
||||||
use {
|
use {
|
||||||
'echasnovski/mini.nvim',
|
'echasnovski/mini.nvim',
|
||||||
|
@ -173,19 +163,19 @@ require("packer").startup(function()
|
||||||
use {
|
use {
|
||||||
"nvim-telescope/telescope.nvim",
|
"nvim-telescope/telescope.nvim",
|
||||||
requires = {
|
requires = {
|
||||||
{"nvim-lua/popup.nvim"}, {"nvim-lua/plenary.nvim"},
|
{ "nvim-lua/popup.nvim" }, { "nvim-lua/plenary.nvim" },
|
||||||
{"nvim-telescope/telescope-fzf-native.nvim", run = 'make'}
|
{ "nvim-telescope/telescope-fzf-native.nvim", run = 'make' }
|
||||||
},
|
},
|
||||||
config = function() require('plug._telescope') end
|
config = function() require('plug._telescope') end
|
||||||
}
|
}
|
||||||
use {
|
use {
|
||||||
'protex/better-digraphs.nvim',
|
'protex/better-digraphs.nvim',
|
||||||
requires = {{"nvim-telescope/telescope.nvim"}}
|
requires = { { "nvim-telescope/telescope.nvim" } }
|
||||||
}
|
}
|
||||||
|
|
||||||
-- snippeting
|
-- snippeting
|
||||||
use {"hrsh7th/vim-vsnip", event = "InsertEnter"} -- snippet engine
|
use { "hrsh7th/vim-vsnip", event = "InsertEnter" } -- snippet engine
|
||||||
use {"rafamadriz/friendly-snippets", event = "InsertEnter"} -- many snippets
|
use { "rafamadriz/friendly-snippets", event = "InsertEnter" } -- many snippets
|
||||||
|
|
||||||
-- treesitter
|
-- treesitter
|
||||||
use {
|
use {
|
||||||
|
@ -198,7 +188,7 @@ require("packer").startup(function()
|
||||||
use {
|
use {
|
||||||
'RRethy/nvim-treesitter-textsubjects', -- allows using . and ; to target treesitter branches
|
'RRethy/nvim-treesitter-textsubjects', -- allows using . and ; to target treesitter branches
|
||||||
config = function()
|
config = function()
|
||||||
require'nvim-treesitter.configs'.setup {
|
require 'nvim-treesitter.configs'.setup {
|
||||||
textsubjects = {
|
textsubjects = {
|
||||||
enable = true,
|
enable = true,
|
||||||
keymaps = {
|
keymaps = {
|
||||||
|
@ -225,7 +215,7 @@ require("packer").startup(function()
|
||||||
use 'ray-x/lsp_signature.nvim'
|
use 'ray-x/lsp_signature.nvim'
|
||||||
use {
|
use {
|
||||||
'ray-x/navigator.lua',
|
'ray-x/navigator.lua',
|
||||||
requires = {'ray-x/guihua.lua', run = 'cd lua/fzy && make'},
|
requires = { 'ray-x/guihua.lua', run = 'cd lua/fzy && make' },
|
||||||
config = function() require('plug._lsp') end
|
config = function() require('plug._lsp') end
|
||||||
}
|
}
|
||||||
-- and completion
|
-- and completion
|
||||||
|
@ -241,7 +231,7 @@ require("packer").startup(function()
|
||||||
}
|
}
|
||||||
use {
|
use {
|
||||||
'aspeddro/cmp-pandoc.nvim',
|
'aspeddro/cmp-pandoc.nvim',
|
||||||
requires = {'nvim-lua/plenary.nvim', 'jbyuki/nabla.nvim'}
|
requires = { 'nvim-lua/plenary.nvim', 'jbyuki/nabla.nvim' }
|
||||||
}
|
}
|
||||||
require('plug._cmp')
|
require('plug._cmp')
|
||||||
|
|
||||||
|
|
|
@ -1,214 +1,5 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
## Integration at the Bottom
|
SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
|
||||||
|
export SSH_AUTH_SOCK
|
||||||
# Copyright (C) 2011 by Wayne Walker <wwalker@solid-constructs.com>
|
gpgconf --launch gpg-agent
|
||||||
#
|
|
||||||
# Released under one of the versions of the MIT License.
|
|
||||||
#
|
|
||||||
# Copyright (C) 2011 by Wayne Walker <wwalker@solid-constructs.com>
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
|
||||||
# in the Software without restriction, including without limitation the rights
|
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
|
||||||
# furnished to do so, subject to the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in
|
|
||||||
# all copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
# THE SOFTWARE.
|
|
||||||
|
|
||||||
_LIVE_AGENT_LIST=""
|
|
||||||
declare -a _LIVE_AGENT_SOCK_LIST
|
|
||||||
_LIVE_AGENT_SOCK_LIST=()
|
|
||||||
|
|
||||||
_debug_print() {
|
|
||||||
if [[ $_DEBUG -gt 0 ]]; then
|
|
||||||
printf "%s\n" "$1"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
find_all_ssh_agent_sockets() {
|
|
||||||
_SSH_AGENT_SOCKETS=$(find /tmp/ -type s -name agent.\* 2>/dev/null | grep '/tmp/ssh-.*/agent.*')
|
|
||||||
_debug_print "$_SSH_AGENT_SOCKETS"
|
|
||||||
}
|
|
||||||
|
|
||||||
find_all_gpg_agent_sockets() {
|
|
||||||
_GPG_AGENT_SOCKETS=$(find /tmp/ -type s -name S.gpg-agent.ssh 2>/dev/null | grep '/tmp/gpg-.*/S.gpg-agent.ssh')
|
|
||||||
_debug_print "$_GPG_AGENT_SOCKETS"
|
|
||||||
}
|
|
||||||
|
|
||||||
find_all_gnome_keyring_agent_sockets() {
|
|
||||||
_GNOME_KEYRING_AGENT_SOCKETS=$(find /tmp/ -type s -name "ssh" 2>/dev/null | grep '/tmp/keyring-.*/ssh$')
|
|
||||||
_debug_print "$_GNOME_KEYRING_AGENT_SOCKETS"
|
|
||||||
}
|
|
||||||
|
|
||||||
find_all_osx_keychain_agent_sockets() {
|
|
||||||
[[ -n "$TMPDIR" ]] || TMPDIR=/tmp
|
|
||||||
_OSX_KEYCHAIN_AGENT_SOCKETS=$(find $TMPDIR/ -type s -regex '.*/ssh-.*/agent..*$' 2>/dev/null)
|
|
||||||
_debug_print "$_OSX_KEYCHAIN_AGENT_SOCKETS"
|
|
||||||
}
|
|
||||||
|
|
||||||
test_agent_socket() {
|
|
||||||
local SOCKET=$1
|
|
||||||
SSH_AUTH_SOCK=$SOCKET ssh-add -l 2>/dev/null >/dev/null
|
|
||||||
result=$?
|
|
||||||
|
|
||||||
_debug_print $result
|
|
||||||
|
|
||||||
if [[ $result -eq 0 ]]; then
|
|
||||||
# contactible and has keys loaded
|
|
||||||
_KEY_COUNT=$(SSH_AUTH_SOCK=$SOCKET ssh-add -l | wc -l | tr -d ' ')
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $result -eq 1 ]]; then
|
|
||||||
# contactible butno keys loaded
|
|
||||||
_KEY_COUNT=0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $result -eq 0 ] || [ $result -eq 1 ]; then
|
|
||||||
if [[ -n "$_LIVE_AGENT_LIST" ]]; then
|
|
||||||
_LIVE_AGENT_LIST="${_LIVE_AGENT_LIST} ${SOCKET}:$_KEY_COUNT"
|
|
||||||
else
|
|
||||||
_LIVE_AGENT_LIST="${SOCKET}:$_KEY_COUNT"
|
|
||||||
fi
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
find_live_gnome_keyring_agents() {
|
|
||||||
for i in $_GNOME_KEYRING_AGENT_SOCKETS; do
|
|
||||||
test_agent_socket "$i"
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
find_live_osx_keychain_agents() {
|
|
||||||
for i in $_OSX_KEYCHAIN_AGENT_SOCKETS; do
|
|
||||||
test_agent_socket "$i"
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
find_live_gpg_agents() {
|
|
||||||
for i in $_GPG_AGENT_SOCKETS; do
|
|
||||||
test_agent_socket "$i"
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
find_live_ssh_agents() {
|
|
||||||
for i in $_SSH_AGENT_SOCKETS; do
|
|
||||||
test_agent_socket "$i"
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
function fingerprints() {
|
|
||||||
local file="$1"
|
|
||||||
while read -r l; do
|
|
||||||
[[ -n $l && ${l###} == "$l" ]] && ssh-keygen -l -f /dev/stdin <<<"$l"
|
|
||||||
done <"$file"
|
|
||||||
}
|
|
||||||
|
|
||||||
find_all_agent_sockets() {
|
|
||||||
_SHOW_IDENTITY=0
|
|
||||||
if [ "$1" = "-i" ]; then
|
|
||||||
_SHOW_IDENTITY=1
|
|
||||||
fi
|
|
||||||
_LIVE_AGENT_LIST=
|
|
||||||
find_all_ssh_agent_sockets
|
|
||||||
find_all_gpg_agent_sockets
|
|
||||||
find_all_gnome_keyring_agent_sockets
|
|
||||||
find_all_osx_keychain_agent_sockets
|
|
||||||
find_live_ssh_agents
|
|
||||||
find_live_gpg_agents
|
|
||||||
find_live_gnome_keyring_agents
|
|
||||||
find_live_osx_keychain_agents
|
|
||||||
_debug_print "$_LIVE_AGENT_LIST"
|
|
||||||
_LIVE_AGENT_LIST=$(echo "$_LIVE_AGENT_LIST" | tr ' ' '\n' | sort -n -t: -k 2 -k 1 | uniq)
|
|
||||||
_LIVE_AGENT_SOCK_LIST=()
|
|
||||||
_debug_print "SORTED: $_LIVE_AGENT_LIST"
|
|
||||||
if [[ $_SHOW_IDENTITY -gt 0 ]]; then
|
|
||||||
i=0
|
|
||||||
for a in $_LIVE_AGENT_LIST; do
|
|
||||||
sock=${a/:*/}
|
|
||||||
_LIVE_AGENT_SOCK_LIST[$i]=$sock
|
|
||||||
# technically we could have multiple keys forwarded
|
|
||||||
# But I haven't seen anyone do it
|
|
||||||
akeys=$(SSH_AUTH_SOCK=$sock ssh-add -l)
|
|
||||||
fingerprint=$(echo "${akeys}" | awk '{print $2}')
|
|
||||||
if [ -e ~/.ssh/authorized_keys ]; then
|
|
||||||
authorized_entry=$(fingerprints ~/.ssh/authorized_keys | grep "$fingerprint")
|
|
||||||
fi
|
|
||||||
comment=$(echo "${authorized_entry}" | awk '{print $3,$4,$5,$6,$7}')
|
|
||||||
printf "export SSH_AUTH_SOCK=%s \t#%i) \t%s\n" "$sock" $((i + 1)) "$comment"
|
|
||||||
i=$((i + 1))
|
|
||||||
done
|
|
||||||
else
|
|
||||||
printf "%s\n" "$_LIVE_AGENT_LIST" | sed -e 's/ /\n/g' | sort -n -t: -k 2 -k 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
set_ssh_agent_socket() {
|
|
||||||
if [ "$1" = "-c" ] || [ "$1" = "--choose" ]; then
|
|
||||||
find_all_agent_sockets -i
|
|
||||||
|
|
||||||
if [ -z "$_LIVE_AGENT_LIST" ]; then
|
|
||||||
echo "No agents found"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo -n "Choose (1-${#_LIVE_AGENT_SOCK_LIST[@]})? "
|
|
||||||
read -r choice
|
|
||||||
if [ -n "$choice" ]; then
|
|
||||||
n=$((choice - 1))
|
|
||||||
if [ -z "${_LIVE_AGENT_SOCK_LIST[$n]}" ]; then
|
|
||||||
echo "Invalid choice"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
echo "Setting export SSH_AUTH_SOCK=${_LIVE_AGENT_SOCK_LIST[$n]}"
|
|
||||||
export SSH_AUTH_SOCK=${_LIVE_AGENT_SOCK_LIST[$n]}
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# Choose the first available
|
|
||||||
SOCK=$(find_all_agent_sockets | tail -n 1 | awk -F: '{print $1}')
|
|
||||||
if [ -z "$SOCK" ]; then
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
export SSH_AUTH_SOCK=$SOCK
|
|
||||||
fi
|
|
||||||
|
|
||||||
# set agent pid
|
|
||||||
if [ -n "$SSH_AUTH_SOCK" ]; then
|
|
||||||
export SSH_AGENT_PID=$(($(echo "$SSH_AUTH_SOCK" | cut -d. -f2) + 1))
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
ssh-find-agent() {
|
|
||||||
if [ "$1" = "-c" ] || [ "$1" = "--choose" ]; then
|
|
||||||
set_ssh_agent_socket -c
|
|
||||||
return $?
|
|
||||||
elif [ "$1" = "-a" ] || [ "$1" = "--auto" ]; then
|
|
||||||
set_ssh_agent_socket
|
|
||||||
return $?
|
|
||||||
else
|
|
||||||
find_all_agent_sockets -i
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Automatically add ssh-agent to any new ssh connection
|
|
||||||
ssh-find-agent -a
|
|
||||||
if [ -z "$SSH_AUTH_SOCK" ]; then
|
|
||||||
eval "$(ssh-agent)" >/dev/null
|
|
||||||
ssh-add -l >/dev/null || alias ssh='ssh-add -l >/dev/null || ssh-add && unalias ssh; ssh'
|
|
||||||
fi
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ export FILEREADER="zathura"
|
||||||
export FILEMANAGER="vifm"
|
export FILEMANAGER="vifm"
|
||||||
|
|
||||||
## gopath
|
## gopath
|
||||||
export GOPATH="$HOME/projects/gopath/"
|
export GOPATH="$HOME/.cache/gopath"
|
||||||
export PATH="$PATH:$GOPATH/bin"
|
export PATH="$PATH:$GOPATH/bin"
|
||||||
|
|
||||||
## LANG LOCALE UTF-8
|
## LANG LOCALE UTF-8
|
||||||
|
|
|
@ -64,12 +64,12 @@ return {
|
||||||
tab_bar_at_bottom = true,
|
tab_bar_at_bottom = true,
|
||||||
window_padding = { left = 0, right = 0, top = 0, bottom = 0 },
|
window_padding = { left = 0, right = 0, top = 0, bottom = 0 },
|
||||||
|
|
||||||
color_scheme = "Nord (base16)",
|
color_scheme = "Railscasts (base16)",
|
||||||
|
|
||||||
-- default_prog = {"nu"},
|
-- default_prog = {"nu"},
|
||||||
scrollback_lines = 10000,
|
scrollback_lines = 10000,
|
||||||
|
|
||||||
font = wezterm.font('Iosevka'),
|
font = wezterm.font('Iosevka Nerd Font'),
|
||||||
line_height = 1.0,
|
line_height = 1.0,
|
||||||
|
|
||||||
leader = { key = 'a', mods = 'CTRL', timeout_milliseconds = 1500 },
|
leader = { key = 'a', mods = 'CTRL', timeout_milliseconds = 1500 },
|
||||||
|
|
Loading…
Reference in a new issue