20.05.2025 - 2
This commit is contained in:
parent
57fc86a2cc
commit
020ed86034
26 changed files with 168 additions and 428 deletions
7
nvim/.editorconfig
Normal file
7
nvim/.editorconfig
Normal file
|
@ -0,0 +1,7 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = tab
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
local fn = vim.fn
|
||||
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
|
||||
local install_path = fn.stdpath('config')..'/pack/packer/start/packer.nvim'
|
||||
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
|
||||
|
@ -14,3 +14,5 @@ require 'keymaps'
|
|||
require 'autocommands'
|
||||
require 'plugins'
|
||||
require 'lsp'
|
||||
|
||||
vim.cmd [[colorscheme moonfly]]
|
||||
|
|
|
@ -1,46 +1,46 @@
|
|||
vim.api.nvim_create_autocmd({'BufWritePre'}, {
|
||||
pattern = '*.go',
|
||||
callback = function()
|
||||
local params = vim.lsp.util.make_range_params(nil, vim.lsp.util._get_offset_encoding())
|
||||
params.context = { only = {'source.organizeImports'} }
|
||||
local result = vim.lsp.buf_request_sync(0, 'textDocument/codeAction', params, 3000)
|
||||
for _, res in pairs(result or {}) do
|
||||
for _, r in pairs(res.result or {}) do
|
||||
if r.edit then
|
||||
vim.lsp.util.apply_workspace_edit(r.edit, vim.lsp.util._get_offset_encoding())
|
||||
else
|
||||
vim.lsp.buf.execute_command(r.command)
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
pattern = '*.go',
|
||||
callback = function()
|
||||
local params = vim.lsp.util.make_range_params(nil, vim.lsp.util._get_offset_encoding())
|
||||
params.context = { only = {'source.organizeImports'} }
|
||||
local result = vim.lsp.buf_request_sync(0, 'textDocument/codeAction', params, 3000)
|
||||
for _, res in pairs(result or {}) do
|
||||
for _, r in pairs(res.result or {}) do
|
||||
if r.edit then
|
||||
vim.lsp.util.apply_workspace_edit(r.edit, vim.lsp.util._get_offset_encoding())
|
||||
else
|
||||
vim.lsp.buf.execute_command(r.command)
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({'BufWritePre'}, {
|
||||
pattern = '*.go',
|
||||
callback = function()
|
||||
vim.lsp.buf.format(nil, 3000)
|
||||
end
|
||||
pattern = '*.go',
|
||||
callback = function()
|
||||
vim.lsp.buf.format(nil, 3000)
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
local TrimWhiteSpaceGrp = vim.api.nvim_create_augroup('TrimWhiteSpaceGrp', {})
|
||||
vim.api.nvim_create_autocmd('BufWritePre', {
|
||||
group = TrimWhiteSpaceGrp,
|
||||
pattern = '*',
|
||||
command = '%s/\\s\\+$//e',
|
||||
pattern = '*',
|
||||
command = '%s/\\s\\+$//e',
|
||||
})
|
||||
|
||||
local YankHighlightGrp = vim.api.nvim_create_augroup('YankHighlightGrp', {})
|
||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||
group = YankHighlightGrp,
|
||||
pattern = '*',
|
||||
callback = function()
|
||||
vim.highlight.on_yank({
|
||||
higroup = 'IncSearch',
|
||||
timeout = 40,
|
||||
})
|
||||
end,
|
||||
pattern = '*',
|
||||
callback = function()
|
||||
vim.highlight.on_yank({
|
||||
higroup = 'IncSearch',
|
||||
timeout = 40,
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
|
|
|
@ -15,9 +15,9 @@ map('v', 'i', '<S-i>', opts)
|
|||
map('v', 'a', '<S-a>', opts)
|
||||
|
||||
-- Перемещение между буферами
|
||||
kmap('n', '<leader>bn', ':bnext<CR>', { noremap = true, silent = true }) -- Следующий буфер
|
||||
kmap('n', '<leader>bp', ':bprevious<CR>', { noremap = true, silent = true }) -- Предыдущий буфер
|
||||
kmap('n', '<leader>bd', ':bdelete<CR>', { noremap = true, silent = true }) -- Закрыть текущий буфер
|
||||
kmap('n', '<leader>bn', ':bnext<CR>', { noremap = true, silent = true }) -- Следующий буфер
|
||||
kmap('n', '<leader>bp', ':bprevious<CR>', { noremap = true, silent = true }) -- Предыдущий буфер
|
||||
kmap('n', '<leader>bd', ':bdelete<CR>', { noremap = true, silent = true }) -- Закрыть текущий буфер
|
||||
|
||||
-- Tree
|
||||
map('n', '<C-t>', ':NvimTreeToggle<CR>', opts)
|
||||
|
@ -52,9 +52,9 @@ kmap('n', 'gr', vim.lsp.buf.references, opts)
|
|||
-- kmap('n', '<leader>f', vim.lsp.buf.formatting, opts)
|
||||
|
||||
local function change_root_to_global_cwd()
|
||||
local api = require("nvim-tree.api")
|
||||
local global_cwd = vim.fn.getcwd(-1, -1)
|
||||
api.tree.change_root(global_cwd)
|
||||
local api = require("nvim-tree.api")
|
||||
local global_cwd = vim.fn.getcwd(-1, -1)
|
||||
api.tree.change_root(global_cwd)
|
||||
end
|
||||
|
||||
kmap('n', '<C-c>', change_root_to_global_cwd, {})
|
||||
|
|
|
@ -2,44 +2,44 @@ vim.g.loaded_netrw = 1
|
|||
vim.g.loaded_netrwPlugin = 1
|
||||
|
||||
local options = {
|
||||
backup = false, -- creates a backup file
|
||||
clipboard = "unnamedplus", -- allows neovim to access the system clipboard
|
||||
cmdheight = 2, -- more space in the neovim command line for displaying messages
|
||||
completeopt = { "menuone", "noselect" }, -- mostly just for cmp
|
||||
conceallevel = 0, -- so that `` is visible in markdown files
|
||||
fileencoding = "utf-8", -- the encoding written to a file
|
||||
hidden = true, -- required to keep multiple buffers and open multiple buffers
|
||||
hlsearch = true, -- highlight all matches on previous search pattern
|
||||
ignorecase = true, -- ignore case in search patterns
|
||||
mouse = "a", -- allow the mouse to be used in neovim
|
||||
pumheight = 10, -- pop up menu height
|
||||
showmode = false, -- we don't need to see things like -- INSERT -- anymore
|
||||
showtabline = 2, -- always show tabs
|
||||
smartcase = true, -- smart case
|
||||
smartindent = true, -- make indenting smarter again
|
||||
splitbelow = true, -- force all horizontal splits to go below current window
|
||||
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)
|
||||
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
|
||||
shiftwidth = 2, -- the number of spaces inserted for each indentation
|
||||
tabstop = 2, -- insert 2 spaces for a tab
|
||||
cursorline = true, -- highlight the current line
|
||||
number = true, -- set numbered lines
|
||||
relativenumber = false, -- set relative numbered lines
|
||||
numberwidth = 4, -- set number column width to 2 {default 4}
|
||||
signcolumn = "yes", -- always show the sign column, otherwise it would shift the text each time
|
||||
wrap = false, -- display lines as one long line
|
||||
scrolloff = 8, -- is one of my fav
|
||||
sidescrolloff = 8,
|
||||
backup = false,
|
||||
clipboard = "unnamedplus",
|
||||
cmdheight = 2,
|
||||
completeopt = { "menuone", "noselect" },
|
||||
conceallevel = 0,
|
||||
fileencoding = "utf-8",
|
||||
hidden = true,
|
||||
hlsearch = true,
|
||||
ignorecase = true,
|
||||
mouse = "a",
|
||||
pumheight = 10,
|
||||
showmode = false,
|
||||
showtabline = 2,
|
||||
smartcase = true,
|
||||
smartindent = true,
|
||||
splitbelow = true,
|
||||
splitright = true,
|
||||
swapfile = false,
|
||||
termguicolors = true,
|
||||
undofile = true,
|
||||
updatetime = 300,
|
||||
writebackup = false,
|
||||
shiftwidth = 4,
|
||||
tabstop = 4,
|
||||
cursorline = true,
|
||||
number = true,
|
||||
relativenumber = true,
|
||||
numberwidth = 4,
|
||||
signcolumn = "yes",
|
||||
wrap = true,
|
||||
scrolloff = 8,
|
||||
sidescrolloff = 8,
|
||||
}
|
||||
|
||||
vim.opt.shortmess:append "c"
|
||||
|
||||
for k, v in pairs(options) do
|
||||
vim.opt[k] = v
|
||||
vim.opt[k] = v
|
||||
end
|
||||
|
||||
vim.cmd "set whichwrap+=<,>,[,],h,l"
|
||||
|
|
|
@ -1,39 +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+)
|
||||
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({
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
['<CR>'] = 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' },
|
||||
})
|
||||
-- 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({
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
['<CR>'] = 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' },
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
return require('packer').startup(function(use)
|
||||
return require('packer').startup{function(use)
|
||||
use 'wbthomason/packer.nvim'
|
||||
use 'nvim-lua/plenary.nvim'
|
||||
use 'neovim/nvim-lspconfig'
|
||||
use 'bluz71/vim-moonfly-colors'
|
||||
use {
|
||||
'hrsh7th/nvim-cmp',
|
||||
requires = {
|
||||
|
@ -15,12 +16,12 @@ return require('packer').startup(function(use)
|
|||
require 'plugins.cmp'
|
||||
end
|
||||
}
|
||||
use {
|
||||
'nvim-lualine/lualine.nvim',
|
||||
config = function()
|
||||
require 'plugins.lualine'
|
||||
end
|
||||
}
|
||||
use {
|
||||
'nvim-lualine/lualine.nvim',
|
||||
config = function()
|
||||
require 'plugins.lualine'
|
||||
end
|
||||
}
|
||||
use {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
run = ':TSUpdate',
|
||||
|
@ -36,12 +37,25 @@ return require('packer').startup(function(use)
|
|||
}
|
||||
use {
|
||||
'nvim-tree/nvim-tree.lua',
|
||||
requires = {
|
||||
'nvim-tree/nvim-web-devicons',
|
||||
},
|
||||
config = function()
|
||||
require 'plugins.tree'
|
||||
end
|
||||
}
|
||||
use 'nvim-tree/nvim-web-devicons'
|
||||
use {
|
||||
"stevearc/conform.nvim",
|
||||
config = function()
|
||||
require("conform").setup()
|
||||
end,
|
||||
}
|
||||
if packer_bootstrap then
|
||||
require('packer').sync()
|
||||
end
|
||||
end)
|
||||
end,
|
||||
config = {
|
||||
-- The root has to be a directory named "pack"
|
||||
package_root = vim.fn.stdpath('config') .. '/pack',
|
||||
}}
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
require("nvim-tree").setup({
|
||||
sort = {
|
||||
sorter = "case_sensitive",
|
||||
},
|
||||
view = {
|
||||
width = 30,
|
||||
},
|
||||
renderer = {
|
||||
group_empty = true,
|
||||
},
|
||||
filters = {
|
||||
dotfiles = true,
|
||||
},
|
||||
sort = {
|
||||
sorter = "case_sensitive",
|
||||
},
|
||||
view = {
|
||||
width = 30,
|
||||
},
|
||||
renderer = {
|
||||
group_empty = true,
|
||||
},
|
||||
filters = {
|
||||
dotfiles = true,
|
||||
},
|
||||
})
|
||||
|
|
1
nvim/pack/packer/start/cmp-buffer
Submodule
1
nvim/pack/packer/start/cmp-buffer
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit b74fab3656eea9de20a9b8116afa3cfc4ec09657
|
1
nvim/pack/packer/start/cmp-nvim-lsp
Submodule
1
nvim/pack/packer/start/cmp-nvim-lsp
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit a8912b88ce488f411177fc8aed358b04dc246d7b
|
1
nvim/pack/packer/start/cmp-path
Submodule
1
nvim/pack/packer/start/cmp-path
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit c6635aae33a50d6010bf1aa756ac2398a2d54c32
|
1
nvim/pack/packer/start/cmp-vsnip
Submodule
1
nvim/pack/packer/start/cmp-vsnip
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 989a8a73c44e926199bfd05fa7a516d51f2d2752
|
1
nvim/pack/packer/start/conform.nvim
Submodule
1
nvim/pack/packer/start/conform.nvim
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 819c283db24211fd8ed2732b89a92ff9daa879b6
|
1
nvim/pack/packer/start/lualine.nvim
Submodule
1
nvim/pack/packer/start/lualine.nvim
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 86fe39534b7da729a1ac56c0466e76f2c663dc42
|
1
nvim/pack/packer/start/nvim-cmp
Submodule
1
nvim/pack/packer/start/nvim-cmp
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit b5311ab3ed9c846b585c0c15b7559be131ec4be9
|
1
nvim/pack/packer/start/nvim-tree.lua
Submodule
1
nvim/pack/packer/start/nvim-tree.lua
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 3a63717d3d332d8f39aaf65be7a0e4c2265af021
|
1
nvim/pack/packer/start/nvim-treesitter
Submodule
1
nvim/pack/packer/start/nvim-treesitter
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 684eeac91ed8e297685a97ef70031d19ac1de25a
|
1
nvim/pack/packer/start/nvim-web-devicons
Submodule
1
nvim/pack/packer/start/nvim-web-devicons
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 855c97005c8eebcdd19846f2e54706bffd40ee96
|
1
nvim/pack/packer/start/plenary.nvim
Submodule
1
nvim/pack/packer/start/plenary.nvim
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 857c5ac632080dba10aae49dba902ce3abf91b35
|
1
nvim/pack/packer/start/telescope.nvim
Submodule
1
nvim/pack/packer/start/telescope.nvim
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit a4ed82509cecc56df1c7138920a1aeaf246c0ac5
|
1
nvim/pack/packer/start/vim-moonfly-colors
Submodule
1
nvim/pack/packer/start/vim-moonfly-colors
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit bfa6b2486a72784b7546d0d3e9322aef70e07b03
|
1
nvim/pack/packer/start/vim-vsnip
Submodule
1
nvim/pack/packer/start/vim-vsnip
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 0a4b8419e44f47c57eec4c90df17567ad4b1b36e
|
Loading…
Add table
Add a link
Reference in a new issue