From 57fc86a2ccc8b3ea618b0cfd45efc1c19594e929 Mon Sep 17 00:00:00 2001 From: Alexander Neonxp Kiryukhin Date: Sun, 20 Apr 2025 17:24:11 +0300 Subject: [PATCH] 20.05.2025 --- .gitmodules | 3 ++ git/config | 38 ++++++++-------- git/ignore | 2 + nvim/init.lua | 4 +- nvim/lua/keymaps.lua | 70 ++++++++++++++++------------- nvim/lua/options.lua | 1 - nvim/lua/plugins/cmp.lua | 39 ++++++++++++++++ nvim/lua/plugins/init.lua | 48 ++++++-------------- nvim/pack/nvim/start/nvim-lspconfig | 1 + nvim/pack/nvim/start/packer.nvim | 1 + zsh/zshrc | 5 +++ 11 files changed, 126 insertions(+), 86 deletions(-) create mode 100644 nvim/lua/plugins/cmp.lua create mode 160000 nvim/pack/nvim/start/nvim-lspconfig create mode 160000 nvim/pack/nvim/start/packer.nvim diff --git a/.gitmodules b/.gitmodules index d90739a..d9859e0 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "zsh/p10k"] path = zsh/p10k url = https://github.com/romkatv/powerlevel10k.git +[submodule "nvim/pack/nvim/start/nvim-lspconfig"] + path = nvim/pack/nvim/start/nvim-lspconfig + url = https://github.com/neovim/nvim-lspconfig.git diff --git a/git/config b/git/config index e671bf9..77d7c22 100644 --- a/git/config +++ b/git/config @@ -94,29 +94,29 @@ [init] defaultBranch = master -[pager] - diff = delta - log = delta - reflog = delta - show = delta +#[pager] +# diff = delta +# log = delta +# reflog = delta +# show = delta -[interactive] - diffFilter = delta --color-only --features=interactive +#[interactive] +# diffFilter = delta --color-only --features=interactive -[delta] - features = decorations +#[delta] +# features = decorations -[delta "interactive"] - keep-plus-minus-markers = false +#[delta "interactive"] +# keep-plus-minus-markers = false -[delta "decorations"] - commit-decoration-style = blue ol - commit-style = raw - file-style = omit - hunk-header-decoration-style = blue box - hunk-header-file-style = red - hunk-header-line-number-style = "#067a00" - hunk-header-style = file line-number syntax +#[delta "decorations"] +# commit-decoration-style = blue ol +# commit-style = raw +# file-style = omit +# hunk-header-decoration-style = blue box +# hunk-header-file-style = red +# hunk-header-line-number-style = "#067a00" +# hunk-header-style = file line-number syntax [include] path = .gitconfig.local diff --git a/git/ignore b/git/ignore index 7c53e55..fd81e8c 100644 --- a/git/ignore +++ b/git/ignore @@ -30,3 +30,5 @@ Thumbs.db go.work go.work.sum + +__debug* diff --git a/nvim/init.lua b/nvim/init.lua index 2f632d4..87914ff 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -4,8 +4,10 @@ if fn.empty(fn.glob(install_path)) > 0 then packer_bootstrap = fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path}) end -vim.cmd [[packadd packer.nvim]] +vim.g.mapleader = " " +vim.g.maplocalleader = " " +vim.cmd [[packadd packer.nvim]] require 'options' require 'keymaps' diff --git a/nvim/lua/keymaps.lua b/nvim/lua/keymaps.lua index 3dda8eb..6406100 100644 --- a/nvim/lua/keymaps.lua +++ b/nvim/lua/keymaps.lua @@ -1,10 +1,26 @@ local map = vim.api.nvim_set_keymap +local kmap = vim.keymap.set local opts = {noremap = true, silent = true} -vim.g.mapleader = "\\" + +map('n', '', '', opts) +map('n', '', '^', opts) +map('n', '', '$', opts) +map('v', '', '^', opts) +map('v', '', '$', opts) +map('i', '', '^', opts) +map('i', '', '$', opts) + +map('v', 'i', '', opts) +map('v', 'a', '', opts) + +-- Перемещение между буферами +kmap('n', 'bn', ':bnext', { noremap = true, silent = true }) -- Следующий буфер +kmap('n', 'bp', ':bprevious', { noremap = true, silent = true }) -- Предыдущий буфер +kmap('n', 'bd', ':bdelete', { noremap = true, silent = true }) -- Закрыть текущий буфер -- Tree -map('n', '', ':NvimTreeToggle', opts) +map('n', '', ':NvimTreeToggle', opts) -- Telescope map('n', 'ff', 'Telescope find_files', opts) @@ -12,34 +28,28 @@ map('n', 'fg', 'Telescope live_grep', opts) map('n', 'fb', 'Telescope buffers', opts) -- LSP --- map('n', 'e', vim.diagnostic.open_float, opts) --- map('n', '[d', vim.diagnostic.goto_prev, opts) --- map('n', ']d', vim.diagnostic.goto_next, opts) --- map('n', 'q', vim.diagnostic.setloclist, opts) +kmap('n', 'e', vim.diagnostic.open_float, opts) +kmap('n', '[d', vim.diagnostic.goto_prev, opts) +kmap('n', ']d', vim.diagnostic.goto_next, opts) +kmap('n', 'q', vim.diagnostic.setloclist, opts) -local on_attach = function(client, bufnr) - vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') - - local bufopts = { noremap=true, silent=true, buffer=bufnr } - - -- стандартные горячие клавиши для LSP, больше в документации - -- https://github.com/neovim/nvim-lspconfig - map('n', 'gD', vim.lsp.buf.declaration, bufopts) - map('n', 'gd', vim.lsp.buf.definition, bufopts) - map('n', 'K', vim.lsp.buf.hover, bufopts) - map('n', 'gi', vim.lsp.buf.implementation, bufopts) - map('n', '', vim.lsp.buf.signature_help, bufopts) - map('n', 'wa', vim.lsp.buf.add_workspace_folder, bufopts) - map('n', 'wr', vim.lsp.buf.remove_workspace_folder, bufopts) - map('n', 'wl', function() - print(vim.inspect(vim.lsp.buf.list_workspace_folders())) - end, bufopts) - map('n', 'D', vim.lsp.buf.type_definition, bufopts) - map('n', 'rn', vim.lsp.buf.rename, bufopts) - map('n', 'ca', vim.lsp.buf.code_action, bufopts) - map('n', 'gr', vim.lsp.buf.references, bufopts) - map('n', 'f', vim.lsp.buf.formatting, bufopts) -end +-- стандартные горячие клавиши для LSP, больше в документации +-- https://github.com/neovim/nvim-lspconfig +kmap('n', 'gD', vim.lsp.buf.declaration, opts) +kmap('n', 'gd', vim.lsp.buf.definition, opts) +kmap('n', 'K', vim.lsp.buf.hover, opts) +kmap('n', 'gi', vim.lsp.buf.implementation, opts) +kmap('n', '', vim.lsp.buf.signature_help, opts) +kmap('n', 'wa', vim.lsp.buf.add_workspace_folder, opts) +kmap('n', 'wr', vim.lsp.buf.remove_workspace_folder, opts) +kmap('n', 'wl', function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) +end, opts) +kmap('n', 'D', vim.lsp.buf.type_definition, opts) +kmap('n', 'rn', vim.lsp.buf.rename, opts) +kmap('n', 'ca', vim.lsp.buf.code_action, opts) +kmap('n', 'gr', vim.lsp.buf.references, opts) +-- kmap('n', 'f', vim.lsp.buf.formatting, opts) local function change_root_to_global_cwd() local api = require("nvim-tree.api") @@ -47,5 +57,5 @@ local function change_root_to_global_cwd() api.tree.change_root(global_cwd) end -vim.keymap.set('n', '', change_root_to_global_cwd, {}) +kmap('n', '', change_root_to_global_cwd, {}) diff --git a/nvim/lua/options.lua b/nvim/lua/options.lua index 327c817..5f160a9 100644 --- a/nvim/lua/options.lua +++ b/nvim/lua/options.lua @@ -21,7 +21,6 @@ local options = { splitright = true, -- force all vertical splits to go to the right of current window swapfile = false, -- creates a swapfile termguicolors = true, -- set term gui colors (most terminals support this) - timeoutlen = 100, -- time to wait for a mapped sequence to complete (in milliseconds) undofile = true, -- enable persistent undo updatetime = 300, -- faster completion (4000ms default) writebackup = false, -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited diff --git a/nvim/lua/plugins/cmp.lua b/nvim/lua/plugins/cmp.lua new file mode 100644 index 0000000..01fc505 --- /dev/null +++ b/nvim/lua/plugins/cmp.lua @@ -0,0 +1,39 @@ +local cmp = require'cmp' +cmp.setup{ + snippet = { + -- REQUIRED - you must specify a snippet engine + expand = function(args) + vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users. + -- require('luasnip').lsp_expand(args.body) -- For `luasnip` users. + -- require('snippy').expand_snippet(args.body) -- For `snippy` users. + -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users. + -- vim.snippet.expand(args.body) -- For native neovim snippets (Neovim v0.10+) + + -- For `mini.snippets` users: + -- local insert = MiniSnippets.config.expand.insert or MiniSnippets.default_insert + -- insert({ body = args.body }) -- Insert at cursor + -- cmp.resubscribe({ "TextChangedI", "TextChangedP" }) + -- require("cmp.config").set_onetime({ sources = {} }) + end, + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'vsnip' }, -- For vsnip users. + -- { name = 'luasnip' }, -- For luasnip users. + -- { name = 'ultisnips' }, -- For ultisnips users. + -- { name = 'snippy' }, -- For snippy users. + }, { + { name = 'buffer' }, + }) +} diff --git a/nvim/lua/plugins/init.lua b/nvim/lua/plugins/init.lua index 20adc83..d21a585 100644 --- a/nvim/lua/plugins/init.lua +++ b/nvim/lua/plugins/init.lua @@ -2,41 +2,25 @@ return require('packer').startup(function(use) use 'wbthomason/packer.nvim' use 'nvim-lua/plenary.nvim' use 'neovim/nvim-lspconfig' - use 'hrsh7th/cmp-nvim-lsp' - use 'hrsh7th/cmp-buffer' - use 'hrsh7th/cmp-path' - use 'hrsh7th/nvim-cmp' + use { + 'hrsh7th/nvim-cmp', + requires = { + 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/cmp-buffer', + 'hrsh7th/cmp-path', + 'hrsh7th/cmp-vsnip', + 'hrsh7th/vim-vsnip', + }, + config = function() + require 'plugins.cmp' + end + } use { 'nvim-lualine/lualine.nvim', config = function() require 'plugins.lualine' end } - - -- движок сниппетов - use { - 'L3MON4D3/LuaSnip', - after = 'friendly-snippets', - config = function() - require('luasnip/loaders/from_vscode').load({ - paths = { '~/.local/share/nvim/site/pack/packer/start/friendly-snippets' } - }) - end - } - - -- автодополнения для сниппетов - use 'saadparwaiz1/cmp_luasnip' - - -- набор готовых сниппетов для всех языков, включая go - use 'rafamadriz/friendly-snippets' - - -- плагин для простого комментирования кода - use { - 'numToStr/Comment.nvim', - config = function() - require('Comment').setup() - end - } use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate', @@ -50,12 +34,6 @@ return require('packer').startup(function(use) require 'plugins.telescope' end } - use { - 'olexsmir/gopher.nvim', - config = function() - -- require 'plugins.gopher' - end - } use { 'nvim-tree/nvim-tree.lua', config = function() diff --git a/nvim/pack/nvim/start/nvim-lspconfig b/nvim/pack/nvim/start/nvim-lspconfig new file mode 160000 index 0000000..32b6a64 --- /dev/null +++ b/nvim/pack/nvim/start/nvim-lspconfig @@ -0,0 +1 @@ +Subproject commit 32b6a6449aaba11461fffbb596dd6310af79eea4 diff --git a/nvim/pack/nvim/start/packer.nvim b/nvim/pack/nvim/start/packer.nvim new file mode 160000 index 0000000..ea0cc3c --- /dev/null +++ b/nvim/pack/nvim/start/packer.nvim @@ -0,0 +1 @@ +Subproject commit ea0cc3c59f67c440c5ff0bbe4fb9420f4350b9a3 diff --git a/zsh/zshrc b/zsh/zshrc index 8e68416..6318e61 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -24,8 +24,12 @@ antigen apply # Exports #export GOPROXY=https://proxy.neonxp.ru +export GOPRIVATE=devopar.hippoparking.ru export EDITOR="nvim" #export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/docker.sock +export ANDROID_HOME=$HOME/projects/android/ +export PATH=$PATH:$ANDROID_HOME/emulator +export PATH=$PATH:$ANDROID_HOME/platform-tools export PATH=$PATH:~/.local/bin:~/go/bin export GOBIN=~/go/bin export GPG_TTY=$(tty) @@ -55,6 +59,7 @@ alias np="nano -w PKGBUILD" alias gitu='git add . && git commit && git push' alias g=git alias nsh='wl-paste | curl -d @- https://nixshare.ru/upload 2>/dev/null | wl-copy' +alias p=python3 [[ ! -f `which exa` ]] || alias ls="exa" && alias ll="exa -l"