Merge branch 'main' into ref-install-script

This commit is contained in:
TheK4n 2023-02-28 18:03:51 +03:00
commit 70513a44c9
54 changed files with 1157 additions and 202 deletions

7
.gitignore vendored
View File

@ -3,5 +3,10 @@ sub/zsh/plugins
sub/bash/bashrc.d/*
!sub/bash/bashrc.d/00_test.sh
sub/zsh/zshrc.d/*
!sub/zsh/shrc.d/00_test.sh
!sub/zsh/zshrc.d/00_test.sh
sub/vim/tmp/
sub/nvim/plugin
sub/nvim/tmp/
*.zwc

View File

@ -28,6 +28,8 @@ Config files for:
* git
* ranger
* i3
* vim
* neovim
### Prompt
@ -74,14 +76,12 @@ echo "Hello $USER!"
| <kbd>,l</kbd> | Line number styles |
| <kbd>,c</kbd> | Highlight cursor line |
| <kbd>,/</kbd> | Toggle search highlight |
| <kbd>,``</kbd> | Close all without saving |
| <kbd>,qq</kbd> | Delete current buffer |
| <kbd>,qa</kbd> | Close all without saving |
| <kbd>,t</kbd> | Tagbar |
| <kbd>,rr</kbd> | Run script in new tab (python, go, preview markdown)|
| <kbd>,rm</kbd> | Run script (make run) |
| <kbd>,rf</kbd> | Format file (go) |
| <kbd>,nn</kbd> | Toggle NerdTree |
| <kbd>,nf</kbd> | Toggle NerdTree focus |
| <kbd>,ve</kbd> | Open ~/.vimrc or ~/.config/nvim/init.vim in new tab |
| <kbd>,rs</kbd> | Run script in new tab by shebang |
| <kbd>,rf</kbd> | Format file (go, rust) |
<a id="chapter-1"></a>

5
etc/sudoers Normal file
View File

@ -0,0 +1,5 @@
%wheel ALL=(ALL:ALL) ALL
@includedir /etc/sudoers.d
Defaults passwd_timeout=0

View File

@ -0,0 +1 @@
%custompower ALL= NOPASSWD: /sbin/reboot,/sbin/shutdown now,/sbin/systemctl suspend

1
etc/sudoers.d/wireguard Normal file
View File

@ -0,0 +1 @@
%wireguard ALL= NOPASSWD: /sbin/systemctl start wg-quick@wg0.service,/sbin/systemctl stop wg-quick@wg0.service

View File

@ -1,4 +1,16 @@
#!/bin/sh
bssid="$(bluetoothctl devices | dmenu -p "Devices: " -l 20 | cut -d' ' -f2)"
bluetoothctl connect "$bssid"
exit_counter=0
until bluetoothctl connect "$bssid"
do
((exit_counter+=1))
if [ "$exit_counter" -gt 3 ]; then
break
else
echo ...
sleep 1
fi
done

56
functions/i3status_wrapper Executable file
View File

@ -0,0 +1,56 @@
#!/usr/bin/env bash
# The idea is to define "holder" modules in i3status config and then replace them
# In order to make this example work you need to add
# order += "tztime holder__headphones"
# and
# tztime holder__headphones {
# format = "holder__headphones"
# }
# in i3staus config
# Don't forget that i3status config should contain:
# general {
# output_format = i3bar
# }
#
# and i3 config should contain:
# bar {
# status_command exec /path/to/this/script.sh
# }
# Make sure jq is installed
# You can easily add multiple custom modules using additional "holders"
function update_holder {
local instance="$1"
local replacement="$2"
echo "$json_array" | jq --argjson arg_j "$replacement" "(.[] | (select(.instance==\"$instance\"))) |= \$arg_j"
}
function remove_holder {
local instance="$1"
echo "$json_array" | jq "del(.[] | (select(.instance==\"$instance\")))"
}
function headphones {
battery_status="$(bluetoothctl info 14:0A:29:0A:6A:2F | grep "Battery Percentage" | awk -F '[()]' '{ print "🎧🔋"$2"%" }')"
local json="{ \"full_text\": \"$battery_status\", \"color\": \"#FFFFFF\"}"
json_array=$(update_holder holder__headphones "$json")
}
i3status | (read line; echo "$line"; read line ; echo "$line" ; read line ; echo "$line" ; while true
do
read line
json_array="$(echo $line | sed -e 's/^,//')"
headphones
echo ",$json_array"
done)

2
functions/vim_askpass_helper Executable file
View File

@ -0,0 +1,2 @@
#!/usr/bin/env bash
echo -e "SETTITLE vim\nOPTION default-prompt=[sudo] password for $USER:\nGETPIN" | pinentry-qt --display :0 2>/dev/null | grep ^D | cut -d" " -f2-

View File

@ -0,0 +1,44 @@
#!/usr/bin/env python3
import os
import tkinter as tk
from tkinter import Entry, Label
class App:
def __init__(self):
self.root = tk.Tk()
self.root.title("vim")
self.root.attributes('-type', 'dialog')
self.create_label()
self.create_widget_get_password()
self.create_button_ok()
def mainloop(self):
self.root.mainloop()
def __event_get(self, _):
print(self.widget.get())
self.root.quit()
def create_label(self):
label_text = f"[sudo] password for {os.getlogin()}:"
user_password = Label(self.root, text = label_text)
user_password.grid(row = 1, column = 1)
def create_widget_get_password(self):
self.widget = Entry(self.root, show="*", width=15)
self.widget.grid(row = 1, column = 2)
self.widget.focus_set()
def create_button_ok(self):
btn = tk.Button(self.root, text="OK")
btn.bind("<Button-1>", self.__event_get)
self.root.bind("<Return>", self.__event_get)
btn.grid(row = 1, column = 3)
if __name__ == "__main__":
app = App()
app.mainloop()

0
functions/wifi Normal file → Executable file
View File

View File

@ -82,9 +82,6 @@ alias ve='python3 -m virtualenv venv && . venv/bin/activate'
alias vd='deactivate'
# docker
alias drma='docker rm $(docker ps -a -q -f status=exited)'
# python
alias pipir='python3 -m pip install -r requirements.txt'

View File

@ -25,6 +25,10 @@ set smartcase
set hlsearch
set incsearch
let &t_SI.="\e[5 q" "SI = режим вставки
let &t_SR.="\e[3 q" "SR = режим замены
let &t_EI.="\e[1 q" "EI = нормальный режим
set mousehide
set mouse=a

View File

@ -1 +0,0 @@
[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx >> ~/.xlogs 2>&1

4
light/zprofile Normal file
View File

@ -0,0 +1,4 @@
if systemctl -q is-active graphical.target && [[ $(tty) = "/dev/tty1" ]] && [[ -z $DISPLAY && $XDG_VTNR -eq 1 ]]; then
exec startx >> ~/.xlogs 2>&1
fi

View File

@ -1,7 +1,5 @@
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
. "$HOME/.bashrc"
fi
fi

View File

@ -1,7 +1,7 @@
# colors
if [ -x "$(which dircolors)" ]; then
if [ -x "$(command -v dircolors)" ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias grep='grep --color=auto'
@ -76,10 +76,13 @@ alias shutdown='sudo /sbin/shutdown now'
alias meminfo='free -mlth'
alias psmem='ps auxf | sort -nr -k 4 | less -R'
alias wake='((speaker-test -t sine -f 400 &>/dev/null)& local pid=$! ;sleep 0.2s; kill -9 $pid) &>/dev/null'
alias music='mplayer -shuffle ~/Music/*.mp3'
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
alias wake='((speaker-test -t sine -f 400 &>/dev/null)& local pid=$! ;sleep 0.2s; kill -9 $pid) &>/dev/null'
elif [[ "$OSTYPE" == "linux-android"* ]]; then
alias wake='termux-notification --sound --vibrate 500,1000,200'
fi
# python
alias pipir='python3 -m pip install -r requirements.txt'
@ -105,16 +108,16 @@ alias drmi='docker image prune'
# clipboard
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
if [[ -n "$DISPLAY" ]]; then
alias ctc='xclip -selection clipboard -i'
alias ctv='xclip -selection clipboard -o'
alias copy='xclip -selection clipboard -i'
alias paste='xclip -selection clipboard -o'
else
alias ctc='read -rd "EOF" TTYCLIPBOARD'
alias ctv='echo "$TTYCLIPBOARD"'
alias copy='read -rd "EOF" TTYCLIPBOARD'
alias paste='echo "$TTYCLIPBOARD"'
fi
elif [[ "$OSTYPE" == "linux-android"* ]]; then
alias ctc='termux-clipboard-set'
alias ctv='termux-clipboard-get'
alias copy='termux-clipboard-set'
alias paste='termux-clipboard-get'
elif [[ "$OSTYPE" == "darwin" ]]; then
alias ctc='pbcopy'
alias ctv='pbpaste'
alias copy='pbcopy'
alias paste='pbpaste'
fi

View File

@ -2,6 +2,7 @@
umask 0077
export EDITOR="nvim"
export VISUAL="nvim"
export PAGER="less -R"
export HISTSIZE=10000
@ -11,25 +12,19 @@ export HISTIGNORE="&:l[lsa\.]:[bf]g:exit:q:clear:c:history:h"
test -z "$BROWSER" && export BROWSER=firefox
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
export PATH="$PATH:$HOME/bin"
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
export PATH="$PATH:$HOME/.local/bin"
export PATH="$HOME/.local/bin:$PATH"
fi
if [ -d "$HOME/.npm-global/bin" ] ; then
export PATH="$PATH:$HOME/.npm-global/bin"
export PATH="$HOME/.npm-global/bin:$PATH"
fi
if [ -d "$HOME/.go" ] ; then
export GOPATH="$HOME/.go"
fi
if [ -d "$HOME/.go/bin" ] ; then
export PATH="$PATH:$HOME/.go/bin"
export PATH="$HOME/.go/bin:$PATH"
fi

View File

@ -152,7 +152,7 @@ docker_ips() {
py() {
if [ -z "$@" -a -n "$(which ipython)" ]; then
if [[ -z "$@" && -x "$(command -v ipython 2>/dev/null)" ]]; then
ipython -i -c "q = exit"
else
python3 $@
@ -258,3 +258,17 @@ rmt() {
done
}
# shows text from ~/.tips/*
showtips() {
TIPS_DIR="$HOME/.tips"
if [ ! -d "$TIPS_DIR" ]; then
mkdir "$TIPS_DIR" 2>/dev/null
git init "$TIPS_DIR"
fi
cat "$TIPS_DIR"/* 2>/dev/null
return 0
}

View File

@ -1,7 +1,7 @@
parse_git_branch() {
if ! [ -x "$(which git)" ]; then
if ! [ -x "$(command -v git)" ]; then
return
fi

View File

@ -10,6 +10,9 @@
[push]
default = current
[pull]
rebase = false
[color]
status = auto
diff = auto
@ -23,7 +26,6 @@
d = "!git diff --color=always | less -R"
co = checkout
ci = commit
ca = commit -a
ps = "!git push origin $(git rev-parse --abbrev-ref HEAD)"
pl = "!git pull origin $(git rev-parse --abbrev-ref HEAD)"
st = status
@ -31,8 +33,9 @@
ba = branch -a
bm = branch --merged
bn = branch --no-merged
hist = log --pretty=format:\"%Cgreen%h %Creset%cd %Cblue[%cn] %Creset%s%C(yellow)%d%C(reset)\" --graph --date=relative --decorate --all --color=always
df = "!git hist | peco | awk '{print $2}' | xargs -I {} git diff {}^ {}"
hist = log --pretty=format:\"%Cgreen%h %Creset%cd %Cblue[%cn] %Creset%s%C(yellow)%d%C(reset)\" --graph --date=relative --decorate --all
hs = "!git hist | head"
llog = log --graph --name-status --pretty=format:\"%C(red)%h %C(reset)(%cd) %C(green)%an %Creset%s %C(yellow)%d%Creset\" --date=relative
open = "!hub browse"
type = cat-file -t
@ -40,11 +43,10 @@
find = "!f() { git log --pretty=format:\"%h %cd [%cn] %s%d\" --date=relative -S'pretty' -S\"$@\" | peco | awk '{print $1}' | xargs -I {} git diff {}^ {}; }; f"
unstage = 'reset HEAD --'
last = log -1 HEAD
branches = branch -avv --list
# edit conflicted file on merge
edit-unmerged = "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; vim `f`"
edit-unmerged = "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; $EDITOR `f`"
# add conflicted file on merge
add-unmerged = "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; git add `f`"
@ -56,3 +58,4 @@
[user]
name = "TheK4n"
email = "djvlad967891@gmail.com"
signingkey = "thek4n"

View File

@ -98,11 +98,6 @@ bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
# split in horizontal orientation
# bindsym $mod+h split h
# split in vertical orientation
bindsym $mod+v split v
# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle
@ -120,9 +115,13 @@ bindsym $mod+slash focus mode_toggle
# focus the parent container
bindsym $mod+a focus parent
# focus the child container
#bindsym $mod+d focus child
bindsym $mod+z focus child
# split in horizontal orientation
bindsym $mod+b split h
# split in vertical orientation
bindsym $mod+v split v
# Define names for default workspaces for which we configure key bindings later on.
# We use variables to avoid repeating the names in multiple places.
@ -198,7 +197,7 @@ bindsym $mod+r mode "resize"
# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
bar {
status_command i3status
status_command exec ~/.local/bin/i3status_wrapper
tray_output DP-0
}

View File

@ -7,8 +7,9 @@
# If the above line is not correctly displayed, fix your editor first!
general {
colors = true
interval = 5
colors = true
interval = 5
output_format = i3bar
}
order += "ipv6"
@ -20,38 +21,40 @@ order += "disk /home"
order += "memory"
order += "cpu_usage"
order += "cpu_temperature 0"
order += "tztime holder__headphones"
order += "volume master"
order += "tztime local"
wireless _first_ {
format_up = " (%quality at %essid) %ip"
format_down = " down"
format_up = " (%quality at %essid) %ip"
format_down = " down"
}
ethernet _first_ {
format_up = " %ip"
format_down = " down"
format_up = " %ip"
format_down = " down"
}
battery all {
format = " %status %percentage %remaining"
format = " %status %percentage %remaining"
}
disk "/" {
format = "/ %used/%total"
format = "/ %used/%total"
}
disk "/home" {
format = " %used/%total"
format = " %used/%total"
}
load {
format = "%1min"
format = "%1min"
}
memory {
format = "%used/%available"
threshold_degraded = "1G"
format_degraded = "MEMORY < %available"
format = "%used/%available"
threshold_degraded = "1G"
format_degraded = "MEMORY < %available"
}
cpu_usage {
@ -65,5 +68,18 @@ cpu_temperature 0 {
}
tztime local {
format = " %Y-%m-%d  %H:%M:%S"
format = " %Y-%m-%d  %H:%M:%S"
}
volume master {
format = " %volume" # шаблон громкости в активном состоянии
format_muted = " %volume" # шаблон громкости в состоянии muted (без звука)
device = "default"
mixer = "Master"
mixer_idx = 0
}
tztime holder__headphones {
format = "holder__headphones"
}

View File

@ -0,0 +1,40 @@
local status, autosave = pcall(require, "auto-save")
if (not status) then return end
autosave.setup(
{
enabled = true, -- start auto-save when the plugin is loaded (i.e. when your package manager loads it)
execution_message = {
message = function() -- message to print on save
return ("AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S"))
end,
dim = 0.18, -- dim the color of `message`
cleaning_interval = 1250, -- (milliseconds) automatically clean MsgArea after displaying `message`. See :h MsgArea
},
trigger_events = {"InsertLeave", "TextChanged"}, -- vim events that trigger auto-save. See :h events
-- function that determines whether to save the current buffer or not
-- return true: if buffer is ok to be saved
-- return false: if it's not ok to be saved
condition = function(buf)
local fn = vim.fn
local utils = require("auto-save.utils.data")
if
fn.getbufvar(buf, "&modifiable") == 1 and
utils.not_in(fn.getbufvar(buf, "&filetype"), {}) then
return true -- met condition(s), can save
end
return false -- can't save
end,
write_all_buffers = false, -- write all buffers when the current one meets `condition`
debounce_delay = 135, -- saves the file at most every `debounce_delay` milliseconds
callbacks = { -- functions to be executed at different intervals
enabling = nil, -- ran when enabling auto-save
disabling = nil, -- ran when disabling auto-save
before_asserting_save = nil, -- ran before checking `condition`
before_saving = nil, -- ran before doing the actual save
after_saving = nil -- ran after doing the actual save
}
}
)

View File

@ -0,0 +1,45 @@
local status, cmp = pcall(require, "cmp")
if (not status) then return end
local function has_words_before()
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
-- nvim-cmp setup
local cmp = require 'cmp'
cmp.setup {
completion = {
autocomplete = false
},
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body)
end,
},
mapping = {
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
['<S-Tab>'] = cmp.mapping.select_prev_item(),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-e>'] = cmp.mapping.close(),
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
},
},
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
},
}

View File

@ -0,0 +1,5 @@
local status, _ = pcall(require, "gruvbox")
if (not status) then return end
vim.cmd.colorscheme("gruvbox")

View File

@ -0,0 +1,4 @@
local status, comment = pcall(require, 'Comment')
if (not status) then return end
comment.setup()

View File

@ -0,0 +1,5 @@
local status, gitsigns = pcall(require, "gitsigns")
if (not status) then return end
gitsigns.setup()

View File

@ -1,83 +1,7 @@
local autosave = require("autosave")
local status, nvim_lsp = pcall(require, "lspconfig")
if (not status) then return end
autosave.setup(
{
enabled = true,
execution_message = "AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S"),
events = {"TextChanged", "InsertLeave"},
conditions = {
exists = true,
filename_is_not = {},
filetype_is_not = {},
modifiable = true
},
write_all_buffers = false,
on_off_commands = true,
clean_command_line_interval = 0,
debounce_delay = 0
}
)
-- Set completeopt to have a better completion experience
vim.o.completeopt = 'menuone,noselect'
-- luasnip setup
local luasnip = require 'luasnip'
-- nvim-cmp setup
local cmp = require 'cmp'
cmp.setup {
completion = {
autocomplete = false
},
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body)
end,
},
mapping = {
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.close(),
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
},
['<Tab>'] = function(fallback)
if vim.fn.pumvisible() == 1 then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<C-n>', true, true, true), 'n')
elseif luasnip.expand_or_jumpable() then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<Plug>luasnip-expand-or-jump', true, true, true), '')
else
fallback()
end
end,
['<S-Tab>'] = function(fallback)
if vim.fn.pumvisible() == 1 then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<C-p>', true, true, true), 'n')
elseif luasnip.jumpable(-1) then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<Plug>luasnip-jump-prev', true, true, true), '')
else
fallback()
end
end,
},
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
},
}
local nvim_lsp = require('lspconfig')
-- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer
@ -115,7 +39,7 @@ end
-- Use a loop to conveniently call 'setup' on multiple servers and
-- map buffer local keybindings when the language server attaches
local servers = { 'pyright' }
local servers = { 'pyright', 'lua_ls', 'rust_analyzer' }
for _, lsp in ipairs(servers) do
nvim_lsp[lsp].setup {
on_attach = on_attach,
@ -124,8 +48,3 @@ for _, lsp in ipairs(servers) do
}
}
end
require('telescope').load_extension('fzf')
require("nvim-autopairs").setup {}

View File

@ -0,0 +1,5 @@
local status, lualine = pcall(require, "lualine")
if (not status) then return end
lualine.setup()

View File

@ -0,0 +1,27 @@
local status, ls = pcall(require, "luasnip")
if (not status) then return end
vim.g.snips_author = 'thek4n'
vim.g.snips_email = 'thek4n@yandex.com'
vim.g.snips_github = 'https://github.com/thek4n'
local map = vim.keymap.set
local function jump(val)
return function()
ls.jump(val)
end
end
map({'i', 's'}, '<C-n>', jump(1))
map({'i', 's'}, '<C-p>', jump(-1))
local status_loader, luasnip_loaders = pcall(require, "luasnip.loaders.from_snipmate")
if (not status_loader) then return end
luasnip_loaders.lazy_load()

View File

@ -0,0 +1,6 @@
local status, mason_lspconfig = pcall(require, "mason-lspconfig")
if (not status) then return end
mason_lspconfig.setup()

View File

@ -0,0 +1,6 @@
local status, mason = pcall(require, "mason")
if (not status) then return end
mason.setup()

View File

@ -0,0 +1,5 @@
local status, nvim_autopairs = pcall(require, "nvim-autopairs")
if (not status) then return end
nvim_autopairs.setup()

View File

@ -0,0 +1,14 @@
local status, nvim_treesitter = pcall(require, "nvim-treesitter")
if (not status) then return end
nvim_treesitter.setup {
ensure_installed = {"python", "lua", "vim", "html", "rust"},
sync_install = true,
auto_install = true,
highlight = {
enable = true,
}
}

View File

@ -0,0 +1,6 @@
local status, nvim_ts_autotag = pcall(require, "nvim-ts-autotag")
if (not status) then return end
nvim_ts_autotag.setup()

View File

@ -0,0 +1,9 @@
if not (packer_plugins["vim-rainbow"] and packer_plugins["vim-rainbow"].loaded) then
return
end
vim.api.nvim_create_autocmd('BufEnter',
{
pattern = {"*"},
command = 'RainbowToggle'
})

View File

@ -0,0 +1,62 @@
local status, telescope = pcall(require, "telescope")
if (not status) then return end
telescope.load_extension('fzf')
telescope.setup {
defaults = {
selection_caret = "",
path_display = { "smart" },
file_ignore_patterns = {
".git/",
"target/",
"docs/",
"vendor/*",
"%.lock",
"pycache/*",
"%.sqlite3",
"%.ipynb",
"node_modules/*",
"%.svg",
"%.otf",
"%.ttf",
"%.webp",
".dart_tool/",
".github/",
".gradle/",
".idea/",
".settings/",
".vscode/",
"pycache/",
"build/",
"env/",
"gradle/",
"node_modules/",
"%.pdb",
"%.dll",
"%.class",
"%.exe",
"%.cache",
"%.ico",
"%.pdf",
"%.dylib",
"%.jar",
"%.docx",
"%.met",
"smalljre_*/*",
".vale/",
"%.burp",
"%.mp4",
"%.mkv",
"%.rar",
"%.zip",
"%.7z",
"%.tar",
"%.bz2",
"%.epub",
"%.flac",
"%.tar.gz",
},
}
}

View File

@ -0,0 +1,5 @@
local status, trouble = pcall(require, "trouble")
if (not status) then return end
trouble.setup()

1
sub/nvim/init.lua Normal file
View File

@ -0,0 +1 @@
require("base")

View File

@ -0,0 +1,3 @@
require("base.options")
require("base.keys")
require("base.plugins")

View File

@ -0,0 +1,2 @@
require("base.keys.keys")
require("base.keys.run-scripts")

View File

@ -0,0 +1,126 @@
local map = vim.keymap.set
local opts = { noremap = true, silent = true }
vim.g.mapleader = ','
local function create_function_tabdo(command)
return function()
local curr_tab = vim.fn.tabpagenr()
vim.cmd.tabdo(command)
vim.cmd.tabn(curr_tab)
end
end
-- Toggle line highlighting
map('n', '<Leader>c', create_function_tabdo('set cursorline!'), opts)
map('n', '<Leader>/',
function() vim.opt.hlsearch = not vim.opt.hlsearch["_value"] end,
opts)
map('i', 'jk', '<ESC>', opts)
map('n', '<Enter>', 'o<ESC>', opts)
map('n', '<Space>', 'O<ESC>', opts)
-- x to blackhole
map({'n', 'v'}, 'x', '"_x', opts)
-- Put without overwrite yanked text
map('x', 'p', 'P', opts)
-- Increment/decrement
map('n', '+', '<C-a>', opts)
map('n', '-', '<C-x>', opts)
-- map \ to prev finding
map({"n", "v"}, [[\]], ',', opts)
-- Select all
map('n', '<C-a>', 'gg<S-v>G', opts)
-- Scroll tabs
map("n", '<C-l>', vim.cmd.tabnext, opts)
map("n", '<C-h>', vim.cmd.tabprev, opts)
-- Open file under cursor in new tab
map("n", 'gf', '<C-w>gf')
-- Kill current buffer
map("n", '<Leader>qq', '<cmd>bd!<CR>', opts)
-- Quick exit without saving
map("n", '<Leader>qa', '<cmd>qa!<CR>', opts)
map("n", '<Leader>eh', '<cmd>set list!<CR>', opts)
vim.opt.listchars=[[tab:→\ ,eol:↵,trail:·,extends:↷,precedes:↶]]
-- Tags panel (ctags required)
map("n", '<Leader>t', '<cmd>TagbarToggle<CR>', opts)
-- Telescope
map("n", '<Leader>ff', '<cmd>Telescope find_files<CR>', opts)
map("n", '<Leader>fg', '<cmd>Telescope live_grep<CR>', opts)
-- Expand %% to dirname of current file in command line
map("c", '%%', [[getcmdtype() == ':' ? expand('%:h').'/' : '%%']], {expr = true})
-- Save from root
vim.api.nvim_create_user_command('Sw', [[execute 'silent! write !SUDO_ASKPASS=$(command -v vim_askpass_helper) sudo -A tee % >/dev/null']], {})
-- Toggle line number style
function toggle_number_style()
local opt = vim.opt
local number = opt.number["_value"]
local relativenumber = opt.relativenumber["_value"]
if (not number) and (not relativenumber) then
opt.number = true
opt.relativenumber = false
elseif (number) and (not relativenumber) then
opt.number = false
opt.relativenumber = true
elseif (not number) and (relativenumber) then
opt.number = true
opt.relativenumber = true
elseif (number) and (relativenumber) then
opt.number = false
opt.relativenumber = false
end
end
-- Toggle line number style
map('n', '<Leader>l', create_function_tabdo('lua toggle_number_style()'), opts)
local function set_trouble_keymap(key, cmd)
map("n", string.format("<Leader>x%s", key), string.format("<cmd>TroubleToggle %s<CR>", cmd), opts)
end
set_trouble_keymap("x", "")
set_trouble_keymap("w", "workspace_diagnostics") -- lsp diagnostic of workspace
set_trouble_keymap("d", "document_diagnostics") -- diagnostic of current file
local function set_gitsigns_keymap(key, cmd)
map("n", string.format("<Leader>g%s", key), string.format("<cmd>Gitsigns %s<CR>", cmd), opts)
end
set_gitsigns_keymap('p', 'preview_hunk') -- show diff
set_gitsigns_keymap('b', 'blame_line') -- show author, hash, date and message of current line commit
set_gitsigns_keymap('n', 'next_hunk') -- go to next unstaged changes

