Compare commits
19 Commits
72b38584ef
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e2a9441056 | ||
|
|
852911332d | ||
|
|
025ff1e657 | ||
| 7079e870f8 | |||
|
|
4fe6739d9d | ||
|
|
2fa073ea87 | ||
|
|
880bbd18e0 | ||
| ebe143ee28 | |||
| ba7cec969f | |||
|
|
e2bdd71b08 | ||
|
|
966b7c74ef | ||
|
|
a3c78dfcba | ||
|
|
622ae698cd | ||
|
|
6a20ac709a | ||
|
|
386257dd6e | ||
| e0f933c26c | |||
|
|
352a8c3c97 | ||
|
|
bcba0e372a | ||
|
|
909acaa69f |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
||||
*.swp
|
||||
*.swo
|
||||
.netrwhist
|
||||
|
||||
@@ -28,8 +28,9 @@ history = 0
|
||||
multiplier = 3
|
||||
|
||||
[font]
|
||||
size = 13
|
||||
size = 14
|
||||
# use_thin_strokes = true
|
||||
# on mac - https://petar.dev/notes/crisp-fonts-alacritty/
|
||||
|
||||
[font.normal]
|
||||
family = "RecMonoLinear Nerd Font Mono"
|
||||
@@ -73,6 +74,10 @@ bindings = [
|
||||
{ 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" },
|
||||
@@ -86,5 +91,24 @@ bindings = [
|
||||
{ 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 +1 @@
|
||||
vim.cmd [[autocmd BufWritePre * lua vim.lsp.buf.format()]]
|
||||
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/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
|
||||
@@ -1,18 +1,19 @@
|
||||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"LuaSnip": { "branch": "master", "commit": "21f74f7ba8c49f95f9d7c8293b147c2901dd2d3a" },
|
||||
"avante.nvim": { "branch": "main", "commit": "e89eb79abf5754645e20aa6074da10ed20bba33c" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "bd5a7d6db125d4654b50eeae9f5217f24bb22fd3" },
|
||||
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
|
||||
"fzf-lua": { "branch": "main", "commit": "a8458b79a957a6e3e217d84106a0fd4b9470ff4c" },
|
||||
"github-theme": { "branch": "main", "commit": "c106c9472154d6b2c74b74565616b877ae8ed31d" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "011dc6718bcebdf92a5336bb0da79189c3afe621" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" },
|
||||
"mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "c27370703e798666486e3064b64d59eaf4bdc6d5" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "fd26f8626c03b424f7140d454031d1dcb8d23513" },
|
||||
"outline.nvim": { "branch": "main", "commit": "ae473fb51b7b6086de0876328c81a63f9c3ecfef" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
||||
"telescope-file-browser.nvim": { "branch": "master", "commit": "626998e5c1b71c130d8bc6cf7abb6709b98287bb" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "814f102cd1da3dc78c7d2f20f2ef3ed3cdf0e6e4" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
|
||||
"lazy.nvim": { "branch": "main", "commit": "f0f5bbb9e5bfae5e6468f9359ffea3d151418176" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "3590d66effccc7376d8c3dbe45e8291f9fed2843" },
|
||||
"mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" },
|
||||
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "a7bcf1d88069fc67c9ace8a62ba480b8fe879025" },
|
||||
"outline.nvim": { "branch": "main", "commit": "6b62f73a6bf317531d15a7ae1b724e85485d8148" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||
"telescope-file-browser.nvim": { "branch": "master", "commit": "3610dc7dc91f06aa98b11dca5cc30dfa98626b7e" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" }
|
||||
}
|
||||
|
||||
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,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
5
nvim/lsp/starpls.lua
Normal file
5
nvim/lsp/starpls.lua
Normal file
@@ -0,0 +1,5 @@
|
||||
return {
|
||||
cmd = { 'starpls' },
|
||||
filetypes = { 'starlark' },
|
||||
root_markers = { 'WORKSPACE' },
|
||||
}
|
||||
@@ -3,58 +3,56 @@ require("mason-lspconfig").setup({
|
||||
ensure_installed = {
|
||||
'lua_ls',
|
||||
'gopls',
|
||||
'bashls',
|
||||
'pyright',
|
||||
'bashls', -- install "shfmt" binary for formatting capabilities
|
||||
'basedpyright',
|
||||
},
|
||||
automatic_installation = true,
|
||||
automatic_enable = false
|
||||
})
|
||||
|
||||
-- Customized on_attach function
|
||||
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
||||
--
|
||||
local opts = { noremap = true, silent = true }
|
||||
vim.keymap.set("n", "<leader>e", vim.diagnostic.open_float, opts)
|
||||
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts)
|
||||
vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts)
|
||||
vim.keymap.set("n", "<leader>q", vim.diagnostic.setloclist, opts)
|
||||
local keymap = vim.keymap.set
|
||||
|
||||
local on_attach = function(client, bufnr)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
callback = function(ev)
|
||||
local bufnr = ev.buf
|
||||
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
||||
|
||||
if client.name == "rust_analyzer" then
|
||||
-- This requires Neovim 0.10 or later
|
||||
vim.lsp.inlay_hint.enable()
|
||||
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
|
||||
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
||||
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, Append(bufopts, "desc", 'Go to declaration'))
|
||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition, Append(bufopts, "desc", "Go to definition"))
|
||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, bufopts)
|
||||
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, Append(bufopts, "desc", "Go to implementation"))
|
||||
vim.keymap.set("n", "gr", require'telescope.builtin'.lsp_references, Append(bufopts, "desc", "Go to references"))
|
||||
vim.keymap.set("n", "<C-k>", vim.lsp.buf.signature_help, bufopts)
|
||||
vim.keymap.set("n", "<leader>wa", vim.lsp.buf.add_workspace_folder, bufopts)
|
||||
vim.keymap.set("n", "<leader>wr", vim.lsp.buf.remove_workspace_folder, bufopts)
|
||||
vim.keymap.set("n", "<leader>wl", function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
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)
|
||||
vim.keymap.set("n", "<leader>D", vim.lsp.buf.type_definition, bufopts)
|
||||
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, bufopts)
|
||||
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, bufopts)
|
||||
vim.keymap.set("n", "<leader>lf", function()
|
||||
vim.lsp.buf.format({
|
||||
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, bufopts)
|
||||
end
|
||||
end, opt("[l]sp [f]ormat buffer"))
|
||||
end
|
||||
})
|
||||
|
||||
-- Add the border on hover and on signature help popup window
|
||||
local handlers = {
|
||||
['textDocument/hover'] = vim.lsp.with(vim.lsp.handlers.hover, { border = "rounded" }),
|
||||
['textDocument/signatureHelp'] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = "rounded" }),
|
||||
}
|
||||
vim.o.winborder = 'rounded'
|
||||
|
||||
-- Add border to the diagnostic popup window
|
||||
vim.diagnostic.config({
|
||||
@@ -65,76 +63,14 @@ vim.diagnostic.config({
|
||||
underline = true,
|
||||
update_in_insert = false, -- Don't update diagnostics in insert mode
|
||||
severity_sort = true, -- Sort diagnostics by severity
|
||||
float = { border = "rounded" },
|
||||
jump = { float = true },
|
||||
})
|
||||
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
keymap("n", "<leader>e", vim.diagnostic.open_float, opts)
|
||||
keymap("n", "<leader>q", vim.diagnostic.setloclist, opts)
|
||||
|
||||
require("lspconfig").lua_ls.setup({
|
||||
on_attach = on_attach,
|
||||
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,
|
||||
},
|
||||
}
|
||||
},
|
||||
capabilities = capabilities,
|
||||
handlers = handlers
|
||||
})
|
||||
require("lspconfig").gopls.setup { capabilities = capabilities, handlers = handlers, on_attach = on_attach,
|
||||
cmd = IsYandex and { "/home/dmchumak/.ya/tools/v3/gopls-linux/gopls" },
|
||||
root_dir = IsYandex and require('lspconfig').util.root_pattern("YAOWNERS", "ya.make", ".arcadia.root", ".cloudia.root", "go.work", "go.mod", ".git"),
|
||||
-- settings = {
|
||||
-- gopls = {
|
||||
-- arcadiaIndexDirs = {
|
||||
-- "/home/horseinthesky/bl/cloud-go/cloud/cloud-go/cloudgate",
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
}
|
||||
require("lspconfig").bashls.setup { capabilities = capabilities, handlers = handlers,
|
||||
on_attach = on_attach,
|
||||
settings = {
|
||||
bashIde = {
|
||||
globPattern = "*@(.sh|.inc|.bash|.command)"
|
||||
}
|
||||
}
|
||||
}
|
||||
require("lspconfig").pyright.setup { capabilities = capabilities, handlers = handlers,
|
||||
on_attach = on_attach,
|
||||
-- more details on configuring pyright can be found here
|
||||
-- https://microsoft.github.io/pyright/#/settings?id=pyright-settings
|
||||
settings = {
|
||||
python = {
|
||||
analysis = {
|
||||
include = {
|
||||
'~/arcadia',
|
||||
'~/arcadia/yt/python',
|
||||
'~/arcadia/contrib/libs/protobuf/python',
|
||||
'~/arcadia/contrib/python',
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
vim.lsp.enable("lua_ls")
|
||||
vim.lsp.enable("bashls")
|
||||
vim.lsp.enable("gopls")
|
||||
vim.lsp.enable("basedpyright")
|
||||
vim.lsp.enable("starpls")
|
||||
|
||||
@@ -39,3 +39,11 @@ 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,
|
||||
-- },
|
||||
-- })
|
||||
@@ -10,6 +10,7 @@ cmp.setup({
|
||||
luasnip.lsp_expand(args.body)
|
||||
end
|
||||
},
|
||||
preselect = cmp.PreselectMode.None;
|
||||
window = {
|
||||
documentation = cmp.config.window.bordered(),
|
||||
completion = { border = 'rounded' }
|
||||
|
||||
@@ -14,10 +14,6 @@ vim.opt.rtp:prepend(lazypath)
|
||||
local plugins = {
|
||||
"williamboman/mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = { 'hrsh7th/cmp-nvim-lsp' }
|
||||
},
|
||||
{
|
||||
'projekt0n/github-nvim-theme',
|
||||
name = 'github-theme',
|
||||
@@ -51,9 +47,8 @@ local plugins = {
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
-- your configuration comes here
|
||||
-- or leave it empty to use the default settings
|
||||
-- refer to the configuration section below
|
||||
preset = "modern",
|
||||
show_help = false, -- workaround for border glitch https://github.com/folke/which-key.nvim/issues/967#issuecomment-2842309305
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
@@ -84,6 +79,61 @@ local plugins = {
|
||||
-- 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 = "yaqwencode",
|
||||
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",
|
||||
use_ReAct_prompt = true,
|
||||
},
|
||||
yaqwencode = {
|
||||
__inherited_from = "openai",
|
||||
api_key_name = "cmd:cat ~/.config/eliza_api_key",
|
||||
endpoint = "https://api.eliza.yandex.net/raw/internal/qwen3-coder-480b-a35b-runtime/v1",
|
||||
model = "qwen3-coder-480b-a35b-runtime",
|
||||
use_ReAct_prompt = true,
|
||||
},
|
||||
yaclaude = {
|
||||
__inherited_from = "openai",
|
||||
api_key_name = "cmd:cat ~/.config/eliza_api_key",
|
||||
endpoint = "https://api.eliza.yandex.net/raw/anthropic/v1",
|
||||
model = "claude-opus-4-5-20251101",
|
||||
-- use_ReAct_prompt = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
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)
|
||||
@@ -96,3 +146,4 @@ vim.cmd([[
|
||||
require("plugins/telescope")
|
||||
require("plugins/completions")
|
||||
require("plugins/gitsigns")
|
||||
-- require("plugins/codecompanion")
|
||||
|
||||
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
|
||||
@@ -1,4 +1,6 @@
|
||||
alias l="ls -lah"
|
||||
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"
|
||||
alias dev="ssh dmchumak-dev.sas.yp-c.yandex.net"
|
||||
|
||||
@@ -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 set-clipboard external
|
||||
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
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user