Перевёл dotfiles на stow
This commit is contained in:
parent
27416cef99
commit
97af93b2a8
169 changed files with 1256 additions and 100 deletions
7
config/nvim/.editorconfig
Normal file
7
config/nvim/.editorconfig
Normal file
|
@ -0,0 +1,7 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = tab
|
||||
|
1
config/nvim/.gitignore
vendored
Normal file
1
config/nvim/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
codecompanion.lua
|
54
config/nvim/Session.vim
Normal file
54
config/nvim/Session.vim
Normal file
|
@ -0,0 +1,54 @@
|
|||
let SessionLoad = 1
|
||||
let s:so_save = &g:so | let s:siso_save = &g:siso | setg so=0 siso=0 | setl so=-1 siso=-1
|
||||
let v:this_session=expand("<sfile>:p")
|
||||
silent only
|
||||
silent tabonly
|
||||
cd ~/projects/dotfiles/nvim
|
||||
if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == ''
|
||||
let s:wipebuf = bufnr('%')
|
||||
endif
|
||||
let s:shortmess_save = &shortmess
|
||||
if &shortmess =~ 'A'
|
||||
set shortmess=aoOA
|
||||
else
|
||||
set shortmess=aoO
|
||||
endif
|
||||
badd +6 init.lua
|
||||
badd +25 lua/plugins/theme.lua
|
||||
badd +1 lua/plugins/tree.lua
|
||||
argglobal
|
||||
%argdel
|
||||
edit lua/plugins/tree.lua
|
||||
argglobal
|
||||
balt lua/plugins/theme.lua
|
||||
setlocal fdm=expr
|
||||
setlocal fde=nvim_treesitter#foldexpr()
|
||||
setlocal fmr={{{,}}}
|
||||
setlocal fdi=#
|
||||
setlocal fdl=6
|
||||
setlocal fml=1
|
||||
setlocal fdn=20
|
||||
setlocal fen
|
||||
let s:l = 1 - ((0 * winheight(0) + 22) / 44)
|
||||
if s:l < 1 | let s:l = 1 | endif
|
||||
keepjumps exe s:l
|
||||
normal! zt
|
||||
keepjumps 1
|
||||
normal! 0
|
||||
tabnext 1
|
||||
if exists('s:wipebuf') && len(win_findbuf(s:wipebuf)) == 0 && getbufvar(s:wipebuf, '&buftype') isnot# 'terminal'
|
||||
silent exe 'bwipe ' . s:wipebuf
|
||||
endif
|
||||
unlet! s:wipebuf
|
||||
set winheight=1 winwidth=20
|
||||
let &shortmess = s:shortmess_save
|
||||
let s:sx = expand("<sfile>:p:r")."x.vim"
|
||||
if filereadable(s:sx)
|
||||
exe "source " . fnameescape(s:sx)
|
||||
endif
|
||||
let &g:so = s:so_save | let &g:siso = s:siso_save
|
||||
set hlsearch
|
||||
nohlsearch
|
||||
doautoall SessionLoadPost
|
||||
unlet SessionLoad
|
||||
" vim: set ft=vim :
|
142
config/nvim/colors/neonxp.lua
Normal file
142
config/nvim/colors/neonxp.lua
Normal file
|
@ -0,0 +1,142 @@
|
|||
local function SetHl(group, mod, fg, bg)
|
||||
|
||||
local fmt="highlight %s gui=%s cterm=%s guifg=%s ctermfg=%s guibg=%s ctermbg=%s"
|
||||
vim.cmd(fmt:format(group, mod[1], mod[2], fg[1], fg[2], bg[1], bg[2]))
|
||||
end
|
||||
local colors = require("theme.colors")
|
||||
local mods = require("theme.modifiers")
|
||||
|
||||
vim.cmd([[hi normal guibg=NONE ctermbg=NONE]])
|
||||
|
||||
-- VIM - INTERFACE
|
||||
------------------
|
||||
SetHl("StatusLine", mods["bold"], colors["none"], colors["black_l"])
|
||||
SetHl("StatusLineNC", mods["none"], colors["none"], colors["black_l"])
|
||||
SetHl("TabLineSel", mods["bold"], colors["none"], colors["black_l"])
|
||||
SetHl("WinSeparator", mods["none"], colors["gray"], colors["none"])
|
||||
SetHl("Pmenu", mods["none"], colors["none"], colors["black_l"])
|
||||
SetHl("PmenuSel", mods["bold"], colors["none"], colors["black_l"])
|
||||
SetHl("PmenuThumb", mods["none"], colors["none"], colors["gray_dd"])
|
||||
SetHl("FloatBorder", mods["none"], colors["gray"], colors["none"])
|
||||
|
||||
-- VIM - GENERAL TEXT
|
||||
---------------------
|
||||
SetHl("Visual", mods["bold"], colors["none"], colors["black_l"])
|
||||
SetHl("Normal", mods["none"], colors["white"], colors["none"])
|
||||
SetHl("NormalFloat", mods["none"], colors["white"], colors["none"])
|
||||
SetHl("NonText", mods["none"], colors["gray"], colors["none"])
|
||||
SetHl("SpecialKey", mods["none"], colors["gray"], colors["none"])
|
||||
SetHl("Conceal", mods["none"], colors["gray"], colors["none"])
|
||||
SetHl("Folded", mods["none"], colors["none"], colors["none"])
|
||||
SetHl("MatchParen", mods["bold"], colors["yellow_l"], colors["black_l"])
|
||||
SetHl("Search", mods["bold"], colors["yellow_l"], colors["black_l"])
|
||||
SetHl("CurSearch", mods["bold"], colors["chartreuse_l"], colors["black_l"])
|
||||
SetHl("CursorLine", mods["bold"], colors["none"], colors["black_ll"])
|
||||
SetHl("CursorColumn", mods["bold"], colors["none"], colors["black_l"])
|
||||
SetHl("ColorColumn", mods["bold"], colors["none"], colors["black_ll"])
|
||||
|
||||
-- VIM - INFO TEXT
|
||||
------------------
|
||||
SetHl("LineNr", mods["italic"], colors["gray"], colors["none"])
|
||||
SetHl("SignColumn", mods["bold"], colors["gray"], colors["none"])
|
||||
SetHl("DiagnosticError", mods["none"], colors["red_l"], colors["none"])
|
||||
SetHl("DiagnosticWarn", mods["none"], colors["orange_l"], colors["none"])
|
||||
SetHl("DiagnosticOK", mods["none"], colors["green_l"], colors["none"])
|
||||
SetHl("DiagnosticInfo", mods["none"], colors["royal_l"], colors["none"])
|
||||
SetHl("DiffAdd", mods["none"], colors["green_l"], colors["black_l"])
|
||||
SetHl("DiffChange", mods["none"], colors["orange_l"], colors["black_l"])
|
||||
SetHl("DiffDelete", mods["none"], colors["red_l"], colors["black_l"])
|
||||
SetHl("DiffText", mods["none"], colors["royal_l"], colors["black_l"])
|
||||
SetHl("QuickFixLine", mods["none"], colors["royal_l"], colors["none"])
|
||||
|
||||
-- VIM - MESSAGE TEXT
|
||||
---------------------
|
||||
SetHl("ErrorMsg", mods["none"], colors["red_l"], colors["none"])
|
||||
SetHl("WarningMsg", mods["none"], colors["orange_l"], colors["none"])
|
||||
SetHl("Title", mods["bold"], colors["white"], colors["none"])
|
||||
SetHl("ModeMsg", mods["none"], colors["turquoise_l"], colors["none"])
|
||||
SetHl("MoreMsg", mods["none"], colors["turquoise_l"], colors["none"])
|
||||
SetHl("Question", mods["none"], colors["royal_l"], colors["none"])
|
||||
|
||||
-- VIM - FILE SYSTEM
|
||||
--------------------
|
||||
SetHl("Directory", mods["none"], colors["royal_l"], colors["none"])
|
||||
SetHl("netrwClassify", mods["none"], colors["royal_d"], colors["none"])
|
||||
SetHl("netrwExe", mods["none"], colors["turquoise_l"], colors["none"])
|
||||
|
||||
-- CODE - VIM GENERAL
|
||||
---------------------
|
||||
SetHl("PreProc", mods["none"], colors["purple_l"], colors["none"])
|
||||
SetHl("PreCondit", mods["none"], colors["purple_l"], colors["none"])
|
||||
SetHl("Statement", mods["none"], colors["cyan_l"], colors["none"])
|
||||
SetHl("Type", mods["none"], colors["green_l"], colors["none"])
|
||||
SetHl("Identifier", mods["none"], colors["royal_l"], colors["none"])
|
||||
SetHl("Function", mods["none"], colors["turquoise_l"], colors["none"])
|
||||
SetHl("Delimiter", mods["none"], colors["gray_ll"], colors["none"])
|
||||
SetHl("Operator", mods["none"], colors["white"], colors["none"])
|
||||
SetHl("Constant", mods["none"], colors["white"], colors["none"])
|
||||
SetHl("Special", mods["none"], colors["white_dd"], colors["none"])
|
||||
SetHl("String", mods["italic"], colors["white"], colors["none"])
|
||||
SetHl("Comment", mods["italic"], colors["gray"], colors["none"])
|
||||
SetHl("SpecialComment", mods["italic"], colors["turquoise_l"], colors["none"])
|
||||
SetHl("Todo", mods["italic"], colors["turquoise_l"], colors["none"])
|
||||
SetHl("Debug", mods["italic"], colors["gray"], colors["none"])
|
||||
SetHl("Error", mods["none"], colors["red_l"], colors["none"])
|
||||
SetHl("Added", mods["none"], colors["green_l"], colors["none"])
|
||||
SetHl("Changed", mods["none"], colors["orange_l"], colors["none"])
|
||||
SetHl("Removed", mods["none"], colors["red_l"], colors["none"])
|
||||
|
||||
-- CODE - TREESITTER GENERAL
|
||||
----------------------------
|
||||
SetHl("@variable", mods["none"], colors["royal_l"], colors["none"])
|
||||
SetHl("@constant", mods["none"], colors["royal_l"], colors["none"])
|
||||
SetHl("@function.builtin", mods["none"], colors["turquoise_l"], colors["none"])
|
||||
SetHl("@variable.builtin", mods["none"], colors["purple_l"], colors["none"])
|
||||
SetHl("@constant.builtin", mods["none"], colors["purple_l"], colors["none"])
|
||||
|
||||
-- CODE - TREESITTER BASH
|
||||
-------------------------
|
||||
SetHl("@variable.parameter.bash", mods["none"], colors["turquoise_d"], colors["none"])
|
||||
SetHl("@punctuation.special.bash", mods["none"], colors["royal_d"], colors["none"])
|
||||
SetHl("@character.special.bash", mods["none"], colors["purple_l"], colors["none"])
|
||||
|
||||
-- ADDON - LAZY
|
||||
---------------
|
||||
SetHl("LazyH1", mods["bold"], colors["purple_l"], colors["none"])
|
||||
SetHl("LazyH2", mods["bold"], colors["turquoise_l"], colors["none"])
|
||||
SetHl("LazyComment", mods["none"], colors["turquoise_d"], colors["none"])
|
||||
SetHl("LazyButton", mods["none"], colors["white"], colors["none"])
|
||||
SetHl("LazyButtonActive", mods["none"], colors["turquoise_l"], colors["none"])
|
||||
SetHl("LazySpecial", mods["bold"], colors["turquoise_l"], colors["none"])
|
||||
|
||||
-- ADDON - LSPCMP
|
||||
-----------------
|
||||
SetHl("CmpItemKind", mods["italic"], colors["gray_l"], colors["none"])
|
||||
SetHl("CmpItemKindKeyword", mods["italic"], colors["cyan_l"], colors["none"])
|
||||
SetHl("CmpItemKindClass", mods["italic"], colors["yellow_l"], colors["none"])
|
||||
SetHl("CmpItemKindStruct", mods["italic"], colors["green_l"], colors["none"])
|
||||
SetHl("CmpItemKindEnum", mods["italic"], colors["salmon_l"], colors["none"])
|
||||
SetHl("CmpItemKindInterface", mods["italic"], colors["blue_l"], colors["none"])
|
||||
SetHl("CmpItemKindField", mods["italic"], colors["green_l"], colors["none"])
|
||||
SetHl("CmpItemKindUnit", mods["italic"], colors["salmon_l"], colors["none"])
|
||||
SetHl("CmpItemKindFile", mods["italic"], colors["turquoise_l"], colors["none"])
|
||||
SetHl("CmpItemKindFunction", mods["italic"], colors["turquoise_l"], colors["none"])
|
||||
SetHl("CmpItemKindMethod", mods["italic"], colors["turquoise_l"], colors["none"])
|
||||
SetHl("CmpItemKindModule", mods["italic"], colors["turquoise_l"], colors["none"])
|
||||
SetHl("CmpItemKindConstructor", mods["italic"], colors["turquoise_l"], colors["none"])
|
||||
SetHl("CmpItemKindOperator", mods["italic"], colors["turquoise_l"], colors["none"])
|
||||
SetHl("CmpItemKindFolder", mods["italic"], colors["royal_l"], colors["none"])
|
||||
SetHl("CmpItemKindConstant", mods["italic"], colors["royal_l"], colors["none"])
|
||||
SetHl("CmpItemKindVariable", mods["italic"], colors["royal_l"], colors["none"])
|
||||
SetHl("CmpItemKindReference", mods["italic"], colors["royal_l"], colors["none"])
|
||||
SetHl("CmpItemKindParameter", mods["italic"], colors["royal_l"], colors["none"])
|
||||
SetHl("CmpItemKindEnumMember", mods["italic"], colors["royal_l"], colors["none"])
|
||||
SetHl("CmpItemKindSnippet", mods["italic"], colors["purple_l"], colors["none"])
|
||||
|
||||
-- ADDON - TELESCOPE
|
||||
--------------------
|
||||
SetHl("TelescopeTitle", mods["bold"], colors["white"], colors["none"])
|
||||
SetHl("TelescopeBorder", mods["none"], colors["gray"], colors["none"])
|
||||
SetHl("TelescopePromptPrefix", mods["none"], colors["purple_l"], colors["none"])
|
||||
|
||||
|
38
config/nvim/init.lua
Normal file
38
config/nvim/init.lua
Normal file
|
@ -0,0 +1,38 @@
|
|||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||
local out = vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"--branch=stable",
|
||||
lazyrepo,
|
||||
lazypath,
|
||||
})
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo({
|
||||
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||
{ out, "WarningMsg" },
|
||||
{ "\nPress any key to exit..." },
|
||||
}, true, {})
|
||||
vim.fn.getchar()
|
||||
os.exit(1)
|
||||
end
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
vim.g.colorcolumn = 120
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
vim.cmd("filetype plugin indent on")
|
||||
|
||||
require("options")
|
||||
require("plugins")
|
||||
require("keymaps")
|
||||
require("commands")
|
||||
require("autocommands")
|
||||
require("lsp")
|
||||
require("syntax")
|
||||
-- require("dap")
|
||||
vim.cmd [[colorscheme nightfly]]
|
35
config/nvim/lazy-lock.json
Normal file
35
config/nvim/lazy-lock.json
Normal file
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" },
|
||||
"auto-save.nvim": { "branch": "main", "commit": "37c82fd548e3f5ffc2d9d020a65dac1044584f44" },
|
||||
"blink.cmp": { "branch": "main", "commit": "022521a8910a5543b0251b21c9e1a1e989745796" },
|
||||
"codecompanion.nvim": { "branch": "main", "commit": "9edf22cb71711cd7fab7671a25ed5424011a379d" },
|
||||
"conform.nvim": { "branch": "master", "commit": "0e93e0d12d2f7ebdea9e3e444dfaff0050cefbe6" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
|
||||
"go.nvim": { "branch": "master", "commit": "a3455f48cff718a86275115523dcc735535a13aa" },
|
||||
"goerr-nvim": { "branch": "main", "commit": "d30ba1cab652e78dbf6a644eb4823be57e9af203" },
|
||||
"goimpl.nvim": { "branch": "main", "commit": "2548d42c4db0645dea14f27e67c4b19b7030f1cf" },
|
||||
"guihua.lua": { "branch": "master", "commit": "87bea7b98429405caf2a0ce4d029b027bb017c70" },
|
||||
"headlines.nvim": { "branch": "master", "commit": "bf17c96a836ea27c0a7a2650ba385a7783ed322e" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||
"lsp_signature.nvim": { "branch": "master", "commit": "a4e3c15dfdce8783c074539b1835edae75fa63d5" },
|
||||
"lspsaga.nvim": { "branch": "main", "commit": "920b1253e1a26732e53fac78412f6da7f674671d" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "0c6cca9f2c63dadeb9225c45bc92bb95a151d4af" },
|
||||
"nightfly": { "branch": "master", "commit": "8c55003e89f321a48a8cd4bb426dd3e7c58f0646" },
|
||||
"nvim-dap": { "branch": "master", "commit": "ea82027c3447dc1a022be9a9884de276c05cd33a" },
|
||||
"nvim-dap-go": { "branch": "main", "commit": "8763ced35b19c8dc526e04a70ab07c34e11ad064" },
|
||||
"nvim-dap-ui": { "branch": "master", "commit": "73a26abf4941aa27da59820fd6b028ebcdbcf932" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "036885e8e5456d3907626b634693234f628afef6" },
|
||||
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "1c733e8c1957dc67f47580fe9c458a13b5612d5b" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
||||
"nvim-treesitter-context": { "branch": "master", "commit": "464a443b5a6657f39772b20baa95d02ffe97b268" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "0f051e9813a36481f48ca1f833897210dbcfffde" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
||||
"popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" },
|
||||
"smartcolumn.nvim": { "branch": "main", "commit": "92f3773af80d674f1eb61e112dca79e2fa449fd1" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" },
|
||||
"todotxt.nvim": { "branch": "main", "commit": "225ac77fea10a9ad9a48d0247a8d3c23f33cb2ba" }
|
||||
}
|
163
config/nvim/lua/autocommands.lua
Normal file
163
config/nvim/lua/autocommands.lua
Normal file
|
@ -0,0 +1,163 @@
|
|||
local function async_cmd(cmd)
|
||||
local job_id = vim.fn.jobstart(cmd, {
|
||||
on_stdout = function(_, data)
|
||||
for _, line in pairs(data or {}) do
|
||||
print(line)
|
||||
end
|
||||
end,
|
||||
on_stderr = function(_, data)
|
||||
for _, line in pairs(data or {}) do
|
||||
print(line)
|
||||
end
|
||||
end,
|
||||
on_exit = function(_, code)
|
||||
if code ~= 0 then
|
||||
vim.notify(
|
||||
string.format("Команда завершилась с ошибкой (%d)", code),
|
||||
vim.log.levels.ERROR
|
||||
)
|
||||
else
|
||||
vim.notify("OK", vim.log.levels.INFO)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
return job_id
|
||||
end
|
||||
|
||||
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,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
|
||||
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",
|
||||
})
|
||||
|
||||
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,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("BufEnter", {
|
||||
callback = function()
|
||||
if vim.bo.filetype == "NvimTree" or vim.fn.expand("%") == "" then
|
||||
return
|
||||
end
|
||||
vim.schedule(function()
|
||||
vim.cmd("nohlsearch")
|
||||
local treeapi = require("nvim-tree.api")
|
||||
treeapi.tree.find_file({
|
||||
update_root = false,
|
||||
focus = false,
|
||||
})
|
||||
end)
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufEnter", "BufAdd", "BufNew", "BufNewFile", "BufWinEnter" }, {
|
||||
group = vim.api.nvim_create_augroup("TS_FOLD_WORKAROUND", {}),
|
||||
callback = function()
|
||||
-- vim.cmd([[normal zR]])
|
||||
end,
|
||||
})
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "*",
|
||||
callback = function(args)
|
||||
local buf = args.buf
|
||||
local ft = vim.bo[buf].filetype
|
||||
|
||||
if ft and ft ~= "" then
|
||||
local has_parser, _ = pcall(vim.treesitter.language.get_lang, ft)
|
||||
if has_parser then
|
||||
pcall(vim.treesitter.start, buf, ft)
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "TSUpdate",
|
||||
callback = function()
|
||||
vim.cmd([[TSEnable highlight]])
|
||||
end,
|
||||
})
|
||||
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
|
||||
pattern = "*.templ",
|
||||
callback = function()
|
||||
local cmd = "templ generate"
|
||||
async_cmd(cmd)
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ "VimEnter" }, {
|
||||
callback = function(data)
|
||||
local directory = vim.fn.isdirectory(data.file) == 1
|
||||
if not directory then
|
||||
return
|
||||
end
|
||||
vim.cmd.cd(data.file)
|
||||
require("nvim-tree.api").tree.open()
|
||||
end,
|
||||
})
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "go",
|
||||
callback = function()
|
||||
vim.opt_local.expandtab = false
|
||||
vim.opt_local.tabstop = 4
|
||||
vim.opt_local.shiftwidth = 4
|
||||
vim.opt_local.autoindent = true
|
||||
vim.opt_local.smartindent = true
|
||||
vim.opt_local.cindent = false
|
||||
end,
|
||||
})
|
||||
vim.filetype.add({
|
||||
extension = {
|
||||
hjson = "hjson",
|
||||
},
|
||||
})
|
||||
vim.api.nvim_create_autocmd("VimResized", {
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
vim.opt.scrolloff = vim.fn.floor(vim.fn.winheight(0) / 2)
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("InsertEnter", {
|
||||
pattern = "*",
|
||||
command = "set norelativenumber",
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("InsertLeave", {
|
||||
pattern = "*",
|
||||
command = "set relativenumber",
|
||||
})
|
6
config/nvim/lua/commands.lua
Normal file
6
config/nvim/lua/commands.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
vim.api.nvim_create_user_command("Lower", function()
|
||||
vim.cmd([[normal! guaw]])
|
||||
end, { force = true })
|
||||
vim.api.nvim_create_user_command("Upper", function()
|
||||
vim.cmd([[normal! gUaw]])
|
||||
end, { force = true })
|
77
config/nvim/lua/keymaps.lua
Normal file
77
config/nvim/lua/keymaps.lua
Normal file
|
@ -0,0 +1,77 @@
|
|||
local map = vim.api.nvim_set_keymap
|
||||
local kmap = vim.keymap.set
|
||||
-- Базовые настройки навигации --
|
||||
map("n", "<Space>", "<Nop>", { noremap = true, silent = true })
|
||||
|
||||
-- Навигация в начало/конец строки
|
||||
map("n", "<Home>", "^", { noremap = true, silent = true })
|
||||
map("n", "<End>", "$", { noremap = true, silent = true })
|
||||
map("v", "<Home>", "^", { noremap = true, silent = true })
|
||||
map("v", "<End>", "$", { noremap = true, silent = true })
|
||||
map("i", "<Home>", "<C-o>^", { noremap = true, silent = true })
|
||||
map("i", "<End>", "<C-o>$", { noremap = true, silent = true })
|
||||
|
||||
-- Фикс для визуального режима
|
||||
map("v", "i", "<S-i>", { noremap = true, silent = true })
|
||||
map("v", "a", "<S-a>", { noremap = true, silent = true })
|
||||
map("v", "J", ":m '>+1<CR>gv=gv", { noremap = true, silent = true })
|
||||
map("v", "K", ":m '<-2<CR>gv=gv", { noremap = true, silent = true })
|
||||
map("v", "<", "<gv", { noremap = true, silent = true })
|
||||
map("v", ">", ">gv", { noremap = true, silent = true })
|
||||
|
||||
-- {{{ Управление буферами --
|
||||
kmap("n", "<leader>bn", "<cmd>bnext<CR>", { noremap = true, silent = true, desc = "Next buffer" })
|
||||
kmap("n", "<leader>bp", "<cmd>bprevious<CR>", { noremap = true, silent = true, desc = "Previous buffer" })
|
||||
kmap("n", "<leader>bd", "<cmd>bdelete<CR>", { noremap = true, silent = true, desc = "Delete buffer" })
|
||||
kmap("n", "<C-s>", "<cmd>wa<CR>", { noremap = true, silent = true, desc = "Save all files" })
|
||||
kmap("n", "<leader>q", "<cmd>q<CR>", { noremap = true, silent = true, desc = "Exit" })
|
||||
kmap("n", "<leader>vs", "<cmd>vsplit<CR>", { noremap = true, silent = true, desc = "Vertical split" })
|
||||
-- }}}
|
||||
|
||||
-- {{{ Управление вкладками --
|
||||
kmap("n", "<A-Right>", ":tabnext<CR>", { noremap = true, silent = true, desc = "Next tab" })
|
||||
kmap("n", "<A-Left>", ":tabprevious<CR>", { noremap = true, silent = true, desc = "Previous tab" })
|
||||
kmap("n", "<A-t>", ":tabnew<CR>", { noremap = true, silent = true, desc = "New tab" })
|
||||
kmap("n", "<A-w>", ":tabclose<CR>", { noremap = true, silent = true, desc = "Close tab" })
|
||||
|
||||
-- Быстрый переход по вкладкам --
|
||||
for i = 1, 9 do
|
||||
kmap("n", "<A-" .. i .. ">", ":tabn " .. i .. "<CR>", { noremap = true, silent = true, desc = "Go to tab " .. i })
|
||||
end
|
||||
|
||||
-- }}}
|
||||
|
||||
-- {{{ LSP функции
|
||||
kmap("n", "d[", vim.diagnostic.goto_prev, { noremap = true, silent = true, desc = "Previous diagnostic" })
|
||||
kmap("n", "d]", vim.diagnostic.goto_next, { noremap = true, silent = true, desc = "Next diagnostic" })
|
||||
|
||||
kmap("n", "gD", vim.lsp.buf.declaration, { noremap = true, silent = true, desc = "Go to declaration" })
|
||||
kmap("n", "gd", vim.lsp.buf.definition, { noremap = true, silent = true, desc = "Go to definition" })
|
||||
kmap("n", "K", vim.lsp.buf.hover, { noremap = true, silent = true, desc = "Show documentation" })
|
||||
|
||||
kmap("n", "<C-k>", vim.lsp.buf.signature_help, { noremap = true, silent = true, desc = "Signature help" })
|
||||
|
||||
kmap(
|
||||
"n",
|
||||
"<leader>wa",
|
||||
vim.lsp.buf.add_workspace_folder,
|
||||
{ noremap = true, silent = true, desc = "Add workspace folder" }
|
||||
)
|
||||
|
||||
kmap(
|
||||
"n",
|
||||
"<leader>wr",
|
||||
vim.lsp.buf.remove_workspace_folder,
|
||||
{ noremap = true, silent = true, desc = "Remove workspace folder" }
|
||||
)
|
||||
|
||||
kmap("n", "<leader>wl", function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, { noremap = true, silent = true, desc = "List workspace folders" })
|
||||
|
||||
--kmap("n", "<A-CR>", vim.lsp.buf.code_action, { noremap = true, silent = true, desc = "Code actions" })
|
||||
kmap("n", "<A-CR>", "<cmd>Lspsaga code_action<cr>", { noremap = true, silent = true, desc = "Code actions" })
|
||||
|
||||
kmap("n", "<F2>", vim.lsp.buf.rename, { noremap = true, silent = true, desc = "Rename symbol" })
|
||||
|
||||
-- }}}
|
31
config/nvim/lua/lsp.lua
Normal file
31
config/nvim/lua/lsp.lua
Normal file
|
@ -0,0 +1,31 @@
|
|||
-- инициализация LSP для различных ЯП
|
||||
local lspconfig = require("lspconfig")
|
||||
local util = require("lspconfig/util")
|
||||
|
||||
local function config(_config)
|
||||
return vim.tbl_deep_extend("force", {
|
||||
-- capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()),
|
||||
}, _config or {})
|
||||
end
|
||||
-- иницализация gopls LSP для Go
|
||||
-- https://github.com/golang/tools/blob/master/gopls/doc/vim.md#neovim-install
|
||||
lspconfig.gopls.setup(config({
|
||||
cmd = { "gopls", "serve" },
|
||||
filetypes = { "go", "go.mod" },
|
||||
root_dir = util.root_pattern("go.work", "go.mod", ".git"),
|
||||
settings = {
|
||||
gopls = {
|
||||
analyses = {
|
||||
unusedparams = true,
|
||||
},
|
||||
staticcheck = true,
|
||||
gofumpt = true,
|
||||
},
|
||||
},
|
||||
}))
|
||||
|
||||
lspconfig.templ.setup(config({
|
||||
cmd = { "templ", "lsp" },
|
||||
filetypes = { "templ" },
|
||||
root_markers = { "go.work", "go.mod", ".git" },
|
||||
}))
|
97
config/nvim/lua/myplugins/resize.lua
Normal file
97
config/nvim/lua/myplugins/resize.lua
Normal file
|
@ -0,0 +1,97 @@
|
|||
local M = {}
|
||||
|
||||
M.setup = function(opts) end
|
||||
|
||||
M.isRightMost = function()
|
||||
local curWin = vim.fn.winnr()
|
||||
vim.cmd([[wincmd l]])
|
||||
local rightWin = vim.fn.winnr()
|
||||
if curWin == rightWin then
|
||||
return true
|
||||
else
|
||||
vim.cmd([[wincmd h]])
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
M.isLeftMost = function()
|
||||
local curWin = vim.fn.winnr()
|
||||
vim.cmd([[wincmd h]])
|
||||
local leftWin = vim.fn.winnr()
|
||||
if curWin == leftWin then
|
||||
return true
|
||||
else
|
||||
vim.cmd([[wincmd l]])
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
M.isBottomMost = function()
|
||||
local curWin = vim.fn.winnr()
|
||||
vim.cmd([[wincmd j]])
|
||||
local bottomWin = vim.fn.winnr()
|
||||
if curWin == bottomWin then
|
||||
return true
|
||||
else
|
||||
vim.cmd([[wincmd k]])
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
M.isTopMost = function()
|
||||
local curWin = vim.fn.winnr()
|
||||
vim.cmd([[wincmd k]])
|
||||
local topWin = vim.fn.winnr()
|
||||
if curWin == topWin then
|
||||
return true
|
||||
else
|
||||
vim.cmd([[wincmd j]])
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
M.ResizeLeft = function()
|
||||
if M.isRightMost() then
|
||||
if not M.isLeftMost() then
|
||||
vim.cmd([[wincmd 5 >]])
|
||||
end
|
||||
else
|
||||
vim.cmd([[wincmd 5 <]])
|
||||
end
|
||||
end
|
||||
|
||||
M.ResizeRight = function()
|
||||
if M.isRightMost() then
|
||||
if not M.isLeftMost() then
|
||||
vim.cmd([[wincmd 5 <]])
|
||||
end
|
||||
else
|
||||
vim.cmd([[wincmd 5 >]])
|
||||
end
|
||||
end
|
||||
|
||||
M.ResizeUp = function()
|
||||
if M.isBottomMost() then
|
||||
if not M.isTopMost() then
|
||||
vim.cmd([[wincmd 5 +]])
|
||||
else
|
||||
vim.cmd([[wincmd 5 -]])
|
||||
end
|
||||
else
|
||||
vim.cmd([[wincmd 5 -]])
|
||||
end
|
||||
end
|
||||
|
||||
M.ResizeDown = function()
|
||||
if M.isBottomMost() then
|
||||
if not M.isTopMost() then
|
||||
vim.cmd([[wincmd 5 -]])
|
||||
else
|
||||
vim.cmd([[wincmd 5 +]])
|
||||
end
|
||||
else
|
||||
vim.cmd([[wincmd 5 +]])
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
68
config/nvim/lua/options.lua
Normal file
68
config/nvim/lua/options.lua
Normal file
|
@ -0,0 +1,68 @@
|
|||
local options = {
|
||||
backup = false,
|
||||
clipboard = "unnamedplus",
|
||||
cmdheight = 2,
|
||||
completeopt = { "menuone", "noselect" },
|
||||
conceallevel = 0,
|
||||
fileencoding = "utf-8",
|
||||
hidden = true,
|
||||
hlsearch = true,
|
||||
ignorecase = true,
|
||||
mouse = "",
|
||||
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,
|
||||
syntax = "on",
|
||||
foldmethod = "expr",
|
||||
foldexpr = "v:lua.vim.treesitter.foldexpr()",
|
||||
-- foldexpr = "nvim_treesitter#foldexpr()"
|
||||
foldnestmax = 10,
|
||||
foldlevel = 9,
|
||||
-- foldlevelstart = 99,
|
||||
scrolloff = 999,
|
||||
so = vim.fn.floor(vim.fn.winheight(0) / 2),
|
||||
guicursor = "n-v-c:block,i-ci-ve:hor10,r-cr:hor20,o:hor50,a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor,sm:block-blinkwait175-blinkoff150-blinkon175",
|
||||
langmap = "ФИСВУАПРШОЛДЬТЩЗЙКЫЕГМЦЧНЯЖ;ABCDEFGHIJKLMNOPQRSTUVWXYZ:,фисвуапршолдьтщзйкыегмцчня;abcdefghijklmnopqrstuvwxyz",
|
||||
spelllang = "en,ru_yo",
|
||||
spell = true,
|
||||
}
|
||||
vim.opt.formatoptions:append({ r = true, o = true })
|
||||
vim.opt.shortmess:append("c")
|
||||
|
||||
for k, v in pairs(options) do
|
||||
vim.opt[k] = v
|
||||
end
|
||||
vim.wo.foldmethod = "expr"
|
||||
vim.wo.foldexpr = "v:lua.vim.treesitter.foldexpr()"
|
||||
vim.cmd("set whichwrap+=<,>,[,],h,l")
|
||||
vim.filetype.add({
|
||||
extension = {
|
||||
templ = "templ",
|
||||
},
|
||||
pattern = {
|
||||
[".*/todo.txt"] = "todotxt",
|
||||
},
|
||||
})
|
||||
|
||||
vim.g.nightflyCursorColor = true
|
||||
vim.g.nightflyVirtualTextColor = true
|
||||
vim.g.nightflyTransparent = true
|
45
config/nvim/lua/plugins.lua
Normal file
45
config/nvim/lua/plugins.lua
Normal file
|
@ -0,0 +1,45 @@
|
|||
require("lazy").setup({
|
||||
{ "bluz71/vim-nightfly-colors", name = "nightfly", lazy = false, priority = 1000 },
|
||||
{ "nvim-lua/plenary.nvim" },
|
||||
{
|
||||
"ray-x/guihua.lua",
|
||||
build = "cd lua/fzy && make",
|
||||
},
|
||||
{ "neovim/nvim-lspconfig" },
|
||||
{ "Snyssfx/goerr-nvim" },
|
||||
require("plugins.todo"),
|
||||
require("plugins.codecompanion"),
|
||||
require("plugins.resize"),
|
||||
require("plugins.blankline"),
|
||||
require("plugins.headlines"),
|
||||
require("plugins.lsp_saga"),
|
||||
require("plugins.lsp_signature"),
|
||||
require("plugins.autosave"),
|
||||
require("plugins.cmp"),
|
||||
require("plugins.treesitter"),
|
||||
require("plugins.tree"),
|
||||
require("plugins.conform"),
|
||||
require("plugins.dapui"),
|
||||
require("plugins.dap"),
|
||||
require("plugins.dap_go"),
|
||||
require("plugins.go"),
|
||||
require("plugins.goimpl"),
|
||||
require("plugins.lualine"),
|
||||
require("plugins.telescope"),
|
||||
require("plugins.columns"),
|
||||
}, {
|
||||
performance = {
|
||||
rtp = {
|
||||
disabled_plugins = {
|
||||
"gzip",
|
||||
"matchit",
|
||||
"matchparen",
|
||||
"netrwPlugin",
|
||||
"tarPlugin",
|
||||
"tohtml",
|
||||
"tutor",
|
||||
"zipPlugin",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
69
config/nvim/lua/plugins/autosave.lua
Normal file
69
config/nvim/lua/plugins/autosave.lua
Normal file
|
@ -0,0 +1,69 @@
|
|||
return {
|
||||
"okuuva/auto-save.nvim",
|
||||
enabled = true,
|
||||
cmd = "ASToggle", -- optional for lazy loading on command
|
||||
event = { "InsertLeave", "TextChanged" }, -- optional for lazy loading on trigger events
|
||||
opts = {
|
||||
enabled = true, -- start auto-save when the plugin is loaded (i.e. when your package manager loads it)
|
||||
trigger_events = { -- See :h events
|
||||
-- -- vim events that trigger an immediate save
|
||||
-- -- I'm disabling this, as it's autosaving when I leave the buffer and
|
||||
-- -- that's autoformatting stuff if on insert mode and following a tutorial
|
||||
-- -- Re-enabling this to only save if NOT in insert mode in the condition below
|
||||
-- immediate_save = { nil },
|
||||
immediate_save = { "BufLeave", "FocusLost", "QuitPre", "VimSuspend" }, -- vim events that trigger an immediate save
|
||||
-- vim events that trigger a deferred save (saves after `debounce_delay`)
|
||||
defer_save = {
|
||||
"InsertLeave",
|
||||
"TextChanged",
|
||||
{ "User", pattern = "VisualLeave" },
|
||||
{ "User", pattern = "FlashJumpEnd" },
|
||||
{ "User", pattern = "SnacksInputLeave" },
|
||||
{ "User", pattern = "SnacksPickerInputLeave" },
|
||||
},
|
||||
cancel_deferred_save = {
|
||||
"InsertEnter",
|
||||
{ "User", pattern = "VisualEnter" },
|
||||
{ "User", pattern = "FlashJumpStart" },
|
||||
{ "User", pattern = "SnacksInputEnter" },
|
||||
{ "User", pattern = "SnacksPickerInputEnter" },
|
||||
},
|
||||
},
|
||||
-- function that takes the buffer handle and determines whether to save the current buffer or not
|
||||
-- return true: if buffer is ok to be saved
|
||||
-- return false: if it's not ok to be saved
|
||||
-- if set to `nil` then no specific condition is applied
|
||||
condition = function(buf)
|
||||
-- Do not save when I'm in insert mode
|
||||
-- Do NOT ADD VISUAL MODE HERE or the cancel_deferred_save wont' work
|
||||
-- If I STAY in insert mode and switch to another app, like YouTube to
|
||||
-- take notes, the BufLeave or FocusLost immediate_save will be ignored
|
||||
-- and the save will not be triggered
|
||||
local mode = vim.fn.mode()
|
||||
if mode == "i" then
|
||||
return false
|
||||
end
|
||||
|
||||
-- Disable auto-save for the harpoon plugin, otherwise it just opens and closes
|
||||
-- https://github.com/ThePrimeagen/harpoon/issues/434
|
||||
--
|
||||
-- don't save for `sql` file types
|
||||
-- I do this so when working with dadbod the file is not saved every time
|
||||
-- I make a change, and a SQL query executed
|
||||
-- Run `:set filetype?` on a dadbod query to make sure of the filetype
|
||||
local filetype = vim.bo[buf].filetype
|
||||
if filetype == "harpoon" or filetype == "mysql" then
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end,
|
||||
write_all_buffers = true, -- write all buffers when the current one meets `condition`
|
||||
noautocmd = false,
|
||||
lockmarks = false, -- lock marks when saving, see `:h lockmarks` for more details
|
||||
-- delay after which a pending save is executed (default 1000)
|
||||
debounce_delay = 2000,
|
||||
-- log debug messages to 'auto-save.log' file in neovim cache directory, set to `true` to enable
|
||||
debug = false,
|
||||
},
|
||||
}
|
7
config/nvim/lua/plugins/blankline.lua
Normal file
7
config/nvim/lua/plugins/blankline.lua
Normal file
|
@ -0,0 +1,7 @@
|
|||
return {
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
main = "ibl",
|
||||
--@module "ibl"
|
||||
--@type ibl.config
|
||||
config = true,
|
||||
}
|
55
config/nvim/lua/plugins/cmp.lua
Normal file
55
config/nvim/lua/plugins/cmp.lua
Normal file
|
@ -0,0 +1,55 @@
|
|||
local source_mapping = {
|
||||
buffer = "[Buffer]",
|
||||
nvim_lsp = "[LSP]",
|
||||
nvim_lua = "[Lua]",
|
||||
luasnip = "[Snip]",
|
||||
path = "[Path]",
|
||||
}
|
||||
return {
|
||||
"saghen/blink.cmp",
|
||||
lazy = false,
|
||||
version = "1.*",
|
||||
dependencies = {
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
version = "v2.*",
|
||||
build = "make install_jsregexp",
|
||||
dependencies = { "rafamadriz/friendly-snippets" },
|
||||
config = function()
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
require("luasnip.loaders.from_vscode").lazy_load("./snippets")
|
||||
end,
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
keymap = {
|
||||
preset = "enter",
|
||||
},
|
||||
completion = {
|
||||
list = {
|
||||
selection = {
|
||||
preselect = false,
|
||||
auto_insert = false,
|
||||
},
|
||||
},
|
||||
ghost_text = {
|
||||
enabled = true,
|
||||
},
|
||||
},
|
||||
cmdline = {
|
||||
keymap = {
|
||||
preset = "inherit",
|
||||
['<Tab>'] = { 'show', 'accept' },
|
||||
},
|
||||
completion = {
|
||||
menu = { auto_show = false },
|
||||
ghost_text = { enabled = true },
|
||||
},
|
||||
sources = { "cmdline" },
|
||||
},
|
||||
snippets = { preset = "luasnip" },
|
||||
sources = {
|
||||
default = { "lsp", "path", "snippets", "buffer", "codecompanion" },
|
||||
},
|
||||
},
|
||||
}
|
10
config/nvim/lua/plugins/columns.lua
Normal file
10
config/nvim/lua/plugins/columns.lua
Normal file
|
@ -0,0 +1,10 @@
|
|||
return {
|
||||
"m4xshen/smartcolumn.nvim",
|
||||
opts = {
|
||||
colorcolumn = "80",
|
||||
disabled_filetypes = { "help", "text" },
|
||||
custom_colorcolumn = {},
|
||||
scope = "file",
|
||||
editorconfig = true,
|
||||
},
|
||||
}
|
35
config/nvim/lua/plugins/conform.lua
Normal file
35
config/nvim/lua/plugins/conform.lua
Normal file
|
@ -0,0 +1,35 @@
|
|||
return {
|
||||
"stevearc/conform.nvim",
|
||||
opts = {
|
||||
formatters_by_ft = {
|
||||
javascript = { "prettier" },
|
||||
typescript = { "prettier" },
|
||||
javascriptreact = { "prettier" },
|
||||
typescriptreact = { "prettier" },
|
||||
css = { "prettier" },
|
||||
html = { "prettier" },
|
||||
json = { "prettier" },
|
||||
yaml = { "prettier" },
|
||||
markdown = { "prettier" },
|
||||
graphql = { "prettier" },
|
||||
lua = { "stylua" },
|
||||
python = { "isort", "black" },
|
||||
go = { "gofmt" },
|
||||
templ = { "templ" },
|
||||
},
|
||||
format_on_save = {
|
||||
lsp_fallback = true,
|
||||
async = false,
|
||||
timeout_ms = 500,
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
"<leader>mp",
|
||||
function()
|
||||
require("conform").format({ lsp_fallback = true, async = false, timeout_ms = 500 })
|
||||
end,
|
||||
desc = "Format file or range (in visual mode)",
|
||||
},
|
||||
},
|
||||
}
|
3
config/nvim/lua/plugins/dap.lua
Normal file
3
config/nvim/lua/plugins/dap.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
return {
|
||||
"mfussenegger/nvim-dap",
|
||||
}
|
159
config/nvim/lua/plugins/dap_go.lua
Normal file
159
config/nvim/lua/plugins/dap_go.lua
Normal file
|
@ -0,0 +1,159 @@
|
|||
local default_config = {
|
||||
delve = {
|
||||
path = "dlv",
|
||||
initialize_timeout_sec = 20,
|
||||
port = "${port}",
|
||||
args = {},
|
||||
build_flags = "",
|
||||
-- Automatically handle the issue on delve Windows versions < 1.24.0
|
||||
-- where delve needs to be run in attched mode or it will fail (actually crashes).
|
||||
detached = vim.fn.has("win32") == 0,
|
||||
output_mode = "remote",
|
||||
cwd = nil,
|
||||
},
|
||||
tests = {
|
||||
verbose = false,
|
||||
},
|
||||
}
|
||||
|
||||
local function setup_go_configuration(dap, configs)
|
||||
local common_debug_configs = {
|
||||
{
|
||||
type = "go",
|
||||
name = "Debug",
|
||||
request = "launch",
|
||||
program = "${workspaceFolder}",
|
||||
args = {},
|
||||
buildFlags = configs.delve.build_flags,
|
||||
outputMode = configs.delve.output_mode,
|
||||
},
|
||||
}
|
||||
|
||||
if dap.configurations.go == nil then
|
||||
dap.configurations.go = {}
|
||||
end
|
||||
|
||||
for _, config in ipairs(common_debug_configs) do
|
||||
table.insert(dap.configurations.go, config)
|
||||
end
|
||||
|
||||
if configs == nil or configs.dap_configurations == nil then
|
||||
return
|
||||
end
|
||||
|
||||
for _, config in ipairs(configs.dap_configurations) do
|
||||
if config.type == "go" then
|
||||
table.insert(dap.configurations.go, config)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
"leoluz/nvim-dap-go",
|
||||
dependencies = { "mfussenegger/nvim-dap" },
|
||||
opts = true,
|
||||
config = function()
|
||||
local dap, dapui = require("dap"), require("dapui")
|
||||
|
||||
dap.adapters.go = {
|
||||
type = "server",
|
||||
port = "${port}",
|
||||
executable = {
|
||||
command = "dlv",
|
||||
args = { "dap", "-l", "127.0.0.1:${port}" },
|
||||
},
|
||||
}
|
||||
|
||||
setup_go_configuration(dap, default_config)
|
||||
|
||||
dap.defaults.fallback.terminal_win_cmd = "enew | set filetype=dap-terminal"
|
||||
dap.listeners.before.attach.dapui_config = function()
|
||||
dapui.open()
|
||||
end
|
||||
dap.listeners.before.launch.dapui_config = function()
|
||||
dapui.open()
|
||||
end
|
||||
dap.listeners.before.event_terminated.dapui_config = function()
|
||||
dapui.close()
|
||||
end
|
||||
dap.listeners.before.event_exited.dapui_config = function()
|
||||
dapui.close()
|
||||
end
|
||||
|
||||
vim.api.nvim_set_hl(0, "DapBreakpoint", { ctermbg = 0, fg = "#993939", bg = "#31353f" })
|
||||
vim.api.nvim_set_hl(0, "DapLogPoint", { ctermbg = 0, fg = "#61afef", bg = "#31353f" })
|
||||
vim.api.nvim_set_hl(0, "DapStopped", { ctermbg = 0, fg = "#98c379", bg = "#31353f" })
|
||||
|
||||
vim.fn.sign_define(
|
||||
"DapBreakpoint",
|
||||
{ text = "!", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" }
|
||||
)
|
||||
vim.fn.sign_define(
|
||||
"DapBreakpointCondition",
|
||||
{ text = "?", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" }
|
||||
)
|
||||
vim.fn.sign_define(
|
||||
"DapBreakpointRejected",
|
||||
{ text = "RJ", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" }
|
||||
)
|
||||
vim.fn.sign_define(
|
||||
"DapLogPoint",
|
||||
{ text = "i", texthl = "DapLogPoint", linehl = "DapLogPoint", numhl = "DapLogPoint" }
|
||||
)
|
||||
vim.fn.sign_define(
|
||||
"DapStopped",
|
||||
{ text = "→", texthl = "DapStopped", linehl = "DapStopped", numhl = "DapStopped" }
|
||||
)
|
||||
end,
|
||||
keys = {
|
||||
{
|
||||
"<F5>",
|
||||
function()
|
||||
require("dap").continue()
|
||||
end,
|
||||
silent = true,
|
||||
},
|
||||
{
|
||||
"<F17>", -- S-F5
|
||||
function()
|
||||
require("dap").restart()
|
||||
end,
|
||||
silent = true,
|
||||
},
|
||||
{
|
||||
"<F29>", -- C-F5
|
||||
function()
|
||||
require("dap").terminate()
|
||||
end,
|
||||
silent = true,
|
||||
},
|
||||
{
|
||||
"<F8>",
|
||||
function()
|
||||
require("dap").step_over()
|
||||
end,
|
||||
silent = true,
|
||||
},
|
||||
{
|
||||
"<F7>",
|
||||
function()
|
||||
require("dap").step_into()
|
||||
end,
|
||||
silent = true,
|
||||
},
|
||||
{
|
||||
"<F19>", -- S-F7
|
||||
function()
|
||||
require("dap").step_out()
|
||||
end,
|
||||
silent = true,
|
||||
},
|
||||
{
|
||||
"<A-b>",
|
||||
function()
|
||||
require("dap").toggle_breakpoint()
|
||||
end,
|
||||
silent = true,
|
||||
},
|
||||
},
|
||||
}
|
73
config/nvim/lua/plugins/dapui.lua
Normal file
73
config/nvim/lua/plugins/dapui.lua
Normal file
|
@ -0,0 +1,73 @@
|
|||
return {
|
||||
"rcarriga/nvim-dap-ui",
|
||||
dependencies = {
|
||||
"mfussenegger/nvim-dap",
|
||||
"nvim-neotest/nvim-nio",
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
"<F6>",
|
||||
function()
|
||||
require("dapui").toggle()
|
||||
end,
|
||||
silent = true,
|
||||
},
|
||||
{
|
||||
"<Leader>dh",
|
||||
function()
|
||||
require("dap.ui.widgets").hover()
|
||||
end,
|
||||
silent = true,
|
||||
},
|
||||
{
|
||||
"<Leader>dp",
|
||||
function()
|
||||
require("dap.ui.widgets").preview()
|
||||
end,
|
||||
silent = true,
|
||||
},
|
||||
{
|
||||
"<F9>",
|
||||
function()
|
||||
local widgets = require("dap.ui.widgets")
|
||||
widgets.centered_float(widgets.scopes)
|
||||
end,
|
||||
silent = true,
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
icons = {
|
||||
expanded = "[-]",
|
||||
collapsed = "[+]",
|
||||
},
|
||||
mappings = {
|
||||
open = "o",
|
||||
remove = "d",
|
||||
edit = "e",
|
||||
repl = "r",
|
||||
toggle = "t",
|
||||
},
|
||||
expand_lines = vim.fn.has("nvim-0.7"),
|
||||
layouts = {
|
||||
{
|
||||
elements = {
|
||||
"repl",
|
||||
},
|
||||
size = 0.3,
|
||||
position = "bottom",
|
||||
},
|
||||
},
|
||||
floating = {
|
||||
max_height = nil,
|
||||
max_width = nil,
|
||||
border = "single",
|
||||
mappings = {
|
||||
close = { "q", "<Esc>" },
|
||||
},
|
||||
},
|
||||
windows = { indent = 1 },
|
||||
render = {
|
||||
max_type_length = nil,
|
||||
},
|
||||
},
|
||||
}
|
12
config/nvim/lua/plugins/go.lua
Normal file
12
config/nvim/lua/plugins/go.lua
Normal file
|
@ -0,0 +1,12 @@
|
|||
return {
|
||||
"ray-x/go.nvim",
|
||||
dependencies = {
|
||||
"ray-x/guihua.lua",
|
||||
"neovim/nvim-lspconfig",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
},
|
||||
config = true,
|
||||
event = { "CmdlineEnter" },
|
||||
ft = { "go", "gomod" },
|
||||
build = ':lua require("go.install").update_all_sync()',
|
||||
}
|
21
config/nvim/lua/plugins/goimpl.lua
Normal file
21
config/nvim/lua/plugins/goimpl.lua
Normal file
|
@ -0,0 +1,21 @@
|
|||
return {
|
||||
"edolphin-ydf/goimpl.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-lua/popup.nvim",
|
||||
"nvim-telescope/telescope.nvim",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
},
|
||||
config = function()
|
||||
require("telescope").load_extension("goimpl")
|
||||
end,
|
||||
keys = {
|
||||
{
|
||||
"<leader>im",
|
||||
function()
|
||||
require("telescope").extensions.goimpl.goimpl({})
|
||||
end,
|
||||
desc = "Generate stub for interface on a type for golang",
|
||||
},
|
||||
},
|
||||
}
|
5
config/nvim/lua/plugins/headlines.lua
Normal file
5
config/nvim/lua/plugins/headlines.lua
Normal file
|
@ -0,0 +1,5 @@
|
|||
return {
|
||||
"lukas-reineke/headlines.nvim",
|
||||
dependencies = "nvim-treesitter/nvim-treesitter",
|
||||
config = true,
|
||||
}
|
8
config/nvim/lua/plugins/lsp_saga.lua
Normal file
8
config/nvim/lua/plugins/lsp_saga.lua
Normal file
|
@ -0,0 +1,8 @@
|
|||
return {
|
||||
"nvimdev/lspsaga.nvim",
|
||||
opts = {
|
||||
lightbulb = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
}
|
15
config/nvim/lua/plugins/lsp_signature.lua
Normal file
15
config/nvim/lua/plugins/lsp_signature.lua
Normal file
|
@ -0,0 +1,15 @@
|
|||
return {
|
||||
"ray-x/lsp_signature.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
doc_lines = 1,
|
||||
max_height = 3,
|
||||
hint_prefix = "",
|
||||
hint_prefix = {
|
||||
above = "↙ ",
|
||||
current = "← ",
|
||||
below = "↖ ",
|
||||
},
|
||||
floating_window = true,
|
||||
},
|
||||
}
|
44
config/nvim/lua/plugins/lualine.lua
Normal file
44
config/nvim/lua/plugins/lualine.lua
Normal file
|
@ -0,0 +1,44 @@
|
|||
local colors = require("theme.colors")
|
||||
return {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
opts = {
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = "nightfly",
|
||||
component_separators = { left = "", right = "" },
|
||||
section_separators = { left = "", right = "" },
|
||||
disabled_filetypes = {
|
||||
statusline = {},
|
||||
winbar = {},
|
||||
},
|
||||
ignore_focus = {},
|
||||
always_divide_middle = true,
|
||||
globalstatus = false,
|
||||
refresh = {
|
||||
statusline = 1000,
|
||||
tabline = 1000,
|
||||
winbar = 1000,
|
||||
},
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { "mode" },
|
||||
lualine_b = { "branch", "diff", "diagnostics" },
|
||||
lualine_c = { "filename" },
|
||||
lualine_x = { "filetype" },
|
||||
lualine_y = { "progress", "location" },
|
||||
lualine_z = { "lsp_status", "os.date('%H:%M')" },
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = { "filename" },
|
||||
lualine_x = { "location" },
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
},
|
||||
tabline = {},
|
||||
winbar = {},
|
||||
inactive_winbar = {},
|
||||
extensions = {},
|
||||
},
|
||||
}
|
34
config/nvim/lua/plugins/resize.lua
Normal file
34
config/nvim/lua/plugins/resize.lua
Normal file
|
@ -0,0 +1,34 @@
|
|||
return {
|
||||
name = "resize",
|
||||
dir = "~/.config/nvim/lua/myplugins",
|
||||
keys = {
|
||||
{
|
||||
"<C-A-Left>",
|
||||
function()
|
||||
require("myplugins.resize").ResizeLeft()
|
||||
end,
|
||||
silent = true,
|
||||
},
|
||||
{
|
||||
"<C-A-Right>",
|
||||
function()
|
||||
require("myplugins.resize").ResizeRight()
|
||||
end,
|
||||
silent = true,
|
||||
},
|
||||
{
|
||||
"<C-A-Up>",
|
||||
function()
|
||||
require("myplugins.resize").ResizeUp()
|
||||
end,
|
||||
silent = true,
|
||||
},
|
||||
{
|
||||
"<C-A-Down>",
|
||||
function()
|
||||
require("myplugins.resize").ResizeDown()
|
||||
end,
|
||||
silent = true,
|
||||
},
|
||||
},
|
||||
}
|
50
config/nvim/lua/plugins/telescope.lua
Normal file
50
config/nvim/lua/plugins/telescope.lua
Normal file
|
@ -0,0 +1,50 @@
|
|||
return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
},
|
||||
config = function()
|
||||
local actions = require("telescope.actions")
|
||||
require("telescope").setup({
|
||||
extensions = {
|
||||
project = {
|
||||
sync_with_nvim_tree = true,
|
||||
},
|
||||
},
|
||||
pickers = {
|
||||
buffers = {
|
||||
initial_mode = "normal",
|
||||
},
|
||||
},
|
||||
defaults = {
|
||||
file_ignore_patterns = { "vendor", "node_modules" },
|
||||
mappings = {
|
||||
i = {
|
||||
["<F4>"] = actions.close,
|
||||
},
|
||||
n = {
|
||||
["<F4>"] = actions.close,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
keys = {
|
||||
{ "<leader>ff", "<cmd>Telescope find_files<CR>", noremap = true, silent = true, desc = "Find files" },
|
||||
{ "<leader>fg", "<cmd>Telescope live_grep<CR>", noremap = true, silent = true, desc = "Live grep" },
|
||||
{
|
||||
"<leader>fb",
|
||||
"<cmd>Telescope current_buffer_fuzzy_fund<CR>",
|
||||
noremap = true,
|
||||
silent = true,
|
||||
desc = "Find current file",
|
||||
},
|
||||
{ "<F4>", "<cmd>Telescope buffers<CR>", noremap = true, silent = true, desc = "Find buffers" },
|
||||
{ "<leader>gc", "<cmd>Telescope git_commits<CR>", noremap = true, silent = true },
|
||||
{ "<leader>gs", "<cmd>Telescope git_status<CR>", noremap = true, silent = true },
|
||||
{ "<leader>ch", "<cmd>Telescope commands_history<CR>", noremap = true, silent = true },
|
||||
{ "<leader>e", "<cmd>Telescope diagnostics<CR>", noremap = true, silent = true },
|
||||
{ "gi", "<cmd>Telescope lsp_implementations<CR>", noremap = true, silent = true },
|
||||
{ "gr", "<cmd>Telescope lsp_references<CR>", noremap = true, silent = true },
|
||||
},
|
||||
}
|
69
config/nvim/lua/plugins/todo.lua
Normal file
69
config/nvim/lua/plugins/todo.lua
Normal file
|
@ -0,0 +1,69 @@
|
|||
return {
|
||||
"phrmendes/todotxt.nvim",
|
||||
cmd = { "TodoTxt", "DoneTxt" },
|
||||
opts = {
|
||||
todotxt = "/home/neonxp/Документы/todo.txt",
|
||||
donetxt = "/home/neonxp/Документы/done.txt",
|
||||
},
|
||||
-- suggested keybindings
|
||||
keys = {
|
||||
{
|
||||
"<leader>tp",
|
||||
function() require("todotxt").cycle_priority() end,
|
||||
desc = "todo.txt: cycle priority",
|
||||
ft = "todotxt",
|
||||
},
|
||||
{
|
||||
"<cr>",
|
||||
function() require("todotxt").toggle_todo_state() end,
|
||||
desc = "todo.txt: toggle task state",
|
||||
ft = "todotxt",
|
||||
},
|
||||
{
|
||||
"<leader>tn",
|
||||
function() require("todotxt").capture_todo() end,
|
||||
desc = "New entry",
|
||||
},
|
||||
{
|
||||
"<leader>tt",
|
||||
function() require("todotxt").toggle_todotxt() end,
|
||||
desc = "Open",
|
||||
},
|
||||
{
|
||||
"<leader>tr",
|
||||
function() require("todotxt").move_done_tasks() end,
|
||||
desc = "Move to done.txt",
|
||||
ft = "todotxt",
|
||||
},
|
||||
{
|
||||
"<leader>tss",
|
||||
function() require("todotxt").sort_tasks() end,
|
||||
desc = "Sort",
|
||||
ft = "todotxt",
|
||||
},
|
||||
{
|
||||
"<leader>tsd",
|
||||
function() require("todotxt").sort_tasks_by_due_date() end,
|
||||
desc = "Sort by due:date",
|
||||
ft = "todotxt",
|
||||
},
|
||||
{
|
||||
"<leader>tsP",
|
||||
function() require("todotxt").sort_tasks_by_priority() end,
|
||||
desc = "Sort by (priority)",
|
||||
ft = "todotxt",
|
||||
},
|
||||
{
|
||||
"<leader>tsc",
|
||||
function() require("todotxt").sort_tasks_by_context() end,
|
||||
desc = "Sort by @context",
|
||||
ft = "todotxt",
|
||||
},
|
||||
{
|
||||
"<leader>tsp",
|
||||
function() require("todotxt").sort_tasks_by_project() end,
|
||||
desc = "Sort by +project",
|
||||
ft = "todotxt",
|
||||
},
|
||||
},
|
||||
}
|
54
config/nvim/lua/plugins/tree.lua
Normal file
54
config/nvim/lua/plugins/tree.lua
Normal file
|
@ -0,0 +1,54 @@
|
|||
local WIDTH_RATIO = 0.25
|
||||
|
||||
return {
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
dependencies = {
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
},
|
||||
opts = {
|
||||
disable_netrw = true,
|
||||
hijack_netrw = true,
|
||||
sort = {
|
||||
sorter = "case_sensitive",
|
||||
},
|
||||
view = {
|
||||
width = function()
|
||||
return math.floor(vim.opt.columns:get() * WIDTH_RATIO)
|
||||
end,
|
||||
adaptive_size = true,
|
||||
centralize_selection = true,
|
||||
},
|
||||
git = {
|
||||
enable = true,
|
||||
},
|
||||
renderer = {
|
||||
group_empty = true,
|
||||
highlight_git = true,
|
||||
icons = {
|
||||
show = {
|
||||
git = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
filters = {
|
||||
dotfiles = false,
|
||||
},
|
||||
update_focused_file = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
"<C-c>",
|
||||
function()
|
||||
local api = require("nvim-tree.api")
|
||||
local global_cwd = vim.fn.getcwd(-1, -1)
|
||||
api.tree.change_root(global_cwd)
|
||||
end,
|
||||
noremap = true,
|
||||
silent = true,
|
||||
desc = "Change tree root to CWD",
|
||||
},
|
||||
{ "<F3>", ":NvimTreeToggle<CR>", noremap = true, silent = true, desc = "Toggle file tree" },
|
||||
},
|
||||
}
|
53
config/nvim/lua/plugins/treesitter.lua
Normal file
53
config/nvim/lua/plugins/treesitter.lua
Normal file
|
@ -0,0 +1,53 @@
|
|||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
opts = {
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
ensure_installed = "all",
|
||||
ignore_install = { "gdhsader", "phpdoc", "org" },
|
||||
indent = { enable = true },
|
||||
auto_install = true,
|
||||
sync_install = true,
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = "<C-space>",
|
||||
node_incremental = "<C-space>",
|
||||
scope_incremental = false,
|
||||
node_decremental = "<bs>",
|
||||
},
|
||||
},
|
||||
textobjects = {
|
||||
select = { enable = true, lookahead = true },
|
||||
move = {
|
||||
enable = true,
|
||||
goto_next_start = { ["]f"] = "@function.outer", ["]c"] = "@class.outer", ["]a"] = "@parameter.inner" },
|
||||
goto_next_end = { ["]F"] = "@function.outer", ["]C"] = "@class.outer", ["]A"] = "@parameter.inner" },
|
||||
goto_previous_start = {
|
||||
["[f"] = "@function.outer",
|
||||
["[c"] = "@class.outer",
|
||||
["[a"] = "@parameter.inner",
|
||||
},
|
||||
goto_previous_end = { ["[F"] = "@function.outer", ["[C"] = "@class.outer", ["[A"] = "@parameter.inner" },
|
||||
},
|
||||
},
|
||||
},
|
||||
build = function()
|
||||
require("nvim-treesitter.install").update({ with_sync = true })()
|
||||
end,
|
||||
dependencies = {
|
||||
{ "nvim-treesitter/nvim-treesitter-textobjects" },
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter-context",
|
||||
opts = {
|
||||
enable = true,
|
||||
mode = "topline",
|
||||
line_numbers = true,
|
||||
},
|
||||
},
|
||||
{ "windwp/nvim-ts-autotag" },
|
||||
},
|
||||
}
|
61
config/nvim/lua/syntax/hjson.lua
Normal file
61
config/nvim/lua/syntax/hjson.lua
Normal file
|
@ -0,0 +1,61 @@
|
|||
-- ~/.config/nvim/after/syntax/hjson.lua
|
||||
-- Или путь плагина: ~/.config/nvim/plugin/hjson.lua
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
|
||||
pattern = "*.hjson",
|
||||
callback = function()
|
||||
vim.b.current_syntax = "hjson"
|
||||
|
||||
-- Очистка предыдущих правил
|
||||
vim.cmd("syntax clear")
|
||||
|
||||
-- Комментарии (высший приоритет)
|
||||
vim.cmd([[ syntax match hjsonLineComment "\/\/.*" ]])
|
||||
vim.cmd([[ syntax match hjsonLineComment "#.*" ]])
|
||||
vim.cmd([[ syntax region hjsonComment start="/\*" end="\*/" ]])
|
||||
|
||||
-- Строки
|
||||
vim.cmd([[ syntax region hjsonString matchgroup=hjsonQuote start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=hjsonEscape ]])
|
||||
vim.cmd([[ syntax region hjsonString matchgroup=hjsonQuote start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=hjsonEscape ]])
|
||||
vim.cmd([[ syntax region hjsonMLString matchgroup=hjsonQuote start=/'''/ end=/'''/ ]])
|
||||
|
||||
-- Числа
|
||||
vim.cmd([[ syntax match hjsonNumber "-\=\<\%(0\|[1-9]\d*\)\%(\.\d\+\)\=\%([eE][-+]\=\d\+\)\=\>" ]])
|
||||
|
||||
-- Булевы значения и null
|
||||
vim.cmd([[ syntax keyword hjsonBoolean true false ]])
|
||||
vim.cmd([[ syntax keyword hjsonNull null ]])
|
||||
|
||||
-- Ключи объектов
|
||||
vim.cmd([[ syntax match hjsonKey "[^][{}:,\"'\s]\+" contained ]])
|
||||
vim.cmd([[ syntax match hjsonKeyUnquoted "[^][{}:,\"'\s]\+:"he=e-1 contains=hjsonKey,hjsonNoise ]])
|
||||
|
||||
-- Пунктуация
|
||||
vim.cmd([[ syntax match hjsonNoise "[{}\[\],:]" ]])
|
||||
|
||||
-- Escape-последовательности
|
||||
vim.cmd([[ syntax match hjsonEscape "\\[\\\"'/bfnrt]" contained ]])
|
||||
vim.cmd([[ syntax match hjsonEscape "\\u\x\{4}" contained ]])
|
||||
|
||||
-- Строки без кавычек (низший приоритет)
|
||||
vim.cmd([[ syntax match hjsonStringUQ "[^][{}:,\"'\s]\+" contains=@NoSpell ]])
|
||||
|
||||
-- Сворачивание структур
|
||||
vim.cmd([[ syntax region hjsonObject matchgroup=hjsonBraces start="{" end="}" transparent fold ]])
|
||||
vim.cmd([[ syntax region hjsonArray matchgroup=hjsonBraces start="\[" end="\]" transparent fold ]])
|
||||
|
||||
-- Подсветка
|
||||
vim.cmd([[ highlight default link hjsonComment Comment ]])
|
||||
vim.cmd([[ highlight default link hjsonLineComment Comment ]])
|
||||
vim.cmd([[ highlight default link hjsonString String ]])
|
||||
vim.cmd([[ highlight default link hjsonMLString String ]])
|
||||
vim.cmd([[ highlight default link hjsonStringUQ String ]])
|
||||
vim.cmd([[ highlight default link hjsonEscape SpecialChar ]])
|
||||
vim.cmd([[ highlight default link hjsonNumber Number ]])
|
||||
vim.cmd([[ highlight default link hjsonBoolean Boolean ]])
|
||||
vim.cmd([[ highlight default link hjsonNull Constant ]])
|
||||
vim.cmd([[ highlight default link hjsonKey Label ]])
|
||||
vim.cmd([[ highlight default link hjsonNoise Delimiter ]])
|
||||
vim.cmd([[ highlight default link hjsonBraces Delimiter ]])
|
||||
end
|
||||
})
|
1
config/nvim/lua/syntax/init.lua
Normal file
1
config/nvim/lua/syntax/init.lua
Normal file
|
@ -0,0 +1 @@
|
|||
require("syntax.hjson")
|
29
config/nvim/lua/theme/asset/hsv-to-rgb.lua
Normal file
29
config/nvim/lua/theme/asset/hsv-to-rgb.lua
Normal file
|
@ -0,0 +1,29 @@
|
|||
local function HsvToRgb(h, s, v)
|
||||
|
||||
s = s / 100.0
|
||||
v = v / 100.0
|
||||
h = h / 60.0
|
||||
|
||||
local i = math.floor(h) % 6
|
||||
local f = h - math.floor(h)
|
||||
local p = v * (1.0 - s)
|
||||
local q = v * (1.0 - f * s)
|
||||
local t = v * (1.0 - (1.0 - f) * s)
|
||||
|
||||
local r, g, b = 0, 0, 0
|
||||
|
||||
if i == 0 then r, g, b = v, t, p
|
||||
elseif i == 1 then r, g, b = q, v, p
|
||||
elseif i == 2 then r, g, b = p, v, t
|
||||
elseif i == 3 then r, g, b = p, q, v
|
||||
elseif i == 4 then r, g, b = t, p, v
|
||||
else r, g, b = v, p, q
|
||||
end
|
||||
|
||||
r = math.floor(r * 255 + 0.5)
|
||||
g = math.floor(g * 255 + 0.5)
|
||||
b = math.floor(b * 255 + 0.5)
|
||||
|
||||
return string.format("#%02x%02x%02x", r, g, b)
|
||||
end
|
||||
return HsvToRgb
|
68
config/nvim/lua/theme/colors.lua
Normal file
68
config/nvim/lua/theme/colors.lua
Normal file
|
@ -0,0 +1,68 @@
|
|||
local HsvToRgb = require("theme.asset.hsv-to-rgb")
|
||||
local colors = {
|
||||
|
||||
black = {HsvToRgb(0, 0, 0), 0},--0 Black
|
||||
black_l = {HsvToRgb(0, 0, 10), 0},
|
||||
black_ll = {HsvToRgb(0, 0, 20), 0},
|
||||
|
||||
gray_dd = {HsvToRgb(0, 0, 30), 8},--8 DarkGray
|
||||
gray_d = {HsvToRgb(0, 0, 40), 8},
|
||||
gray = {HsvToRgb(0, 0, 50), 7},--7 Gray
|
||||
gray_l = {HsvToRgb(0, 0, 60), 7},
|
||||
gray_ll = {HsvToRgb(0, 0, 70), 7},
|
||||
|
||||
white_dd = {HsvToRgb(0, 0, 80), 15},--15 White
|
||||
white_d = {HsvToRgb(0, 0, 90), 15},
|
||||
white = {HsvToRgb(0, 0, 100), 15},
|
||||
|
||||
red_d = {HsvToRgb(0, 100, 75), 12},--12 Red
|
||||
red = {HsvToRgb(0, 100, 100), 12},
|
||||
red_l = {HsvToRgb(0, 75, 100), 12},
|
||||
|
||||
orange_d = {HsvToRgb(30, 100, 75), 4},--4 DarkRed
|
||||
orange = {HsvToRgb(30, 100, 100), 4},
|
||||
orange_l = {HsvToRgb(30, 75, 100), 4},
|
||||
|
||||
yellow_d = {HsvToRgb(60, 100, 75), 14},--14 Yellow
|
||||
yellow = {HsvToRgb(60, 100, 100), 14},
|
||||
yellow_l = {HsvToRgb(60, 75, 100), 14},
|
||||
|
||||
chartreuse_d = {HsvToRgb(90, 100, 75), 6},--6 DarkYellow
|
||||
chartreuse = {HsvToRgb(90, 100, 100), 6},
|
||||
chartreuse_l = {HsvToRgb(90, 75, 100), 6},
|
||||
|
||||
green_d = {HsvToRgb(120, 100, 75), 10},--10 Green
|
||||
green = {HsvToRgb(120, 100, 100), 10},
|
||||
green_l = {HsvToRgb(120, 75, 100), 10},
|
||||
|
||||
turquoise_d = {HsvToRgb(150, 100, 75), 2},--2 DarkGreen
|
||||
turquoise = {HsvToRgb(150, 100, 100), 2},
|
||||
turquoise_l = {HsvToRgb(150, 75, 100), 2},
|
||||
|
||||
cyan_d = {HsvToRgb(180, 100, 75), 11},--11 Cyan
|
||||
cyan = {HsvToRgb(180, 100, 100), 11},
|
||||
cyan_l = {HsvToRgb(180, 75, 100), 11},
|
||||
|
||||
royal_d = {HsvToRgb(210, 100, 75), 3},--3 DarkCyan
|
||||
royal = {HsvToRgb(210, 100, 100), 3},
|
||||
royal_l = {HsvToRgb(210, 75, 100), 3},
|
||||
|
||||
blue_d = {HsvToRgb(240, 100, 75), 9},--9 Blue
|
||||
blue = {HsvToRgb(240, 100, 100), 9},
|
||||
blue_l = {HsvToRgb(240, 75, 100), 9},
|
||||
|
||||
purple_d = {HsvToRgb(270, 100, 75), 1},--1 DarkBlue
|
||||
purple = {HsvToRgb(270, 100, 100), 1},
|
||||
purple_l = {HsvToRgb(270, 75, 100), 1},
|
||||
|
||||
pink_d = {HsvToRgb(300, 100, 75), 13},--13 Magenta
|
||||
pink = {HsvToRgb(300, 100, 100), 13},
|
||||
pink_l = {HsvToRgb(300, 75, 100), 13},
|
||||
|
||||
salmon_d = {HsvToRgb(330, 100, 75), 5},--5 DarkMagenta
|
||||
salmon = {HsvToRgb(330, 100, 100), 5},
|
||||
salmon_l = {HsvToRgb(330, 75, 100), 5},
|
||||
|
||||
none = {"NONE", "NONE"}
|
||||
}
|
||||
return colors
|
16
config/nvim/lua/theme/modifiers.lua
Normal file
16
config/nvim/lua/theme/modifiers.lua
Normal file
|
@ -0,0 +1,16 @@
|
|||
local mods = {
|
||||
|
||||
bold = {"bold", "bold"},
|
||||
italic = {"italic", "italic"},
|
||||
underline = {"underline", "underline"},
|
||||
underdouble = {"underdouble", "underdouble"},
|
||||
underdoted = {"underdoted", "underdoted"},
|
||||
underdashed = {"underdashed", "underdashed"},
|
||||
undercurl = {"undercurl", "undercurl"},
|
||||
reverse = {"reverse", "reverse"},
|
||||
standout = {"standout", "standout"},
|
||||
altfont = {"altfont", "altfont"},
|
||||
strikethrough = {"strikethrough", "strikethrough"},
|
||||
none = {"NONE", "NONE"}
|
||||
}
|
||||
return mods
|
28
config/nvim/snippets/go.json
Normal file
28
config/nvim/snippets/go.json
Normal file
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"package line": {
|
||||
"body": ["package ${TM_DIRECTORY/.+\\/(.+)$/${1:/downcase}/}", "", "$0"],
|
||||
"description": "package header",
|
||||
"prefix": "pkg"
|
||||
},
|
||||
"structure constructor": {
|
||||
"body": [
|
||||
"// New$1 returns new $1.",
|
||||
"func New${1:type}(${2}) *$1 {",
|
||||
"\t$3",
|
||||
"\treturn &$1{$4}",
|
||||
"}"
|
||||
],
|
||||
"description": "constructor for structure type",
|
||||
"prefix": "construct"
|
||||
},
|
||||
"if err := ...; err != nil": {
|
||||
"prefix": "iferrr",
|
||||
"body": "if err := ${1}; err != nil {\n\t${2:return ${3:nil, }${4:err}}\n}",
|
||||
"description": "Snippet for if err := ...; err != nil"
|
||||
},
|
||||
"if err != nil": {
|
||||
"prefix": "iferr",
|
||||
"body": "if err != nil {\n\t${1:return ${2:nil, }${3:err}}\n}",
|
||||
"description": "Snippet for if err != nil"
|
||||
}
|
||||
}
|
11
config/nvim/snippets/package.json
Normal file
11
config/nvim/snippets/package.json
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"name": "gotools",
|
||||
"contributes": {
|
||||
"snippets": [
|
||||
{
|
||||
"language": "go",
|
||||
"path": "./go.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
2
config/nvim/spell/en.utf-8.add
Normal file
2
config/nvim/spell/en.utf-8.add
Normal file
|
@ -0,0 +1,2 @@
|
|||
блог
|
||||
блога
|
BIN
config/nvim/spell/en.utf-8.add.spl
Normal file
BIN
config/nvim/spell/en.utf-8.add.spl
Normal file
Binary file not shown.
BIN
config/nvim/spell/ru.cp1251.spl
Normal file
BIN
config/nvim/spell/ru.cp1251.spl
Normal file
Binary file not shown.
BIN
config/nvim/spell/ru.cp1251.sug
Normal file
BIN
config/nvim/spell/ru.cp1251.sug
Normal file
Binary file not shown.
BIN
config/nvim/spell/ru.koi8-r.spl
Normal file
BIN
config/nvim/spell/ru.koi8-r.spl
Normal file
Binary file not shown.
BIN
config/nvim/spell/ru.koi8-r.sug
Normal file
BIN
config/nvim/spell/ru.koi8-r.sug
Normal file
Binary file not shown.
BIN
config/nvim/spell/ru.utf-8.spl
Normal file
BIN
config/nvim/spell/ru.utf-8.spl
Normal file
Binary file not shown.
BIN
config/nvim/spell/ru.utf-8.sug
Normal file
BIN
config/nvim/spell/ru.utf-8.sug
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue