Compare commits
10 commits
a1f77fb47c
...
57fc86a2cc
Author | SHA1 | Date | |
---|---|---|---|
57fc86a2cc | |||
4bff377885 | |||
bf3e6717e6 | |||
cf2dc37aac | |||
![]() |
7482175e83 | ||
cd2c89282c | |||
![]() |
f993274068 | ||
bd6795f4bd | |||
2a62c0430b | |||
60e8ec422b |
24 changed files with 3602 additions and 429 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
nvim/plugin/packer_compiled.lua
|
||||||
|
zsh/powerlevel10k
|
5
.gitmodules
vendored
5
.gitmodules
vendored
|
@ -1,3 +1,6 @@
|
||||||
[submodule "zsh/p10k"]
|
[submodule "zsh/p10k"]
|
||||||
path = zsh/p10k
|
path = zsh/p10k
|
||||||
url = https://gitrepo.ru/NeonXP/powerlevel10k.git
|
url = https://github.com/romkatv/powerlevel10k.git
|
||||||
|
[submodule "nvim/pack/nvim/start/nvim-lspconfig"]
|
||||||
|
path = nvim/pack/nvim/start/nvim-lspconfig
|
||||||
|
url = https://github.com/neovim/nvim-lspconfig.git
|
||||||
|
|
117
git/config
117
git/config
|
@ -10,12 +10,19 @@
|
||||||
[http]
|
[http]
|
||||||
sslVerify = false
|
sslVerify = false
|
||||||
|
|
||||||
|
[column]
|
||||||
|
ui = auto
|
||||||
|
|
||||||
[commit]
|
[commit]
|
||||||
gpgsign = true
|
gpgsign = true
|
||||||
verbose = true
|
verbose = true
|
||||||
|
|
||||||
[branch]
|
[branch]
|
||||||
autosetuprebase = always
|
autosetuprebase = always
|
||||||
|
sort = -committerdate
|
||||||
|
|
||||||
|
[tag]
|
||||||
|
sort = version:refname
|
||||||
|
|
||||||
[help]
|
[help]
|
||||||
autocorrect = 1
|
autocorrect = 1
|
||||||
|
@ -38,6 +45,8 @@
|
||||||
|
|
||||||
[rebase]
|
[rebase]
|
||||||
autoStash = true
|
autoStash = true
|
||||||
|
autoSquash = true
|
||||||
|
updateRefs = true
|
||||||
|
|
||||||
[pull]
|
[pull]
|
||||||
rebase = true
|
rebase = true
|
||||||
|
@ -46,14 +55,75 @@
|
||||||
[fetch]
|
[fetch]
|
||||||
prune = true
|
prune = true
|
||||||
pruneTags = true
|
pruneTags = true
|
||||||
|
all = true
|
||||||
output = full
|
output = full
|
||||||
|
|
||||||
|
[push]
|
||||||
|
default = simple
|
||||||
|
autoSetupRemote = true
|
||||||
|
followTags = true
|
||||||
|
|
||||||
|
[merge]
|
||||||
|
conflictstyle = zdiff3
|
||||||
|
|
||||||
[core]
|
[core]
|
||||||
preloadindex = true
|
preloadindex = true
|
||||||
excludesFile = ~/.gitignore
|
excludesFile = ~/.gitignore
|
||||||
trustctime = false
|
trustctime = false
|
||||||
commitGraph = true
|
commitGraph = true
|
||||||
|
|
||||||
|
[diff]
|
||||||
|
indentHeuristic = true
|
||||||
|
algorithm = histogram
|
||||||
|
tool = vimdiff
|
||||||
|
|
||||||
|
[log]
|
||||||
|
date = local
|
||||||
|
|
||||||
|
[rerere]
|
||||||
|
enabled = true
|
||||||
|
autoupdate = true
|
||||||
|
|
||||||
|
[pager]
|
||||||
|
color = true
|
||||||
|
|
||||||
|
[status]
|
||||||
|
color = true
|
||||||
|
submodulesummary = true
|
||||||
|
|
||||||
|
[init]
|
||||||
|
defaultBranch = master
|
||||||
|
|
||||||
|
#[pager]
|
||||||
|
# diff = delta
|
||||||
|
# log = delta
|
||||||
|
# reflog = delta
|
||||||
|
# show = delta
|
||||||
|
|
||||||
|
#[interactive]
|
||||||
|
# diffFilter = delta --color-only --features=interactive
|
||||||
|
|
||||||
|
#[delta]
|
||||||
|
# features = decorations
|
||||||
|
|
||||||
|
#[delta "interactive"]
|
||||||
|
# keep-plus-minus-markers = false
|
||||||
|
|
||||||
|
#[delta "decorations"]
|
||||||
|
# commit-decoration-style = blue ol
|
||||||
|
# commit-style = raw
|
||||||
|
# file-style = omit
|
||||||
|
# hunk-header-decoration-style = blue box
|
||||||
|
# hunk-header-file-style = red
|
||||||
|
# hunk-header-line-number-style = "#067a00"
|
||||||
|
# hunk-header-style = file line-number syntax
|
||||||
|
|
||||||
|
[include]
|
||||||
|
path = .gitconfig.local
|
||||||
|
|
||||||
|
[gpg]
|
||||||
|
format = ssh
|
||||||
|
|
||||||
[color]
|
[color]
|
||||||
ui = auto
|
ui = auto
|
||||||
|
|
||||||
|
@ -81,50 +151,3 @@
|
||||||
changed = green
|
changed = green
|
||||||
untracked = cyan
|
untracked = cyan
|
||||||
|
|
||||||
[diff]
|
|
||||||
indentHeuristic = true
|
|
||||||
algorithm = histogram
|
|
||||||
tool = vimdiff
|
|
||||||
|
|
||||||
[log]
|
|
||||||
date = local
|
|
||||||
|
|
||||||
[rerere]
|
|
||||||
enabled = true
|
|
||||||
|
|
||||||
[pager]
|
|
||||||
color = true
|
|
||||||
|
|
||||||
[status]
|
|
||||||
color = true
|
|
||||||
submodulesummary = true
|
|
||||||
|
|
||||||
[init]
|
|
||||||
defaultBranch = master
|
|
||||||
|
|
||||||
[pager]
|
|
||||||
diff = delta
|
|
||||||
log = delta
|
|
||||||
reflog = delta
|
|
||||||
show = delta
|
|
||||||
|
|
||||||
[interactive]
|
|
||||||
diffFilter = delta --color-only --features=interactive
|
|
||||||
|
|
||||||
[delta]
|
|
||||||
features = decorations
|
|
||||||
|
|
||||||
[delta "interactive"]
|
|
||||||
keep-plus-minus-markers = false
|
|
||||||
|
|
||||||
[delta "decorations"]
|
|
||||||
commit-decoration-style = blue ol
|
|
||||||
commit-style = raw
|
|
||||||
file-style = omit
|
|
||||||
hunk-header-decoration-style = blue box
|
|
||||||
hunk-header-file-style = red
|
|
||||||
hunk-header-line-number-style = "#067a00"
|
|
||||||
hunk-header-style = file line-number syntax
|
|
||||||
|
|
||||||
[include]
|
|
||||||
path = .gitconfig.local
|
|
||||||
|
|
|
@ -30,3 +30,5 @@ Thumbs.db
|
||||||
|
|
||||||
go.work
|
go.work
|
||||||
go.work.sum
|
go.work.sum
|
||||||
|
|
||||||
|
__debug*
|
||||||
|
|
|
@ -328,5 +328,5 @@ map kitty_mod+k clear_terminal reset active
|
||||||
# map opt+cmd+h hide_macos_other_apps
|
# map opt+cmd+h hide_macos_other_apps
|
||||||
# map cmd+m minimize_macos_window
|
# map cmd+m minimize_macos_window
|
||||||
# map cmd+q quit
|
# map cmd+q quit
|
||||||
map F5 launch --location=hsplit --cwd=current
|
map kitty_mod+F5 launch --location=hsplit --cwd=current
|
||||||
map F6 launch --location=vsplit --cwd=current
|
map kitty_mod+F6 launch --location=vsplit --cwd=current
|
||||||
|
|
0
nvim/.nvimlog
Normal file
0
nvim/.nvimlog
Normal file
|
@ -1,3 +1,14 @@
|
||||||
|
local fn = vim.fn
|
||||||
|
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
|
||||||
|
if fn.empty(fn.glob(install_path)) > 0 then
|
||||||
|
packer_bootstrap = fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.g.mapleader = " "
|
||||||
|
vim.g.maplocalleader = " "
|
||||||
|
|
||||||
|
vim.cmd [[packadd packer.nvim]]
|
||||||
|
|
||||||
require 'options'
|
require 'options'
|
||||||
require 'keymaps'
|
require 'keymaps'
|
||||||
require 'autocommands'
|
require 'autocommands'
|
||||||
|
|
|
@ -1,8 +1,26 @@
|
||||||
local map = vim.api.nvim_set_keymap
|
local map = vim.api.nvim_set_keymap
|
||||||
|
local kmap = vim.keymap.set
|
||||||
local opts = {noremap = true, silent = true}
|
local opts = {noremap = true, silent = true}
|
||||||
|
|
||||||
|
|
||||||
|
map('n', '<Space>', '<Nop>', opts)
|
||||||
|
map('n', '<Home>', '^', opts)
|
||||||
|
map('n', '<End>', '$', opts)
|
||||||
|
map('v', '<Home>', '^', opts)
|
||||||
|
map('v', '<End>', '$', opts)
|
||||||
|
map('i', '<Home>', '<C-o>^', opts)
|
||||||
|
map('i', '<End>', '<C-o>$', opts)
|
||||||
|
|
||||||
|
map('v', 'i', '<S-i>', opts)
|
||||||
|
map('v', 'a', '<S-a>', opts)
|
||||||
|
|
||||||
|
-- Перемещение между буферами
|
||||||
|
kmap('n', '<leader>bn', ':bnext<CR>', { noremap = true, silent = true }) -- Следующий буфер
|
||||||
|
kmap('n', '<leader>bp', ':bprevious<CR>', { noremap = true, silent = true }) -- Предыдущий буфер
|
||||||
|
kmap('n', '<leader>bd', ':bdelete<CR>', { noremap = true, silent = true }) -- Закрыть текущий буфер
|
||||||
|
|
||||||
-- Tree
|
-- Tree
|
||||||
map('n', '<C-h>', ':NvimTreeToggle<CR>', opts)
|
map('n', '<C-t>', ':NvimTreeToggle<CR>', opts)
|
||||||
|
|
||||||
-- Telescope
|
-- Telescope
|
||||||
map('n', '<leader>ff', '<cmd>Telescope find_files<CR>', opts)
|
map('n', '<leader>ff', '<cmd>Telescope find_files<CR>', opts)
|
||||||
|
@ -10,34 +28,28 @@ map('n', '<leader>fg', '<cmd>Telescope live_grep<CR>', opts)
|
||||||
map('n', '<leader>fb', '<cmd>Telescope buffers<CR>', opts)
|
map('n', '<leader>fb', '<cmd>Telescope buffers<CR>', opts)
|
||||||
|
|
||||||
-- LSP
|
-- LSP
|
||||||
map('n', '<leader>e', vim.diagnostic.open_float, opts)
|
kmap('n', '<leader>e', vim.diagnostic.open_float, opts)
|
||||||
map('n', '[d', vim.diagnostic.goto_prev, opts)
|
kmap('n', '[d', vim.diagnostic.goto_prev, opts)
|
||||||
map('n', ']d', vim.diagnostic.goto_next, opts)
|
kmap('n', ']d', vim.diagnostic.goto_next, opts)
|
||||||
map('n', '<leader>q', vim.diagnostic.setloclist, opts)
|
kmap('n', '<leader>q', vim.diagnostic.setloclist, opts)
|
||||||
|
|
||||||
local on_attach = function(client, bufnr)
|
|
||||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
|
||||||
|
|
||||||
local bufopts = { noremap=true, silent=true, buffer=bufnr }
|
|
||||||
|
|
||||||
-- стандартные горячие клавиши для LSP, больше в документации
|
-- стандартные горячие клавиши для LSP, больше в документации
|
||||||
-- https://github.com/neovim/nvim-lspconfig
|
-- https://github.com/neovim/nvim-lspconfig
|
||||||
map('n', 'gD', vim.lsp.buf.declaration, bufopts)
|
kmap('n', 'gD', vim.lsp.buf.declaration, opts)
|
||||||
map('n', 'gd', vim.lsp.buf.definition, bufopts)
|
kmap('n', 'gd', vim.lsp.buf.definition, opts)
|
||||||
map('n', 'K', vim.lsp.buf.hover, bufopts)
|
kmap('n', 'K', vim.lsp.buf.hover, opts)
|
||||||
map('n', 'gi', vim.lsp.buf.implementation, bufopts)
|
kmap('n', 'gi', vim.lsp.buf.implementation, opts)
|
||||||
map('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
|
kmap('n', '<C-k>', vim.lsp.buf.signature_help, opts)
|
||||||
map('n', '<leader>wa', vim.lsp.buf.add_workspace_folder, bufopts)
|
kmap('n', '<leader>wa', vim.lsp.buf.add_workspace_folder, opts)
|
||||||
map('n', '<leader>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
|
kmap('n', '<leader>wr', vim.lsp.buf.remove_workspace_folder, opts)
|
||||||
map('n', '<leader>wl', function()
|
kmap('n', '<leader>wl', function()
|
||||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||||
end, bufopts)
|
end, opts)
|
||||||
map('n', '<leader>D', vim.lsp.buf.type_definition, bufopts)
|
kmap('n', '<leader>D', vim.lsp.buf.type_definition, opts)
|
||||||
map('n', '<leader>rn', vim.lsp.buf.rename, bufopts)
|
kmap('n', '<leader>rn', vim.lsp.buf.rename, opts)
|
||||||
map('n', '<leader>ca', vim.lsp.buf.code_action, bufopts)
|
kmap('n', '<leader>ca', vim.lsp.buf.code_action, opts)
|
||||||
map('n', 'gr', vim.lsp.buf.references, bufopts)
|
kmap('n', 'gr', vim.lsp.buf.references, opts)
|
||||||
map('n', '<leader>f', vim.lsp.buf.formatting, bufopts)
|
-- kmap('n', '<leader>f', vim.lsp.buf.formatting, opts)
|
||||||
end
|
|
||||||
|
|
||||||
local function change_root_to_global_cwd()
|
local function change_root_to_global_cwd()
|
||||||
local api = require("nvim-tree.api")
|
local api = require("nvim-tree.api")
|
||||||
|
@ -45,5 +57,5 @@ local function change_root_to_global_cwd()
|
||||||
api.tree.change_root(global_cwd)
|
api.tree.change_root(global_cwd)
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.keymap.set('n', '<C-c>', change_root_to_global_cwd, {})
|
kmap('n', '<C-c>', change_root_to_global_cwd, {})
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,6 @@ local options = {
|
||||||
splitright = true, -- force all vertical splits to go to the right of current window
|
splitright = true, -- force all vertical splits to go to the right of current window
|
||||||
swapfile = false, -- creates a swapfile
|
swapfile = false, -- creates a swapfile
|
||||||
termguicolors = true, -- set term gui colors (most terminals support this)
|
termguicolors = true, -- set term gui colors (most terminals support this)
|
||||||
timeoutlen = 100, -- time to wait for a mapped sequence to complete (in milliseconds)
|
|
||||||
undofile = true, -- enable persistent undo
|
undofile = true, -- enable persistent undo
|
||||||
updatetime = 300, -- faster completion (4000ms default)
|
updatetime = 300, -- faster completion (4000ms default)
|
||||||
writebackup = false, -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited
|
writebackup = false, -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited
|
||||||
|
|
39
nvim/lua/plugins/cmp.lua
Normal file
39
nvim/lua/plugins/cmp.lua
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
local cmp = require'cmp'
|
||||||
|
cmp.setup{
|
||||||
|
snippet = {
|
||||||
|
-- REQUIRED - you must specify a snippet engine
|
||||||
|
expand = function(args)
|
||||||
|
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
||||||
|
-- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
||||||
|
-- require('snippy').expand_snippet(args.body) -- For `snippy` users.
|
||||||
|
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
|
||||||
|
-- vim.snippet.expand(args.body) -- For native neovim snippets (Neovim v0.10+)
|
||||||
|
|
||||||
|
-- For `mini.snippets` users:
|
||||||
|
-- local insert = MiniSnippets.config.expand.insert or MiniSnippets.default_insert
|
||||||
|
-- insert({ body = args.body }) -- Insert at cursor
|
||||||
|
-- cmp.resubscribe({ "TextChangedI", "TextChangedP" })
|
||||||
|
-- require("cmp.config").set_onetime({ sources = {} })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
window = {
|
||||||
|
completion = cmp.config.window.bordered(),
|
||||||
|
documentation = cmp.config.window.bordered(),
|
||||||
|
},
|
||||||
|
mapping = cmp.mapping.preset.insert({
|
||||||
|
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||||
|
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||||
|
['<C-Space>'] = cmp.mapping.complete(),
|
||||||
|
['<C-e>'] = cmp.mapping.abort(),
|
||||||
|
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||||
|
}),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'nvim_lsp' },
|
||||||
|
{ name = 'vsnip' }, -- For vsnip users.
|
||||||
|
-- { name = 'luasnip' }, -- For luasnip users.
|
||||||
|
-- { name = 'ultisnips' }, -- For ultisnips users.
|
||||||
|
-- { name = 'snippy' }, -- For snippy users.
|
||||||
|
}, {
|
||||||
|
{ name = 'buffer' },
|
||||||
|
})
|
||||||
|
}
|
|
@ -1,48 +1,26 @@
|
||||||
local fn = vim.fn
|
|
||||||
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
|
|
||||||
if fn.empty(fn.glob(install_path)) > 0 then
|
|
||||||
packer_bootstrap = fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
|
|
||||||
end
|
|
||||||
|
|
||||||
return require('packer').startup(function(use)
|
return require('packer').startup(function(use)
|
||||||
use 'wbthomason/packer.nvim'
|
use 'wbthomason/packer.nvim'
|
||||||
use 'nvim-lua/plenary.nvim'
|
use 'nvim-lua/plenary.nvim'
|
||||||
use 'neovim/nvim-lspconfig'
|
use 'neovim/nvim-lspconfig'
|
||||||
use 'hrsh7th/cmp-nvim-lsp'
|
use {
|
||||||
use 'hrsh7th/cmp-buffer'
|
'hrsh7th/nvim-cmp',
|
||||||
use 'hrsh7th/cmp-path'
|
requires = {
|
||||||
use 'hrsh7th/nvim-cmp'
|
'hrsh7th/cmp-nvim-lsp',
|
||||||
|
'hrsh7th/cmp-buffer',
|
||||||
|
'hrsh7th/cmp-path',
|
||||||
|
'hrsh7th/cmp-vsnip',
|
||||||
|
'hrsh7th/vim-vsnip',
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require 'plugins.cmp'
|
||||||
|
end
|
||||||
|
}
|
||||||
use {
|
use {
|
||||||
'nvim-lualine/lualine.nvim',
|
'nvim-lualine/lualine.nvim',
|
||||||
config = function()
|
config = function()
|
||||||
require 'plugins.lualine'
|
require 'plugins.lualine'
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
-- движок сниппетов
|
|
||||||
use {
|
|
||||||
'L3MON4D3/LuaSnip',
|
|
||||||
after = 'friendly-snippets',
|
|
||||||
config = function()
|
|
||||||
require('luasnip/loaders/from_vscode').load({
|
|
||||||
paths = { '~/.local/share/nvim/site/pack/packer/start/friendly-snippets' }
|
|
||||||
})
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
-- автодополнения для сниппетов
|
|
||||||
use 'saadparwaiz1/cmp_luasnip'
|
|
||||||
|
|
||||||
-- набор готовых сниппетов для всех языков, включая go
|
|
||||||
use 'rafamadriz/friendly-snippets'
|
|
||||||
|
|
||||||
-- плагин для простого комментирования кода
|
|
||||||
use {
|
|
||||||
'numToStr/Comment.nvim',
|
|
||||||
config = function()
|
|
||||||
require('Comment').setup()
|
|
||||||
end
|
|
||||||
}
|
|
||||||
use {
|
use {
|
||||||
'nvim-treesitter/nvim-treesitter',
|
'nvim-treesitter/nvim-treesitter',
|
||||||
run = ':TSUpdate',
|
run = ':TSUpdate',
|
||||||
|
@ -56,12 +34,6 @@ return require('packer').startup(function(use)
|
||||||
require 'plugins.telescope'
|
require 'plugins.telescope'
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
use {
|
|
||||||
'olexsmir/gopher.nvim',
|
|
||||||
config = function()
|
|
||||||
-- require 'plugins.gopher'
|
|
||||||
end
|
|
||||||
}
|
|
||||||
use {
|
use {
|
||||||
'nvim-tree/nvim-tree.lua',
|
'nvim-tree/nvim-tree.lua',
|
||||||
config = function()
|
config = function()
|
||||||
|
|
1
nvim/pack/nvim/start/nvim-lspconfig
Submodule
1
nvim/pack/nvim/start/nvim-lspconfig
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 32b6a6449aaba11461fffbb596dd6310af79eea4
|
1
nvim/pack/nvim/start/packer.nvim
Submodule
1
nvim/pack/nvim/start/packer.nvim
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit ea0cc3c59f67c440c5ff0bbe4fb9420f4350b9a3
|
|
@ -1,221 +0,0 @@
|
||||||
-- Automatically generated packer.nvim plugin loader code
|
|
||||||
|
|
||||||
if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then
|
|
||||||
vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"')
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.api.nvim_command('packadd packer.nvim')
|
|
||||||
|
|
||||||
local no_errors, error_msg = pcall(function()
|
|
||||||
|
|
||||||
_G._packer = _G._packer or {}
|
|
||||||
_G._packer.inside_compile = true
|
|
||||||
|
|
||||||
local time
|
|
||||||
local profile_info
|
|
||||||
local should_profile = false
|
|
||||||
if should_profile then
|
|
||||||
local hrtime = vim.loop.hrtime
|
|
||||||
profile_info = {}
|
|
||||||
time = function(chunk, start)
|
|
||||||
if start then
|
|
||||||
profile_info[chunk] = hrtime()
|
|
||||||
else
|
|
||||||
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
time = function(chunk, start) end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function save_profiles(threshold)
|
|
||||||
local sorted_times = {}
|
|
||||||
for chunk_name, time_taken in pairs(profile_info) do
|
|
||||||
sorted_times[#sorted_times + 1] = {chunk_name, time_taken}
|
|
||||||
end
|
|
||||||
table.sort(sorted_times, function(a, b) return a[2] > b[2] end)
|
|
||||||
local results = {}
|
|
||||||
for i, elem in ipairs(sorted_times) do
|
|
||||||
if not threshold or threshold and elem[2] > threshold then
|
|
||||||
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if threshold then
|
|
||||||
table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)')
|
|
||||||
end
|
|
||||||
|
|
||||||
_G._packer.profile_output = results
|
|
||||||
end
|
|
||||||
|
|
||||||
time([[Luarocks path setup]], true)
|
|
||||||
local package_path_str = "/home/neonxp/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/neonxp/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/neonxp/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/neonxp/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua"
|
|
||||||
local install_cpath_pattern = "/home/neonxp/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so"
|
|
||||||
if not string.find(package.path, package_path_str, 1, true) then
|
|
||||||
package.path = package.path .. ';' .. package_path_str
|
|
||||||
end
|
|
||||||
|
|
||||||
if not string.find(package.cpath, install_cpath_pattern, 1, true) then
|
|
||||||
package.cpath = package.cpath .. ';' .. install_cpath_pattern
|
|
||||||
end
|
|
||||||
|
|
||||||
time([[Luarocks path setup]], false)
|
|
||||||
time([[try_loadstring definition]], true)
|
|
||||||
local function try_loadstring(s, component, name)
|
|
||||||
local success, result = pcall(loadstring(s), name, _G.packer_plugins[name])
|
|
||||||
if not success then
|
|
||||||
vim.schedule(function()
|
|
||||||
vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {})
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
return result
|
|
||||||
end
|
|
||||||
|
|
||||||
time([[try_loadstring definition]], false)
|
|
||||||
time([[Defining packer_plugins]], true)
|
|
||||||
_G.packer_plugins = {
|
|
||||||
["Comment.nvim"] = {
|
|
||||||
config = { "\27LJ\2\n5\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\fComment\frequire\0" },
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/neonxp/.local/share/nvim/site/pack/packer/start/Comment.nvim",
|
|
||||||
url = "https://github.com/numToStr/Comment.nvim"
|
|
||||||
},
|
|
||||||
LuaSnip = {
|
|
||||||
config = { "\27LJ\2\nž\1\0\0\4\0\6\0\t6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\4\0005\3\3\0=\3\5\2B\0\2\1K\0\1\0\npaths\1\0\0\1\2\0\0A~/.local/share/nvim/site/pack/packer/start/friendly-snippets\tload luasnip/loaders/from_vscode\frequire\0" },
|
|
||||||
load_after = {},
|
|
||||||
loaded = true,
|
|
||||||
needs_bufread = true,
|
|
||||||
path = "/home/neonxp/.local/share/nvim/site/pack/packer/opt/LuaSnip",
|
|
||||||
url = "https://github.com/L3MON4D3/LuaSnip"
|
|
||||||
},
|
|
||||||
["cmp-buffer"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/neonxp/.local/share/nvim/site/pack/packer/start/cmp-buffer",
|
|
||||||
url = "https://github.com/hrsh7th/cmp-buffer"
|
|
||||||
},
|
|
||||||
["cmp-nvim-lsp"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/neonxp/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
|
|
||||||
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
|
|
||||||
},
|
|
||||||
["cmp-path"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/neonxp/.local/share/nvim/site/pack/packer/start/cmp-path",
|
|
||||||
url = "https://github.com/hrsh7th/cmp-path"
|
|
||||||
},
|
|
||||||
cmp_luasnip = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/neonxp/.local/share/nvim/site/pack/packer/start/cmp_luasnip",
|
|
||||||
url = "https://github.com/saadparwaiz1/cmp_luasnip"
|
|
||||||
},
|
|
||||||
["friendly-snippets"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/neonxp/.local/share/nvim/site/pack/packer/start/friendly-snippets",
|
|
||||||
url = "https://github.com/rafamadriz/friendly-snippets"
|
|
||||||
},
|
|
||||||
["gopher.nvim"] = {
|
|
||||||
config = { "\27LJ\2\n\v\0\0\1\0\0\0\1K\0\1\0\0" },
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/neonxp/.local/share/nvim/site/pack/packer/start/gopher.nvim",
|
|
||||||
url = "https://github.com/olexsmir/gopher.nvim"
|
|
||||||
},
|
|
||||||
["lualine.nvim"] = {
|
|
||||||
config = { "\27LJ\2\n/\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\20plugins.lualine\frequire\0" },
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/neonxp/.local/share/nvim/site/pack/packer/start/lualine.nvim",
|
|
||||||
url = "https://github.com/nvim-lualine/lualine.nvim"
|
|
||||||
},
|
|
||||||
["nvim-cmp"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/neonxp/.local/share/nvim/site/pack/packer/start/nvim-cmp",
|
|
||||||
url = "https://github.com/hrsh7th/nvim-cmp"
|
|
||||||
},
|
|
||||||
["nvim-lspconfig"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/neonxp/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
|
|
||||||
url = "https://github.com/neovim/nvim-lspconfig"
|
|
||||||
},
|
|
||||||
["nvim-tree.lua"] = {
|
|
||||||
config = { "\27LJ\2\n,\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\17plugins.tree\frequire\0" },
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/neonxp/.local/share/nvim/site/pack/packer/start/nvim-tree.lua",
|
|
||||||
url = "https://github.com/nvim-tree/nvim-tree.lua"
|
|
||||||
},
|
|
||||||
["nvim-treesitter"] = {
|
|
||||||
config = { "\27LJ\2\n2\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\23plugins.treesitter\frequire\0" },
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/neonxp/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
|
|
||||||
url = "https://github.com/nvim-treesitter/nvim-treesitter"
|
|
||||||
},
|
|
||||||
["nvim-web-devicons"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/neonxp/.local/share/nvim/site/pack/packer/start/nvim-web-devicons",
|
|
||||||
url = "https://github.com/nvim-tree/nvim-web-devicons"
|
|
||||||
},
|
|
||||||
["packer.nvim"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/neonxp/.local/share/nvim/site/pack/packer/start/packer.nvim",
|
|
||||||
url = "https://github.com/wbthomason/packer.nvim"
|
|
||||||
},
|
|
||||||
["plenary.nvim"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/neonxp/.local/share/nvim/site/pack/packer/start/plenary.nvim",
|
|
||||||
url = "https://github.com/nvim-lua/plenary.nvim"
|
|
||||||
},
|
|
||||||
["telescope.nvim"] = {
|
|
||||||
config = { "\27LJ\2\n1\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\22plugins.telescope\frequire\0" },
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/neonxp/.local/share/nvim/site/pack/packer/start/telescope.nvim",
|
|
||||||
url = "https://github.com/nvim-telescope/telescope.nvim"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
time([[Defining packer_plugins]], false)
|
|
||||||
-- Config for: nvim-tree.lua
|
|
||||||
time([[Config for nvim-tree.lua]], true)
|
|
||||||
try_loadstring("\27LJ\2\n,\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\17plugins.tree\frequire\0", "config", "nvim-tree.lua")
|
|
||||||
time([[Config for nvim-tree.lua]], false)
|
|
||||||
-- Config for: nvim-treesitter
|
|
||||||
time([[Config for nvim-treesitter]], true)
|
|
||||||
try_loadstring("\27LJ\2\n2\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\23plugins.treesitter\frequire\0", "config", "nvim-treesitter")
|
|
||||||
time([[Config for nvim-treesitter]], false)
|
|
||||||
-- Config for: Comment.nvim
|
|
||||||
time([[Config for Comment.nvim]], true)
|
|
||||||
try_loadstring("\27LJ\2\n5\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\fComment\frequire\0", "config", "Comment.nvim")
|
|
||||||
time([[Config for Comment.nvim]], false)
|
|
||||||
-- Config for: lualine.nvim
|
|
||||||
time([[Config for lualine.nvim]], true)
|
|
||||||
try_loadstring("\27LJ\2\n/\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\20plugins.lualine\frequire\0", "config", "lualine.nvim")
|
|
||||||
time([[Config for lualine.nvim]], false)
|
|
||||||
-- Config for: telescope.nvim
|
|
||||||
time([[Config for telescope.nvim]], true)
|
|
||||||
try_loadstring("\27LJ\2\n1\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\22plugins.telescope\frequire\0", "config", "telescope.nvim")
|
|
||||||
time([[Config for telescope.nvim]], false)
|
|
||||||
-- Config for: gopher.nvim
|
|
||||||
time([[Config for gopher.nvim]], true)
|
|
||||||
try_loadstring("\27LJ\2\n\v\0\0\1\0\0\0\1K\0\1\0\0", "config", "gopher.nvim")
|
|
||||||
time([[Config for gopher.nvim]], false)
|
|
||||||
-- Load plugins in order defined by `after`
|
|
||||||
time([[Sequenced loading]], true)
|
|
||||||
vim.cmd [[ packadd friendly-snippets ]]
|
|
||||||
vim.cmd [[ packadd LuaSnip ]]
|
|
||||||
|
|
||||||
-- Config for: LuaSnip
|
|
||||||
try_loadstring("\27LJ\2\nž\1\0\0\4\0\6\0\t6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\4\0005\3\3\0=\3\5\2B\0\2\1K\0\1\0\npaths\1\0\0\1\2\0\0A~/.local/share/nvim/site/pack/packer/start/friendly-snippets\tload luasnip/loaders/from_vscode\frequire\0", "config", "LuaSnip")
|
|
||||||
|
|
||||||
time([[Sequenced loading]], false)
|
|
||||||
|
|
||||||
_G._packer.inside_compile = false
|
|
||||||
if _G._packer.needs_bufread == true then
|
|
||||||
vim.cmd("doautocmd BufRead")
|
|
||||||
end
|
|
||||||
_G._packer.needs_bufread = false
|
|
||||||
|
|
||||||
if should_profile then save_profiles() end
|
|
||||||
|
|
||||||
end)
|
|
||||||
|
|
||||||
if not no_errors then
|
|
||||||
error_msg = error_msg:gsub('"', '\\"')
|
|
||||||
vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None')
|
|
||||||
end
|
|
177
zsh/comp/cobra.zsh-completion
Normal file
177
zsh/comp/cobra.zsh-completion
Normal file
|
@ -0,0 +1,177 @@
|
||||||
|
#compdef _cobra-cli cobra-cli
|
||||||
|
|
||||||
|
# zsh completion for cobra-cli -*- shell-script -*-
|
||||||
|
|
||||||
|
__cobra-cli_debug()
|
||||||
|
{
|
||||||
|
local file="$BASH_COMP_DEBUG_FILE"
|
||||||
|
if [[ -n ${file} ]]; then
|
||||||
|
echo "$*" >> "${file}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
_cobra-cli()
|
||||||
|
{
|
||||||
|
local shellCompDirectiveError=1
|
||||||
|
local shellCompDirectiveNoSpace=2
|
||||||
|
local shellCompDirectiveNoFileComp=4
|
||||||
|
local shellCompDirectiveFilterFileExt=8
|
||||||
|
local shellCompDirectiveFilterDirs=16
|
||||||
|
|
||||||
|
local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace
|
||||||
|
local -a completions
|
||||||
|
|
||||||
|
__cobra-cli_debug "\n========= starting completion logic =========="
|
||||||
|
__cobra-cli_debug "CURRENT: ${CURRENT}, words[*]: ${words[*]}"
|
||||||
|
|
||||||
|
# The user could have moved the cursor backwards on the command-line.
|
||||||
|
# We need to trigger completion from the $CURRENT location, so we need
|
||||||
|
# to truncate the command-line ($words) up to the $CURRENT location.
|
||||||
|
# (We cannot use $CURSOR as its value does not work when a command is an alias.)
|
||||||
|
words=("${=words[1,CURRENT]}")
|
||||||
|
__cobra-cli_debug "Truncated words[*]: ${words[*]},"
|
||||||
|
|
||||||
|
lastParam=${words[-1]}
|
||||||
|
lastChar=${lastParam[-1]}
|
||||||
|
__cobra-cli_debug "lastParam: ${lastParam}, lastChar: ${lastChar}"
|
||||||
|
|
||||||
|
# For zsh, when completing a flag with an = (e.g., cobra-cli -n=<TAB>)
|
||||||
|
# completions must be prefixed with the flag
|
||||||
|
setopt local_options BASH_REMATCH
|
||||||
|
if [[ "${lastParam}" =~ '-.*=' ]]; then
|
||||||
|
# We are dealing with a flag with an =
|
||||||
|
flagPrefix="-P ${BASH_REMATCH}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Prepare the command to obtain completions
|
||||||
|
requestComp="${words[1]} __complete ${words[2,-1]}"
|
||||||
|
if [ "${lastChar}" = "" ]; then
|
||||||
|
# If the last parameter is complete (there is a space following it)
|
||||||
|
# We add an extra empty parameter so we can indicate this to the go completion code.
|
||||||
|
__cobra-cli_debug "Adding extra empty parameter"
|
||||||
|
requestComp="${requestComp} \"\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
__cobra-cli_debug "About to call: eval ${requestComp}"
|
||||||
|
|
||||||
|
# Use eval to handle any environment variables and such
|
||||||
|
out=$(eval ${requestComp} 2>/dev/null)
|
||||||
|
__cobra-cli_debug "completion output: ${out}"
|
||||||
|
|
||||||
|
# Extract the directive integer following a : from the last line
|
||||||
|
local lastLine
|
||||||
|
while IFS='\n' read -r line; do
|
||||||
|
lastLine=${line}
|
||||||
|
done < <(printf "%s\n" "${out[@]}")
|
||||||
|
__cobra-cli_debug "last line: ${lastLine}"
|
||||||
|
|
||||||
|
if [ "${lastLine[1]}" = : ]; then
|
||||||
|
directive=${lastLine[2,-1]}
|
||||||
|
# Remove the directive including the : and the newline
|
||||||
|
local suffix
|
||||||
|
(( suffix=${#lastLine}+2))
|
||||||
|
out=${out[1,-$suffix]}
|
||||||
|
else
|
||||||
|
# There is no directive specified. Leave $out as is.
|
||||||
|
__cobra-cli_debug "No directive found. Setting do default"
|
||||||
|
directive=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
__cobra-cli_debug "directive: ${directive}"
|
||||||
|
__cobra-cli_debug "completions: ${out}"
|
||||||
|
__cobra-cli_debug "flagPrefix: ${flagPrefix}"
|
||||||
|
|
||||||
|
if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then
|
||||||
|
__cobra-cli_debug "Completion received error. Ignoring completions."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
while IFS='\n' read -r comp; do
|
||||||
|
if [ -n "$comp" ]; then
|
||||||
|
# If requested, completions are returned with a description.
|
||||||
|
# The description is preceded by a TAB character.
|
||||||
|
# For zsh's _describe, we need to use a : instead of a TAB.
|
||||||
|
# We first need to escape any : as part of the completion itself.
|
||||||
|
comp=${comp//:/\\:}
|
||||||
|
|
||||||
|
local tab=$(printf '\t')
|
||||||
|
comp=${comp//$tab/:}
|
||||||
|
|
||||||
|
__cobra-cli_debug "Adding completion: ${comp}"
|
||||||
|
completions+=${comp}
|
||||||
|
lastComp=$comp
|
||||||
|
fi
|
||||||
|
done < <(printf "%s\n" "${out[@]}")
|
||||||
|
|
||||||
|
if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then
|
||||||
|
__cobra-cli_debug "Activating nospace."
|
||||||
|
noSpace="-S ''"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then
|
||||||
|
# File extension filtering
|
||||||
|
local filteringCmd
|
||||||
|
filteringCmd='_files'
|
||||||
|
for filter in ${completions[@]}; do
|
||||||
|
if [ ${filter[1]} != '*' ]; then
|
||||||
|
# zsh requires a glob pattern to do file filtering
|
||||||
|
filter="\*.$filter"
|
||||||
|
fi
|
||||||
|
filteringCmd+=" -g $filter"
|
||||||
|
done
|
||||||
|
filteringCmd+=" ${flagPrefix}"
|
||||||
|
|
||||||
|
__cobra-cli_debug "File filtering command: $filteringCmd"
|
||||||
|
_arguments '*:filename:'"$filteringCmd"
|
||||||
|
elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then
|
||||||
|
# File completion for directories only
|
||||||
|
local subdir
|
||||||
|
subdir="${completions[1]}"
|
||||||
|
if [ -n "$subdir" ]; then
|
||||||
|
__cobra-cli_debug "Listing directories in $subdir"
|
||||||
|
pushd "${subdir}" >/dev/null 2>&1
|
||||||
|
else
|
||||||
|
__cobra-cli_debug "Listing directories in ."
|
||||||
|
fi
|
||||||
|
|
||||||
|
local result
|
||||||
|
_arguments '*:dirname:_files -/'" ${flagPrefix}"
|
||||||
|
result=$?
|
||||||
|
if [ -n "$subdir" ]; then
|
||||||
|
popd >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
return $result
|
||||||
|
else
|
||||||
|
__cobra-cli_debug "Calling _describe"
|
||||||
|
if eval _describe "completions" completions $flagPrefix $noSpace; then
|
||||||
|
__cobra-cli_debug "_describe found some completions"
|
||||||
|
|
||||||
|
# Return the success of having called _describe
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
__cobra-cli_debug "_describe did not find completions."
|
||||||
|
__cobra-cli_debug "Checking if we should do file completion."
|
||||||
|
if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then
|
||||||
|
__cobra-cli_debug "deactivating file completion"
|
||||||
|
|
||||||
|
# We must return an error code here to let zsh know that there were no
|
||||||
|
# completions found by _describe; this is what will trigger other
|
||||||
|
# matching algorithms to attempt to find completions.
|
||||||
|
# For example zsh can match letters in the middle of words.
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
# Perform file completion
|
||||||
|
__cobra-cli_debug "Activating file completion"
|
||||||
|
|
||||||
|
# We must return the result of this command, so it must be the
|
||||||
|
# last command, or else we must store its result to return it.
|
||||||
|
_arguments '*:filename:_files'" ${flagPrefix}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# don't run the completion function when being source-ed or eval-ed
|
||||||
|
if [ "$funcstack[1]" = "_cobra-cli" ]; then
|
||||||
|
_cobra-cli
|
||||||
|
fi
|
212
zsh/comp/goldwarden.zsh-completion
Normal file
212
zsh/comp/goldwarden.zsh-completion
Normal file
|
@ -0,0 +1,212 @@
|
||||||
|
#compdef goldwarden
|
||||||
|
compdef _goldwarden goldwarden
|
||||||
|
|
||||||
|
# zsh completion for goldwarden -*- shell-script -*-
|
||||||
|
|
||||||
|
__goldwarden_debug()
|
||||||
|
{
|
||||||
|
local file="$BASH_COMP_DEBUG_FILE"
|
||||||
|
if [[ -n ${file} ]]; then
|
||||||
|
echo "$*" >> "${file}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
_goldwarden()
|
||||||
|
{
|
||||||
|
local shellCompDirectiveError=1
|
||||||
|
local shellCompDirectiveNoSpace=2
|
||||||
|
local shellCompDirectiveNoFileComp=4
|
||||||
|
local shellCompDirectiveFilterFileExt=8
|
||||||
|
local shellCompDirectiveFilterDirs=16
|
||||||
|
local shellCompDirectiveKeepOrder=32
|
||||||
|
|
||||||
|
local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace keepOrder
|
||||||
|
local -a completions
|
||||||
|
|
||||||
|
__goldwarden_debug "\n========= starting completion logic =========="
|
||||||
|
__goldwarden_debug "CURRENT: ${CURRENT}, words[*]: ${words[*]}"
|
||||||
|
|
||||||
|
# The user could have moved the cursor backwards on the command-line.
|
||||||
|
# We need to trigger completion from the $CURRENT location, so we need
|
||||||
|
# to truncate the command-line ($words) up to the $CURRENT location.
|
||||||
|
# (We cannot use $CURSOR as its value does not work when a command is an alias.)
|
||||||
|
words=("${=words[1,CURRENT]}")
|
||||||
|
__goldwarden_debug "Truncated words[*]: ${words[*]},"
|
||||||
|
|
||||||
|
lastParam=${words[-1]}
|
||||||
|
lastChar=${lastParam[-1]}
|
||||||
|
__goldwarden_debug "lastParam: ${lastParam}, lastChar: ${lastChar}"
|
||||||
|
|
||||||
|
# For zsh, when completing a flag with an = (e.g., goldwarden -n=<TAB>)
|
||||||
|
# completions must be prefixed with the flag
|
||||||
|
setopt local_options BASH_REMATCH
|
||||||
|
if [[ "${lastParam}" =~ '-.*=' ]]; then
|
||||||
|
# We are dealing with a flag with an =
|
||||||
|
flagPrefix="-P ${BASH_REMATCH}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Prepare the command to obtain completions
|
||||||
|
requestComp="${words[1]} __complete ${words[2,-1]}"
|
||||||
|
if [ "${lastChar}" = "" ]; then
|
||||||
|
# If the last parameter is complete (there is a space following it)
|
||||||
|
# We add an extra empty parameter so we can indicate this to the go completion code.
|
||||||
|
__goldwarden_debug "Adding extra empty parameter"
|
||||||
|
requestComp="${requestComp} \"\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
__goldwarden_debug "About to call: eval ${requestComp}"
|
||||||
|
|
||||||
|
# Use eval to handle any environment variables and such
|
||||||
|
out=$(eval ${requestComp} 2>/dev/null)
|
||||||
|
__goldwarden_debug "completion output: ${out}"
|
||||||
|
|
||||||
|
# Extract the directive integer following a : from the last line
|
||||||
|
local lastLine
|
||||||
|
while IFS='\n' read -r line; do
|
||||||
|
lastLine=${line}
|
||||||
|
done < <(printf "%s\n" "${out[@]}")
|
||||||
|
__goldwarden_debug "last line: ${lastLine}"
|
||||||
|
|
||||||
|
if [ "${lastLine[1]}" = : ]; then
|
||||||
|
directive=${lastLine[2,-1]}
|
||||||
|
# Remove the directive including the : and the newline
|
||||||
|
local suffix
|
||||||
|
(( suffix=${#lastLine}+2))
|
||||||
|
out=${out[1,-$suffix]}
|
||||||
|
else
|
||||||
|
# There is no directive specified. Leave $out as is.
|
||||||
|
__goldwarden_debug "No directive found. Setting do default"
|
||||||
|
directive=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
__goldwarden_debug "directive: ${directive}"
|
||||||
|
__goldwarden_debug "completions: ${out}"
|
||||||
|
__goldwarden_debug "flagPrefix: ${flagPrefix}"
|
||||||
|
|
||||||
|
if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then
|
||||||
|
__goldwarden_debug "Completion received error. Ignoring completions."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
local activeHelpMarker="_activeHelp_ "
|
||||||
|
local endIndex=${#activeHelpMarker}
|
||||||
|
local startIndex=$((${#activeHelpMarker}+1))
|
||||||
|
local hasActiveHelp=0
|
||||||
|
while IFS='\n' read -r comp; do
|
||||||
|
# Check if this is an activeHelp statement (i.e., prefixed with $activeHelpMarker)
|
||||||
|
if [ "${comp[1,$endIndex]}" = "$activeHelpMarker" ];then
|
||||||
|
__goldwarden_debug "ActiveHelp found: $comp"
|
||||||
|
comp="${comp[$startIndex,-1]}"
|
||||||
|
if [ -n "$comp" ]; then
|
||||||
|
compadd -x "${comp}"
|
||||||
|
__goldwarden_debug "ActiveHelp will need delimiter"
|
||||||
|
hasActiveHelp=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$comp" ]; then
|
||||||
|
# If requested, completions are returned with a description.
|
||||||
|
# The description is preceded by a TAB character.
|
||||||
|
# For zsh's _describe, we need to use a : instead of a TAB.
|
||||||
|
# We first need to escape any : as part of the completion itself.
|
||||||
|
comp=${comp//:/\\:}
|
||||||
|
|
||||||
|
local tab="$(printf '\t')"
|
||||||
|
comp=${comp//$tab/:}
|
||||||
|
|
||||||
|
__goldwarden_debug "Adding completion: ${comp}"
|
||||||
|
completions+=${comp}
|
||||||
|
lastComp=$comp
|
||||||
|
fi
|
||||||
|
done < <(printf "%s\n" "${out[@]}")
|
||||||
|
|
||||||
|
# Add a delimiter after the activeHelp statements, but only if:
|
||||||
|
# - there are completions following the activeHelp statements, or
|
||||||
|
# - file completion will be performed (so there will be choices after the activeHelp)
|
||||||
|
if [ $hasActiveHelp -eq 1 ]; then
|
||||||
|
if [ ${#completions} -ne 0 ] || [ $((directive & shellCompDirectiveNoFileComp)) -eq 0 ]; then
|
||||||
|
__goldwarden_debug "Adding activeHelp delimiter"
|
||||||
|
compadd -x "--"
|
||||||
|
hasActiveHelp=0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then
|
||||||
|
__goldwarden_debug "Activating nospace."
|
||||||
|
noSpace="-S ''"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $((directive & shellCompDirectiveKeepOrder)) -ne 0 ]; then
|
||||||
|
__goldwarden_debug "Activating keep order."
|
||||||
|
keepOrder="-V"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then
|
||||||
|
# File extension filtering
|
||||||
|
local filteringCmd
|
||||||
|
filteringCmd='_files'
|
||||||
|
for filter in ${completions[@]}; do
|
||||||
|
if [ ${filter[1]} != '*' ]; then
|
||||||
|
# zsh requires a glob pattern to do file filtering
|
||||||
|
filter="\*.$filter"
|
||||||
|
fi
|
||||||
|
filteringCmd+=" -g $filter"
|
||||||
|
done
|
||||||
|
filteringCmd+=" ${flagPrefix}"
|
||||||
|
|
||||||
|
__goldwarden_debug "File filtering command: $filteringCmd"
|
||||||
|
_arguments '*:filename:'"$filteringCmd"
|
||||||
|
elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then
|
||||||
|
# File completion for directories only
|
||||||
|
local subdir
|
||||||
|
subdir="${completions[1]}"
|
||||||
|
if [ -n "$subdir" ]; then
|
||||||
|
__goldwarden_debug "Listing directories in $subdir"
|
||||||
|
pushd "${subdir}" >/dev/null 2>&1
|
||||||
|
else
|
||||||
|
__goldwarden_debug "Listing directories in ."
|
||||||
|
fi
|
||||||
|
|
||||||
|
local result
|
||||||
|
_arguments '*:dirname:_files -/'" ${flagPrefix}"
|
||||||
|
result=$?
|
||||||
|
if [ -n "$subdir" ]; then
|
||||||
|
popd >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
return $result
|
||||||
|
else
|
||||||
|
__goldwarden_debug "Calling _describe"
|
||||||
|
if eval _describe $keepOrder "completions" completions $flagPrefix $noSpace; then
|
||||||
|
__goldwarden_debug "_describe found some completions"
|
||||||
|
|
||||||
|
# Return the success of having called _describe
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
__goldwarden_debug "_describe did not find completions."
|
||||||
|
__goldwarden_debug "Checking if we should do file completion."
|
||||||
|
if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then
|
||||||
|
__goldwarden_debug "deactivating file completion"
|
||||||
|
|
||||||
|
# We must return an error code here to let zsh know that there were no
|
||||||
|
# completions found by _describe; this is what will trigger other
|
||||||
|
# matching algorithms to attempt to find completions.
|
||||||
|
# For example zsh can match letters in the middle of words.
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
# Perform file completion
|
||||||
|
__goldwarden_debug "Activating file completion"
|
||||||
|
|
||||||
|
# We must return the result of this command, so it must be the
|
||||||
|
# last command, or else we must store its result to return it.
|
||||||
|
_arguments '*:filename:_files'" ${flagPrefix}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# don't run the completion function when being source-ed or eval-ed
|
||||||
|
if [ "$funcstack[1]" = "_goldwarden" ]; then
|
||||||
|
_goldwarden
|
||||||
|
fi
|
212
zsh/comp/hugo.zsh-completion
Normal file
212
zsh/comp/hugo.zsh-completion
Normal file
|
@ -0,0 +1,212 @@
|
||||||
|
#compdef hugo
|
||||||
|
compdef _hugo hugo
|
||||||
|
|
||||||
|
# zsh completion for hugo -*- shell-script -*-
|
||||||
|
|
||||||
|
__hugo_debug()
|
||||||
|
{
|
||||||
|
local file="$BASH_COMP_DEBUG_FILE"
|
||||||
|
if [[ -n ${file} ]]; then
|
||||||
|
echo "$*" >> "${file}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
_hugo()
|
||||||
|
{
|
||||||
|
local shellCompDirectiveError=1
|
||||||
|
local shellCompDirectiveNoSpace=2
|
||||||
|
local shellCompDirectiveNoFileComp=4
|
||||||
|
local shellCompDirectiveFilterFileExt=8
|
||||||
|
local shellCompDirectiveFilterDirs=16
|
||||||
|
local shellCompDirectiveKeepOrder=32
|
||||||
|
|
||||||
|
local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace keepOrder
|
||||||
|
local -a completions
|
||||||
|
|
||||||
|
__hugo_debug "\n========= starting completion logic =========="
|
||||||
|
__hugo_debug "CURRENT: ${CURRENT}, words[*]: ${words[*]}"
|
||||||
|
|
||||||
|
# The user could have moved the cursor backwards on the command-line.
|
||||||
|
# We need to trigger completion from the $CURRENT location, so we need
|
||||||
|
# to truncate the command-line ($words) up to the $CURRENT location.
|
||||||
|
# (We cannot use $CURSOR as its value does not work when a command is an alias.)
|
||||||
|
words=("${=words[1,CURRENT]}")
|
||||||
|
__hugo_debug "Truncated words[*]: ${words[*]},"
|
||||||
|
|
||||||
|
lastParam=${words[-1]}
|
||||||
|
lastChar=${lastParam[-1]}
|
||||||
|
__hugo_debug "lastParam: ${lastParam}, lastChar: ${lastChar}"
|
||||||
|
|
||||||
|
# For zsh, when completing a flag with an = (e.g., hugo -n=<TAB>)
|
||||||
|
# completions must be prefixed with the flag
|
||||||
|
setopt local_options BASH_REMATCH
|
||||||
|
if [[ "${lastParam}" =~ '-.*=' ]]; then
|
||||||
|
# We are dealing with a flag with an =
|
||||||
|
flagPrefix="-P ${BASH_REMATCH}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Prepare the command to obtain completions
|
||||||
|
requestComp="${words[1]} __complete ${words[2,-1]}"
|
||||||
|
if [ "${lastChar}" = "" ]; then
|
||||||
|
# If the last parameter is complete (there is a space following it)
|
||||||
|
# We add an extra empty parameter so we can indicate this to the go completion code.
|
||||||
|
__hugo_debug "Adding extra empty parameter"
|
||||||
|
requestComp="${requestComp} \"\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
__hugo_debug "About to call: eval ${requestComp}"
|
||||||
|
|
||||||
|
# Use eval to handle any environment variables and such
|
||||||
|
out=$(eval ${requestComp} 2>/dev/null)
|
||||||
|
__hugo_debug "completion output: ${out}"
|
||||||
|
|
||||||
|
# Extract the directive integer following a : from the last line
|
||||||
|
local lastLine
|
||||||
|
while IFS='\n' read -r line; do
|
||||||
|
lastLine=${line}
|
||||||
|
done < <(printf "%s\n" "${out[@]}")
|
||||||
|
__hugo_debug "last line: ${lastLine}"
|
||||||
|
|
||||||
|
if [ "${lastLine[1]}" = : ]; then
|
||||||
|
directive=${lastLine[2,-1]}
|
||||||
|
# Remove the directive including the : and the newline
|
||||||
|
local suffix
|
||||||
|
(( suffix=${#lastLine}+2))
|
||||||
|
out=${out[1,-$suffix]}
|
||||||
|
else
|
||||||
|
# There is no directive specified. Leave $out as is.
|
||||||
|
__hugo_debug "No directive found. Setting do default"
|
||||||
|
directive=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
__hugo_debug "directive: ${directive}"
|
||||||
|
__hugo_debug "completions: ${out}"
|
||||||
|
__hugo_debug "flagPrefix: ${flagPrefix}"
|
||||||
|
|
||||||
|
if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then
|
||||||
|
__hugo_debug "Completion received error. Ignoring completions."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
local activeHelpMarker="_activeHelp_ "
|
||||||
|
local endIndex=${#activeHelpMarker}
|
||||||
|
local startIndex=$((${#activeHelpMarker}+1))
|
||||||
|
local hasActiveHelp=0
|
||||||
|
while IFS='\n' read -r comp; do
|
||||||
|
# Check if this is an activeHelp statement (i.e., prefixed with $activeHelpMarker)
|
||||||
|
if [ "${comp[1,$endIndex]}" = "$activeHelpMarker" ];then
|
||||||
|
__hugo_debug "ActiveHelp found: $comp"
|
||||||
|
comp="${comp[$startIndex,-1]}"
|
||||||
|
if [ -n "$comp" ]; then
|
||||||
|
compadd -x "${comp}"
|
||||||
|
__hugo_debug "ActiveHelp will need delimiter"
|
||||||
|
hasActiveHelp=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$comp" ]; then
|
||||||
|
# If requested, completions are returned with a description.
|
||||||
|
# The description is preceded by a TAB character.
|
||||||
|
# For zsh's _describe, we need to use a : instead of a TAB.
|
||||||
|
# We first need to escape any : as part of the completion itself.
|
||||||
|
comp=${comp//:/\\:}
|
||||||
|
|
||||||
|
local tab="$(printf '\t')"
|
||||||
|
comp=${comp//$tab/:}
|
||||||
|
|
||||||
|
__hugo_debug "Adding completion: ${comp}"
|
||||||
|
completions+=${comp}
|
||||||
|
lastComp=$comp
|
||||||
|
fi
|
||||||
|
done < <(printf "%s\n" "${out[@]}")
|
||||||
|
|
||||||
|
# Add a delimiter after the activeHelp statements, but only if:
|
||||||
|
# - there are completions following the activeHelp statements, or
|
||||||
|
# - file completion will be performed (so there will be choices after the activeHelp)
|
||||||
|
if [ $hasActiveHelp -eq 1 ]; then
|
||||||
|
if [ ${#completions} -ne 0 ] || [ $((directive & shellCompDirectiveNoFileComp)) -eq 0 ]; then
|
||||||
|
__hugo_debug "Adding activeHelp delimiter"
|
||||||
|
compadd -x "--"
|
||||||
|
hasActiveHelp=0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then
|
||||||
|
__hugo_debug "Activating nospace."
|
||||||
|
noSpace="-S ''"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $((directive & shellCompDirectiveKeepOrder)) -ne 0 ]; then
|
||||||
|
__hugo_debug "Activating keep order."
|
||||||
|
keepOrder="-V"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then
|
||||||
|
# File extension filtering
|
||||||
|
local filteringCmd
|
||||||
|
filteringCmd='_files'
|
||||||
|
for filter in ${completions[@]}; do
|
||||||
|
if [ ${filter[1]} != '*' ]; then
|
||||||
|
# zsh requires a glob pattern to do file filtering
|
||||||
|
filter="\*.$filter"
|
||||||
|
fi
|
||||||
|
filteringCmd+=" -g $filter"
|
||||||
|
done
|
||||||
|
filteringCmd+=" ${flagPrefix}"
|
||||||
|
|
||||||
|
__hugo_debug "File filtering command: $filteringCmd"
|
||||||
|
_arguments '*:filename:'"$filteringCmd"
|
||||||
|
elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then
|
||||||
|
# File completion for directories only
|
||||||
|
local subdir
|
||||||
|
subdir="${completions[1]}"
|
||||||
|
if [ -n "$subdir" ]; then
|
||||||
|
__hugo_debug "Listing directories in $subdir"
|
||||||
|
pushd "${subdir}" >/dev/null 2>&1
|
||||||
|
else
|
||||||
|
__hugo_debug "Listing directories in ."
|
||||||
|
fi
|
||||||
|
|
||||||
|
local result
|
||||||
|
_arguments '*:dirname:_files -/'" ${flagPrefix}"
|
||||||
|
result=$?
|
||||||
|
if [ -n "$subdir" ]; then
|
||||||
|
popd >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
return $result
|
||||||
|
else
|
||||||
|
__hugo_debug "Calling _describe"
|
||||||
|
if eval _describe $keepOrder "completions" completions $flagPrefix $noSpace; then
|
||||||
|
__hugo_debug "_describe found some completions"
|
||||||
|
|
||||||
|
# Return the success of having called _describe
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
__hugo_debug "_describe did not find completions."
|
||||||
|
__hugo_debug "Checking if we should do file completion."
|
||||||
|
if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then
|
||||||
|
__hugo_debug "deactivating file completion"
|
||||||
|
|
||||||
|
# We must return an error code here to let zsh know that there were no
|
||||||
|
# completions found by _describe; this is what will trigger other
|
||||||
|
# matching algorithms to attempt to find completions.
|
||||||
|
# For example zsh can match letters in the middle of words.
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
# Perform file completion
|
||||||
|
__hugo_debug "Activating file completion"
|
||||||
|
|
||||||
|
# We must return the result of this command, so it must be the
|
||||||
|
# last command, or else we must store its result to return it.
|
||||||
|
_arguments '*:filename:_files'" ${flagPrefix}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# don't run the completion function when being source-ed or eval-ed
|
||||||
|
if [ "$funcstack[1]" = "_hugo" ]; then
|
||||||
|
_hugo
|
||||||
|
fi
|
144
zsh/comp/pass.zsh-completion
Normal file
144
zsh/comp/pass.zsh-completion
Normal file
|
@ -0,0 +1,144 @@
|
||||||
|
#compdef pass
|
||||||
|
#autoload
|
||||||
|
|
||||||
|
# Copyright (C) 2012 - 2014:
|
||||||
|
# Johan Venant <jvenant@invicem.pro>
|
||||||
|
# Brian Mattern <rephorm@rephorm.com>
|
||||||
|
# Jason A. Donenfeld <Jason@zx2c4.com>.
|
||||||
|
# All Rights Reserved.
|
||||||
|
# This file is licensed under the GPLv2+. Please see COPYING for more information.
|
||||||
|
|
||||||
|
|
||||||
|
# If you use multiple repositories, you can configure completion like this:
|
||||||
|
#
|
||||||
|
# compdef _pass workpass
|
||||||
|
# zstyle ':completion::complete:workpass::' prefix "$HOME/work/pass"
|
||||||
|
# workpass() {
|
||||||
|
# PASSWORD_STORE_DIR=$HOME/work/pass pass $@
|
||||||
|
# }
|
||||||
|
|
||||||
|
|
||||||
|
_pass () {
|
||||||
|
local cmd
|
||||||
|
if (( CURRENT > 2)); then
|
||||||
|
cmd=${words[2]}
|
||||||
|
# Set the context for the subcommand.
|
||||||
|
curcontext="${curcontext%:*:*}:pass-$cmd"
|
||||||
|
# Narrow the range of words we are looking at to exclude `pass'
|
||||||
|
(( CURRENT-- ))
|
||||||
|
shift words
|
||||||
|
# Run the completion for the subcommand
|
||||||
|
case "${cmd}" in
|
||||||
|
init)
|
||||||
|
_arguments : \
|
||||||
|
"-p[gpg-id will only be applied to this subfolder]" \
|
||||||
|
"--path[gpg-id will only be applied to this subfolder]"
|
||||||
|
_pass_complete_keys
|
||||||
|
;;
|
||||||
|
ls|list|edit)
|
||||||
|
_pass_complete_entries_with_subdirs
|
||||||
|
;;
|
||||||
|
insert)
|
||||||
|
_arguments : \
|
||||||
|
"-e[echo password to console]" \
|
||||||
|
"--echo[echo password to console]" \
|
||||||
|
"-m[multiline]" \
|
||||||
|
"--multiline[multiline]"
|
||||||
|
_pass_complete_entries_with_subdirs
|
||||||
|
;;
|
||||||
|
generate)
|
||||||
|
_arguments : \
|
||||||
|
"-n[don't include symbols in password]" \
|
||||||
|
"--no-symbols[don't include symbols in password]" \
|
||||||
|
"-c[copy password to the clipboard]" \
|
||||||
|
"--clip[copy password to the clipboard]" \
|
||||||
|
"-f[force overwrite]" \
|
||||||
|
"--force[force overwrite]" \
|
||||||
|
"-i[replace first line]" \
|
||||||
|
"--in-place[replace first line]"
|
||||||
|
_pass_complete_entries_with_subdirs
|
||||||
|
;;
|
||||||
|
cp|copy|mv|rename)
|
||||||
|
_arguments : \
|
||||||
|
"-f[force rename]" \
|
||||||
|
"--force[force rename]"
|
||||||
|
_pass_complete_entries_with_subdirs
|
||||||
|
;;
|
||||||
|
rm)
|
||||||
|
_arguments : \
|
||||||
|
"-f[force deletion]" \
|
||||||
|
"--force[force deletion]" \
|
||||||
|
"-r[recursively delete]" \
|
||||||
|
"--recursive[recursively delete]"
|
||||||
|
_pass_complete_entries_with_subdirs
|
||||||
|
;;
|
||||||
|
git)
|
||||||
|
local -a subcommands
|
||||||
|
subcommands=(
|
||||||
|
"init:Initialize git repository"
|
||||||
|
"push:Push to remote repository"
|
||||||
|
"pull:Pull from remote repository"
|
||||||
|
"config:Show git config"
|
||||||
|
"log:Show git log"
|
||||||
|
"reflog:Show git reflog"
|
||||||
|
)
|
||||||
|
_describe -t commands 'pass git' subcommands
|
||||||
|
;;
|
||||||
|
show|*)
|
||||||
|
_pass_cmd_show
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
local -a subcommands
|
||||||
|
subcommands=(
|
||||||
|
"init:Initialize new password storage"
|
||||||
|
"ls:List passwords"
|
||||||
|
"find:Find password files or directories based on pattern"
|
||||||
|
"grep:Search inside decrypted password files for matching pattern"
|
||||||
|
"show:Decrypt and print a password"
|
||||||
|
"insert:Insert a new password"
|
||||||
|
"generate:Generate a new password using pwgen"
|
||||||
|
"edit:Edit a password with \$EDITOR"
|
||||||
|
"mv:Rename the password"
|
||||||
|
"cp:Copy the password"
|
||||||
|
"rm:Remove the password"
|
||||||
|
"git:Call git on the password store"
|
||||||
|
"version:Output version information"
|
||||||
|
"help:Output help message"
|
||||||
|
)
|
||||||
|
_describe -t commands 'pass' subcommands
|
||||||
|
_arguments : \
|
||||||
|
"--version[Output version information]" \
|
||||||
|
"--help[Output help message]"
|
||||||
|
_pass_cmd_show
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
_pass_cmd_show () {
|
||||||
|
_arguments : \
|
||||||
|
"-c[put it on the clipboard]" \
|
||||||
|
"--clip[put it on the clipboard]"
|
||||||
|
_pass_complete_entries
|
||||||
|
}
|
||||||
|
_pass_complete_entries_helper () {
|
||||||
|
local IFS=$'\n'
|
||||||
|
local prefix
|
||||||
|
zstyle -s ":completion:${curcontext}:" prefix prefix || prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
|
||||||
|
_values -C 'passwords' ${$(find -L "$prefix" \( -name .git -o -name .gpg-id \) -prune -o $@ -print 2>/dev/null | sed -e "s#${prefix}/\{0,1\}##" -e 's#\.gpg##' -e 's#\\#\\\\#g' -e 's#:#\\:#g' | sort):-""}
|
||||||
|
}
|
||||||
|
|
||||||
|
_pass_complete_entries_with_subdirs () {
|
||||||
|
_pass_complete_entries_helper
|
||||||
|
}
|
||||||
|
|
||||||
|
_pass_complete_entries () {
|
||||||
|
_pass_complete_entries_helper -type f
|
||||||
|
}
|
||||||
|
|
||||||
|
_pass_complete_keys () {
|
||||||
|
local IFS=$'\n'
|
||||||
|
# Extract names and email addresses from gpg --list-keys
|
||||||
|
_values 'gpg keys' $(gpg2 --list-secret-keys --with-colons | cut -d : -f 10 | sort -u | sed '/^$/d')
|
||||||
|
}
|
||||||
|
|
||||||
|
_pass
|
212
zsh/comp/vgo.zsh-completion
Normal file
212
zsh/comp/vgo.zsh-completion
Normal file
|
@ -0,0 +1,212 @@
|
||||||
|
#compdef vgo
|
||||||
|
compdef _vgo vgo
|
||||||
|
|
||||||
|
# zsh completion for vgo -*- shell-script -*-
|
||||||
|
|
||||||
|
__vgo_debug()
|
||||||
|
{
|
||||||
|
local file="$BASH_COMP_DEBUG_FILE"
|
||||||
|
if [[ -n ${file} ]]; then
|
||||||
|
echo "$*" >> "${file}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
_vgo()
|
||||||
|
{
|
||||||
|
local shellCompDirectiveError=1
|
||||||
|
local shellCompDirectiveNoSpace=2
|
||||||
|
local shellCompDirectiveNoFileComp=4
|
||||||
|
local shellCompDirectiveFilterFileExt=8
|
||||||
|
local shellCompDirectiveFilterDirs=16
|
||||||
|
local shellCompDirectiveKeepOrder=32
|
||||||
|
|
||||||
|
local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace keepOrder
|
||||||
|
local -a completions
|
||||||
|
|
||||||
|
__vgo_debug "\n========= starting completion logic =========="
|
||||||
|
__vgo_debug "CURRENT: ${CURRENT}, words[*]: ${words[*]}"
|
||||||
|
|
||||||
|
# The user could have moved the cursor backwards on the command-line.
|
||||||
|
# We need to trigger completion from the $CURRENT location, so we need
|
||||||
|
# to truncate the command-line ($words) up to the $CURRENT location.
|
||||||
|
# (We cannot use $CURSOR as its value does not work when a command is an alias.)
|
||||||
|
words=("${=words[1,CURRENT]}")
|
||||||
|
__vgo_debug "Truncated words[*]: ${words[*]},"
|
||||||
|
|
||||||
|
lastParam=${words[-1]}
|
||||||
|
lastChar=${lastParam[-1]}
|
||||||
|
__vgo_debug "lastParam: ${lastParam}, lastChar: ${lastChar}"
|
||||||
|
|
||||||
|
# For zsh, when completing a flag with an = (e.g., vgo -n=<TAB>)
|
||||||
|
# completions must be prefixed with the flag
|
||||||
|
setopt local_options BASH_REMATCH
|
||||||
|
if [[ "${lastParam}" =~ '-.*=' ]]; then
|
||||||
|
# We are dealing with a flag with an =
|
||||||
|
flagPrefix="-P ${BASH_REMATCH}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Prepare the command to obtain completions
|
||||||
|
requestComp="${words[1]} __complete ${words[2,-1]}"
|
||||||
|
if [ "${lastChar}" = "" ]; then
|
||||||
|
# If the last parameter is complete (there is a space following it)
|
||||||
|
# We add an extra empty parameter so we can indicate this to the go completion code.
|
||||||
|
__vgo_debug "Adding extra empty parameter"
|
||||||
|
requestComp="${requestComp} \"\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
__vgo_debug "About to call: eval ${requestComp}"
|
||||||
|
|
||||||
|
# Use eval to handle any environment variables and such
|
||||||
|
out=$(eval ${requestComp} 2>/dev/null)
|
||||||
|
__vgo_debug "completion output: ${out}"
|
||||||
|
|
||||||
|
# Extract the directive integer following a : from the last line
|
||||||
|
local lastLine
|
||||||
|
while IFS='\n' read -r line; do
|
||||||
|
lastLine=${line}
|
||||||
|
done < <(printf "%s\n" "${out[@]}")
|
||||||
|
__vgo_debug "last line: ${lastLine}"
|
||||||
|
|
||||||
|
if [ "${lastLine[1]}" = : ]; then
|
||||||
|
directive=${lastLine[2,-1]}
|
||||||
|
# Remove the directive including the : and the newline
|
||||||
|
local suffix
|
||||||
|
(( suffix=${#lastLine}+2))
|
||||||
|
out=${out[1,-$suffix]}
|
||||||
|
else
|
||||||
|
# There is no directive specified. Leave $out as is.
|
||||||
|
__vgo_debug "No directive found. Setting do default"
|
||||||
|
directive=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
__vgo_debug "directive: ${directive}"
|
||||||
|
__vgo_debug "completions: ${out}"
|
||||||
|
__vgo_debug "flagPrefix: ${flagPrefix}"
|
||||||
|
|
||||||
|
if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then
|
||||||
|
__vgo_debug "Completion received error. Ignoring completions."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
local activeHelpMarker="_activeHelp_ "
|
||||||
|
local endIndex=${#activeHelpMarker}
|
||||||
|
local startIndex=$((${#activeHelpMarker}+1))
|
||||||
|
local hasActiveHelp=0
|
||||||
|
while IFS='\n' read -r comp; do
|
||||||
|
# Check if this is an activeHelp statement (i.e., prefixed with $activeHelpMarker)
|
||||||
|
if [ "${comp[1,$endIndex]}" = "$activeHelpMarker" ];then
|
||||||
|
__vgo_debug "ActiveHelp found: $comp"
|
||||||
|
comp="${comp[$startIndex,-1]}"
|
||||||
|
if [ -n "$comp" ]; then
|
||||||
|
compadd -x "${comp}"
|
||||||
|
__vgo_debug "ActiveHelp will need delimiter"
|
||||||
|
hasActiveHelp=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$comp" ]; then
|
||||||
|
# If requested, completions are returned with a description.
|
||||||
|
# The description is preceded by a TAB character.
|
||||||
|
# For zsh's _describe, we need to use a : instead of a TAB.
|
||||||
|
# We first need to escape any : as part of the completion itself.
|
||||||
|
comp=${comp//:/\\:}
|
||||||
|
|
||||||
|
local tab="$(printf '\t')"
|
||||||
|
comp=${comp//$tab/:}
|
||||||
|
|
||||||
|
__vgo_debug "Adding completion: ${comp}"
|
||||||
|
completions+=${comp}
|
||||||
|
lastComp=$comp
|
||||||
|
fi
|
||||||
|
done < <(printf "%s\n" "${out[@]}")
|
||||||
|
|
||||||
|
# Add a delimiter after the activeHelp statements, but only if:
|
||||||
|
# - there are completions following the activeHelp statements, or
|
||||||
|
# - file completion will be performed (so there will be choices after the activeHelp)
|
||||||
|
if [ $hasActiveHelp -eq 1 ]; then
|
||||||
|
if [ ${#completions} -ne 0 ] || [ $((directive & shellCompDirectiveNoFileComp)) -eq 0 ]; then
|
||||||
|
__vgo_debug "Adding activeHelp delimiter"
|
||||||
|
compadd -x "--"
|
||||||
|
hasActiveHelp=0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then
|
||||||
|
__vgo_debug "Activating nospace."
|
||||||
|
noSpace="-S ''"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $((directive & shellCompDirectiveKeepOrder)) -ne 0 ]; then
|
||||||
|
__vgo_debug "Activating keep order."
|
||||||
|
keepOrder="-V"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then
|
||||||
|
# File extension filtering
|
||||||
|
local filteringCmd
|
||||||
|
filteringCmd='_files'
|
||||||
|
for filter in ${completions[@]}; do
|
||||||
|
if [ ${filter[1]} != '*' ]; then
|
||||||
|
# zsh requires a glob pattern to do file filtering
|
||||||
|
filter="\*.$filter"
|
||||||
|
fi
|
||||||
|
filteringCmd+=" -g $filter"
|
||||||
|
done
|
||||||
|
filteringCmd+=" ${flagPrefix}"
|
||||||
|
|
||||||
|
__vgo_debug "File filtering command: $filteringCmd"
|
||||||
|
_arguments '*:filename:'"$filteringCmd"
|
||||||
|
elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then
|
||||||
|
# File completion for directories only
|
||||||
|
local subdir
|
||||||
|
subdir="${completions[1]}"
|
||||||
|
if [ -n "$subdir" ]; then
|
||||||
|
__vgo_debug "Listing directories in $subdir"
|
||||||
|
pushd "${subdir}" >/dev/null 2>&1
|
||||||
|
else
|
||||||
|
__vgo_debug "Listing directories in ."
|
||||||
|
fi
|
||||||
|
|
||||||
|
local result
|
||||||
|
_arguments '*:dirname:_files -/'" ${flagPrefix}"
|
||||||
|
result=$?
|
||||||
|
if [ -n "$subdir" ]; then
|
||||||
|
popd >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
return $result
|
||||||
|
else
|
||||||
|
__vgo_debug "Calling _describe"
|
||||||
|
if eval _describe $keepOrder "completions" completions $flagPrefix $noSpace; then
|
||||||
|
__vgo_debug "_describe found some completions"
|
||||||
|
|
||||||
|
# Return the success of having called _describe
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
__vgo_debug "_describe did not find completions."
|
||||||
|
__vgo_debug "Checking if we should do file completion."
|
||||||
|
if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then
|
||||||
|
__vgo_debug "deactivating file completion"
|
||||||
|
|
||||||
|
# We must return an error code here to let zsh know that there were no
|
||||||
|
# completions found by _describe; this is what will trigger other
|
||||||
|
# matching algorithms to attempt to find completions.
|
||||||
|
# For example zsh can match letters in the middle of words.
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
# Perform file completion
|
||||||
|
__vgo_debug "Activating file completion"
|
||||||
|
|
||||||
|
# We must return the result of this command, so it must be the
|
||||||
|
# last command, or else we must store its result to return it.
|
||||||
|
_arguments '*:filename:_files'" ${flagPrefix}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# don't run the completion function when being source-ed or eval-ed
|
||||||
|
if [ "$funcstack[1]" = "_vgo" ]; then
|
||||||
|
_vgo
|
||||||
|
fi
|
431
zsh/conf.d/p10k.zsh
Normal file
431
zsh/conf.d/p10k.zsh
Normal file
|
@ -0,0 +1,431 @@
|
||||||
|
# Powerlevel10k configuration file restricted to 8-color ASCII. Produced by
|
||||||
|
# running `p10k configure` while at 1387763f2719661dc7e43e86a5bfd24cc357d6a0
|
||||||
|
# and then editing ~/.p10k.zsh. Configuration wizard header follows.
|
||||||
|
#
|
||||||
|
# Generated by Powerlevel10k configuration wizard on 2019-11-12 at 08:45 CET.
|
||||||
|
# Based on romkatv/powerlevel10k/config/p10k-lean.zsh, checksum 11792.
|
||||||
|
# Wizard options: compatible, lean, 2 lines, disconnected, no frame, sparse, concise.
|
||||||
|
# Type `p10k configure` to generate another config.
|
||||||
|
|
||||||
|
# Temporarily change options.
|
||||||
|
'builtin' 'local' '-a' 'p10k_config_opts'
|
||||||
|
[[ ! -o 'aliases' ]] || p10k_config_opts+=('aliases')
|
||||||
|
[[ ! -o 'sh_glob' ]] || p10k_config_opts+=('sh_glob')
|
||||||
|
[[ ! -o 'no_brace_expand' ]] || p10k_config_opts+=('no_brace_expand')
|
||||||
|
'builtin' 'setopt' 'no_aliases' 'no_sh_glob' 'brace_expand'
|
||||||
|
|
||||||
|
() {
|
||||||
|
emulate -L zsh
|
||||||
|
setopt no_unset extended_glob
|
||||||
|
zmodload zsh/langinfo
|
||||||
|
if [[ ${langinfo[CODESET]:-} != (utf|UTF)(-|)8 ]]; then
|
||||||
|
local LC_ALL=${${(@M)$(locale -a):#*.(utf|UTF)(-|)8}[1]:-en_US.UTF-8}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Unset all configuration options. This allows you to apply configiguration changes without
|
||||||
|
# restarting zsh. Edit ~/.p10k.zsh and type `source ~/.p10k.zsh`.
|
||||||
|
unset -m 'POWERLEVEL9K_*'
|
||||||
|
|
||||||
|
# The list of segments shown on the left. Fill it with the most important segments.
|
||||||
|
typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
|
||||||
|
# =========================[ Line #1 ]=========================
|
||||||
|
dir # current directory
|
||||||
|
vcs # git status
|
||||||
|
# =========================[ Line #2 ]=========================
|
||||||
|
newline
|
||||||
|
prompt_char # prompt symbol
|
||||||
|
)
|
||||||
|
|
||||||
|
# The list of segments shown on the right. Fill it with less important segments.
|
||||||
|
# Right prompt on the last prompt line (where you are typing your commands) gets
|
||||||
|
# automatically hidden when the input line reaches it. Right prompt above the
|
||||||
|
# last prompt line gets hidden if it would overlap with left prompt.
|
||||||
|
typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(
|
||||||
|
# =========================[ Line #1 ]=========================
|
||||||
|
status # exit code of the last command
|
||||||
|
command_execution_time # duration of the last command
|
||||||
|
background_jobs # presence of background jobs
|
||||||
|
context # user@hostname
|
||||||
|
# =========================[ Line #2 ]=========================
|
||||||
|
newline
|
||||||
|
)
|
||||||
|
|
||||||
|
# Basic style options that define the overall look of your prompt. You probably don't want to
|
||||||
|
# change them.
|
||||||
|
typeset -g POWERLEVEL9K_BACKGROUND= # transparent background
|
||||||
|
typeset -g POWERLEVEL9K_{LEFT,RIGHT}_{LEFT,RIGHT}_WHITESPACE= # no surrounding whitespace
|
||||||
|
typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SUBSEGMENT_SEPARATOR=' ' # separate segments with a space
|
||||||
|
typeset -g POWERLEVEL9K_{LEFT,RIGHT}_SEGMENT_SEPARATOR= # no end-of-line symbol
|
||||||
|
|
||||||
|
# When set to true, icons appear before content on both sides of the prompt. When set
|
||||||
|
# to false, icons go after content. If empty or not set, icons go before content in the left
|
||||||
|
# prompt and after content in the right prompt.
|
||||||
|
#
|
||||||
|
# You can also override it for a specific segment:
|
||||||
|
#
|
||||||
|
# POWERLEVEL9K_STATUS_ICON_BEFORE_CONTENT=false
|
||||||
|
#
|
||||||
|
# Or for a specific segment in specific state:
|
||||||
|
#
|
||||||
|
# POWERLEVEL9K_DIR_NOT_WRITABLE_ICON_BEFORE_CONTENT=false
|
||||||
|
typeset -g POWERLEVEL9K_ICON_BEFORE_CONTENT=true
|
||||||
|
|
||||||
|
# Add an empty line before each prompt.
|
||||||
|
typeset -g POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
|
||||||
|
|
||||||
|
# Connect left prompt lines with these symbols.
|
||||||
|
typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX=
|
||||||
|
typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_PREFIX=
|
||||||
|
typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX=
|
||||||
|
# Connect right prompt lines with these symbols.
|
||||||
|
typeset -g POWERLEVEL9K_MULTILINE_FIRST_PROMPT_SUFFIX=
|
||||||
|
typeset -g POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_SUFFIX=
|
||||||
|
typeset -g POWERLEVEL9K_MULTILINE_LAST_PROMPT_SUFFIX=
|
||||||
|
|
||||||
|
# The left end of left prompt.
|
||||||
|
typeset -g POWERLEVEL9K_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL=
|
||||||
|
# The right end of right prompt.
|
||||||
|
typeset -g POWERLEVEL9K_RIGHT_PROMPT_LAST_SEGMENT_END_SYMBOL=
|
||||||
|
|
||||||
|
################################[ prompt_char: prompt symbol ]################################
|
||||||
|
# Green prompt symbol if the last command succeeded.
|
||||||
|
typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS,VIOWR}_FOREGROUND=2
|
||||||
|
# Red prompt symbol if the last command failed.
|
||||||
|
typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS,VIOWR}_FOREGROUND=1
|
||||||
|
# Default prompt symbol.
|
||||||
|
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIINS_CONTENT_EXPANSION='>'
|
||||||
|
# Prompt symbol in command vi mode.
|
||||||
|
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VICMD_CONTENT_EXPANSION='<'
|
||||||
|
# Prompt symbol in visual vi mode.
|
||||||
|
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIVIS_CONTENT_EXPANSION='V'
|
||||||
|
# Prompt symbol in overwrite vi mode.
|
||||||
|
typeset -g POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIOWR_CONTENT_EXPANSION='^'
|
||||||
|
typeset -g POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=true
|
||||||
|
typeset -g POWERLEVEL9K_PROMPT_CHAR_LEFT_PROMPT_LAST_SEGMENT_END_SYMBOL=''
|
||||||
|
|
||||||
|
##################################[ dir: current directory ]##################################
|
||||||
|
# Default current directory color.
|
||||||
|
typeset -g POWERLEVEL9K_DIR_FOREGROUND=4
|
||||||
|
# If directory is too long, shorten some of its segments to the shortest possible unique
|
||||||
|
# prefix. The shortened directory can be tab-completed to the original.
|
||||||
|
typeset -g POWERLEVEL9K_SHORTEN_STRATEGY=truncate_to_unique
|
||||||
|
# Replace removed segment suffixes with this symbol.
|
||||||
|
typeset -g POWERLEVEL9K_SHORTEN_DELIMITER=
|
||||||
|
# Color of the shortened directory segments.
|
||||||
|
typeset -g POWERLEVEL9K_DIR_SHORTENED_FOREGROUND=4
|
||||||
|
# Color of the anchor directory segments. Anchor segments are never shortened. The first
|
||||||
|
# segment is always an anchor.
|
||||||
|
typeset -g POWERLEVEL9K_DIR_ANCHOR_FOREGROUND=4
|
||||||
|
# Display anchor directory segments in bold.
|
||||||
|
typeset -g POWERLEVEL9K_DIR_ANCHOR_BOLD=false
|
||||||
|
# Don't shorten directories that contain any of these files. They are anchors.
|
||||||
|
local anchor_files=(
|
||||||
|
.bzr
|
||||||
|
.citc
|
||||||
|
.git
|
||||||
|
.hg
|
||||||
|
.node-version
|
||||||
|
.python-version
|
||||||
|
.ruby-version
|
||||||
|
.shorten_folder_marker
|
||||||
|
.svn
|
||||||
|
.terraform
|
||||||
|
CVS
|
||||||
|
Cargo.toml
|
||||||
|
composer.json
|
||||||
|
go.mod
|
||||||
|
package.json
|
||||||
|
)
|
||||||
|
typeset -g POWERLEVEL9K_SHORTEN_FOLDER_MARKER="(${(j:|:)anchor_files})"
|
||||||
|
# Don't shorten this many last directory segments. They are anchors.
|
||||||
|
typeset -g POWERLEVEL9K_SHORTEN_DIR_LENGTH=1
|
||||||
|
# Shorten directory if it's longer than this even if there is space for it. The value can
|
||||||
|
# be either absolute (e.g., '80') or a percentage of terminal width (e.g, '50%'). If empty,
|
||||||
|
# directory will be shortened only when prompt doesn't fit or when other parameters demand it
|
||||||
|
# (see POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS and POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT below).
|
||||||
|
typeset -g POWERLEVEL9K_DIR_MAX_LENGTH=80
|
||||||
|
# When `dir` segment is on the last prompt line, try to shorten it enough to leave at least this
|
||||||
|
# many columns for typing commands.
|
||||||
|
typeset -g POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS=40
|
||||||
|
# When `dir` segment is on the last prompt line, try to shorten it enough to leave at least
|
||||||
|
# COLUMNS * POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT * 0.01 columns for typing commands.
|
||||||
|
typeset -g POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT=50
|
||||||
|
|
||||||
|
# Enable special styling for non-writable directories.
|
||||||
|
typeset -g POWERLEVEL9K_DIR_SHOW_WRITABLE=true
|
||||||
|
# Show this icon when the current directory is not writable. POWERLEVEL9K_DIR_SHOW_WRITABLE
|
||||||
|
# above must be set to true for this parameter to have effect.
|
||||||
|
typeset -g POWERLEVEL9K_DIR_NOT_WRITABLE_VISUAL_IDENTIFIER_EXPANSION='X'
|
||||||
|
|
||||||
|
# Custom prefix.
|
||||||
|
# typeset -g POWERLEVEL9K_DIR_PREFIX='%fin '
|
||||||
|
|
||||||
|
# POWERLEVEL9K_DIR_CLASSES allows you to specify custom icons for different directories.
|
||||||
|
# It must be an array with 3 * N elements. Each triplet consists of:
|
||||||
|
#
|
||||||
|
# 1. A pattern against which the current directory is matched. Matching is done with
|
||||||
|
# extended_glob option enabled.
|
||||||
|
# 2. Directory class for the purpose of styling.
|
||||||
|
# 3. Icon.
|
||||||
|
#
|
||||||
|
# Triplets are tried in order. The first triplet whose pattern matches $PWD wins. If there
|
||||||
|
# are no matches, the directory will have no icon.
|
||||||
|
#
|
||||||
|
# Example:
|
||||||
|
#
|
||||||
|
# typeset -g POWERLEVEL9K_DIR_CLASSES=(
|
||||||
|
# '~/work(/*)#' WORK '(╯°□°)╯︵ ┻━┻'
|
||||||
|
# '~(/*)#' HOME '⌂'
|
||||||
|
# '*' DEFAULT '')
|
||||||
|
#
|
||||||
|
# With these settings, the current directory in the prompt may look like this:
|
||||||
|
#
|
||||||
|
# (╯°□°)╯︵ ┻━┻ ~/work/projects/important/urgent
|
||||||
|
#
|
||||||
|
# Or like this:
|
||||||
|
#
|
||||||
|
# ⌂ ~/best/powerlevel10k
|
||||||
|
#
|
||||||
|
# You can also set different colors for directories of different classes. Remember to override
|
||||||
|
# FOREGROUND, SHORTENED_FOREGROUND and ANCHOR_FOREGROUND for every directory class that you wish
|
||||||
|
# to have its own color.
|
||||||
|
#
|
||||||
|
# typeset -g POWERLEVEL9K_DIR_WORK_FOREGROUND=31
|
||||||
|
# typeset -g POWERLEVEL9K_DIR_WORK_SHORTENED_FOREGROUND=103
|
||||||
|
# typeset -g POWERLEVEL9K_DIR_WORK_ANCHOR_FOREGROUND=39
|
||||||
|
#
|
||||||
|
typeset -g POWERLEVEL9K_DIR_CLASSES=()
|
||||||
|
|
||||||
|
#####################################[ vcs: git status ]######################################
|
||||||
|
# Branch icon.
|
||||||
|
typeset -g POWERLEVEL9K_VCS_BRANCH_ICON=
|
||||||
|
POWERLEVEL9K_VCS_BRANCH_ICON=${(g::)POWERLEVEL9K_VCS_BRANCH_ICON}
|
||||||
|
|
||||||
|
# Untracked files icon. It's really a question mark, your font isn't broken.
|
||||||
|
# Change the value of this parameter to show a different icon.
|
||||||
|
typeset -g POWERLEVEL9K_VCS_UNTRACKED_ICON='?'
|
||||||
|
POWERLEVEL9K_VCS_UNTRACKED_ICON=${(g::)POWERLEVEL9K_VCS_UNTRACKED_ICON}
|
||||||
|
|
||||||
|
# Formatter for Git status.
|
||||||
|
#
|
||||||
|
# Example output: master <42 >42 *42 merge ~42 +42 !42 ?42.
|
||||||
|
#
|
||||||
|
# You can edit the function to customize how Git status looks.
|
||||||
|
#
|
||||||
|
# VCS_STATUS_* parameters are set by gitstatus plugin. See reference:
|
||||||
|
# https://github.com/romkatv/gitstatus/blob/master/gitstatus.plugin.zsh.
|
||||||
|
function my_git_formatter() {
|
||||||
|
emulate -L zsh
|
||||||
|
|
||||||
|
if [[ -n $P9K_CONTENT ]]; then
|
||||||
|
# If P9K_CONTENT is not empty, use it. It's either "loading" or from vcs_info (not from
|
||||||
|
# gitstatus plugin). VCS_STATUS_* parameters are not available in this case.
|
||||||
|
typeset -g my_git_format=$P9K_CONTENT
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if (( $1 )); then
|
||||||
|
# Styling for up-to-date Git status.
|
||||||
|
local meta='%f' # default foreground
|
||||||
|
local clean='%2F' # green foreground
|
||||||
|
local modified='%3F' # yellow foreground
|
||||||
|
local untracked='%4F' # blue foreground
|
||||||
|
local conflicted='%1F' # red foreground
|
||||||
|
else
|
||||||
|
# Styling for incomplete and stale Git status.
|
||||||
|
local meta='%5F' # magenta foreground
|
||||||
|
local clean='%5F' # magenta foreground
|
||||||
|
local modified='%5F' # magenta foreground
|
||||||
|
local untracked='%5F' # magenta foreground
|
||||||
|
local conflicted='%5F' # magenta foreground
|
||||||
|
fi
|
||||||
|
|
||||||
|
local res
|
||||||
|
local where # branch name, tag or commit
|
||||||
|
if [[ -n $VCS_STATUS_LOCAL_BRANCH ]]; then
|
||||||
|
res+="${clean}${POWERLEVEL9K_VCS_BRANCH_ICON}"
|
||||||
|
where=${(V)VCS_STATUS_LOCAL_BRANCH}
|
||||||
|
elif [[ -n $VCS_STATUS_TAG ]]; then
|
||||||
|
res+="${meta}#"
|
||||||
|
where=${(V)VCS_STATUS_TAG}
|
||||||
|
else
|
||||||
|
res+="${meta}@"
|
||||||
|
where=${VCS_STATUS_COMMIT[1,8]}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If local branch name or tag is at most 32 characters long, show it in full.
|
||||||
|
# Otherwise show the first 12 … the last 12.
|
||||||
|
(( $#where > 32 )) && where[13,-13]="…"
|
||||||
|
res+="${clean}${where//\%/%%}" # escape %
|
||||||
|
|
||||||
|
# Show tracking branch name if it differs from local branch.
|
||||||
|
if [[ -n ${VCS_STATUS_REMOTE_BRANCH:#$VCS_STATUS_LOCAL_BRANCH} ]]; then
|
||||||
|
res+="${meta}:${clean}${(V)VCS_STATUS_REMOTE_BRANCH//\%/%%}" # escape %
|
||||||
|
fi
|
||||||
|
|
||||||
|
# <42 if behind the remote.
|
||||||
|
(( VCS_STATUS_COMMITS_BEHIND )) && res+=" ${clean}<${VCS_STATUS_COMMITS_BEHIND}"
|
||||||
|
# >42 if ahead of the remote.
|
||||||
|
(( VCS_STATUS_COMMITS_AHEAD )) && res+=" ${clean}⇡${VCS_STATUS_COMMITS_AHEAD}"
|
||||||
|
# *42 if have stashes.
|
||||||
|
(( VCS_STATUS_STASHES )) && res+=" ${clean}*${VCS_STATUS_STASHES}"
|
||||||
|
# 'merge' if the repo is in an unusual state.
|
||||||
|
[[ -n $VCS_STATUS_ACTION ]] && res+=" ${conflicted}${VCS_STATUS_ACTION}"
|
||||||
|
# ~42 if have merge conflicts.
|
||||||
|
(( VCS_STATUS_NUM_CONFLICTED )) && res+=" ${conflicted}~${VCS_STATUS_NUM_CONFLICTED}"
|
||||||
|
# +42 if have staged changes.
|
||||||
|
(( VCS_STATUS_NUM_STAGED )) && res+=" ${modified}+${VCS_STATUS_NUM_STAGED}"
|
||||||
|
# !42 if have unstaged changes.
|
||||||
|
(( VCS_STATUS_NUM_UNSTAGED )) && res+=" ${modified}!${VCS_STATUS_NUM_UNSTAGED}"
|
||||||
|
# ?42 if have untracked files. It's really a question mark, your font isn't broken.
|
||||||
|
# See POWERLEVEL9K_VCS_UNTRACKED_ICON above if you want to use a different icon.
|
||||||
|
# Remove the next line if you don't want to see untracked files at all.
|
||||||
|
(( VCS_STATUS_NUM_UNTRACKED )) && res+=" ${untracked}${POWERLEVEL9K_VCS_UNTRACKED_ICON}${VCS_STATUS_NUM_UNTRACKED}"
|
||||||
|
|
||||||
|
typeset -g my_git_format=$res
|
||||||
|
}
|
||||||
|
functions -M my_git_formatter 2>/dev/null
|
||||||
|
|
||||||
|
# Disable the default Git status formatting.
|
||||||
|
typeset -g POWERLEVEL9K_VCS_DISABLE_GITSTATUS_FORMATTING=true
|
||||||
|
# Install our own Git status formatter.
|
||||||
|
typeset -g POWERLEVEL9K_VCS_CONTENT_EXPANSION='${$((my_git_formatter(1)))+${my_git_format}}'
|
||||||
|
typeset -g POWERLEVEL9K_VCS_LOADING_CONTENT_EXPANSION='${$((my_git_formatter(0)))+${my_git_format}}'
|
||||||
|
# Enable counters for staged, unstaged, etc.
|
||||||
|
typeset -g POWERLEVEL9K_VCS_{STAGED,UNSTAGED,UNTRACKED,CONFLICTED,COMMITS_AHEAD,COMMITS_BEHIND}_MAX_NUM=-1
|
||||||
|
|
||||||
|
# Icon color.
|
||||||
|
typeset -g POWERLEVEL9K_VCS_VISUAL_IDENTIFIER_COLOR=2
|
||||||
|
typeset -g POWERLEVEL9K_VCS_LOADING_VISUAL_IDENTIFIER_COLOR=5
|
||||||
|
# Custom icon.
|
||||||
|
typeset -g POWERLEVEL9K_VCS_VISUAL_IDENTIFIER_EXPANSION=
|
||||||
|
# Custom prefix.
|
||||||
|
# typeset -g POWERLEVEL9K_VCS_PREFIX='%fon '
|
||||||
|
|
||||||
|
# Show status of repositories of these types. You can add svn and/or hg if you are
|
||||||
|
# using them. If you do, your prompt may become slow even when your current directory
|
||||||
|
# isn't in an svn or hg reposotiry.
|
||||||
|
typeset -g POWERLEVEL9K_VCS_BACKENDS=(git)
|
||||||
|
|
||||||
|
# These settings are used for respositories other than Git or when gitstatusd fails and
|
||||||
|
# Powerlevel10k has to fall back to using vcs_info.
|
||||||
|
typeset -g POWERLEVEL9K_VCS_CLEAN_FOREGROUND=2
|
||||||
|
typeset -g POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND=2
|
||||||
|
typeset -g POWERLEVEL9K_VCS_MODIFIED_FOREGROUND=3
|
||||||
|
typeset -g POWERLEVEL9K_VCS_UNSTAGED_ICON='!'
|
||||||
|
typeset -g POWERLEVEL9K_VCS_STAGED_ICON='+'
|
||||||
|
typeset -g POWERLEVEL9K_VCS_STASH_ICON='*'
|
||||||
|
typeset -g POWERLEVEL9K_VCS_INCOMING_CHANGES_ICON='<'
|
||||||
|
typeset -g POWERLEVEL9K_VCS_OUTGOING_CHANGES_ICON='>'
|
||||||
|
typeset -g POWERLEVEL9K_VCS_TAG_ICON='#'
|
||||||
|
typeset -g POWERLEVEL9K_VCS_COMMIT_ICON='@'
|
||||||
|
typeset -g POWERLEVEL9K_VCS_REMOTE_BRANCH_ICON=':'
|
||||||
|
|
||||||
|
##########################[ status: exit code of the last command ]###########################
|
||||||
|
# Enable OK_PIPE, ERROR_PIPE and ERROR_SIGNAL status states to allow us to enable, disable and
|
||||||
|
# style them independently from the regular OK and ERROR state.
|
||||||
|
typeset -g POWERLEVEL9K_STATUS_EXTENDED_STATES=true
|
||||||
|
|
||||||
|
# Status on success. No content, just an icon. No need to show it if prompt_char is enabled as
|
||||||
|
# it will signify success by turning green.
|
||||||
|
typeset -g POWERLEVEL9K_STATUS_OK=false
|
||||||
|
typeset -g POWERLEVEL9K_STATUS_OK_FOREGROUND=2
|
||||||
|
typeset -g POWERLEVEL9K_STATUS_OK_VISUAL_IDENTIFIER_EXPANSION=''
|
||||||
|
|
||||||
|
# Status when some part of a pipe command fails but the overall exit status is zero. It may look
|
||||||
|
# like this: 1|0.
|
||||||
|
typeset -g POWERLEVEL9K_STATUS_OK_PIPE=true
|
||||||
|
typeset -g POWERLEVEL9K_STATUS_OK_PIPE_FOREGROUND=2
|
||||||
|
typeset -g POWERLEVEL9K_STATUS_OK_PIPE_VISUAL_IDENTIFIER_EXPANSION=''
|
||||||
|
|
||||||
|
# Status when it's just an error code (e.g., '1'). No need to show it if prompt_char is enabled as
|
||||||
|
# it will signify error by turning red.
|
||||||
|
typeset -g POWERLEVEL9K_STATUS_ERROR=false
|
||||||
|
typeset -g POWERLEVEL9K_STATUS_ERROR_FOREGROUND=1
|
||||||
|
typeset -g POWERLEVEL9K_STATUS_ERROR_VISUAL_IDENTIFIER_EXPANSION=''
|
||||||
|
|
||||||
|
# Status when the last command was terminated by a signal.
|
||||||
|
typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL=true
|
||||||
|
typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_FOREGROUND=1
|
||||||
|
# Use terse signal names: "INT" instead of "SIGINT(2)".
|
||||||
|
typeset -g POWERLEVEL9K_STATUS_VERBOSE_SIGNAME=false
|
||||||
|
typeset -g POWERLEVEL9K_STATUS_ERROR_SIGNAL_VISUAL_IDENTIFIER_EXPANSION=''
|
||||||
|
|
||||||
|
# Status when some part of a pipe command fails and the overall exit status is also non-zero.
|
||||||
|
# It may look like this: 1|0.
|
||||||
|
typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE=true
|
||||||
|
typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_FOREGROUND=1
|
||||||
|
typeset -g POWERLEVEL9K_STATUS_ERROR_PIPE_VISUAL_IDENTIFIER_EXPANSION=''
|
||||||
|
|
||||||
|
###################[ command_execution_time: duration of the last command ]###################
|
||||||
|
# Show duration of the last command if takes longer than this many seconds.
|
||||||
|
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=3
|
||||||
|
# Show this many fractional digits. Zero means round to seconds.
|
||||||
|
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0
|
||||||
|
# Execution time color.
|
||||||
|
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=3
|
||||||
|
# Duration format: 1d 2h 3m 4s.
|
||||||
|
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT='d h m s'
|
||||||
|
# Custom icon.
|
||||||
|
typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_VISUAL_IDENTIFIER_EXPANSION=
|
||||||
|
# Custom prefix.
|
||||||
|
# typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PREFIX='%ftook '
|
||||||
|
|
||||||
|
#######################[ background_jobs: presence of background jobs ]#######################
|
||||||
|
# Don't show the number of background jobs.
|
||||||
|
typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE=false
|
||||||
|
# Background jobs color.
|
||||||
|
typeset -g POWERLEVEL9K_BACKGROUND_JOBS_FOREGROUND=2
|
||||||
|
# Icon to show when there are background jobs.
|
||||||
|
typeset -g POWERLEVEL9K_BACKGROUND_JOBS_VISUAL_IDENTIFIER_EXPANSION='bg'
|
||||||
|
|
||||||
|
##################################[ context: user@hostname ]##################################
|
||||||
|
# Default context color.
|
||||||
|
typeset -g POWERLEVEL9K_CONTEXT_FOREGROUND=2
|
||||||
|
# Default context format: %n is username, %m is hostname.
|
||||||
|
typeset -g POWERLEVEL9K_CONTEXT_TEMPLATE='%n@%m'
|
||||||
|
|
||||||
|
# Context color when running with privileges.
|
||||||
|
typeset -g POWERLEVEL9K_CONTEXT_ROOT_FOREGROUND=1
|
||||||
|
# Context format when running with privileges: bold user@hostname.
|
||||||
|
typeset -g POWERLEVEL9K_CONTEXT_ROOT_TEMPLATE='%n@%m'
|
||||||
|
|
||||||
|
# Don't show context unless running with privileges or in SSH.
|
||||||
|
# Tip: Remove the next line to always show context.
|
||||||
|
typeset -g POWERLEVEL9K_CONTEXT_{DEFAULT,SUDO}_{CONTENT,VISUAL_IDENTIFIER}_EXPANSION=
|
||||||
|
|
||||||
|
# Custom icon.
|
||||||
|
# typeset -g POWERLEVEL9K_CONTEXT_VISUAL_IDENTIFIER_EXPANSION='⭐'
|
||||||
|
# Custom prefix.
|
||||||
|
# typeset -g POWERLEVEL9K_CONTEXT_PREFIX='%fwith '
|
||||||
|
|
||||||
|
# Transient prompt works similarly to the builtin transient_rprompt option. It trims down prompt
|
||||||
|
# when accepting a command line. Supported values:
|
||||||
|
#
|
||||||
|
# - off: Don't change prompt when accepting a command line.
|
||||||
|
# - always: Trim down prompt when accepting a command line.
|
||||||
|
# - same-dir: Trim down prompt when accepting a command line unless this is the first command
|
||||||
|
# typed after changing current working directory.
|
||||||
|
typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=always
|
||||||
|
|
||||||
|
# Instant prompt mode.
|
||||||
|
#
|
||||||
|
# - off: Disable instant prompt. Choose this if you've tried instant prompt and found
|
||||||
|
# it incompatible with your zsh configuration files.
|
||||||
|
# - quiet: Enable instant prompt and don't print warnings when detecting console output
|
||||||
|
# during zsh initialization. Choose this if you've read and understood
|
||||||
|
# https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt.
|
||||||
|
# - verbose: Enable instant prompt and print a warning when detecting console output during
|
||||||
|
# zsh initialization. Choose this if you've never tried instant prompt, haven't
|
||||||
|
# seen the warning, or if you are unsure what this all means.
|
||||||
|
typeset -g POWERLEVEL9K_INSTANT_PROMPT=verbose
|
||||||
|
|
||||||
|
# Hot reload allows you to change POWERLEVEL9K options after Powerlevel10k has been initialized.
|
||||||
|
# For example, you can type POWERLEVEL9K_BACKGROUND=red and see your prompt turn red. Hot reload
|
||||||
|
# can slow down prompt by 1-2 milliseconds, so it's better to keep it turned off unless you
|
||||||
|
# really need it.
|
||||||
|
typeset -g POWERLEVEL9K_DISABLE_HOT_RELOAD=true
|
||||||
|
}
|
||||||
|
|
||||||
|
(( ${#p10k_config_opts} )) && setopt ${p10k_config_opts[@]}
|
||||||
|
'builtin' 'unset' 'p10k_config_opts'
|
1
zsh/p10k
Submodule
1
zsh/p10k
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 62341054d8aa40ade03fc55bdbc95b9ff2d8d2b6
|
1711
zsh/p10k.zsh
Normal file
1711
zsh/p10k.zsh
Normal file
File diff suppressed because it is too large
Load diff
1
zsh/powerlevel10k
Submodule
1
zsh/powerlevel10k
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 2b7da93df04acd04d84f5de827e5b14077839a4b
|
368
zsh/zshrc
368
zsh/zshrc
|
@ -1,51 +1,65 @@
|
||||||
# Use powerline
|
source ~/.config/zsh/antigen.zsh
|
||||||
USE_POWERLINE="true"
|
|
||||||
# Has weird character width
|
if command -v git >/dev/null && [ ! -d ~/.config/zsh/powerlevel10k ]; then
|
||||||
# Example:
|
echo "info: installing p10k"
|
||||||
# is not a diamond
|
git clone --depth 1 --single-branch https://github.com/romkatv/powerlevel10k.git ~/.config/zsh/powerlevel10k
|
||||||
HAS_WIDECHARS="false"
|
|
||||||
# Source manjaro-zsh-configuration
|
|
||||||
if [[ -e /usr/share/zsh/manjaro-zsh-config ]]; then
|
|
||||||
source /usr/share/zsh/manjaro-zsh-config
|
|
||||||
fi
|
fi
|
||||||
# Use manjaro zsh prompt
|
source ~/.config/zsh/powerlevel10k/powerlevel10k.zsh-theme
|
||||||
if [[ -e /usr/share/zsh/manjaro-zsh-prompt ]]; then
|
|
||||||
source /usr/share/zsh/manjaro-zsh-prompt
|
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
|
||||||
|
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
source ~/.config/zsh/antigen.zsh
|
source ~/.config/zsh/powerlevel10k/powerlevel10k.zsh-theme
|
||||||
|
source ~/.config/zsh/p10k.zsh
|
||||||
|
|
||||||
antigen bundle zsh-users/zsh-syntax-highlighting
|
antigen bundle zsh-users/zsh-syntax-highlighting
|
||||||
antigen bundle zsh-users/zsh-history-substring-search
|
antigen bundle zsh-users/zsh-history-substring-search
|
||||||
antigen bundle zsh-users/zsh-autosuggestions
|
antigen bundle zsh-users/zsh-autosuggestions
|
||||||
antigen bundle zsh-users/zsh-completions
|
antigen bundle zsh-users/zsh-completions
|
||||||
|
antigen bundle ael-code/zsh-colored-man-pages
|
||||||
|
|
||||||
antigen apply
|
antigen apply
|
||||||
|
|
||||||
# Exports
|
# Exports
|
||||||
|
|
||||||
export PATH=$HOME/.local/bin:/usr/local/bin:$HOME/go/bin:$PATH
|
#export GOPROXY=https://proxy.neonxp.ru
|
||||||
# export GOROOT=$HOME/work/go
|
export GOPRIVATE=devopar.hippoparking.ru
|
||||||
export GOPATH=$HOME/go
|
export EDITOR="nvim"
|
||||||
export GOPROXY=https://proxy.neonxp.ru
|
|
||||||
export EDITOR="micro"
|
|
||||||
#export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/docker.sock
|
#export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/docker.sock
|
||||||
|
export ANDROID_HOME=$HOME/projects/android/
|
||||||
|
export PATH=$PATH:$ANDROID_HOME/emulator
|
||||||
|
export PATH=$PATH:$ANDROID_HOME/platform-tools
|
||||||
|
export PATH=$PATH:~/.local/bin:~/go/bin
|
||||||
|
export GOBIN=~/go/bin
|
||||||
|
export GPG_TTY=$(tty)
|
||||||
|
export LS_OPTIONS='--color=auto'
|
||||||
|
eval "$(dircolors -b)"
|
||||||
|
|
||||||
|
fpath+="~/.config/zsh/comp"
|
||||||
|
|
||||||
|
|
||||||
# Aliases
|
# Aliases
|
||||||
alias ls="ls -F"
|
alias ls='ls $LS_OPTIONS -F'
|
||||||
alias l="ls"
|
alias l='ls $LS_OPTIONS -F'
|
||||||
|
alias j="sudo journalctl"
|
||||||
|
alias s='sudo'
|
||||||
|
alias sctl="sudo systemctl"
|
||||||
alias ll="ls -AFhl"
|
alias ll="ls -AFhl"
|
||||||
alias cp="cp -i" # Confirm before overwriting something
|
alias cp="cp -i" # Confirm before overwriting something
|
||||||
alias gitpush='git add . && git commit --amend --no-edit && git push -f'
|
alias gitpush="git add . && git commit --amend --no-edit && git push -f"
|
||||||
alias k='kubectl'
|
alias k="kubectl"
|
||||||
alias yu="ssh-add -e /usr/lib/x86_64-linux-gnu/libykcs11.so; ssh-add -s /usr/lib/x86_64-linux-gnu/libykcs11.so"
|
alias yu="ssh-add -e /usr/lib/x86_64-linux-gnu/libykcs11.so; ssh-add -s /usr/lib/x86_64-linux-gnu/libykcs11.so"
|
||||||
alias m='micro'
|
alias m="micro"
|
||||||
|
alias n="nvim"
|
||||||
alias cp="cp -i" # confirm before overwriting something
|
alias cp="cp -i" # confirm before overwriting something
|
||||||
alias df='df -h' # human-readable sizes
|
alias df="df -h" # human-readable sizes
|
||||||
alias free='free -m' # show sizes in MB
|
alias free="free -m" # show sizes in MB
|
||||||
alias np='nano -w PKGBUILD'
|
alias np="nano -w PKGBUILD"
|
||||||
alias more=less
|
alias gitu='git add . && git commit && git push'
|
||||||
|
alias g=git
|
||||||
|
alias nsh='wl-paste | curl -d @- https://nixshare.ru/upload 2>/dev/null | wl-copy'
|
||||||
|
alias p=python3
|
||||||
|
|
||||||
[[ ! -f `which exa` ]] || alias ls="exa" && alias ll="exa -l"
|
[[ ! -f `which exa` ]] || alias ls="exa" && alias ll="exa -l"
|
||||||
|
|
||||||
|
@ -61,56 +75,55 @@ setopt correct # Auto correct m
|
||||||
setopt extendedglob # Extended globbing. Allows using regular expressions with *
|
setopt extendedglob # Extended globbing. Allows using regular expressions with *
|
||||||
setopt nocaseglob # Case insensitive globbing
|
setopt nocaseglob # Case insensitive globbing
|
||||||
setopt rcexpandparam # Array expension with parameters
|
setopt rcexpandparam # Array expension with parameters
|
||||||
setopt nocheckjobs # Don't warn about running processes when exiting
|
setopt nocheckjobs # Don"t warn about running processes when exiting
|
||||||
setopt numericglobsort # Sort filenames numerically when it makes sense
|
setopt numericglobsort # Sort filenames numerically when it makes sense
|
||||||
setopt nobeep # No beep
|
setopt nobeep # No beep
|
||||||
setopt appendhistory # Immediately append history instead of overwriting
|
setopt appendhistory # Immediately append history instead of overwriting
|
||||||
setopt histignorealldups # If a new command is a duplicate, remove the older one
|
setopt histignorealldups # If a new command is a duplicate, remove the older one
|
||||||
setopt autocd # if only directory path is entered, cd there.
|
setopt autocd # if only directory path is entered, cd there.
|
||||||
setopt inc_append_history # save commands are added to the history immediately, otherwise only when shell exits.
|
setopt inc_append_history # save commands are added to the history immediately, otherwise only when shell exits.
|
||||||
setopt histignorespace # Don't save commands that start with space
|
setopt histignorespace # Don"t save commands that start with space
|
||||||
|
|
||||||
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' # Case insensitive tab completion
|
zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' # Case insensitive tab completion
|
||||||
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" # Colored completion (different colors for dirs/files/etc)
|
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" # Colored completion (different colors for dirs/files/etc)
|
||||||
zstyle ':completion:*' rehash true # automatically find new executables in path
|
zstyle ':completion:*' rehash true # automatically find new executables in path
|
||||||
|
zstyle ':completion:*' menu select # Highlight menu selection
|
||||||
# Speed up completions
|
# Speed up completions
|
||||||
zstyle ':completion:*' accept-exact '*(N)'
|
zstyle ':completion:*' accept-exact '*(N)'
|
||||||
zstyle ':completion:*' use-cache on
|
zstyle ':completion:*' use-cache on
|
||||||
zstyle ':completion:*' cache-path ~/.zsh/cache
|
zstyle ':completion:*' cache-path ~/.zsh/cache
|
||||||
|
|
||||||
zstyle ':completion:*:processes' command 'ps -ax'
|
zstyle ":completion:*:processes" command "ps -ax"
|
||||||
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;32'
|
zstyle ":completion:*:*:kill:*:processes" list-colors "=(#b) #([0-9]#)*=0=01;32"
|
||||||
zstyle ':completion:*:*:kill:*' menu yes select
|
zstyle ":completion:*:*:kill:*" menu yes select
|
||||||
zstyle ':completion:*:kill:*' force-list always
|
zstyle ":completion:*:kill:*" force-list always
|
||||||
|
|
||||||
zstyle ':completion:*:processes-names' command 'ps -e -o comm='
|
zstyle ":completion:*:processes-names" command "ps -e -o comm="
|
||||||
zstyle ':completion:*:*:killall:*' menu yes select
|
zstyle ":completion:*:*:killall:*" menu yes select
|
||||||
zstyle ':completion:*:killall:*' force-list always
|
zstyle ":completion:*:killall:*" force-list always
|
||||||
|
|
||||||
HISTFILE=~/.zsh_history
|
HISTFILE=~/.zsh_history
|
||||||
HISTSIZE=100000
|
HISTSIZE=100000
|
||||||
SAVEHIST=100000
|
SAVEHIST=100000
|
||||||
#export EDITOR=/usr/bin/nano
|
WORDCHARS=${WORDCHARS//\/[&.;]}
|
||||||
#export VISUAL=/usr/bin/nano
|
|
||||||
WORDCHARS=${WORDCHARS//\/[&.;]} # Don't consider certain characters part of the word
|
|
||||||
|
|
||||||
autoload -U compinit colors zcalc
|
autoload -U compinit colors zcalc
|
||||||
compinit -d
|
compinit -d
|
||||||
|
|
||||||
|
|
||||||
|
autoload -U add-zsh-hook
|
||||||
|
add-zsh-hook precmd mzc_termsupport_precmd
|
||||||
|
add-zsh-hook preexec mzc_termsupport_preexec
|
||||||
|
# Use a precmd hook instead of a chpwd hook to avoid contaminating output
|
||||||
|
# i.e. when a script or function changes directory without `cd -q`, chpwd
|
||||||
|
# will be called the output may be swallowed by the script or function.
|
||||||
|
add-zsh-hook precmd mzc_termsupport_cwd
|
||||||
|
|
||||||
source ~/.config/zsh/conf.d/*.zsh
|
source ~/.config/zsh/conf.d/*.zsh
|
||||||
|
|
||||||
colors
|
colors
|
||||||
|
|
||||||
# Color man pages
|
|
||||||
export LESS_TERMCAP_mb=$'\E[01;32m'
|
|
||||||
export LESS_TERMCAP_md=$'\E[01;32m'
|
|
||||||
export LESS_TERMCAP_me=$'\E[0m'
|
|
||||||
export LESS_TERMCAP_se=$'\E[0m'
|
|
||||||
export LESS_TERMCAP_so=$'\E[01;47;34m'
|
|
||||||
export LESS_TERMCAP_ue=$'\E[0m'
|
|
||||||
export LESS_TERMCAP_us=$'\E[01;36m'
|
|
||||||
export LESS=-R
|
|
||||||
|
|
||||||
|
|
||||||
## Plugins section: Enable fish style features
|
## Plugins section: Enable fish style features
|
||||||
# Use syntax highlighting
|
# Use syntax highlighting
|
||||||
|
@ -121,34 +134,249 @@ export LESS=-R
|
||||||
zmodload zsh/terminfo
|
zmodload zsh/terminfo
|
||||||
bindkey "$terminfo[kcuu1]" history-substring-search-up
|
bindkey "$terminfo[kcuu1]" history-substring-search-up
|
||||||
bindkey "$terminfo[kcud1]" history-substring-search-down
|
bindkey "$terminfo[kcud1]" history-substring-search-down
|
||||||
bindkey '^[[A' history-substring-search-up
|
bindkey "^[[A" history-substring-search-up
|
||||||
bindkey '^[[B' history-substring-search-down
|
bindkey "^[[B" history-substring-search-down
|
||||||
|
|
||||||
bindkey -e
|
bindkey -e
|
||||||
bindkey '^[[7~' beginning-of-line # Home key
|
bindkey "^[[7~" beginning-of-line # Home key
|
||||||
bindkey '^[[H' beginning-of-line # Home key
|
bindkey "^[[H" beginning-of-line # Home key
|
||||||
if [[ "${terminfo[khome]}" != "" ]]; then
|
if [[ "${terminfo[khome]}" != "" ]]; then
|
||||||
bindkey "${terminfo[khome]}" beginning-of-line # [Home] - Go to beginning of line
|
bindkey "${terminfo[khome]}" beginning-of-line # [Home] - Go to beginning of line
|
||||||
fi
|
fi
|
||||||
bindkey '^[[8~' end-of-line # End key
|
bindkey "^[[8~" end-of-line # End key
|
||||||
bindkey '^[[F' end-of-line # End key
|
bindkey "^[[F" end-of-line # End key
|
||||||
if [[ "${terminfo[kend]}" != "" ]]; then
|
if [[ "${terminfo[kend]}" != "" ]]; then
|
||||||
bindkey "${terminfo[kend]}" end-of-line # [End] - Go to end of line
|
bindkey "${terminfo[kend]}" end-of-line # [End] - Go to end of line
|
||||||
fi
|
fi
|
||||||
bindkey '^[[2~' overwrite-mode # Insert key
|
bindkey "^[[2~" overwrite-mode # Insert key
|
||||||
bindkey '^[[3~' delete-char # Delete key
|
bindkey "^[[3~" delete-char # Delete key
|
||||||
bindkey '^[[C' forward-char # Right key
|
bindkey "^[[C" forward-char # Right key
|
||||||
bindkey '^[[D' backward-char # Left key
|
bindkey "^[[D" backward-char # Left key
|
||||||
bindkey '^[[5~' history-beginning-search-backward # Page up key
|
bindkey "^[[5~" history-beginning-search-backward # Page up key
|
||||||
bindkey '^[[6~' history-beginning-search-forward # Page down key
|
bindkey "^[[6~" history-beginning-search-forward # Page down key
|
||||||
|
|
||||||
# Navigate words with ctrl+arrow keys
|
# Navigate words with ctrl+arrow keys
|
||||||
bindkey '^[Oc' forward-word #
|
bindkey "^[Oc" forward-word #
|
||||||
bindkey '^[Od' backward-word #
|
bindkey "^[Od" backward-word #
|
||||||
bindkey '^[[1;5D' backward-word #
|
bindkey "^[[1;5D" backward-word #
|
||||||
bindkey '^[[1;5C' forward-word #
|
bindkey "^[[1;5C" forward-word #
|
||||||
bindkey '^H' backward-kill-word # delete previous word with ctrl+backspace
|
bindkey "^H" backward-kill-word # delete previous word with ctrl+backspace
|
||||||
bindkey '^[[Z' undo # Shift+tab undo last action
|
bindkey "^[[Z" undo # Shift+tab undo last action
|
||||||
|
|
||||||
# ctrl + space accept suggestion
|
# ctrl + space accept suggestion
|
||||||
bindkey '^ ' autosuggest-accept
|
bindkey "^ " autosuggest-accept
|
||||||
|
|
||||||
|
dotenv() {
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
[ -f .env.gpg ] && set -- .env.gpg "$@"
|
||||||
|
[ -f .env ] && set -- .env "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
set -a
|
||||||
|
while [ $# -gt 0 ]; do
|
||||||
|
echo "dotenv: Loading $1"
|
||||||
|
case "$1" in
|
||||||
|
*.gpg)
|
||||||
|
eval "$(gpg --quiet --decrypt --yes "$1")"
|
||||||
|
;;
|
||||||
|
*/*)
|
||||||
|
. "$1"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
. "./$1"
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
set +a
|
||||||
|
}
|
||||||
|
|
||||||
|
# Set terminal window and tab/icon title
|
||||||
|
#
|
||||||
|
# usage: title short_tab_title [long_window_title]
|
||||||
|
#
|
||||||
|
# See: http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1
|
||||||
|
# Fully supports screen and probably most modern xterm and rxvt
|
||||||
|
# (In screen, only short_tab_title is used)
|
||||||
|
function title {
|
||||||
|
emulate -L zsh
|
||||||
|
setopt prompt_subst
|
||||||
|
|
||||||
|
[[ "$EMACS" == *term* ]] && return
|
||||||
|
|
||||||
|
# if $2 is unset use $1 as default
|
||||||
|
# if it is set and empty, leave it as is
|
||||||
|
: ${2=$1}
|
||||||
|
|
||||||
|
case "$TERM" in
|
||||||
|
xterm*|putty*|rxvt*|konsole*|ansi|mlterm*|alacritty|kitty|wezterm|st*)
|
||||||
|
print -Pn "\e]2;${2:q}\a" # set window name
|
||||||
|
print -Pn "\e]1;${1:q}\a" # set tab name
|
||||||
|
;;
|
||||||
|
screen*|tmux*)
|
||||||
|
print -Pn "\ek${1:q}\e\\" # set screen hardstatus
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# Try to use terminfo to set the title
|
||||||
|
# If the feature is available set title
|
||||||
|
if [[ -n "$terminfo[fsl]" ]] && [[ -n "$terminfo[tsl]" ]]; then
|
||||||
|
echoti tsl
|
||||||
|
print -Pn "$1"
|
||||||
|
echoti fsl
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" #15 char left truncated PWD
|
||||||
|
ZSH_THEME_TERM_TITLE_IDLE="%n@%m:%~"
|
||||||
|
|
||||||
|
# Runs before showing the prompt
|
||||||
|
function mzc_termsupport_precmd {
|
||||||
|
[[ "${DISABLE_AUTO_TITLE:-}" == true ]] && return
|
||||||
|
title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE
|
||||||
|
}
|
||||||
|
|
||||||
|
# Runs before executing the command
|
||||||
|
function mzc_termsupport_preexec {
|
||||||
|
[[ "${DISABLE_AUTO_TITLE:-}" == true ]] && return
|
||||||
|
|
||||||
|
emulate -L zsh
|
||||||
|
|
||||||
|
# split command into array of arguments
|
||||||
|
local -a cmdargs
|
||||||
|
cmdargs=("${(z)2}")
|
||||||
|
# if running fg, extract the command from the job description
|
||||||
|
if [[ "${cmdargs[1]}" = fg ]]; then
|
||||||
|
# get the job id from the first argument passed to the fg command
|
||||||
|
local job_id jobspec="${cmdargs[2]#%}"
|
||||||
|
# logic based on jobs arguments:
|
||||||
|
# http://zsh.sourceforge.net/Doc/Release/Jobs-_0026-Signals.html#Jobs
|
||||||
|
# https://www.zsh.org/mla/users/2007/msg00704.html
|
||||||
|
case "$jobspec" in
|
||||||
|
<->) # %number argument:
|
||||||
|
# use the same <number> passed as an argument
|
||||||
|
job_id=${jobspec} ;;
|
||||||
|
""|%|+) # empty, %% or %+ argument:
|
||||||
|
# use the current job, which appears with a + in $jobstates:
|
||||||
|
# suspended:+:5071=suspended (tty output)
|
||||||
|
job_id=${(k)jobstates[(r)*:+:*]} ;;
|
||||||
|
-) # %- argument:
|
||||||
|
# use the previous job, which appears with a - in $jobstates:
|
||||||
|
# suspended:-:6493=suspended (signal)
|
||||||
|
job_id=${(k)jobstates[(r)*:-:*]} ;;
|
||||||
|
[?]*) # %?string argument:
|
||||||
|
# use $jobtexts to match for a job whose command *contains* <string>
|
||||||
|
job_id=${(k)jobtexts[(r)*${(Q)jobspec}*]} ;;
|
||||||
|
*) # %string argument:
|
||||||
|
# use $jobtexts to match for a job whose command *starts with* <string>
|
||||||
|
job_id=${(k)jobtexts[(r)${(Q)jobspec}*]} ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# override preexec function arguments with job command
|
||||||
|
if [[ -n "${jobtexts[$job_id]}" ]]; then
|
||||||
|
1="${jobtexts[$job_id]}"
|
||||||
|
2="${jobtexts[$job_id]}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# cmd name only, or if this is sudo or ssh, the next cmd
|
||||||
|
local CMD=${1[(wr)^(*=*|sudo|ssh|mosh|rake|-*)]:gs/%/%%}
|
||||||
|
local LINE="${2:gs/%/%%}"
|
||||||
|
|
||||||
|
title '$CMD' '%100>...>$LINE%<<'
|
||||||
|
}
|
||||||
|
|
||||||
|
# URL-encode a string
|
||||||
|
#
|
||||||
|
# Encodes a string using RFC 2396 URL-encoding (%-escaped).
|
||||||
|
# See: https://www.ietf.org/rfc/rfc2396.txt
|
||||||
|
#
|
||||||
|
# By default, reserved characters and unreserved "mark" characters are
|
||||||
|
# not escaped by this function. This allows the common usage of passing
|
||||||
|
# an entire URL in, and encoding just special characters in it, with
|
||||||
|
# the expectation that reserved and mark characters are used appropriately.
|
||||||
|
# The -r and -m options turn on escaping of the reserved and mark characters,
|
||||||
|
# respectively, which allows arbitrary strings to be fully escaped for
|
||||||
|
# embedding inside URLs, where reserved characters might be misinterpreted.
|
||||||
|
#
|
||||||
|
# Prints the encoded string on stdout.
|
||||||
|
# Returns nonzero if encoding failed.
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
# zsh_urlencode [-r] [-m] [-P] <string> [<string> ...]
|
||||||
|
#
|
||||||
|
# -r causes reserved characters (;/?:@&=+$,) to be escaped
|
||||||
|
#
|
||||||
|
# -m causes "mark" characters (_.!~*''()-) to be escaped
|
||||||
|
#
|
||||||
|
# -P causes spaces to be encoded as '%20' instead of '+'
|
||||||
|
function zsh_urlencode() {
|
||||||
|
emulate -L zsh
|
||||||
|
local -a opts
|
||||||
|
zparseopts -D -E -a opts r m P
|
||||||
|
|
||||||
|
local in_str="$@"
|
||||||
|
local url_str=""
|
||||||
|
local spaces_as_plus
|
||||||
|
if [[ -z $opts[(r)-P] ]]; then spaces_as_plus=1; fi
|
||||||
|
local str="$in_str"
|
||||||
|
|
||||||
|
# URLs must use UTF-8 encoding; convert str to UTF-8 if required
|
||||||
|
local encoding=$langinfo[CODESET]
|
||||||
|
|
||||||
|
|
||||||
|
# Use LC_CTYPE=C to process text byte-by-byte
|
||||||
|
local i byte ord LC_ALL=C
|
||||||
|
export LC_ALL
|
||||||
|
local reserved=';/?:@&=+$,'
|
||||||
|
local mark='_.!~*''()-'
|
||||||
|
local dont_escape="[A-Za-z0-9"
|
||||||
|
if [[ -z $opts[(r)-r] ]]; then
|
||||||
|
dont_escape+=$reserved
|
||||||
|
fi
|
||||||
|
# $mark must be last because of the "-"
|
||||||
|
if [[ -z $opts[(r)-m] ]]; then
|
||||||
|
dont_escape+=$mark
|
||||||
|
fi
|
||||||
|
dont_escape+="]"
|
||||||
|
|
||||||
|
# Implemented to use a single printf call and avoid subshells in the loop,
|
||||||
|
# for performance
|
||||||
|
local url_str=""
|
||||||
|
for (( i = 1; i <= ${#str}; ++i )); do
|
||||||
|
byte="$str[i]"
|
||||||
|
if [[ "$byte" =~ "$dont_escape" ]]; then
|
||||||
|
url_str+="$byte"
|
||||||
|
else
|
||||||
|
if [[ "$byte" == " " && -n $spaces_as_plus ]]; then
|
||||||
|
url_str+="+"
|
||||||
|
else
|
||||||
|
ord=$(( [##16] #byte ))
|
||||||
|
url_str+="%$ord"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo -E "$url_str"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Emits the control sequence to notify many terminal emulators
|
||||||
|
# of the cwd
|
||||||
|
#
|
||||||
|
# Identifies the directory using a file: URI scheme, including
|
||||||
|
# the host name to disambiguate local vs. remote paths.
|
||||||
|
function mzc_termsupport_cwd {
|
||||||
|
# Percent-encode the host and path names.
|
||||||
|
local URL_HOST URL_PATH
|
||||||
|
URL_HOST="$(zsh_urlencode -P $HOST)" || return 1
|
||||||
|
URL_PATH="$(zsh_urlencode -P $PWD)" || return 1
|
||||||
|
|
||||||
|
# common control sequence (OSC 7) to set current host and path
|
||||||
|
printf "\e]7;%s\a" "file://${URL_HOST}${URL_PATH}"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -f env.sh ]; then
|
||||||
|
source ./env.sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
[[ ! -f ~/.zshrc.local ]] || source ~/.zshrc.local
|
||||||
|
[[ ! -f ~/.config/zsh/p10k.zsh ]] || source ~/.config/zsh/p10k.zsh
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue