Compare commits
53 Commits
c5981f5eb2
...
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 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
|||||||
*.swp
|
*.swp
|
||||||
*.swo
|
*.swo
|
||||||
|
.netrwhist
|
||||||
|
|||||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -5,3 +5,6 @@
|
|||||||
[submodule "dotbot-asdf"]
|
[submodule "dotbot-asdf"]
|
||||||
path = dotbot-asdf
|
path = dotbot-asdf
|
||||||
url = https://github.com/sobolevn/dotbot-asdf.git
|
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
@@ -7,8 +7,10 @@
|
|||||||
- link:
|
- link:
|
||||||
~/.tmux.conf: tmux.conf
|
~/.tmux.conf: tmux.conf
|
||||||
~/.vim: vim
|
~/.vim: vim
|
||||||
~/.zshrc: zsh/zshrc
|
~/.zshrc: shell/zsh/zshrc
|
||||||
~/.bashrc: bash/bashrc
|
~/.bashrc: shell/bash/bashrc
|
||||||
|
~/.config/nvim: nvim
|
||||||
|
~/.config/alacritty: alacritty
|
||||||
|
|
||||||
- asdf:
|
- asdf:
|
||||||
- plugin: vim
|
- 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"
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
source ~/.dotfiles/git/git-prompt.sh
|
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}\$ '
|
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
|
# tmux history preservation
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
source ~/.dotfiles/shell/alias.sh
|
||||||
|
eval "$(/opt/homebrew/bin/brew shellenv)"
|
||||||
if type brew &>/dev/null
|
if type brew &>/dev/null
|
||||||
then
|
then
|
||||||
FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}"
|
FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}"
|
||||||
@@ -13,7 +15,14 @@ setopt histignoredups
|
|||||||
source ~/.dotfiles/git/git-prompt.sh
|
source ~/.dotfiles/git/git-prompt.sh
|
||||||
setopt PROMPT_SUBST ; PS1='%n@%m %c$(__git_ps1 " [%s]")\$ '
|
setopt PROMPT_SUBST ; PS1='%n@%m %c$(__git_ps1 " [%s]")\$ '
|
||||||
|
|
||||||
if [ -f "~/.zsh_local" ]
|
if [ -f ~/.zshrc_local ]
|
||||||
then
|
then
|
||||||
source ~/.zshrc_local
|
source ~/.zshrc_local
|
||||||
fi
|
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
|
||||||
|
|
||||||
15
tmux.conf
15
tmux.conf
@@ -1,4 +1,6 @@
|
|||||||
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 mouse on
|
||||||
set -g set-clipboard external
|
set -g set-clipboard external
|
||||||
set -g escape-time 10 # https://www.johnhawthorn.com/2012/09/vi-escape-delays/
|
set -g escape-time 10 # https://www.johnhawthorn.com/2012/09/vi-escape-delays/
|
||||||
@@ -69,7 +71,7 @@ bind -T copy-mode-emacs C-WheelDownPane send-keys -X halfpage-down
|
|||||||
# color status bar
|
# color status bar
|
||||||
set -g status-style fg=white,bg=colour235
|
set -g status-style fg=white,bg=colour235
|
||||||
# color of message bar
|
# 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
|
# highlight current window
|
||||||
setw -g window-status-style fg=cyan,bg=colour235
|
setw -g window-status-style fg=cyan,bg=colour235
|
||||||
@@ -85,5 +87,10 @@ set -g pane-active-border-style fg=green,bg=default
|
|||||||
setw -g mode-keys vi
|
setw -g mode-keys vi
|
||||||
# Update default binding of `Enter` to also use copy-pipe
|
# Update default binding of `Enter` to also use copy-pipe
|
||||||
unbind -T copy-mode-vi Enter
|
unbind -T copy-mode-vi Enter
|
||||||
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xclip -selection c"
|
if-shell '[[ $(uname -s) = Linux ]]' {
|
||||||
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 "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> gi <Plug>(coc-implementation)
|
||||||
nmap <silent> gr <Plug>(coc-references)
|
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','')}
|
"set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
|
||||||
|
|
||||||
" Applying codeAction to the selected region.
|
" Applying codeAction to the selected region.
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"inlayHints.enable": false,
|
|
||||||
"pyright.inlayHints.functionReturnTypes": false,
|
|
||||||
"pyright.inlayHints.variableTypes": 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
|
||||||
19
vim/vimrc
19
vim/vimrc
@@ -39,6 +39,8 @@ noremap <silent> <C-Down> :resize -3<CR>
|
|||||||
set backspace=indent,eol,start
|
set backspace=indent,eol,start
|
||||||
filetype plugin indent on
|
filetype plugin indent on
|
||||||
|
|
||||||
|
let hostname = substitute(system('hostname'), '\n', '', '')
|
||||||
|
|
||||||
if empty(glob('~/.vim/autoload/plug.vim')) "Если vim-plug не стоит
|
if empty(glob('~/.vim/autoload/plug.vim')) "Если vim-plug не стоит
|
||||||
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
|
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
|
||||||
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||||
@@ -63,7 +65,10 @@ call plug#begin('~/.vim/bundle') "Начать искать плагины в э
|
|||||||
Plug 'pearofducks/ansible-vim'
|
Plug 'pearofducks/ansible-vim'
|
||||||
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
||||||
Plug 'elzr/vim-json'
|
Plug 'elzr/vim-json'
|
||||||
|
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
|
||||||
|
Plug 'hashivim/vim-terraform'
|
||||||
" Plug 'Exafunction/codeium.vim'
|
" Plug 'Exafunction/codeium.vim'
|
||||||
|
Plug 'habamax/vim-godot'
|
||||||
call plug#end() "Перестать это делать
|
call plug#end() "Перестать это делать
|
||||||
|
|
||||||
"
|
"
|
||||||
@@ -176,15 +181,20 @@ let g:ansible_yamlKeyName = 'yamlKey'
|
|||||||
"
|
"
|
||||||
" CoC plugin settings
|
" 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()
|
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
|
if index(l:filesuffix_whitelist, expand('%:e')) == -1
|
||||||
let b:coc_enabled = 0
|
let b:coc_enabled = 0
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
autocmd BufRead,BufNewFile * call s:enable_coc_for_type()
|
autocmd BufRead,BufNewFile * call s:enable_coc_for_type()
|
||||||
source ~/.vim/coc.vim
|
source ~/.vim/coc-lsp/coc.vim
|
||||||
|
|
||||||
"
|
"
|
||||||
" vim-sneak plugin settings
|
" vim-sneak plugin settings
|
||||||
@@ -194,3 +204,6 @@ let g:sneak#label = 1
|
|||||||
" YAML files config
|
" YAML files config
|
||||||
autocmd FileType yaml,yml setlocal ts=2 sts=2 sw=2 expandtab
|
autocmd FileType yaml,yml setlocal ts=2 sts=2 sw=2 expandtab
|
||||||
let g:indentLine_char = '⦙'
|
let g:indentLine_char = '⦙'
|
||||||
|
|
||||||
|
" vim-go settings
|
||||||
|
let g:go_fmt_autosave = 1
|
||||||
|
|||||||
Reference in New Issue
Block a user