Compare commits
66 Commits
e9fdee74a6
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 7079e870f8 | |||
|
|
4fe6739d9d | ||
|
|
2fa073ea87 | ||
|
|
880bbd18e0 | ||
| ebe143ee28 | |||
| ba7cec969f | |||
|
|
e2bdd71b08 | ||
|
|
966b7c74ef | ||
|
|
a3c78dfcba | ||
|
|
622ae698cd | ||
|
|
6a20ac709a | ||
|
|
386257dd6e | ||
| e0f933c26c | |||
|
|
352a8c3c97 | ||
|
|
bcba0e372a | ||
|
|
909acaa69f | ||
|
|
72b38584ef | ||
|
|
3e4452cf24 | ||
|
|
04aef1e179 | ||
|
|
bcca54a031 | ||
|
|
491aae86da | ||
|
|
d271383341 | ||
| 90f29dcec2 | |||
|
|
186bb40650 | ||
| de04ddd511 | |||
| 836a80c332 | |||
| 8de9883cbe | |||
|
|
5b562a12da | ||
|
|
63250216bb | ||
|
|
4bf35a7004 | ||
|
|
4a89901c68 | ||
|
|
957a62b72e | ||
| 860e52b19d | |||
| 3dd4270e9b | |||
| db287b99f2 | |||
| f8deaa5f64 | |||
| e1ce4b2fa8 | |||
| 972a43b01f | |||
|
|
d8a74ec472 | ||
|
|
6c69e5e6eb | ||
|
|
993dbd7fa1 | ||
| bdab2117f3 | |||
|
|
3ca34914a5 | ||
|
|
108fdaae99 | ||
| 274c9f2bab | |||
| 9876c30d6d | |||
|
|
2de1ebcfef | ||
|
|
9b60dd3c82 | ||
|
|
84c92e76a2 | ||
|
|
34de0841b9 | ||
|
|
2dd4b82d87 | ||
|
|
98f19403cc | ||
|
|
a72751e4f0 | ||
| c5981f5eb2 | |||
| 2ae741def7 | |||
| 835fad3214 | |||
| 9d23b67d7a | |||
| e0c8deda25 | |||
| 09eba0e76e | |||
| d8763db08d | |||
| 26528c66e1 | |||
| b36d591496 | |||
| c04e8f79a5 | |||
| e672a42060 | |||
| 04964316e8 | |||
| 98799dc3a6 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
||||
*.swp
|
||||
*.swo
|
||||
.netrwhist
|
||||
|
||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -5,3 +5,6 @@
|
||||
[submodule "dotbot-asdf"]
|
||||
path = dotbot-asdf
|
||||
url = https://github.com/sobolevn/dotbot-asdf.git
|
||||
[submodule "alacritty/themes"]
|
||||
path = alacritty/themes
|
||||
url = https://github.com/alacritty/alacritty-theme.git
|
||||
|
||||
3
README.md
Normal file
3
README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
### Firefox
|
||||
|
||||
Для более вменяемого плавного скролла на вейланде включаем параметр `apz.gtk.kinetic_scroll.enabled`, а `apz.fling_friction` выставляем в 0.008. [Источник](https://support.mozilla.org/bm/questions/1437281).
|
||||
114
alacritty/alacritty.toml
Normal file
114
alacritty/alacritty.toml
Normal file
@@ -0,0 +1,114 @@
|
||||
colors.draw_bold_text_with_bright_colors = false
|
||||
#custom_cursor_colors = true
|
||||
|
||||
[general]
|
||||
import = [
|
||||
"~/.config/alacritty/themes/themes/hardhacker.toml"
|
||||
]
|
||||
live_config_reload = true
|
||||
|
||||
[window]
|
||||
option_as_alt = "Both" # fixing Alt for MacOS
|
||||
dynamic_padding = true
|
||||
decorations = "None"
|
||||
startup_mode = "Maximized"
|
||||
opacity = 0.95
|
||||
blur = true
|
||||
|
||||
[window.dimensions]
|
||||
columns = 100
|
||||
lines = 85
|
||||
|
||||
[window.padding]
|
||||
x = 10
|
||||
y = 5
|
||||
|
||||
[scrolling]
|
||||
history = 0
|
||||
multiplier = 3
|
||||
|
||||
[font]
|
||||
size = 14
|
||||
# use_thin_strokes = true
|
||||
# on mac - https://petar.dev/notes/crisp-fonts-alacritty/
|
||||
|
||||
[font.normal]
|
||||
family = "RecMonoLinear Nerd Font Mono"
|
||||
style = "Regular"
|
||||
|
||||
[font.bold]
|
||||
family = "RecMonoLinear Nerd Font Mono"
|
||||
style = "Bold"
|
||||
|
||||
[font.italic]
|
||||
family = "RecMonoLinear Nerd Font Mono"
|
||||
style = "Regular Italic"
|
||||
|
||||
[font.offset]
|
||||
x = 0
|
||||
y = 3
|
||||
|
||||
[font.glyph_offset]
|
||||
x = 0
|
||||
y = 0
|
||||
|
||||
[colors.cursor]
|
||||
text = 'CellBackground'
|
||||
cursor = '#c7ccd1'
|
||||
|
||||
[bell]
|
||||
animation = "EaseOutExpo"
|
||||
color = "0xffffff"
|
||||
duration = 0
|
||||
|
||||
[mouse]
|
||||
hide_when_typing = false
|
||||
|
||||
[cursor]
|
||||
style = "Block"
|
||||
unfocused_hollow = true
|
||||
|
||||
[keyboard]
|
||||
bindings = [
|
||||
{ key = "A", mods = "Command", chars = "\u0001" },
|
||||
{ key = "C", mods = "Command", chars = "\u0003" },
|
||||
{ key = "D", mods = "Command", chars = "\u0004" },
|
||||
{ key = "E", mods = "Command", chars = "\u0005" },
|
||||
# to make Command-H work in MacOS one need to go to
|
||||
# Settings > keyboard > Hotkeys > Apps' hotkeys
|
||||
# and create some other hotkey for Alacritty's
|
||||
# "Hide alacritty"
|
||||
{ key = "H", mods = "Command", chars = "\u0008" },
|
||||
{ key = "I", mods = "Command", chars = "\u0009" },
|
||||
{ key = "J", mods = "Command", chars = "\u000a" },
|
||||
{ key = "K", mods = "Command", chars = "\u000b" },
|
||||
{ key = "L", mods = "Command", chars = "\u000c" },
|
||||
{ key = "O", mods = "Command", chars = "\u000f" },
|
||||
{ key = "R", mods = "Command", chars = "\u0012" },
|
||||
{ key = "T", mods = "Command", chars = "\u0014" },
|
||||
{ key = "U", mods = "Command", chars = "\u0015" },
|
||||
{ key = "W", mods = "Command", chars = "\u0017" },
|
||||
{ key = "X", mods = "Command", chars = "\u0018" },
|
||||
{ key = "Y", mods = "Command", chars = "\u0019" },
|
||||
{ key = "Z", mods = "Command", chars = "\u001a" },
|
||||
|
||||
# Ctrl-LeftArrow escape sequence, ^[[1;5D
|
||||
# \u001b: ESCAPE character
|
||||
# \u005b: LEFT SQUARE BRACKET [
|
||||
# \u0031: DIGIT ONE 1
|
||||
# \u003b: SEMICOLON ;
|
||||
# \u0035: DIGIT FIVE 5
|
||||
# \u0044: LATIN CAPITAL LETTER D
|
||||
{ key = "ArrowLeft", mods = "Command", chars = "\u001b\u005b\u0031\u003b\u0035\u0044" },
|
||||
|
||||
# Ctrl-RightArrow escape sequence, ^[[1;5D
|
||||
# ^[[1;5C 27 0033 0x1b
|
||||
# 91 0133 0x5b
|
||||
# 49 0061 0x31
|
||||
# 59 0073 0x3b
|
||||
# 53 0065 0x35
|
||||
# 67 0103 0x43
|
||||
{ key = "ArrowRight", mods = "Command", chars = "\u001b\u005b\u0031\u003b\u0035\u0043" },
|
||||
{ key = "ArrowDown", mods = "Command", chars = "\u001b\u005b\u0031\u003b\u0035\u0042" },
|
||||
{ key = "F", mods = "Control", action = "ToggleMaximized" },
|
||||
]
|
||||
1
alacritty/themes
Submodule
1
alacritty/themes
Submodule
Submodule alacritty/themes added at 86c578469e
611
git/git-prompt.sh
Normal file
611
git/git-prompt.sh
Normal file
@@ -0,0 +1,611 @@
|
||||
# bash/zsh git prompt support
|
||||
#
|
||||
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
|
||||
# Distributed under the GNU General Public License, version 2.0.
|
||||
#
|
||||
# This script allows you to see repository status in your prompt.
|
||||
#
|
||||
# To enable:
|
||||
#
|
||||
# 1) Copy this file to somewhere (e.g. ~/.git-prompt.sh).
|
||||
# 2) Add the following line to your .bashrc/.zshrc:
|
||||
# source ~/.git-prompt.sh
|
||||
# 3a) Change your PS1 to call __git_ps1 as
|
||||
# command-substitution:
|
||||
# Bash: PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '
|
||||
# ZSH: setopt PROMPT_SUBST ; PS1='[%n@%m %c$(__git_ps1 " (%s)")]\$ '
|
||||
# the optional argument will be used as format string.
|
||||
# 3b) Alternatively, for a slightly faster prompt, __git_ps1 can
|
||||
# be used for PROMPT_COMMAND in Bash or for precmd() in Zsh
|
||||
# with two parameters, <pre> and <post>, which are strings
|
||||
# you would put in $PS1 before and after the status string
|
||||
# generated by the git-prompt machinery. e.g.
|
||||
# Bash: PROMPT_COMMAND='__git_ps1 "\u@\h:\w" "\\\$ "'
|
||||
# will show username, at-sign, host, colon, cwd, then
|
||||
# various status string, followed by dollar and SP, as
|
||||
# your prompt.
|
||||
# ZSH: precmd () { __git_ps1 "%n" ":%~$ " "|%s" }
|
||||
# will show username, pipe, then various status string,
|
||||
# followed by colon, cwd, dollar and SP, as your prompt.
|
||||
# Optionally, you can supply a third argument with a printf
|
||||
# format string to finetune the output of the branch status
|
||||
#
|
||||
# The repository status will be displayed only if you are currently in a
|
||||
# git repository. The %s token is the placeholder for the shown status.
|
||||
#
|
||||
# The prompt status always includes the current branch name.
|
||||
#
|
||||
# In addition, if you set GIT_PS1_SHOWDIRTYSTATE to a nonempty value,
|
||||
# unstaged (*) and staged (+) changes will be shown next to the branch
|
||||
# name. You can configure this per-repository with the
|
||||
# bash.showDirtyState variable, which defaults to true once
|
||||
# GIT_PS1_SHOWDIRTYSTATE is enabled.
|
||||
#
|
||||
# You can also see if currently something is stashed, by setting
|
||||
# GIT_PS1_SHOWSTASHSTATE to a nonempty value. If something is stashed,
|
||||
# then a '$' will be shown next to the branch name.
|
||||
#
|
||||
# If you would like to see if there're untracked files, then you can set
|
||||
# GIT_PS1_SHOWUNTRACKEDFILES to a nonempty value. If there're untracked
|
||||
# files, then a '%' will be shown next to the branch name. You can
|
||||
# configure this per-repository with the bash.showUntrackedFiles
|
||||
# variable, which defaults to true once GIT_PS1_SHOWUNTRACKEDFILES is
|
||||
# enabled.
|
||||
#
|
||||
# If you would like to see the difference between HEAD and its upstream,
|
||||
# set GIT_PS1_SHOWUPSTREAM="auto". A "<" indicates you are behind, ">"
|
||||
# indicates you are ahead, "<>" indicates you have diverged and "="
|
||||
# indicates that there is no difference. You can further control
|
||||
# behaviour by setting GIT_PS1_SHOWUPSTREAM to a space-separated list
|
||||
# of values:
|
||||
#
|
||||
# verbose show number of commits ahead/behind (+/-) upstream
|
||||
# name if verbose, then also show the upstream abbrev name
|
||||
# legacy don't use the '--count' option available in recent
|
||||
# versions of git-rev-list
|
||||
# git always compare HEAD to @{upstream}
|
||||
# svn always compare HEAD to your SVN upstream
|
||||
#
|
||||
# By default, __git_ps1 will compare HEAD to your SVN upstream if it can
|
||||
# find one, or @{upstream} otherwise. Once you have set
|
||||
# GIT_PS1_SHOWUPSTREAM, you can override it on a per-repository basis by
|
||||
# setting the bash.showUpstream config variable.
|
||||
#
|
||||
# You can change the separator between the branch name and the above
|
||||
# state symbols by setting GIT_PS1_STATESEPARATOR. The default separator
|
||||
# is SP.
|
||||
#
|
||||
# When there is an in-progress operation such as a merge, rebase,
|
||||
# revert, cherry-pick, or bisect, the prompt will include information
|
||||
# related to the operation, often in the form "|<OPERATION-NAME>".
|
||||
#
|
||||
# When the repository has a sparse-checkout, a notification of the form
|
||||
# "|SPARSE" will be included in the prompt. This can be shortened to a
|
||||
# single '?' character by setting GIT_PS1_COMPRESSSPARSESTATE, or omitted
|
||||
# by setting GIT_PS1_OMITSPARSESTATE.
|
||||
#
|
||||
# If you would like to see a notification on the prompt when there are
|
||||
# unresolved conflicts, set GIT_PS1_SHOWCONFLICTSTATE to "yes". The
|
||||
# prompt will include "|CONFLICT".
|
||||
#
|
||||
# If you would like to see more information about the identity of
|
||||
# commits checked out as a detached HEAD, set GIT_PS1_DESCRIBE_STYLE
|
||||
# to one of these values:
|
||||
#
|
||||
# contains relative to newer annotated tag (v1.6.3.2~35)
|
||||
# branch relative to newer tag or branch (master~4)
|
||||
# describe relative to older annotated tag (v1.6.3.1-13-gdd42c2f)
|
||||
# tag relative to any older tag (v1.6.3.1-13-gdd42c2f)
|
||||
# default exactly matching tag
|
||||
#
|
||||
# If you would like a colored hint about the current dirty state, set
|
||||
# GIT_PS1_SHOWCOLORHINTS to a nonempty value. The colors are based on
|
||||
# the colored output of "git status -sb".
|
||||
#
|
||||
# If you would like __git_ps1 to do nothing in the case when the current
|
||||
# directory is set up to be ignored by git, then set
|
||||
# GIT_PS1_HIDE_IF_PWD_IGNORED to a nonempty value. Override this on the
|
||||
# repository level by setting bash.hideIfPwdIgnored to "false".
|
||||
|
||||
# check whether printf supports -v
|
||||
__git_printf_supports_v=
|
||||
printf -v __git_printf_supports_v -- '%s' yes >/dev/null 2>&1
|
||||
|
||||
# stores the divergence from upstream in $p
|
||||
# used by GIT_PS1_SHOWUPSTREAM
|
||||
__git_ps1_show_upstream ()
|
||||
{
|
||||
local key value
|
||||
local svn_remote svn_url_pattern count n
|
||||
local upstream_type=git legacy="" verbose="" name=""
|
||||
|
||||
svn_remote=()
|
||||
# get some config options from git-config
|
||||
local output="$(git config -z --get-regexp '^(svn-remote\..*\.url|bash\.showupstream)$' 2>/dev/null | tr '\0\n' '\n ')"
|
||||
while read -r key value; do
|
||||
case "$key" in
|
||||
bash.showupstream)
|
||||
GIT_PS1_SHOWUPSTREAM="$value"
|
||||
if [[ -z "${GIT_PS1_SHOWUPSTREAM}" ]]; then
|
||||
p=""
|
||||
return
|
||||
fi
|
||||
;;
|
||||
svn-remote.*.url)
|
||||
svn_remote[$((${#svn_remote[@]} + 1))]="$value"
|
||||
svn_url_pattern="$svn_url_pattern\\|$value"
|
||||
upstream_type=svn+git # default upstream type is SVN if available, else git
|
||||
;;
|
||||
esac
|
||||
done <<< "$output"
|
||||
|
||||
# parse configuration values
|
||||
local option
|
||||
for option in ${GIT_PS1_SHOWUPSTREAM-}; do
|
||||
case "$option" in
|
||||
git|svn) upstream_type="$option" ;;
|
||||
verbose) verbose=1 ;;
|
||||
legacy) legacy=1 ;;
|
||||
name) name=1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Find our upstream type
|
||||
case "$upstream_type" in
|
||||
git) upstream_type="@{upstream}" ;;
|
||||
svn*)
|
||||
# get the upstream from the "git-svn-id: ..." in a commit message
|
||||
# (git-svn uses essentially the same procedure internally)
|
||||
local -a svn_upstream
|
||||
svn_upstream=($(git log --first-parent -1 \
|
||||
--grep="^git-svn-id: \(${svn_url_pattern#??}\)" 2>/dev/null))
|
||||
if [[ 0 -ne ${#svn_upstream[@]} ]]; then
|
||||
svn_upstream=${svn_upstream[${#svn_upstream[@]} - 2]}
|
||||
svn_upstream=${svn_upstream%@*}
|
||||
local n_stop="${#svn_remote[@]}"
|
||||
for ((n=1; n <= n_stop; n++)); do
|
||||
svn_upstream=${svn_upstream#${svn_remote[$n]}}
|
||||
done
|
||||
|
||||
if [[ -z "$svn_upstream" ]]; then
|
||||
# default branch name for checkouts with no layout:
|
||||
upstream_type=${GIT_SVN_ID:-git-svn}
|
||||
else
|
||||
upstream_type=${svn_upstream#/}
|
||||
fi
|
||||
elif [[ "svn+git" = "$upstream_type" ]]; then
|
||||
upstream_type="@{upstream}"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# Find how many commits we are ahead/behind our upstream
|
||||
if [[ -z "$legacy" ]]; then
|
||||
count="$(git rev-list --count --left-right \
|
||||
"$upstream_type"...HEAD 2>/dev/null)"
|
||||
else
|
||||
# produce equivalent output to --count for older versions of git
|
||||
local commits
|
||||
if commits="$(git rev-list --left-right "$upstream_type"...HEAD 2>/dev/null)"
|
||||
then
|
||||
local commit behind=0 ahead=0
|
||||
for commit in $commits
|
||||
do
|
||||
case "$commit" in
|
||||
"<"*) ((behind++)) ;;
|
||||
*) ((ahead++)) ;;
|
||||
esac
|
||||
done
|
||||
count="$behind $ahead"
|
||||
else
|
||||
count=""
|
||||
fi
|
||||
fi
|
||||
|
||||
# calculate the result
|
||||
if [[ -z "$verbose" ]]; then
|
||||
case "$count" in
|
||||
"") # no upstream
|
||||
p="" ;;
|
||||
"0 0") # equal to upstream
|
||||
p="=" ;;
|
||||
"0 "*) # ahead of upstream
|
||||
p=">" ;;
|
||||
*" 0") # behind upstream
|
||||
p="<" ;;
|
||||
*) # diverged from upstream
|
||||
p="<>" ;;
|
||||
esac
|
||||
else # verbose, set upstream instead of p
|
||||
case "$count" in
|
||||
"") # no upstream
|
||||
upstream="" ;;
|
||||
"0 0") # equal to upstream
|
||||
upstream="|u=" ;;
|
||||
"0 "*) # ahead of upstream
|
||||
upstream="|u+${count#0 }" ;;
|
||||
*" 0") # behind upstream
|
||||
upstream="|u-${count% 0}" ;;
|
||||
*) # diverged from upstream
|
||||
upstream="|u+${count#* }-${count% *}" ;;
|
||||
esac
|
||||
if [[ -n "$count" && -n "$name" ]]; then
|
||||
__git_ps1_upstream_name=$(git rev-parse \
|
||||
--abbrev-ref "$upstream_type" 2>/dev/null)
|
||||
if [ $pcmode = yes ] && [ $ps1_expanded = yes ]; then
|
||||
upstream="$upstream \${__git_ps1_upstream_name}"
|
||||
else
|
||||
upstream="$upstream ${__git_ps1_upstream_name}"
|
||||
# not needed anymore; keep user's
|
||||
# environment clean
|
||||
unset __git_ps1_upstream_name
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
# Helper function that is meant to be called from __git_ps1. It
|
||||
# injects color codes into the appropriate gitstring variables used
|
||||
# to build a gitstring. Colored variables are responsible for clearing
|
||||
# their own color.
|
||||
__git_ps1_colorize_gitstring ()
|
||||
{
|
||||
if [[ -n ${ZSH_VERSION-} ]]; then
|
||||
local c_red='%F{red}'
|
||||
local c_green='%F{green}'
|
||||
local c_lblue='%F{blue}'
|
||||
local c_clear='%f'
|
||||
else
|
||||
# Using \001 and \002 around colors is necessary to prevent
|
||||
# issues with command line editing/browsing/completion!
|
||||
local c_red=$'\001\e[31m\002'
|
||||
local c_green=$'\001\e[32m\002'
|
||||
local c_lblue=$'\001\e[1;34m\002'
|
||||
local c_clear=$'\001\e[0m\002'
|
||||
fi
|
||||
local bad_color=$c_red
|
||||
local ok_color=$c_green
|
||||
local flags_color="$c_lblue"
|
||||
|
||||
local branch_color=""
|
||||
if [ $detached = no ]; then
|
||||
branch_color="$ok_color"
|
||||
else
|
||||
branch_color="$bad_color"
|
||||
fi
|
||||
if [ -n "$c" ]; then
|
||||
c="$branch_color$c$c_clear"
|
||||
fi
|
||||
b="$branch_color$b$c_clear"
|
||||
|
||||
if [ -n "$w" ]; then
|
||||
w="$bad_color$w$c_clear"
|
||||
fi
|
||||
if [ -n "$i" ]; then
|
||||
i="$ok_color$i$c_clear"
|
||||
fi
|
||||
if [ -n "$s" ]; then
|
||||
s="$flags_color$s$c_clear"
|
||||
fi
|
||||
if [ -n "$u" ]; then
|
||||
u="$bad_color$u$c_clear"
|
||||
fi
|
||||
}
|
||||
|
||||
# Helper function to read the first line of a file into a variable.
|
||||
# __git_eread requires 2 arguments, the file path and the name of the
|
||||
# variable, in that order.
|
||||
__git_eread ()
|
||||
{
|
||||
test -r "$1" && IFS=$'\r\n' read -r "$2" <"$1"
|
||||
}
|
||||
|
||||
# see if a cherry-pick or revert is in progress, if the user has committed a
|
||||
# conflict resolution with 'git commit' in the middle of a sequence of picks or
|
||||
# reverts then CHERRY_PICK_HEAD/REVERT_HEAD will not exist so we have to read
|
||||
# the todo file.
|
||||
__git_sequencer_status ()
|
||||
{
|
||||
local todo
|
||||
if test -f "$g/CHERRY_PICK_HEAD"
|
||||
then
|
||||
r="|CHERRY-PICKING"
|
||||
return 0;
|
||||
elif test -f "$g/REVERT_HEAD"
|
||||
then
|
||||
r="|REVERTING"
|
||||
return 0;
|
||||
elif __git_eread "$g/sequencer/todo" todo
|
||||
then
|
||||
case "$todo" in
|
||||
p[\ \ ]|pick[\ \ ]*)
|
||||
r="|CHERRY-PICKING"
|
||||
return 0
|
||||
;;
|
||||
revert[\ \ ]*)
|
||||
r="|REVERTING"
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
# __git_ps1 accepts 0 or 1 arguments (i.e., format string)
|
||||
# when called from PS1 using command substitution
|
||||
# in this mode it prints text to add to bash PS1 prompt (includes branch name)
|
||||
#
|
||||
# __git_ps1 requires 2 or 3 arguments when called from PROMPT_COMMAND (pc)
|
||||
# in that case it _sets_ PS1. The arguments are parts of a PS1 string.
|
||||
# when two arguments are given, the first is prepended and the second appended
|
||||
# to the state string when assigned to PS1.
|
||||
# The optional third parameter will be used as printf format string to further
|
||||
# customize the output of the git-status string.
|
||||
# In this mode you can request colored hints using GIT_PS1_SHOWCOLORHINTS=true
|
||||
__git_ps1 ()
|
||||
{
|
||||
# preserve exit status
|
||||
local exit=$?
|
||||
local pcmode=no
|
||||
local detached=no
|
||||
local ps1pc_start='\u@\h:\w '
|
||||
local ps1pc_end='\$ '
|
||||
local printf_format=' (%s)'
|
||||
|
||||
case "$#" in
|
||||
2|3) pcmode=yes
|
||||
ps1pc_start="$1"
|
||||
ps1pc_end="$2"
|
||||
printf_format="${3:-$printf_format}"
|
||||
# set PS1 to a plain prompt so that we can
|
||||
# simply return early if the prompt should not
|
||||
# be decorated
|
||||
PS1="$ps1pc_start$ps1pc_end"
|
||||
;;
|
||||
0|1) printf_format="${1:-$printf_format}"
|
||||
;;
|
||||
*) return $exit
|
||||
;;
|
||||
esac
|
||||
|
||||
# ps1_expanded: This variable is set to 'yes' if the shell
|
||||
# subjects the value of PS1 to parameter expansion:
|
||||
#
|
||||
# * bash does unless the promptvars option is disabled
|
||||
# * zsh does not unless the PROMPT_SUBST option is set
|
||||
# * POSIX shells always do
|
||||
#
|
||||
# If the shell would expand the contents of PS1 when drawing
|
||||
# the prompt, a raw ref name must not be included in PS1.
|
||||
# This protects the user from arbitrary code execution via
|
||||
# specially crafted ref names. For example, a ref named
|
||||
# 'refs/heads/$(IFS=_;cmd=sudo_rm_-rf_/;$cmd)' might cause the
|
||||
# shell to execute 'sudo rm -rf /' when the prompt is drawn.
|
||||
#
|
||||
# Instead, the ref name should be placed in a separate global
|
||||
# variable (in the __git_ps1_* namespace to avoid colliding
|
||||
# with the user's environment) and that variable should be
|
||||
# referenced from PS1. For example:
|
||||
#
|
||||
# __git_ps1_foo=$(do_something_to_get_ref_name)
|
||||
# PS1="...stuff...\${__git_ps1_foo}...stuff..."
|
||||
#
|
||||
# If the shell does not expand the contents of PS1, the raw
|
||||
# ref name must be included in PS1.
|
||||
#
|
||||
# The value of this variable is only relevant when in pcmode.
|
||||
#
|
||||
# Assume that the shell follows the POSIX specification and
|
||||
# expands PS1 unless determined otherwise. (This is more
|
||||
# likely to be correct if the user has a non-bash, non-zsh
|
||||
# shell and safer than the alternative if the assumption is
|
||||
# incorrect.)
|
||||
#
|
||||
local ps1_expanded=yes
|
||||
[ -z "${ZSH_VERSION-}" ] || [[ -o PROMPT_SUBST ]] || ps1_expanded=no
|
||||
[ -z "${BASH_VERSION-}" ] || shopt -q promptvars || ps1_expanded=no
|
||||
|
||||
local repo_info rev_parse_exit_code
|
||||
repo_info="$(git rev-parse --git-dir --is-inside-git-dir \
|
||||
--is-bare-repository --is-inside-work-tree --show-ref-format \
|
||||
--short HEAD 2>/dev/null)"
|
||||
rev_parse_exit_code="$?"
|
||||
|
||||
if [ -z "$repo_info" ]; then
|
||||
return $exit
|
||||
fi
|
||||
|
||||
local short_sha=""
|
||||
if [ "$rev_parse_exit_code" = "0" ]; then
|
||||
short_sha="${repo_info##*$'\n'}"
|
||||
repo_info="${repo_info%$'\n'*}"
|
||||
fi
|
||||
local ref_format="${repo_info##*$'\n'}"
|
||||
repo_info="${repo_info%$'\n'*}"
|
||||
local inside_worktree="${repo_info##*$'\n'}"
|
||||
repo_info="${repo_info%$'\n'*}"
|
||||
local bare_repo="${repo_info##*$'\n'}"
|
||||
repo_info="${repo_info%$'\n'*}"
|
||||
local inside_gitdir="${repo_info##*$'\n'}"
|
||||
local g="${repo_info%$'\n'*}"
|
||||
|
||||
if [ "true" = "$inside_worktree" ] &&
|
||||
[ -n "${GIT_PS1_HIDE_IF_PWD_IGNORED-}" ] &&
|
||||
[ "$(git config --bool bash.hideIfPwdIgnored)" != "false" ] &&
|
||||
git check-ignore -q .
|
||||
then
|
||||
return $exit
|
||||
fi
|
||||
|
||||
local sparse=""
|
||||
if [ -z "${GIT_PS1_COMPRESSSPARSESTATE-}" ] &&
|
||||
[ -z "${GIT_PS1_OMITSPARSESTATE-}" ] &&
|
||||
[ "$(git config --bool core.sparseCheckout)" = "true" ]; then
|
||||
sparse="|SPARSE"
|
||||
fi
|
||||
|
||||
local r=""
|
||||
local b=""
|
||||
local step=""
|
||||
local total=""
|
||||
if [ -d "$g/rebase-merge" ]; then
|
||||
__git_eread "$g/rebase-merge/head-name" b
|
||||
__git_eread "$g/rebase-merge/msgnum" step
|
||||
__git_eread "$g/rebase-merge/end" total
|
||||
r="|REBASE"
|
||||
else
|
||||
if [ -d "$g/rebase-apply" ]; then
|
||||
__git_eread "$g/rebase-apply/next" step
|
||||
__git_eread "$g/rebase-apply/last" total
|
||||
if [ -f "$g/rebase-apply/rebasing" ]; then
|
||||
__git_eread "$g/rebase-apply/head-name" b
|
||||
r="|REBASE"
|
||||
elif [ -f "$g/rebase-apply/applying" ]; then
|
||||
r="|AM"
|
||||
else
|
||||
r="|AM/REBASE"
|
||||
fi
|
||||
elif [ -f "$g/MERGE_HEAD" ]; then
|
||||
r="|MERGING"
|
||||
elif __git_sequencer_status; then
|
||||
:
|
||||
elif [ -f "$g/BISECT_LOG" ]; then
|
||||
r="|BISECTING"
|
||||
fi
|
||||
|
||||
if [ -n "$b" ]; then
|
||||
:
|
||||
elif [ -h "$g/HEAD" ]; then
|
||||
# symlink symbolic ref
|
||||
b="$(git symbolic-ref HEAD 2>/dev/null)"
|
||||
else
|
||||
local head=""
|
||||
|
||||
case "$ref_format" in
|
||||
files)
|
||||
if ! __git_eread "$g/HEAD" head; then
|
||||
return $exit
|
||||
fi
|
||||
|
||||
if [[ $head == "ref: "* ]]; then
|
||||
head="${head#ref: }"
|
||||
else
|
||||
head=""
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
head="$(git symbolic-ref HEAD 2>/dev/null)"
|
||||
;;
|
||||
esac
|
||||
|
||||
if test -z "$head"; then
|
||||
detached=yes
|
||||
b="$(
|
||||
case "${GIT_PS1_DESCRIBE_STYLE-}" in
|
||||
(contains)
|
||||
git describe --contains HEAD ;;
|
||||
(branch)
|
||||
git describe --contains --all HEAD ;;
|
||||
(tag)
|
||||
git describe --tags HEAD ;;
|
||||
(describe)
|
||||
git describe HEAD ;;
|
||||
(* | default)
|
||||
git describe --tags --exact-match HEAD ;;
|
||||
esac 2>/dev/null)" ||
|
||||
|
||||
b="$short_sha..."
|
||||
b="($b)"
|
||||
else
|
||||
b="$head"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$step" ] && [ -n "$total" ]; then
|
||||
r="$r $step/$total"
|
||||
fi
|
||||
|
||||
local conflict="" # state indicator for unresolved conflicts
|
||||
if [[ "${GIT_PS1_SHOWCONFLICTSTATE-}" == "yes" ]] &&
|
||||
[[ $(git ls-files --unmerged 2>/dev/null) ]]; then
|
||||
conflict="|CONFLICT"
|
||||
fi
|
||||
|
||||
local w=""
|
||||
local i=""
|
||||
local s=""
|
||||
local u=""
|
||||
local h=""
|
||||
local c=""
|
||||
local p="" # short version of upstream state indicator
|
||||
local upstream="" # verbose version of upstream state indicator
|
||||
|
||||
if [ "true" = "$inside_gitdir" ]; then
|
||||
if [ "true" = "$bare_repo" ]; then
|
||||
c="BARE:"
|
||||
else
|
||||
b="GIT_DIR!"
|
||||
fi
|
||||
elif [ "true" = "$inside_worktree" ]; then
|
||||
if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ] &&
|
||||
[ "$(git config --bool bash.showDirtyState)" != "false" ]
|
||||
then
|
||||
git diff --no-ext-diff --quiet || w="*"
|
||||
git diff --no-ext-diff --cached --quiet || i="+"
|
||||
if [ -z "$short_sha" ] && [ -z "$i" ]; then
|
||||
i="#"
|
||||
fi
|
||||
fi
|
||||
if [ -n "${GIT_PS1_SHOWSTASHSTATE-}" ] &&
|
||||
git rev-parse --verify --quiet refs/stash >/dev/null
|
||||
then
|
||||
s="$"
|
||||
fi
|
||||
|
||||
if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ] &&
|
||||
[ "$(git config --bool bash.showUntrackedFiles)" != "false" ] &&
|
||||
git ls-files --others --exclude-standard --directory --no-empty-directory --error-unmatch -- ':/*' >/dev/null 2>/dev/null
|
||||
then
|
||||
u="%${ZSH_VERSION+%}"
|
||||
fi
|
||||
|
||||
if [ -n "${GIT_PS1_COMPRESSSPARSESTATE-}" ] &&
|
||||
[ "$(git config --bool core.sparseCheckout)" = "true" ]; then
|
||||
h="?"
|
||||
fi
|
||||
|
||||
if [ -n "${GIT_PS1_SHOWUPSTREAM-}" ]; then
|
||||
__git_ps1_show_upstream
|
||||
fi
|
||||
fi
|
||||
|
||||
local z="${GIT_PS1_STATESEPARATOR-" "}"
|
||||
|
||||
b=${b##refs/heads/}
|
||||
if [ $pcmode = yes ] && [ $ps1_expanded = yes ]; then
|
||||
__git_ps1_branch_name=$b
|
||||
b="\${__git_ps1_branch_name}"
|
||||
fi
|
||||
|
||||
if [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then
|
||||
__git_ps1_colorize_gitstring
|
||||
fi
|
||||
|
||||
local f="$h$w$i$s$u$p"
|
||||
local gitstring="$c$b${f:+$z$f}${sparse}$r${upstream}${conflict}"
|
||||
|
||||
if [ $pcmode = yes ]; then
|
||||
if [ "${__git_printf_supports_v-}" != yes ]; then
|
||||
gitstring=$(printf -- "$printf_format" "$gitstring")
|
||||
else
|
||||
printf -v gitstring -- "$printf_format" "$gitstring"
|
||||
fi
|
||||
PS1="$ps1pc_start$gitstring$ps1pc_end"
|
||||
else
|
||||
printf -- "$printf_format" "$gitstring"
|
||||
fi
|
||||
|
||||
return $exit
|
||||
}
|
||||
@@ -7,7 +7,10 @@
|
||||
- link:
|
||||
~/.tmux.conf: tmux.conf
|
||||
~/.vim: vim
|
||||
~/.zshrc: zsh/zshrc
|
||||
~/.zshrc: shell/zsh/zshrc
|
||||
~/.bashrc: shell/bash/bashrc
|
||||
~/.config/nvim: nvim
|
||||
~/.config/alacritty: alacritty
|
||||
|
||||
- asdf:
|
||||
- plugin: vim
|
||||
|
||||
3
nvim/after/ftplugin/cue.lua
Normal file
3
nvim/after/ftplugin/cue.lua
Normal file
@@ -0,0 +1,3 @@
|
||||
vim.opt_local.tabstop = 4
|
||||
vim.opt_local.shiftwidth = 4
|
||||
vim.opt_local.expandtab = false
|
||||
1
nvim/after/ftplugin/go.lua
Normal file
1
nvim/after/ftplugin/go.lua
Normal file
@@ -0,0 +1 @@
|
||||
vim.cmd [[autocmd BufWritePre *.go lua vim.lsp.buf.format()]]
|
||||
14
nvim/after/ftplugin/javascriptreact.lua
Normal file
14
nvim/after/ftplugin/javascriptreact.lua
Normal file
@@ -0,0 +1,14 @@
|
||||
vim.opt_local.tabstop = 2
|
||||
vim.opt_local.shiftwidth = 2
|
||||
vim.opt_local.softtabstop = 2
|
||||
vim.opt_local.expandtab = true
|
||||
-- vim.api.nvim_create_autocmd("FileType", {
|
||||
-- pattern = { "javascript", "javascriptreact" },
|
||||
-- callback = function()
|
||||
-- -- Your JS/JSX settings here
|
||||
-- vim.bo.tabstop = 2
|
||||
-- vim.bo.shiftwidth = 2
|
||||
-- vim.bo.softtabstop = 2
|
||||
-- vim.bo.expandtab = true
|
||||
-- end
|
||||
-- })
|
||||
7
nvim/after/ftplugin/json.lua
Normal file
7
nvim/after/ftplugin/json.lua
Normal file
@@ -0,0 +1,7 @@
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
pattern = "*.json",
|
||||
callback = function()
|
||||
-- vim.cmd([[%!jq . 2>/dev/null || cat]])
|
||||
vim.cmd([[%!jq . ]])
|
||||
end,
|
||||
})
|
||||
4
nvim/after/ftplugin/lua.lua
Normal file
4
nvim/after/ftplugin/lua.lua
Normal file
@@ -0,0 +1,4 @@
|
||||
vim.opt_local.tabstop = 2
|
||||
vim.opt_local.shiftwidth = 2
|
||||
vim.opt_local.softtabstop = 2
|
||||
vim.opt_local.expandtab = true
|
||||
4
nvim/after/ftplugin/nix.lua
Normal file
4
nvim/after/ftplugin/nix.lua
Normal file
@@ -0,0 +1,4 @@
|
||||
vim.opt_local.tabstop = 2
|
||||
vim.opt_local.shiftwidth = 2
|
||||
vim.opt_local.softtabstop = 2
|
||||
vim.opt_local.expandtab = true
|
||||
5
nvim/init.lua
Normal file
5
nvim/init.lua
Normal file
@@ -0,0 +1,5 @@
|
||||
require("funcs")
|
||||
require("options")
|
||||
require("keymap")
|
||||
require("plugins/init")
|
||||
require("lsp-config")
|
||||
21
nvim/lazy-lock.json
Normal file
21
nvim/lazy-lock.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "3d5bced1b9ae69fa3f9b1942e28af5dbc537f946" },
|
||||
"avante.nvim": { "branch": "main", "commit": "2fc63d4128d2dc2fef0913c7480b4586959ebe4e" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" },
|
||||
"cmp-path": { "branch": "main", "commit": "e52e640b7befd8113b3350f46e8cfcfe98fcf730" },
|
||||
"codecompanion.nvim": { "branch": "main", "commit": "e23e8e5a5643b089607f21f576f6e63174cc44dc" },
|
||||
"fzf-lua": { "branch": "main", "commit": "4ee42b241e57b77b4f3c61a018f496219f246901" },
|
||||
"github-theme": { "branch": "main", "commit": "c106c9472154d6b2c74b74565616b877ae8ed31d" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "bb3a17efc797c34c054463174e5522442576ebd8" },
|
||||
"mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" },
|
||||
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
||||
"outline.nvim": { "branch": "main", "commit": "0eb9289ab39c91caf8b3ed0e3a17764809d69558" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
||||
"telescope-file-browser.nvim": { "branch": "master", "commit": "7bf55ed0ff5be182ad3301cff266581fc1c56cce" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
|
||||
}
|
||||
25
nvim/lsp/basedpyright.lua
Normal file
25
nvim/lsp/basedpyright.lua
Normal file
@@ -0,0 +1,25 @@
|
||||
return {
|
||||
cmd = { 'basedpyright-langserver', '--stdio' },
|
||||
filetypes = { 'python' },
|
||||
root_markers = {
|
||||
'pyrightconfig.json',
|
||||
'ya.make',
|
||||
'pyproject.toml',
|
||||
'setup.py',
|
||||
'setup.cfg',
|
||||
'requirements.txt',
|
||||
'Pipfile',
|
||||
'.git',
|
||||
},
|
||||
settings = {
|
||||
python = {
|
||||
analysis = {
|
||||
autoSearchPaths = false,
|
||||
useLibraryCodeForTypes = true,
|
||||
diagnosticMode = 'openFilesOnly',
|
||||
include = {
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
25
nvim/lsp/bashls.lua
Normal file
25
nvim/lsp/bashls.lua
Normal file
@@ -0,0 +1,25 @@
|
||||
return {
|
||||
cmd = { 'bash-language-server', 'start' },
|
||||
filetypes = { 'bash', 'sh', 'zsh' },
|
||||
root_markers = { '.git', vim.uv.cwd() },
|
||||
settings = {
|
||||
bashIde = {
|
||||
globPattern = vim.env.GLOB_PATTERN or '*@(.sh|.inc|.bash|.command)',
|
||||
-- Modern formatting options (requires shfmt)
|
||||
tabSize = 2,
|
||||
insertSpaces = true,
|
||||
-- Enable comprehensive features like Ruby LSP
|
||||
enableSourceErrorDiagnostics = true,
|
||||
enableCodeLens = true,
|
||||
includeAllWorkspaceSymbols = true,
|
||||
-- Background analysis for better performance
|
||||
backgroundAnalysisMaxFiles = 500,
|
||||
-- ShellCheck integration for linting
|
||||
shellcheckPath = 'shellcheck',
|
||||
shellcheckArguments = {
|
||||
'--shell=bash',
|
||||
'--format=json',
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
20
nvim/lsp/gopls.lua
Normal file
20
nvim/lsp/gopls.lua
Normal file
@@ -0,0 +1,20 @@
|
||||
return {
|
||||
cmd = { "/home/dmchumak/.ya/tools/v3/gopls-linux/gopls" },
|
||||
filetypes = { "go", "gotempl", "gowork", "gomod" },
|
||||
root_markers = { "ya.make", "YAOWNERS", ".arcadia.root", ".cloudia.root", "go.work", "go.mod", ".git" },
|
||||
-- settings = {
|
||||
-- gopls = {
|
||||
-- completeUnimported = true,
|
||||
-- usePlaceholders = true,
|
||||
-- analyses = {
|
||||
-- unusedparams = true,
|
||||
-- },
|
||||
-- ["ui.inlayhint.hints"] = {
|
||||
-- compositeLiteralFields = true,
|
||||
-- constantValues = true,
|
||||
-- parameterNames = true,
|
||||
-- rangeVariableTypes = true,
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
}
|
||||
33
nvim/lsp/lua_ls.lua
Normal file
33
nvim/lsp/lua_ls.lua
Normal file
@@ -0,0 +1,33 @@
|
||||
return {
|
||||
cmd = { "lua-language-server" },
|
||||
root_markers = { ".luarc.json", ".git", "init.lua" },
|
||||
filetypes = { "lua" },
|
||||
settings = {
|
||||
Lua = {
|
||||
format = {
|
||||
enable = true,
|
||||
defaultConfig = {
|
||||
indent_style = "space",
|
||||
indent_size = "2",
|
||||
}
|
||||
},
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||
version = "LuaJIT",
|
||||
},
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global
|
||||
globals = { "vim" },
|
||||
},
|
||||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
library = vim.api.nvim_get_runtime_file("", true),
|
||||
},
|
||||
-- Do not send telemetry data containing a randomized but unique identifier
|
||||
telemetry = {
|
||||
enable = false,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
19
nvim/lua/funcs.lua
Normal file
19
nvim/lua/funcs.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
function Contains(list, element)
|
||||
for _, v in ipairs(list) do
|
||||
if element == v then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
---comment
|
||||
---@param list table
|
||||
---@param key string
|
||||
---@param value any
|
||||
---@return table
|
||||
function Append(list, key, value)
|
||||
local new_list = {unpack(list)}
|
||||
new_list[key] = value
|
||||
return new_list
|
||||
end
|
||||
5
nvim/lua/keymap.lua
Normal file
5
nvim/lua/keymap.lua
Normal file
@@ -0,0 +1,5 @@
|
||||
vim.g.mapleader = " "
|
||||
vim.keymap.set("n", "<space><space>", "<cmd> :noh<CR>", { desc = "Clear search highlighting" })
|
||||
|
||||
-- Find and replace visual selection using CTRL-r
|
||||
vim.keymap.set("v", "<C-r>", "\"hy:%s/<C-r>h//gc<left><left><left>")
|
||||
75
nvim/lua/lsp-config.lua
Normal file
75
nvim/lua/lsp-config.lua
Normal file
@@ -0,0 +1,75 @@
|
||||
require("mason").setup()
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = {
|
||||
'lua_ls',
|
||||
'gopls',
|
||||
'bashls',
|
||||
'basedpyright',
|
||||
},
|
||||
automatic_installation = true,
|
||||
automatic_enable = false
|
||||
})
|
||||
|
||||
local opts = { noremap = true, silent = true }
|
||||
local keymap = vim.keymap.set
|
||||
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
callback = function(ev)
|
||||
local bufnr = ev.buf
|
||||
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
||||
|
||||
local client = vim.lsp.get_client_by_id(ev.data.client_id)
|
||||
if not client then
|
||||
return
|
||||
end
|
||||
|
||||
local lsp = vim.lsp
|
||||
local function opt(desc, others)
|
||||
return vim.tbl_extend("force", bufopts, { desc = desc }, others or {})
|
||||
end
|
||||
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
keymap("n", "gD", lsp.buf.declaration, opt('[G]o to [d]eclaration'))
|
||||
keymap("n", "gd", lsp.buf.definition, opt("[G]o to [d]efinition"))
|
||||
keymap("n", "<leader>D", lsp.buf.type_definition, opt("Go to Type [D]efinition"))
|
||||
keymap("n", "K", lsp.buf.hover, bufopts)
|
||||
keymap("n", "gi", lsp.buf.implementation, opt("[G]o to [i]mplementation"))
|
||||
keymap("n", "gr", require'telescope.builtin'.lsp_references, opt("[G]o to [r]eferences"))
|
||||
keymap("n", "<C-k>", lsp.buf.signature_help, bufopts)
|
||||
keymap("n", "<leader>wa", lsp.buf.add_workspace_folder, bufopts)
|
||||
keymap("n", "<leader>wr", lsp.buf.remove_workspace_folder, bufopts)
|
||||
keymap("n", "<leader>wl", function()
|
||||
print(vim.inspect(lsp.buf.list_workspace_folders()))
|
||||
end, bufopts)
|
||||
keymap("n", "<leader>rn", lsp.buf.rename, opt("[l]sp [R]ename"))
|
||||
keymap("n", "<leader>lc", lsp.buf.code_action, opt("[l]sp [C]ode Action"))
|
||||
keymap("n", "<leader>lf", function()
|
||||
lsp.buf.format({
|
||||
async = true,
|
||||
})
|
||||
end, opt("[l]sp [f]ormat buffer"))
|
||||
end
|
||||
})
|
||||
|
||||
-- Add the border on hover and on signature help popup window
|
||||
vim.o.winborder = 'rounded'
|
||||
|
||||
-- Add border to the diagnostic popup window
|
||||
vim.diagnostic.config({
|
||||
virtual_text = {
|
||||
prefix = '■ ', -- Could be '●', '▎', 'x', '■', ,
|
||||
},
|
||||
signs = false, -- Show signs in the gutter
|
||||
underline = true,
|
||||
update_in_insert = false, -- Don't update diagnostics in insert mode
|
||||
severity_sort = true, -- Sort diagnostics by severity
|
||||
jump = { float = true },
|
||||
})
|
||||
|
||||
keymap("n", "<leader>e", vim.diagnostic.open_float, opts)
|
||||
keymap("n", "<leader>q", vim.diagnostic.setloclist, opts)
|
||||
|
||||
vim.lsp.enable("lua_ls")
|
||||
vim.lsp.enable("bashls")
|
||||
vim.lsp.enable("gopls")
|
||||
vim.lsp.enable("basedpyright")
|
||||
49
nvim/lua/options.lua
Normal file
49
nvim/lua/options.lua
Normal file
@@ -0,0 +1,49 @@
|
||||
vim.g.editorconfig = false
|
||||
IsYandex = Contains({"i113855042", "dmchumak-dev.sas.yp-c.yandex.net"}, vim.fn.hostname())
|
||||
|
||||
vim.g.mapleader = ' '
|
||||
vim.g.maplocalleader = ' '
|
||||
|
||||
-- case insensitive search
|
||||
vim.opt.ignorecase = true
|
||||
vim.opt.smartcase = true
|
||||
|
||||
-- show line numbers
|
||||
vim.opt.number = true
|
||||
vim.opt.relativenumber = false
|
||||
vim.opt.cursorline = true
|
||||
|
||||
-- show trailing whitespace
|
||||
vim.opt.list = true
|
||||
vim.opt.listchars = {
|
||||
tab = '▏ ',
|
||||
multispace = '▏ ',
|
||||
trail = '·',
|
||||
extends = '…',
|
||||
precedes = '…'
|
||||
}
|
||||
|
||||
vim.cmd([[match errorMsg /\s\+$/]])
|
||||
|
||||
-- Configuring movement between panes
|
||||
-- using Ctrl/Cmd-hjkl
|
||||
vim.keymap.set("n", "<C-h>", "<C-w>h")
|
||||
vim.keymap.set("n", "<C-j>", "<C-w>j")
|
||||
vim.keymap.set("n", "<C-k>", "<C-w>k")
|
||||
vim.keymap.set("n", "<C-l>", "<C-w>l")
|
||||
|
||||
-- Keymap to copy to system buffer
|
||||
vim.keymap.set('n','<leader>y','"+yy')
|
||||
vim.keymap.set('v','<leader>y','"+y')
|
||||
|
||||
-- Keymap to navigate between tabs
|
||||
vim.keymap.set('n', 'H', 'gT')
|
||||
vim.keymap.set('n', 'L', 'gt')
|
||||
|
||||
-- Makeing :W and :Q work same as :w and :q
|
||||
vim.cmd("command! -bar -nargs=* -complete=file -range=% -bang W <line1>,<line2>write<bang> <args>")
|
||||
vim.cmd("command! -bar -nargs=* -complete=file -range=% -bang Write <line1>,<line2>write<bang> <args>")
|
||||
vim.cmd("command! -bar -nargs=* -complete=file -range=% -bang Wq <line1>,<line2>wq<bang> <args>")
|
||||
vim.cmd("command! -bar -bang Q quit<bang>")
|
||||
vim.cmd("command! -bar -bang Qall qall<bang>")
|
||||
vim.cmd("command! -bar -bang Qa qall<bang>")
|
||||
37
nvim/lua/plugins/codecompanion.lua
Normal file
37
nvim/lua/plugins/codecompanion.lua
Normal file
@@ -0,0 +1,37 @@
|
||||
require("codecompanion").setup({
|
||||
strategies = {
|
||||
chat = {
|
||||
adapter = "deepseek",
|
||||
},
|
||||
inline = {
|
||||
adapter = "deepseek",
|
||||
},
|
||||
cmd = {
|
||||
adapter = "deepseek",
|
||||
}
|
||||
},
|
||||
adapters = {
|
||||
deepseek = function()
|
||||
return require("codecompanion.adapters").extend("deepseek", {
|
||||
env = {
|
||||
api_key = (function()
|
||||
local path = os.getenv("HOME") .. "/.config/deepseek_api_key"
|
||||
local file = io.open(path, "r")
|
||||
if not file then
|
||||
vim.notify("Deepseek API key not found at " .. path, vim.log.levels.WARN)
|
||||
return nil
|
||||
end
|
||||
local content = file:read("*a"):gsub("%s+", "")
|
||||
file:close()
|
||||
return content
|
||||
end)(),
|
||||
},
|
||||
schema = {
|
||||
model = {
|
||||
default = "deepseek-chat",
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
})
|
||||
62
nvim/lua/plugins/completions.lua
Normal file
62
nvim/lua/plugins/completions.lua
Normal file
@@ -0,0 +1,62 @@
|
||||
vim.opt.completeopt = { 'menu', 'menuone', 'noselect' }
|
||||
-- Set up nvim-cmp
|
||||
local cmp = require('cmp')
|
||||
local luasnip = require('luasnip')
|
||||
local select_opts = { behavior = cmp.SelectBehavior.Select }
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end
|
||||
},
|
||||
preselect = cmp.PreselectMode.None;
|
||||
window = {
|
||||
documentation = cmp.config.window.bordered(),
|
||||
completion = { border = 'rounded' }
|
||||
},
|
||||
formatting = {
|
||||
fields = { 'menu', 'abbr', 'kind' },
|
||||
format = function(entry, item)
|
||||
local menu_icon = {
|
||||
nvim_lsp = 'λ',
|
||||
luasnip = '⋗',
|
||||
buffer = 'Ω',
|
||||
path = '🖫',
|
||||
}
|
||||
|
||||
item.menu = menu_icon[entry.source.name]
|
||||
return item
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
-- Trigger completion menu with <Tab>
|
||||
['<Tab>'] = cmp.mapping(function(fallback)
|
||||
local col = vim.fn.col('.') - 1
|
||||
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item(select_opts)
|
||||
elseif col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then
|
||||
fallback()
|
||||
else
|
||||
cmp.complete()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
|
||||
-- Trigger completion menu with <C-Space>
|
||||
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }), -- Open completion menu
|
||||
|
||||
-- Navigate completion menu with <C-n> and <C-p>
|
||||
['<C-n>'] = cmp.mapping.select_next_item(), -- Next item
|
||||
['<C-p>'] = cmp.mapping.select_prev_item(), -- Previous item
|
||||
|
||||
-- Confirm selection with <CR> (Enter)
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Confirm selection
|
||||
},
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' }, -- LSP source
|
||||
{ name = 'buffer' }, -- Buffer source
|
||||
{ name = 'path' }, -- Path source
|
||||
{ name = 'luasnip' }, -- Path source
|
||||
}),
|
||||
})
|
||||
22
nvim/lua/plugins/gitsigns.lua
Normal file
22
nvim/lua/plugins/gitsigns.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
require('gitsigns').setup(
|
||||
{
|
||||
signs = {
|
||||
add = { text = '+' },
|
||||
change = { text = '~' },
|
||||
delete = { text = '-' },
|
||||
topdelete = { text = '▀' },
|
||||
changedelete = { text = '~' },
|
||||
untracked = { text = '┆' },
|
||||
},
|
||||
signs_staged = {
|
||||
add = { text = '+' },
|
||||
change = { text = '~' },
|
||||
delete = { text = '-' },
|
||||
topdelete = { text = '▀' },
|
||||
changedelete = { text = '~' },
|
||||
untracked = { text = '┆' },
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
vim.keymap.set('n', '<leader>vb', ':Gitsigns blame_line<CR>', {desc = "Blame current line (git/arc)"})
|
||||
134
nvim/lua/plugins/init.lua
Normal file
134
nvim/lua/plugins/init.lua
Normal file
@@ -0,0 +1,134 @@
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable", -- latest stable release
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
local plugins = {
|
||||
"williamboman/mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
{
|
||||
'projekt0n/github-nvim-theme',
|
||||
name = 'github-theme',
|
||||
lazy = false, -- make sure we load this during startup if it is your main colorscheme
|
||||
priority = 1000, -- make sure to load this before all the other start plugins
|
||||
config = function()
|
||||
require('github-theme').setup({
|
||||
-- ...
|
||||
})
|
||||
|
||||
-- vim.cmd('colorscheme github_light_colorblind')
|
||||
-- vim.cmd('colorscheme github_light')
|
||||
vim.cmd('colorscheme github_dark_colorblind')
|
||||
-- vim.cmd('colorscheme github_dark')
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvim-telescope/telescope-file-browser.nvim",
|
||||
dependencies = { "nvim-telescope/telescope.nvim", "nvim-lua/plenary.nvim" }
|
||||
},
|
||||
{
|
||||
'hrsh7th/nvim-cmp', -- Auto-completion plugin
|
||||
dependencies = {
|
||||
'hrsh7th/cmp-nvim-lsp', -- LSP source for nvim-cmp
|
||||
'hrsh7th/cmp-buffer', -- Buffer source for nvim-cmp
|
||||
'hrsh7th/cmp-path', -- Path source for nvim-cmp
|
||||
'L3MON4D3/LuaSnip',
|
||||
},
|
||||
},
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
preset = "modern",
|
||||
show_help = false, -- workaround for border glitch https://github.com/folke/which-key.nvim/issues/967#issuecomment-2842309305
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
"<leader>?",
|
||||
function()
|
||||
require("which-key").show({ global = false })
|
||||
end,
|
||||
desc = "Buffer Local Keymaps (which-key)",
|
||||
},
|
||||
},
|
||||
},
|
||||
-- GitSigns
|
||||
{
|
||||
(not IsYandex) and "lewis6991/gitsigns.nvim" or nil,
|
||||
dir = (IsYandex) and "~/arcadia/contrib/tier1/gitsigns.arc.nvim" or nil,
|
||||
},
|
||||
{
|
||||
"hedyhli/outline.nvim",
|
||||
lazy = true,
|
||||
cmd = { "Outline", "OutlineOpen" },
|
||||
keys = { -- Example mapping to toggle outline
|
||||
{ "<leader>o", "<cmd>Outline<CR>", desc = "Toggle outline" },
|
||||
},
|
||||
opts = {
|
||||
outline_window = {
|
||||
position = "left",
|
||||
}
|
||||
-- Your setup opts here
|
||||
},
|
||||
},
|
||||
{
|
||||
"olimorris/codecompanion.nvim",
|
||||
opts = {},
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
},
|
||||
},
|
||||
{
|
||||
"yetone/avante.nvim",
|
||||
build = vim.fn.has("win32") ~= 0
|
||||
and "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false"
|
||||
or "make",
|
||||
event = "VeryLazy",
|
||||
version = false, -- Never set this value to "*"! Never!
|
||||
---@module 'avante'
|
||||
---@type avante.Config
|
||||
opts = {
|
||||
provider = "yadeepseek",
|
||||
providers = {
|
||||
yadeepseek = {
|
||||
__inherited_from = "openai",
|
||||
api_key_name = "cmd:cat ~/.config/eliza_api_key",
|
||||
endpoint = "https://api.eliza.yandex.net/raw/internal/deepseek/v1",
|
||||
model = "deepseek-0324",
|
||||
},
|
||||
},
|
||||
},
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"MunifTanjim/nui.nvim",
|
||||
--- The below dependencies are optional,
|
||||
"nvim-telescope/telescope.nvim", -- for file_selector provider telescope
|
||||
"hrsh7th/nvim-cmp", -- autocompletion for avante commands and mentions
|
||||
"ibhagwan/fzf-lua", -- for file_selector provider fzf
|
||||
-- "stevearc/dressing.nvim", -- for input provider dressing
|
||||
-- "folke/snacks.nvim", -- for input provider snacks
|
||||
-- "nvim-tree/nvim-web-devicons", -- or echasnovski/mini.icons
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
require("lazy").setup(plugins)
|
||||
|
||||
vim.cmd([[
|
||||
set termguicolors
|
||||
hi Cursor guifg=red guibg=green
|
||||
set guicursor=n-v-c:block-Cursor/lCursor,i-ci-ve:ver25-Cursor/lCursor,r-cr:hor20-Cursor/lCursor,o:hor50-Cursor/lCursor,a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor,sm:block-blinkwait175-blinkoff150-blinkon175-Cursor/lCursor
|
||||
]])
|
||||
require("plugins/telescope")
|
||||
require("plugins/completions")
|
||||
require("plugins/gitsigns")
|
||||
require("plugins/codecompanion")
|
||||
20
nvim/lua/plugins/telescope.lua
Normal file
20
nvim/lua/plugins/telescope.lua
Normal file
@@ -0,0 +1,20 @@
|
||||
require("telescope").setup {
|
||||
extensions = {
|
||||
file_browser = {
|
||||
initial_mode = "normal",
|
||||
-- ...
|
||||
},
|
||||
},
|
||||
}
|
||||
require("telescope").load_extension "file_browser"
|
||||
-- require("telescope").load_extension "find_files"
|
||||
|
||||
-- vim.keymap.set("n", "<space>fb", ":Telescope file_browser<CR>")
|
||||
|
||||
-- open file_browser with the path of the current buffer
|
||||
vim.keymap.set("n", "<space>fb", ":Telescope file_browser path=%:p:h select_buffer=true<CR>")
|
||||
local builtin = require('telescope.builtin')
|
||||
vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc = 'Telescope find files' })
|
||||
vim.keymap.set('n', '<leader>fg', builtin.live_grep, { desc = 'Telescope live grep' })
|
||||
vim.keymap.set('n', '<leader>b', builtin.buffers, { desc = 'Telescope buffers' })
|
||||
vim.keymap.set('n', '<leader>fh', builtin.help_tags, { desc = 'Telescope help tags' })
|
||||
248
nvim/lua/ytils.lua
Normal file
248
nvim/lua/ytils.lua
Normal file
@@ -0,0 +1,248 @@
|
||||
local M = {}
|
||||
local NIL = "<NIL>"
|
||||
|
||||
local unpack = table.unpack or unpack
|
||||
|
||||
M.ARC_REPO_ROOT_ENV = "ARC_ROOT"
|
||||
|
||||
M._arc_repo_roots = {
|
||||
"/home/dmchumak/arcadia/",
|
||||
}
|
||||
|
||||
local is_windows = vim.loop.os_uname().version:match("Windows")
|
||||
|
||||
M.table = (function()
|
||||
-- finds the index of value in the table
|
||||
---@param t table
|
||||
---@param value any
|
||||
---@return integer?
|
||||
local function find(t, value)
|
||||
for ix, ix_value in ipairs(t) do
|
||||
if ix_value == value then
|
||||
return ix
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
return {
|
||||
find = find,
|
||||
}
|
||||
end)()
|
||||
|
||||
M.path = (function()
|
||||
-- stolen form
|
||||
-- https://github.com/neovim/nvim-lspconfig/tree/71b39616b14c152da34fcc787fa27f09bf280e72/lua/lspconfig/util.lua#L124
|
||||
local function is_fs_root(path)
|
||||
if is_windows then
|
||||
return path:match("^%a:$")
|
||||
else
|
||||
return path == "/"
|
||||
end
|
||||
end
|
||||
|
||||
-- stolen from https://github.com/neovim/nvim-lspconfig/tree/71b39616b14c152da34fcc787fa27f09bf280e72/lua/lspconfig/util.lua#L142
|
||||
---@param path string
|
||||
---@return string?
|
||||
local function dirname(path)
|
||||
local strip_dir_pat = "/([^/]+)$"
|
||||
local strip_sep_pat = "/$"
|
||||
if not path or #path == 0 then
|
||||
return
|
||||
end
|
||||
local result = path:gsub(strip_sep_pat, ""):gsub(strip_dir_pat, "")
|
||||
if #result == 0 then
|
||||
if is_windows then
|
||||
return path:sub(1, 2):upper()
|
||||
else
|
||||
return "/"
|
||||
end
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
return {
|
||||
is_fs_root = is_fs_root,
|
||||
dirname = dirname,
|
||||
}
|
||||
end)()
|
||||
|
||||
if os.getenv(M.ARC_REPO_ROOT_ENV) then
|
||||
table.insert(M._arc_repo_roots, 1, os.getenv(M.ARC_REPO_ROOT_ENV))
|
||||
end
|
||||
|
||||
function M.is_inside_arc(path)
|
||||
for _, prefix in ipairs(M._arc_repo_roots) do
|
||||
if path:find(prefix, 1, true) == 1 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
function M.is_ok_root_dir(path)
|
||||
-- local util = require("dgronskiy_nvim.util")
|
||||
|
||||
if M.path.is_fs_root(path) then
|
||||
return false
|
||||
end
|
||||
|
||||
if path == os.getenv("HOME") then
|
||||
return false
|
||||
end
|
||||
|
||||
-- No-Go's:
|
||||
-- * /data/a/trunk
|
||||
-- * /data/a/dev
|
||||
-- * /data/a/MLDWH-XXX
|
||||
local path_and_parent = { path, M.path.dirname(path) }
|
||||
for _, check_against in ipairs(M._arc_repo_roots) do
|
||||
if M.table.find(path_and_parent, check_against) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
-- TODO: move ok_root_dirs into global config file
|
||||
|
||||
-- root_dir function in terms of `lspconfig`. Get inspiration here:
|
||||
-- https://github.com/neovim/nvim-lspconfig/tree/bfdf2e91e7297a54bcc09d3e092a12bff69a1cf4/lua/lspconfig/util.lua#L268
|
||||
function M.guarded_pyright_root_directory(startpath)
|
||||
local is_inside_arc = M.is_inside_arc(startpath)
|
||||
local root_dir = nil
|
||||
|
||||
if is_inside_arc then
|
||||
local util = require("lspconfig.util")
|
||||
root_dir = util.root_pattern("pyrightconfig.json")(startpath)
|
||||
else
|
||||
-- use default from here
|
||||
-- https://github.com/neovim/nvim-lspconfig/blob/d1871c84b218931cc758dbbde1fec8e90c6d465c/lua/lspconfig/configs/pyright.lua#L47
|
||||
root_dir = require("lspconfig.configs.pyright").default_config.root_dir(startpath)
|
||||
end
|
||||
|
||||
local is_ok_root_dir = M.is_ok_root_dir(root_dir)
|
||||
root_dir = is_ok_root_dir and root_dir or nil
|
||||
|
||||
-- if not M.is_ok_root_dir(root_dir) then
|
||||
-- logger:warn("patching
|
||||
-- vim.notify(
|
||||
-- "Inside Arc="
|
||||
-- .. tostring(is_inside_arc)
|
||||
-- .. "\nFile= "
|
||||
-- .. startpath
|
||||
-- .. "\nRoot dir= "
|
||||
-- .. root_dir
|
||||
-- .. "\n\nPatching root_dir to nil"
|
||||
-- )
|
||||
-- root_dir = nil
|
||||
-- end
|
||||
return root_dir
|
||||
end
|
||||
|
||||
-- func! GetArcanumLink(mode)
|
||||
-- let l:root = system("arc root")
|
||||
-- let l:link = "https://a.yandex-team.ru/arc_vcs/" . expand("%:p")[len(l:root):]
|
||||
-- if a:mode == "normal"
|
||||
-- return l:link . "\\#L" . getcurpos()[1]
|
||||
-- else
|
||||
-- let l:start = getpos("'<")
|
||||
-- let l:finish = getpos("'>")
|
||||
-- return l:link . "\\#L" . l:start[1] . "-" . l:finish[1]
|
||||
-- endif
|
||||
-- endf
|
||||
|
||||
---comment
|
||||
---@return string? # nil in case of an error
|
||||
function M.GetArcRoot()
|
||||
local stdout = vim.fn.system("arc root 2>/dev/null")
|
||||
if vim.api.nvim_get_vvar("shell_error") ~= 0 then
|
||||
print(stdout)
|
||||
return
|
||||
end
|
||||
return stdout:gsub("\n", "")
|
||||
end
|
||||
|
||||
---
|
||||
---@param file_path string
|
||||
---@param arc_root string
|
||||
---@return string? # nil in case of en error
|
||||
function M.GetArcRelativePath(file_path, arc_root)
|
||||
if string.sub(arc_root, -1, -1) ~= "/" then
|
||||
arc_root = arc_root .. "/"
|
||||
end
|
||||
|
||||
if string.sub(file_path, 1, string.len(arc_root)) ~= arc_root then
|
||||
print(string.format("file_path [%s] is not in the repo [%s]", file_path, arc_root))
|
||||
return
|
||||
end
|
||||
|
||||
local file_relative_path = string.sub(file_path, string.len(arc_root) + 1)
|
||||
return file_relative_path
|
||||
end
|
||||
|
||||
---
|
||||
---@return string? # nil in case of an error
|
||||
function M.GetArcHeadCommit()
|
||||
local stdout = vim.fn.system("arc rev-parse HEAD 2>/dev/null")
|
||||
if vim.api.nvim_get_vvar("shell_error") ~= 0 then
|
||||
print(stdout)
|
||||
return
|
||||
end
|
||||
|
||||
return stdout:gsub("\n", "")
|
||||
end
|
||||
|
||||
---comment
|
||||
---@return string? # nil in case of an error
|
||||
function M.GetArcanumLink(opts)
|
||||
local url_lines_requester = (function(opts)
|
||||
local line1, line2
|
||||
if opts and opts.linerange then
|
||||
line1, line2 = unpack(opts.linerange)
|
||||
else
|
||||
line1 = vim.api.nvim_win_get_cursor(0)[1]
|
||||
line2 = line1
|
||||
end
|
||||
|
||||
-- print(vim.inspect(line1))
|
||||
|
||||
line1, line2 = math.min(line1, line2), math.max(line1, line2)
|
||||
if line1 == line2 then
|
||||
return "#L" .. tostring(line1)
|
||||
else
|
||||
return "#L" .. tostring(line1) .. "-" .. tostring(line2)
|
||||
end
|
||||
end)(opts)
|
||||
|
||||
local arc_root = M.GetArcRoot()
|
||||
if not arc_root then
|
||||
return
|
||||
end
|
||||
|
||||
local file_path = vim.fn.expand("%:p") ---@type string
|
||||
local file_relative_path = M.GetArcRelativePath(file_path, arc_root)
|
||||
if not file_relative_path then
|
||||
return
|
||||
end
|
||||
|
||||
local revision = M.GetArcHeadCommit()
|
||||
revision = revision and ("?rev=" .. revision) or ""
|
||||
|
||||
local url = "https://a.yandex-team.ru/arcadia/" .. file_relative_path .. revision .. url_lines_requester
|
||||
return url
|
||||
|
||||
-- return "https://a.yandex-team.ru/arcadia/" .. .. "#L"
|
||||
--?rev=r14586396#L10
|
||||
end
|
||||
|
||||
---@param link string
|
||||
---@return nil
|
||||
function M.ArcLinkOpen(link)
|
||||
-- https://a.yandex-team.ru/arcadia/ads/libs/py_rearrange/__init__.py#L96
|
||||
local prefix = "https://a.yandex-team.ru/arcadia"
|
||||
end
|
||||
|
||||
return M
|
||||
5
shell/alias.sh
Normal file
5
shell/alias.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
alias l="ls -lahG"
|
||||
alias lg="LANG=en_US-UTF-8 lazygit"
|
||||
alias v="vim"
|
||||
alias n="nvim"
|
||||
alias mac-listen="sudo lsof -iTCP -sTCP:LISTEN -n -P"
|
||||
25
shell/bash/bashrc
Normal file
25
shell/bash/bashrc
Normal file
@@ -0,0 +1,25 @@
|
||||
source ~/.dotfiles/git/git-prompt.sh
|
||||
source ~/.dotfiles/shell/alias.sh
|
||||
PROMPT_COMMAND='PS1_CMD1=$(__git_ps1 " [%s]")'; PS1='\[\e[38;5;117m\]\u\[\e[0m\] \w${PS1_CMD1}\$ '
|
||||
PATH="$PATH:~/go/bin"
|
||||
|
||||
#
|
||||
# tmux history preservation
|
||||
#
|
||||
|
||||
# Avoid duplicates
|
||||
HISTCONTROL=ignoredups:erasedups # Ubuntu default is ignoreboth
|
||||
# When the shell exits, append to the history file instead of overwriting it
|
||||
shopt -s histappend # In Ubuntu this is already set by default
|
||||
|
||||
# After each command, append to the history file and reread it
|
||||
PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r"
|
||||
|
||||
#
|
||||
# tmux autostart
|
||||
#
|
||||
# [[ $- == *i* ]] is to check if the current seession is interactive - https://superuser.com/a/1777888/136716
|
||||
if command -v tmux &> /dev/null && [ -n "$PS1" ] && [[ $- == *i* ]] && [[ ! "$TERM" =~ screen ]] && [[ ! "$TERM" =~ tmux ]] && [ -z "$TMUX" ]; then
|
||||
exec tmux new-session -As0
|
||||
fi
|
||||
|
||||
28
shell/zsh/zshrc
Normal file
28
shell/zsh/zshrc
Normal file
@@ -0,0 +1,28 @@
|
||||
source ~/.dotfiles/shell/alias.sh
|
||||
eval "$(/opt/homebrew/bin/brew shellenv)"
|
||||
if type brew &>/dev/null
|
||||
then
|
||||
FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}"
|
||||
|
||||
autoload -Uz compinit
|
||||
compinit
|
||||
fi
|
||||
|
||||
setopt appendhistory # Append history to the history file (no overwriting)
|
||||
setopt incappendhistory # Immediately append to the history file, not just when a term is killed
|
||||
setopt histignoredups
|
||||
|
||||
source ~/.dotfiles/git/git-prompt.sh
|
||||
setopt PROMPT_SUBST ; PS1='%n@%m %c$(__git_ps1 " [%s]")\$ '
|
||||
|
||||
if [ -f ~/.zshrc_local ]
|
||||
then
|
||||
source ~/.zshrc_local
|
||||
fi
|
||||
|
||||
# The next line updates PATH for CLI.
|
||||
if [ -f '/Users/dmchumak/yandex-cloud/path.bash.inc' ]; then source '/Users/dmchumak/yandex-cloud/path.bash.inc'; fi
|
||||
|
||||
# The next line enables shell command completion for yc.
|
||||
if [ -f '/Users/dmchumak/yandex-cloud/completion.zsh.inc' ]; then source '/Users/dmchumak/yandex-cloud/completion.zsh.inc'; fi
|
||||
|
||||
18
tmux.conf
18
tmux.conf
@@ -1,10 +1,13 @@
|
||||
set -g default-terminal "screen-256color"
|
||||
set -g default-terminal "xterm-256color"
|
||||
set-option -gas terminal-overrides "*:Tc"
|
||||
set-option -gas terminal-overrides "*:RGB"
|
||||
set -g mouse on
|
||||
set -g set-clipboard external
|
||||
set -g escape-time 10 # https://www.johnhawthorn.com/2012/09/vi-escape-delays/
|
||||
set -g history-limit 10000
|
||||
set-option -g status-position top
|
||||
set-window-option -g allow-rename off
|
||||
set allow-rename off
|
||||
set -g allow-rename off
|
||||
|
||||
# remap prefix from 'C-b' to 'C-x', 0x18 hex code for iterm2
|
||||
unbind C-b
|
||||
@@ -26,6 +29,10 @@ unbind %
|
||||
bind -n S-down new-window
|
||||
bind -n S-left prev
|
||||
bind -n S-right next
|
||||
# and for split-keyboard
|
||||
bind -n C-down new-window
|
||||
bind -n C-left prev
|
||||
bind -n C-right next
|
||||
|
||||
# resizing panes using Ctrl-Alt-arrows without prefix
|
||||
bind -n C-M-Up resize-pane -U 2
|
||||
@@ -64,7 +71,7 @@ bind -T copy-mode-emacs C-WheelDownPane send-keys -X halfpage-down
|
||||
# color status bar
|
||||
set -g status-style fg=white,bg=colour235
|
||||
# color of message bar
|
||||
set -g message-style fg=white,bold,bg=green
|
||||
set -g message-style fg=black,bold,bg=colour107
|
||||
|
||||
# highlight current window
|
||||
setw -g window-status-style fg=cyan,bg=colour235
|
||||
@@ -80,5 +87,10 @@ set -g pane-active-border-style fg=green,bg=default
|
||||
setw -g mode-keys vi
|
||||
# Update default binding of `Enter` to also use copy-pipe
|
||||
unbind -T copy-mode-vi Enter
|
||||
if-shell '[[ $(uname -s) = Linux ]]' {
|
||||
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xclip -selection c"
|
||||
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -in -selection clipboard"
|
||||
} {
|
||||
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "pbcopy"
|
||||
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "pbcopy"
|
||||
}
|
||||
|
||||
14
vim/coc-lsp/coc-settings-cloudia.json
Normal file
14
vim/coc-lsp/coc-settings-cloudia.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"inlayHints.enable": false,
|
||||
"pyright.inlayHints.functionReturnTypes": false,
|
||||
"pyright.inlayHints.variableTypes": false,
|
||||
"go.goplsOptions": {
|
||||
"standaloneTags": ["ignore"],
|
||||
"arcadiaIndexDirs": [
|
||||
"cli/",
|
||||
"api/",
|
||||
"gateway/"
|
||||
]
|
||||
},
|
||||
"go.goplsPath": "/Users/dmchumak/.ya/tools/v4/gopls-darwin-arm64/gopls"
|
||||
}
|
||||
12
vim/coc-lsp/coc-settings.json
Normal file
12
vim/coc-lsp/coc-settings.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"inlayHints.enable": false,
|
||||
"pyright.inlayHints.functionReturnTypes": false,
|
||||
"pyright.inlayHints.variableTypes": false,
|
||||
"languageserver": {
|
||||
"godot": {
|
||||
"host": "127.0.0.1",
|
||||
"filetypes": ["gdscript"],
|
||||
"port": 6005
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,6 +43,11 @@ nmap <silent> gy <Plug>(coc-type-definition)
|
||||
nmap <silent> gi <Plug>(coc-implementation)
|
||||
nmap <silent> gr <Plug>(coc-references)
|
||||
|
||||
" Remap keys for applying refactor code actions
|
||||
nmap <silent> <leader>re <Plug>(coc-codeaction-refactor)
|
||||
xmap <silent> <leader>r <Plug>(coc-codeaction-refactor-selected)
|
||||
nmap <silent> <leader>r <Plug>(coc-codeaction-refactor-selected)
|
||||
|
||||
"set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
|
||||
|
||||
" Applying codeAction to the selected region.
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"pyright.inlayHints.enable": false
|
||||
}
|
||||
8
vim/ftplugin/gdscript.vim
Normal file
8
vim/ftplugin/gdscript.vim
Normal file
@@ -0,0 +1,8 @@
|
||||
" to use folding provided by plugin
|
||||
setlocal foldmethod=expr
|
||||
setlocal shiftwidth=4
|
||||
setlocal tabstop=4
|
||||
nnoremap <buffer> <F4> :GodotRunLast<CR>
|
||||
nnoremap <buffer> <F5> :GodotRun<CR>
|
||||
nnoremap <buffer> <F6> :GodotRunCurrent<CR>
|
||||
nnoremap <buffer> <F7> :GodotRunFZF<CR>
|
||||
2
vim/ftplugin/go.vim
Normal file
2
vim/ftplugin/go.vim
Normal file
@@ -0,0 +1,2 @@
|
||||
let g:go_imports_autosave = 1
|
||||
" au BufWritePre,FileWritePre *.go :GoFmt
|
||||
25
vim/ftplugin/yaml.ansible.vim
Normal file
25
vim/ftplugin/yaml.ansible.vim
Normal file
@@ -0,0 +1,25 @@
|
||||
" vim-plug example
|
||||
"call plug#begin('~/.vim/bundle')
|
||||
"Plug 'pearofducks/ansible-vim'
|
||||
"call plug#end()
|
||||
|
||||
let g:ansible_goto_role_paths = './roles,../_common/roles'
|
||||
|
||||
function! FindAnsibleRoleUnderCursor()
|
||||
echo "test!"
|
||||
if exists("g:ansible_goto_role_paths")
|
||||
let l:role_paths = g:ansible_goto_role_paths
|
||||
else
|
||||
let l:role_paths = "./roles"
|
||||
endif
|
||||
let l:tasks_main = expand("<cfile>") . "/tasks/main.yml"
|
||||
let l:found_role_path = findfile(l:tasks_main, l:role_paths)
|
||||
if l:found_role_path == ""
|
||||
echo l:tasks_main . " not found"
|
||||
else
|
||||
execute "edit " . fnameescape(l:found_role_path)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
nnoremap <leader>gd :call FindAnsibleRoleUnderCursor()<CR>
|
||||
vnoremap <leader>gd :call FindAnsibleRoleUnderCursor()<CR>
|
||||
24
vim/vimrc
24
vim/vimrc
@@ -39,6 +39,8 @@ noremap <silent> <C-Down> :resize -3<CR>
|
||||
set backspace=indent,eol,start
|
||||
filetype plugin indent on
|
||||
|
||||
let hostname = substitute(system('hostname'), '\n', '', '')
|
||||
|
||||
if empty(glob('~/.vim/autoload/plug.vim')) "Если vim-plug не стоит
|
||||
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
|
||||
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||
@@ -57,12 +59,16 @@ call plug#begin('~/.vim/bundle') "Начать искать плагины в э
|
||||
Plug 'preservim/nerdtree'
|
||||
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
|
||||
Plug 'junegunn/fzf.vim'
|
||||
Plug 'justinmk/vim-sneak'
|
||||
|
||||
Plug 'towolf/vim-helm'
|
||||
Plug 'pearofducks/ansible-vim'
|
||||
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
||||
Plug 'elzr/vim-json'
|
||||
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
|
||||
Plug 'hashivim/vim-terraform'
|
||||
" Plug 'Exafunction/codeium.vim'
|
||||
Plug 'habamax/vim-godot'
|
||||
call plug#end() "Перестать это делать
|
||||
|
||||
"
|
||||
@@ -175,17 +181,29 @@ let g:ansible_yamlKeyName = 'yamlKey'
|
||||
"
|
||||
" CoC plugin settings
|
||||
"
|
||||
let g:coc_global_extensions = ['coc-pyright', 'coc-flutter', 'coc-sh']
|
||||
if hostname == "i113855042"
|
||||
let g:coc_user_config = '~/.vim/coc-lsp/coc-settings-cloudia.json'
|
||||
else
|
||||
let g:coc_user_config = '~/.vim/coc-lsp/coc-settings.json'
|
||||
endif
|
||||
let g:coc_global_extensions = ['coc-pyright', 'coc-sh', 'coc-go']
|
||||
function! s:enable_coc_for_type()
|
||||
let l:filesuffix_whitelist = ['py', 'dart', 'sh']
|
||||
let l:filesuffix_whitelist = ['py', 'sh', 'go', 'gd', 'gdscript']
|
||||
if index(l:filesuffix_whitelist, expand('%:e')) == -1
|
||||
let b:coc_enabled = 0
|
||||
endif
|
||||
endfunction
|
||||
autocmd BufRead,BufNewFile * call s:enable_coc_for_type()
|
||||
source ~/.vim/coc.vim
|
||||
source ~/.vim/coc-lsp/coc.vim
|
||||
|
||||
"
|
||||
" vim-sneak plugin settings
|
||||
"
|
||||
let g:sneak#label = 1
|
||||
|
||||
" YAML files config
|
||||
autocmd FileType yaml,yml setlocal ts=2 sts=2 sw=2 expandtab
|
||||
let g:indentLine_char = '⦙'
|
||||
|
||||
" vim-go settings
|
||||
let g:go_fmt_autosave = 1
|
||||
|
||||
Reference in New Issue
Block a user