View File

@ -0,0 +1,71 @@
local function autocmd(func)
local create_autocmd = vim.api.nvim_create_autocmd
create_autocmd("BufEnter",
{ pattern = '*', callback = func}
)
end
local function set_keymap_base(key, cmd)
local map = vim.keymap.set
local opts = { noremap = true, silent = true }
local keymap_keys = string.format([[<Leader>r%s]], key)
map("n", keymap_keys, cmd, opts)
end
local function set_keymap_format_file(cmd)
local cmd_string = string.format([[:!%s %% <CR>]], cmd)
set_keymap_base("f", cmd_string)
end
local function set_keymap_run_script_base(key, cmd)
local run_script_string = [[:tabnew %% <CR> :terminal %s %% <CR> :set nocursorline number norelativenumber <CR> G <CR>]]
local cmd_string = string.format(run_script_string, cmd)
set_keymap_base(key, cmd_string)
end
local function set_keymap_run_script(cmd)
set_keymap_run_script_base("r", cmd)
end
local function set_keymap_run_script_by_shebang()
set_keymap_run_script_base("s", [[$(head -1 % | cut -c 3-) %]])
end
local function create_function_autocmd_by_filetype(set_keymap_func, ft, cmd)
return function()
if vim.bo.filetype == ft then
set_keymap_func(cmd)
end
end
end
local function create_function_autocmd_by_filename(set_keymap_func, fn, cmd)
return function()
if vim.fn.expand('%:t') == fn then
set_keymap_func(cmd)
end
end
end
local function autocmd_run_script_by_filetype(ft, cmd)
autocmd(create_function_autocmd_by_filetype(set_keymap_run_script, ft, cmd))
end
local function autocmd_format_file_by_filetype(ft, cmd)
autocmd(create_function_autocmd_by_filetype(set_keymap_format_file, ft, cmd))
end
autocmd_run_script_by_filetype('python', 'python3')
autocmd_run_script_by_filetype('go', 'go run')
autocmd_run_script_by_filetype('rust', 'cargo run')
autocmd_run_script_by_filetype('markdown', 'glow')
autocmd(create_function_autocmd_by_filename(set_keymap_run_script, 'manpage', 'man -P cat -l'))
autocmd_format_file_by_filetype('rust', 'cargo fmt -p')
autocmd_format_file_by_filetype('go', 'go fmt')
autocmd(set_keymap_run_script_by_shebang)

View File

@ -0,0 +1,129 @@
local opt = vim.opt
opt.ruler = true
opt.encoding = 'utf-8'
opt.fileencoding = 'utf-8'
opt.number = true
opt.relativenumber = true
opt.clipboard:append { 'unnamed' }
opt.clipboard:append { 'unnamedplus' }
opt.shm = opt.shm["_value"] .. "I" -- disable startup message
opt.shell = 'bash'
opt.ttimeoutlen = 0
vim.cmd([[
filetype plugin indent on
]])
vim.cmd([[
syntax enable
]])
opt.compatible = false
opt.hidden = true
opt.expandtab = true
opt.smarttab = true
opt.tabstop = 4
opt.cursorline = true
opt.softtabstop = 4
opt.shiftwidth = 4
opt.autoindent = true
opt.smartindent = true
opt.wrap = false
opt.ttyfast = true
opt.autoread = true
opt.errorbells = false
opt.visualbell = false
opt.showcmd = true
opt.showtabline = 2
opt.ignorecase = true
opt.smartcase = true -- if search line hasn`t Upper case chars - ignore case search, else case-sensivity search
opt.incsearch = true
opt.mousehide = true
opt.mouse = 'a'
opt.colorcolumn = '81'
opt.scrolloff = 7
opt.termguicolors = true
opt.background = 'dark'
opt.backup = true
opt.swapfile = false
opt.undofile = true
opt.history = 1000
opt.undoreload = 1000
local prefix = vim.fn.expand("~/.local/state/nvim")
opt.undodir = { prefix .. "/undo//" }
opt.backupdir = { prefix .. "/backup//" }
opt.directory = { prefix .. "/swap//" }
local function makeDirIfNoExists(path)
local path = path["_value"]
if (vim.fn.isdirectory(path) == 0) then
vim.fn.mkdir(path, "p")
end
end
-- make this dirs if no exists previously
makeDirIfNoExists(opt.undodir)
makeDirIfNoExists(opt.backupdir)
makeDirIfNoExists(opt.directory)
opt.ffs = 'unix,mac'
opt.path:append { '**' } -- Finding files - Search down into subfolders
vim.cmd([[
let &t_SI.="\e[5 q" "SI = режим вставки
let &t_SR.="\e[3 q" "SR = режим замены
let &t_EI.="\e[1 q" "EI = нормальный режим
]])
vim.g.netrw_banner = 0 -- hide banner
vim.g.netrw_liststyle = 3 -- tree instead of plain view
vim.g.netrw_browse_split = 0
vim.g.netrw_winsize = 15
vim.g.netrw_keepdir = 0
-- Highlight yanked text for a while
vim.api.nvim_create_autocmd("TextYankPost", {
pattern = "*",
callback = function()
vim.highlight.on_yank()
end,
})
-- dont auto commenting new lines
vim.api.nvim_create_autocmd("BufEnter", {pattern = "*", command = [[set fo-=c fo-=r fo-=o]]})
vim.cmd.highlight({ "DiagnosticError", "guifg=Grey" })
vim.cmd.highlight({ "DiagnosticWarn", "guifg=Grey" })
vim.cmd.highlight({ "DiagnosticInfo", "guifg=Grey" })
vim.cmd.highlight({ "DiagnosticHint", "guifg=Grey" })
-- Russian commands
opt.langmap = 'ФИСВУАПРШОЛДЬТЩЗЙКЫЕГМЦЧНЯ;ABCDEFGHIJKLMNOPQRSTUVWXYZ,фисвуапршолдьтщзйкыегмцчня;abcdefghijklmnopqrstuvwxyz'

View File

@ -0,0 +1,69 @@
vim.cmd([[packadd packer.nvim]])
return require('packer').startup(function(use)
use 'wbthomason/packer.nvim'
use {
'nvim-lualine/lualine.nvim',
requires = { 'kyazdani42/nvim-web-devicons' }
}
use {
'kana/vim-textobj-lastpat', -- text-object i/, operate under finding
requires = { 'kana/vim-textobj-user' }
}
use 'ellisonleao/gruvbox.nvim' -- theme
use 'tpope/vim-surround'
use 'tpope/vim-repeat'
use 'google/vim-searchindex'
use 'tpope/vim-commentary' -- gcc to comment line
use 'ap/vim-css-color' -- highlight hex
use 'preservim/tagbar'
use 'preservim/vimux'
use 'rbgrouleff/bclose.vim'
use 'frazrepo/vim-rainbow' -- rainbow brackets
use 'Pocco81/auto-save.nvim' -- autosave files
use 'windwp/nvim-autopairs' -- auto pair brackets and tags
use 'lewis6991/gitsigns.nvim' -- git integration
use 'windwp/nvim-ts-autotag'
use 'lervag/vimtex'
use {
'shime/vim-livedown', -- Markdown previewer :LivedownPreview
run = '/usr/bin/npm install -g livedown'
}
use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' }
use 'numToStr/Comment.nvim'
use { 'folke/trouble.nvim',
requires = { 'kyazdani42/nvim-web-devicons' }
}
use 'neovim/nvim-lspconfig'
use 'hrsh7th/nvim-cmp'
use 'hrsh7th/cmp-nvim-lsp'
-- snippets
use 'saadparwaiz1/cmp_luasnip'
use {
'L3MON4D3/LuaSnip',
after = 'nvim-cmp',
}
use 'honza/vim-snippets'
-- lsp servers installer
use {
'williamboman/mason.nvim',
requires = {
"williamboman/mason-lspconfig.nvim"
},
}
use {
'nvim-telescope/telescope.nvim',
requires = {
{ 'nvim-lua/plenary.nvim' },
{ 'nvim-telescope/telescope-fzf-native.nvim', run = 'make' }
}
}
end)

4
sub/psql/psqlrc Normal file
View File

@ -0,0 +1,4 @@
\set PROMPT1 '%n@%/%R%# %x'
\setenv LESS '-iMFXSx4R'
\setenv EDITOR 'nvim'
\x auto

View File

@ -55,25 +55,6 @@ let g:netrw_winsize = 15
let g:netrw_keepdir = 0
" Mirror the NERDTree before showing it. This makes it the same on all tabs.
nnoremap <silent> <leader>nn :silent NERDTreeMirror<CR>:silent NERDTreeToggle<CR>
" Toggle focus
nnoremap <silent> <leader>nf :wincmd p<CR>
" Start NERDTree when Vim is started without file arguments.
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists('s:std_in') | NERDTree | wincmd p | endif
" Exit Vim if NERDTree is the only window remaining in the only tab.
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
" Close the tab if NERDTree is the only window remaining in it.
autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
let g:NERDTreeMapActivateNode='l'
set ttimeoutlen=0 "Понижаем задержку ввода escape последовательностей
let &t_SI.="\e[5 q" "SI = режим вставки
let &t_SR.="\e[3 q" "SR = режим замены
@ -104,7 +85,6 @@ set novisualbell
set showcmd
set showtabline=2
set ignorecase
set smartcase
set incsearch
@ -138,6 +118,8 @@ set virtualedit=onemore " allow for cursor beyond last character
" toggle hlsearch
nnoremap <silent> <Leader>/ :set invhlsearch<CR>
cnoremap <C-p> <Up>
cnoremap <C-n> <Down>
nnoremap <up> <nop>
nnoremap <down> <nop>
@ -176,34 +158,17 @@ call vundle#begin()
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-commentary'
Plugin 'ap/vim-css-color'
Plugin 'mg979/vim-visual-multi', {'branch': 'master'}
Plugin 'preservim/tagbar'
Plugin 'preservim/vimux'
Plugin 'rbgrouleff/bclose.vim'
Plugin 'frazrepo/vim-rainbow'
Plugin 'Pocco81/AutoSave.nvim'
Plugin 'Pocco81/auto-save.nvim'
" requiered patch your font
Plugin 'ryanoasis/vim-devicons'
Plugin 'windwp/nvim-autopairs'
" pyright
Plugin 'neovim/nvim-lspconfig'
Plugin 'hrsh7th/nvim-cmp'
Plugin 'hrsh7th/cmp-nvim-lsp'
Plugin 'saadparwaiz1/cmp_luasnip'
Plugin 'L3MON4D3/LuaSnip'
Plugin 'nvim-lua/plenary.nvim'
Plugin 'powerman/vim-plugin-ruscmd' " Russian navigation
" golang
" Plugin 'fatih/vim-go'
Plugin 'nvim-telescope/telescope.nvim'
Plugin 'nvim-telescope/telescope-fzf-native.nvim', {'do': 'make'}
Plugin 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
Plugin 'preservim/nerdtree'
call vundle#end()
filetype plugin indent on
@ -220,6 +185,8 @@ autocmd BufEnter * if (expand('%:t')=='manpage') | nnoremap <silent> <Leader>rr
autocmd BufEnter * if (&filetype=='python') | nnoremap <silent> <Leader>rr :tabnew % <CR> :terminal python3 % <CR> :set nocursorline number norelativenumber <CR> G <CR> | endif
autocmd BufEnter * if (&filetype=='go') | nnoremap <silent> <Leader>rr :tabnew % <CR> :terminal go run % <CR> :set nocursorline number norelativenumber <CR> G <CR> | endif
autocmd BufEnter * if (&filetype=='go') | nnoremap <silent> <Leader>rf :!go fmt % <CR> | endif
autocmd BufEnter * if (&filetype=='rust') | nnoremap <silent> <Leader>rr :tabnew % <CR> :terminal cargo run % <CR> :set nocursorline number norelativenumber <CR> G <CR> | endif
autocmd BufEnter * if (&filetype=='rust') | nnoremap <silent> <Leader>rf :!cargo fmt % <CR> | endif
autocmd BufEnter * if (&filetype=='markdown') | nnoremap <silent> <Leader>rr :let g:buf_curline=line(".") <CR> :tabnew % <CR> :terminal glow % <CR> :set nocursorline number norelativenumber <CR> :exe buf_curline <CR> | endif
autocmd BufEnter * if (&filetype=='vim') | nnoremap <silent> <Leader>rr :so % <CR>
@ -250,20 +217,7 @@ colorscheme gruvbox
set bg=dark
let g:multi_cursor_use_default_mapping=0
" Default mapping
let g:multi_cursor_start_word_key = '<C-n>'
let g:multi_cursor_select_all_word_key = '<A-n>'
let g:multi_cursor_start_key = 'g<C-n>'
let g:multi_cursor_select_all_key = 'g<A-n>'
let g:multi_cursor_next_key = '<C-n>'
let g:multi_cursor_prev_key = '<C-p>'
let g:multi_cursor_skip_key = '<C-x>'
let g:multi_cursor_quit_key = '<Esc>'
au FileType py,go,c,cpp,objc,js call rainbow#load()
au FileType py,go,c,cpp,objc,js,rs call rainbow#load()
let g:rainbow_active = 1
@ -305,6 +259,14 @@ endfunction
nnoremap <silent> <Leader>l :call TabDo('call ToggleRelativeAbsoluteNumber()') <CR>
nnoremap <silent> <Leader>qq :bd!<CR>
" Quick exiting without save
nnoremap <silent> <Leader>qq :qa!<CR>
nnoremap <silent> <Leader>qa :qa!<CR>
" expand %% to dirname of cur file in commandline
cnoremap <expr> %% getcmdtype() == ':' ? expand('%:h').'/' : '%%'
" :Sw to save file by root
command Sw execute 'silent! write !SUDO_ASKPASS=$(which vim_askpass_helper) sudo -A tee % >/dev/null'

View File

@ -5,4 +5,9 @@ alias -g OUT="1>/dev/null" # stdOUT
alias -g ERR="2>/dev/null" # stdERR
alias -g ALL="1>/dev/null 2>&1"
alias -g BG="&>/dev/null &"
alias -s mp4='vlc'
alias -s mp3='audacious'
alias -s flac='audacious'
bindkey '`' autosuggest-accept

View File

@ -1,8 +1,11 @@
# enable completion features
fpath+=~/.zfunc
fpath=(~/.zfunc $fpath)
autoload -Uz compinit
compinit -d ~/.cache/zcompdump
compdef _nvim nvim
compdef _files mcd
compdef _poetry poetry
zstyle ':completion:*:*:*:*:*' menu select
zstyle ':completion:*' auto-description 'specify: %d'
zstyle ':completion:*' completer _expand _complete _correct _approximate

View File

@ -4,6 +4,7 @@ export HISTFILE=~/.zsh_history
export HISTSIZE=1000
export SAVEHIST=2000
setopt HIST_IGNORE_SPACE
setopt HIST_FIND_NO_DUPS
setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
setopt hist_ignore_dups # ignore duplicated commands history list
setopt hist_ignore_space # ignore commands that start with space

View File

@ -14,7 +14,48 @@ WORDCHARS=${WORDCHARS//\/} # Don't consider certain characters part of the word
PROMPT_EOL_MARK=""
# configure key keybindings
# Activate vim mode.
bindkey -v
# Change cursor shape for different vi modes.
zle-keymap-select() {
if [[ ${KEYMAP} == vicmd ]] ||
[[ $1 = 'block' ]]; then
echo -ne '\e[2 q'
elif [[ ${KEYMAP} == main ]] ||
[[ ${KEYMAP} == viins ]] ||
[[ ${KEYMAP} = '' ]] ||
[[ $1 = 'beam' ]]; then
echo -ne '\e[5 q'
fi
}
zle -N zle-keymap-select
# Use beam shape cursor on startup.
echo -ne '\e[5 q'
_fix_cursor() {
echo -ne '\e[5 q'
}
precmd_functions+=(_fix_cursor)
# Set cursor style (DECSCUSR), VT520.
# 0 -> blinking block.
# 1 -> blinking block (default).
# 2 -> steady block.
# 3 -> blinking underline.
# 4 -> steady underline.
# 5 -> blinking bar, xterm.
# 6 -> steady bar, xterm.
bindkey -M viins 'jk' vi-cmd-mode
bindkey ' ' magic-space # do history expansion on space
bindkey '^[[3;5~' kill-word # ctrl + Supr
@ -30,3 +71,5 @@ bindkey '^U' kill-whole-line
bindkey -M vicmd '^U' kill-whole-line
bindkey -M viins '^U' kill-whole-line
bindkey -M viins '\e.' insert-last-word
bindkey -M vicmd '^K' up-line-or-history
bindkey -M vicmd '^J' down-line-or-history

16
sub/zsh/zfunc/_nvim Normal file
View File

@ -0,0 +1,16 @@
#compdef nvim
#autoload
_nvim() {
subcmds=($(git diff --name-only --relative 2>/dev/null))
if [[ -z "$subcmds" ]]; then
_files
else
_values -C 'modified files' $subcmds
_files
fi
}
_nvim

197
sub/zsh/zfunc/_poetry Normal file
View File

@ -0,0 +1,197 @@
#compdef poetry
_poetry_1733398420f0b696_complete()
{
local state com cur
local -a opts
local -a coms
cur=${words[${#words[@]}]}
# lookup for command
for word in ${words[@]:1}; do
if [[ $word != -* ]]; then
com=$word
break
fi
done
if [[ ${cur} == --* ]]; then
state="option"
opts+=("--ansi:Force ANSI output." "--directory:The working directory for the Poetry command \(defaults to the current working directory\)." "--help:Display help for the given command. When no command is given display help for the list command." "--no-ansi:Disable ANSI output." "--no-cache:Disables Poetry source caches." "--no-interaction:Do not ask any interactive question." "--no-plugins:Disables plugins." "--quiet:Do not output any message." "--verbose:Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug." "--version:Display this application version.")
elif [[ $cur == $com ]]; then
state="command"
coms+=("about:Shows information about Poetry." "add:Adds a new dependency to pyproject.toml." "build:Builds a package, as a tarball and a wheel by default." "'cache clear':Clears a Poetry cache by name." "'cache list':List Poetry\'s caches." "check:Checks the validity of the pyproject.toml file." "config:Manages configuration settings." "'debug info':Shows debug information." "'debug resolve':Debugs dependency resolution." "'env info':Displays information about the current environment." "'env list':Lists all virtualenvs associated with the current project." "'env remove':Remove virtual environments associated with the project." "'env use':Activates or creates a new virtualenv for the current project." "export:Exports the lock file to alternative formats." "help:Displays help for a command." "init:Creates a basic pyproject.toml file in the current directory." "install:Installs the project dependencies." "list:Lists commands." "lock:Locks the project dependencies." "new:Creates a new Python project at <path\>." "publish:Publishes a package to a remote repository." "remove:Removes a package from the project dependencies." "run:Runs a command in the appropriate environment." "search:Searches for packages on remote repositories." "'self add':Add additional packages to Poetry\'s runtime environment." "'self install':Install locked packages \(incl. addons\) required by this Poetry installation." "'self lock':Lock the Poetry installation\'s system requirements." "'self remove':Remove additional packages from Poetry\'s runtime environment." "'self show':Show packages from Poetry\'s runtime environment." "'self show plugins':Shows information about the currently installed plugins." "'self update':Updates Poetry to the latest version." "shell:Spawns a shell within the virtual environment." "show:Shows information about packages." "'source add':Add source configuration for project." "'source remove':Remove source configured for the project." "'source show':Show information about sources configured for the project." "update:Update the dependencies as according to the pyproject.toml file." "version:Shows the version of the project or bumps it when a valid bump rule is provided.")
fi
case $state in
(command)
_describe 'command' coms
;;
(option)
case "$com" in
(about)
opts+=()
;;
(add)
opts+=("--allow-prereleases:Accept prereleases." "--dev:Add as a development dependency. \(Deprecated\)" "--dry-run:Output the operations but do not execute anything \(implicitly enables --verbose\)." "--editable:Add vcs/path dependencies as editable." "--extras:Extras to activate for the dependency." "--group:The group to add the dependency to." "--lock:Do not perform operations \(only update the lockfile\)." "--optional:Add as an optional dependency." "--platform:Platforms for which the dependency must be installed." "--python:Python version for which the dependency must be installed." "--source:Name of the source to use to install the package.")
;;
(build)
opts+=("--format:Limit the format to either sdist or wheel.")
;;
('cache clear')
opts+=("--all:Clear all entries in the cache.")
;;
('cache list')
opts+=()
;;
(check)
opts+=()
;;
(config)
opts+=("--list:List configuration settings." "--local:Set/Get from the project\'s local configuration." "--unset:Unset configuration setting.")
;;
('debug info')
opts+=()
;;
('debug resolve')
opts+=("--extras:Extras to activate for the dependency." "--install:Show what would be installed for the current system." "--python:Python version\(s\) to use for resolution." "--tree:Display the dependency tree.")
;;
('env info')
opts+=("--path:Only display the environment\'s path.")
;;
('env list')
opts+=("--full-path:Output the full paths of the virtualenvs.")
;;
('env remove')
opts+=("--all:Remove all managed virtual environments associated with the project.")
;;
('env use')
opts+=()
;;
(export)
opts+=("--dev:Include development dependencies. \(Deprecated\)" "--extras:Extra sets of dependencies to include." "--format:Format to export to. Currently, only constraints.txt and requirements.txt are supported." "--only:The only dependency groups to include." "--output:The name of the output file." "--with:The optional dependency groups to include." "--with-credentials:Include credentials for extra indices." "--without:The dependency groups to ignore." "--without-hashes:Exclude hashes from the exported file." "--without-urls:Exclude source repository urls from the exported file.")
;;
(help)
opts+=()
;;
(init)
opts+=("--author:Author name of the package." "--dependency:Package to require, with an optional version constraint, e.g. requests:\^2.10.0 or requests=2.11.1." "--description:Description of the package." "--dev-dependency:Package to require for development, with an optional version constraint, e.g. requests:\^2.10.0 or requests=2.11.1." "--license:License of the package." "--name:Name of the package." "--python:Compatible Python versions.")
;;
(install)
opts+=("--all-extras:Install all extra dependencies." "--dry-run:Output the operations but do not execute anything \(implicitly enables --verbose\)." "--extras:Extra sets of dependencies to install." "--no-dev:Do not install the development dependencies. \(Deprecated\)" "--no-root:Do not install the root package \(the current project\)." "--only:The only dependency groups to include." "--only-root:Exclude all dependencies." "--remove-untracked:Removes packages not present in the lock file. \(Deprecated\)" "--sync:Synchronize the environment with the locked packages and the specified groups." "--with:The optional dependency groups to include." "--without:The dependency groups to ignore.")
;;
(list)
opts+=()
;;
(lock)
opts+=("--check:Check that the poetry.lock file corresponds to the current version of pyproject.toml." "--no-update:Do not update locked versions, only refresh lock file.")
;;
(new)
opts+=("--name:Set the resulting package name." "--readme:Specify the readme file format. One of md \(default\) or rst" "--src:Use the src layout for the project.")
;;
(publish)
opts+=("--build:Build the package before publishing." "--cert:Certificate authority to access the repository." "--client-cert:Client certificate to access the repository." "--dry-run:Perform all actions except upload the package." "--password:The password to access the repository." "--repository:The repository to publish the package to." "--skip-existing:Ignore errors from files already existing in the repository." "--username:The username to access the repository.")
;;
(remove)
opts+=("--dev:Remove a package from the development dependencies. \(Deprecated\)" "--dry-run:Output the operations but do not execute anything \(implicitly enables --verbose\)." "--group:The group to remove the dependency from.")
;;
(run)
opts+=()
;;
(search)
opts+=()
;;
('self add')
opts+=("--allow-prereleases:Accept prereleases." "--dry-run:Output the operations but do not execute anything \(implicitly enables --verbose\)." "--editable:Add vcs/path dependencies as editable." "--extras:Extras to activate for the dependency." "--source:Name of the source to use to install the package.")
;;
('self install')
opts+=("--dry-run:Output the operations but do not execute anything \(implicitly enables --verbose\)." "--sync:Synchronize the environment with the locked packages and the specified groups.")
;;
('self lock')
opts+=("--check:Check that the poetry.lock file corresponds to the current version of pyproject.toml." "--no-update:Do not update locked versions, only refresh lock file.")
;;
('self remove')
opts+=("--dry-run:Output the operations but do not execute anything \(implicitly enables --verbose\).")
;;
('self show')
opts+=("--addons:List only add-on packages installed." "--latest:Show the latest version." "--outdated:Show the latest version but only for packages that are outdated." "--tree:List the dependencies as a tree.")
;;
('self show plugins')
opts+=()
;;
('self update')
opts+=("--dry-run:Output the operations but do not execute anything \(implicitly enables --verbose\)." "--preview:Allow the installation of pre-release versions.")
;;
(shell)
opts+=()
;;
(show)
opts+=("--all:Show all packages \(even those not compatible with current system\)." "--latest:Show the latest version." "--no-dev:Do not list the development dependencies. \(Deprecated\)" "--only:The only dependency groups to include." "--outdated:Show the latest version but only for packages that are outdated." "--tree:List the dependencies as a tree." "--why:When showing the full list, or a --tree for a single package, also display why it\'s included." "--with:The optional dependency groups to include." "--without:The dependency groups to ignore.")
;;
('source add')
opts+=("--default:Set this source as the default \(disable PyPI\). A default source will also be the fallback source if you add other sources." "--secondary:Set this source as secondary.")
;;
('source remove')
opts+=()
;;
('source show')
opts+=()
;;
(update)
opts+=("--dry-run:Output the operations but do not execute anything \(implicitly enables --verbose\)." "--lock:Do not perform operations \(only update the lockfile\)." "--no-dev:Do not update the development dependencies. \(Deprecated\)" "--only:The only dependency groups to include." "--with:The optional dependency groups to include." "--without:The dependency groups to ignore.")
;;
(version)
opts+=("--dry-run:Do not update pyproject.toml file" "--short:Output the version number only")
;;
esac
_describe 'option' opts
;;
*)
# fallback to file completion
_arguments '*:file:_files'
esac
}
_poetry_1733398420f0b696_complete "$@"
compdef _poetry_1733398420f0b696_complete /home/kan/.local/bin/poetry

View File

@ -0,0 +1,2 @@
# Add here files to source it in ascending order like "01_hello.sh"