stylua
This commit is contained in:
foozzi 2024-01-09 14:40:47 -05:00
parent 6be2114458
commit f549b63062
19 changed files with 406 additions and 364 deletions

View file

@ -1,6 +1,7 @@
{ {
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
"LuaSnip": { "branch": "master", "commit": "8ae1dedd988eb56441b7858bd1e8554dfadaa46d" }, "LuaSnip": { "branch": "master", "commit": "8ae1dedd988eb56441b7858bd1e8554dfadaa46d" },
"bufferline.nvim": { "branch": "main", "commit": "e48ce1805697e4bb97bc171c081e849a65859244" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },

View file

@ -26,8 +26,7 @@ opt.scrolloff = 10
opt.completeopt = "menuone,noinsert,noselect" opt.completeopt = "menuone,noinsert,noselect"
-- opt.guicursor = "" -- opt.guicursor = ""
opt.showmode = false opt.showmode = false
opt.tabline = '%!v:lua.require("utils").tabline()' -- opt.tabline = '%!v:lua.require("utils").tabline()'
-- Behaviour -- Behaviour
opt.hidden = true opt.hidden = true
@ -47,4 +46,4 @@ opt.modifiable = true
-- opt.guicursor = -- opt.guicursor =
-- "n-v-c:block,i-ci-ve:block,r-cr:hor20,o:hor50,a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor,sm:block-blinkwait175-blinkoff150-blinkon175" -- "n-v-c:block,i-ci-ve:block,r-cr:hor20,o:hor50,a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor,sm:block-blinkwait175-blinkoff150-blinkon175"
opt.encoding = "UTF-8" opt.encoding = "UTF-8"
opt.cursorline = true opt.cursorline = false

View file

@ -1,10 +1,10 @@
local config = function() local config = function()
require('ts_context_commentstring').setup { require("ts_context_commentstring").setup({
enable_autocmd = false, enable_autocmd = false,
} })
require('Comment').setup { require("Comment").setup({
pre_hook = require('ts_context_commentstring.integrations.comment_nvim').create_pre_hook(), pre_hook = require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook(),
} })
end end
return { return {
@ -12,6 +12,6 @@ return {
opts = config, opts = config,
lazy = false, lazy = false,
dependencies = { dependencies = {
{"JoosepAlviste/nvim-ts-context-commentstring"} { "JoosepAlviste/nvim-ts-context-commentstring" },
} },
} }

View file

@ -1,5 +1,5 @@
return { return {
'stevearc/conform.nvim', "stevearc/conform.nvim",
opts = { opts = {
formatters_by_ft = { formatters_by_ft = {
lua = { "stylua" }, lua = { "stylua" },
@ -10,7 +10,7 @@ return {
typescriptreact = { "biome" }, typescriptreact = { "biome" },
json = { "biome" }, json = { "biome" },
sh = { "shfmt" }, sh = { "shfmt" },
['*'] = { 'trim_whitespace', 'codespell' }, ["*"] = { "trim_whitespace", "codespell" },
}, },
format_on_save = { format_on_save = {
timeout_ms = 500, timeout_ms = 500,

View file

@ -4,5 +4,5 @@ return {
opts = { opts = {
max_time = 0, max_time = 0,
}, },
lazy = false lazy = false,
} }

View file

@ -10,7 +10,7 @@ return {
-- your configuration comes here -- your configuration comes here
-- or leave it empty to use the default settings -- or leave it empty to use the default settings
-- refer to the configuration section below -- refer to the configuration section below
} },
}, },
{ "folke/neodev.nvim" }, { "folke/neodev.nvim" },
} }

View file

@ -1,6 +1,6 @@
local config = function() local config = function()
local lsp_zero = require 'lsp-zero' local lsp_zero = require("lsp-zero")
local luasnip = require 'luasnip' local luasnip = require("luasnip")
local diagnostic_signs = require("utils.icons").diagnostic_signs local diagnostic_signs = require("utils.icons").diagnostic_signs
lsp_zero.on_attach(function(_, bufnr) lsp_zero.on_attach(function(_, bufnr)
@ -30,32 +30,58 @@ local config = function()
local opts = { buffer = bufnr, remap = false } local opts = { buffer = bufnr, remap = false }
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts) vim.keymap.set("n", "gd", function()
vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts) vim.lsp.buf.definition()
vim.keymap.set("n", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts) end, opts)
vim.keymap.set("n", "<leader>vd", function() vim.diagnostic.open_float() end, opts) vim.keymap.set("n", "K", function()
vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts) vim.lsp.buf.hover()
vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts) end, opts)
vim.keymap.set("n", "<leader>ca", function() vim.lsp.buf.code_action() end, opts) vim.keymap.set("n", "<leader>vws", function()
vim.keymap.set("n", "<leader>vrr", function() vim.lsp.buf.references() end, opts) vim.lsp.buf.workspace_symbol()
vim.keymap.set("n", "<leader>vrn", function() vim.lsp.buf.rename() end, opts) end, opts)
vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts) vim.keymap.set("n", "<leader>vd", function()
vim.keymap.set("n", "<leader>gi", function() vim.lsp.buf.implementation() end, opts) vim.diagnostic.open_float()
end, opts)
vim.keymap.set("n", "[d", function()
vim.diagnostic.goto_next()
end, opts)
vim.keymap.set("n", "]d", function()
vim.diagnostic.goto_prev()
end, opts)
vim.keymap.set("n", "<leader>ca", function()
vim.lsp.buf.code_action()
end, opts)
vim.keymap.set("n", "<leader>vrr", function()
vim.lsp.buf.references()
end, opts)
vim.keymap.set("n", "<leader>vrn", function()
vim.lsp.buf.rename()
end, opts)
vim.keymap.set("i", "<C-h>", function()
vim.lsp.buf.signature_help()
end, opts)
vim.keymap.set("n", "<leader>gi", function()
vim.lsp.buf.implementation()
end, opts)
-- nvim-lint -- nvim-lint
vim.keymap.set("n", "<leader>li", function() require("lint").try_lint() end, opts) vim.keymap.set("n", "<leader>li", function()
require("lint").try_lint()
end, opts)
-- conform -- conform
vim.keymap.set("n", "<leader>fr", function() require("conform").format({ bufnr = bufnr }) end, opts) vim.keymap.set("n", "<leader>fr", function()
require("conform").format({ bufnr = bufnr })
end, opts)
end) end)
lsp_zero.set_sign_icons({ lsp_zero.set_sign_icons({
error = diagnostic_signs.Error, error = diagnostic_signs.Error,
warn = diagnostic_signs.Warn, warn = diagnostic_signs.Warn,
hint = diagnostic_signs.Hint, hint = diagnostic_signs.Hint,
info = diagnostic_signs.Info info = diagnostic_signs.Info,
}) })
require('mason').setup({}) require("mason").setup({})
require('mason-lspconfig').setup({ require("mason-lspconfig").setup({
ensure_installed = { ensure_installed = {
"bashls", "bashls",
"tsserver", "tsserver",
@ -64,33 +90,33 @@ local config = function()
"jsonls", "jsonls",
"clangd", "clangd",
"ruff_lsp", "ruff_lsp",
"biome" -- will install for formatting only "biome", -- will install for formatting only
}, },
automatic_installation = true, automatic_installation = true,
handlers = { handlers = {
lsp_zero.default_setup, lsp_zero.default_setup,
lua_ls = function() lua_ls = function()
local lua_opts = lsp_zero.nvim_lua_ls() local lua_opts = lsp_zero.nvim_lua_ls()
require('lspconfig').lua_ls.setup(lua_opts) require("lspconfig").lua_ls.setup(lua_opts)
end, end,
pyright = function() pyright = function()
require('lspconfig').pyright.setup({ require("lspconfig").pyright.setup({
settings = { settings = {
python = { python = {
analysis = { analysis = {
typeCheckingMode = "off" typeCheckingMode = "off",
} },
} },
} },
}) })
end, end,
biome = function() -- use tsserver instead biome = function() -- use tsserver instead
return {} return {}
end, end,
} },
}) })
local cmp = require('cmp') local cmp = require("cmp")
local cmp_select = { behavior = cmp.SelectBehavior.Select } local cmp_select = { behavior = cmp.SelectBehavior.Select }
require("luasnip/loaders/from_vscode").lazy_load() require("luasnip/loaders/from_vscode").lazy_load()
@ -100,46 +126,46 @@ local config = function()
luasnip.lsp_expand(args.body) luasnip.lsp_expand(args.body)
end, end,
}, },
preselect = 'item', preselect = "item",
completion = { completion = {
completeopt = 'menu,menuone,noinsert' completeopt = "menu,menuone,noinsert",
}, },
sources = { sources = {
{name = 'luasnip'}, { name = "luasnip" },
{name = 'path'}, { name = "path" },
{name = 'nvim_lsp'}, { name = "nvim_lsp" },
{name = 'nvim_lua'}, { name = "nvim_lua" },
{name = 'buffer'}, { name = "buffer" },
}, },
formatting = lsp_zero.cmp_format(), formatting = lsp_zero.cmp_format(),
mapping = cmp.mapping.preset.insert({ mapping = cmp.mapping.preset.insert({
-- ['<C-p>'] = cmp.mapping.select_prev_item(cmp_select), -- ['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
['<Tab>'] = cmp.mapping.select_next_item(cmp_select), ["<Tab>"] = cmp.mapping.select_next_item(cmp_select),
['<C-n>'] = cmp.mapping.select_next_item(cmp_select), ["<C-n>"] = cmp.mapping.select_next_item(cmp_select),
['<CR>'] = cmp.mapping.confirm({ select = true }), ["<CR>"] = cmp.mapping.confirm({ select = true }),
['<C-Space>'] = cmp.mapping.complete(), ["<C-Space>"] = cmp.mapping.complete(),
['<C-f>'] = cmp.mapping(function(fallback) ["<C-f>"] = cmp.mapping(function(fallback)
if luasnip.jumpable(1) then if luasnip.jumpable(1) then
luasnip.jump(1) luasnip.jump(1)
else else
fallback() fallback()
end end
end, {'i', 's'}), end, { "i", "s" }),
['<C-b>'] = cmp.mapping(function(fallback) ["<C-b>"] = cmp.mapping(function(fallback)
if luasnip.jumpable(-1) then if luasnip.jumpable(-1) then
luasnip.jump(-1) luasnip.jump(-1)
else else
fallback() fallback()
end end
end, {'i', 's'}), end, { "i", "s" }),
}), }),
}) })
end end
return { return {
"VonHeikemen/lsp-zero.nvim", "VonHeikemen/lsp-zero.nvim",
branch = 'v3.x', branch = "v3.x",
config = config, config = config,
lazy = false, lazy = false,
dependencies = { dependencies = {
@ -151,6 +177,11 @@ return {
"hrsh7th/cmp-buffer", "hrsh7th/cmp-buffer",
"hrsh7th/cmp-path", "hrsh7th/cmp-path",
"saadparwaiz1/cmp_luasnip", "saadparwaiz1/cmp_luasnip",
{"L3MON4D3/LuaSnip", version = "v2.*", build = "make install_jsregexp", dependencies={"rafamadriz/friendly-snippets"}}, {
} "L3MON4D3/LuaSnip",
version = "v2.*",
build = "make install_jsregexp",
dependencies = { "rafamadriz/friendly-snippets" },
},
},
} }

View file

@ -14,11 +14,11 @@ local config = {
statusline = 1000, statusline = 1000,
tabline = 1000, tabline = 1000,
winbar = 1000, winbar = 1000,
} },
}, },
sections = { sections = {
lualine_a = { "mode" }, lualine_a = { "mode" },
lualine_b = { "buffers" }, lualine_b = { "" },
lualine_x = { "diagnostics", "encoding", "fileformat", "filetype" }, lualine_x = { "diagnostics", "encoding", "fileformat", "filetype" },
lualine_y = { "progress" }, lualine_y = { "progress" },
lualine_z = { "location" }, lualine_z = { "location" },
@ -27,7 +27,7 @@ local config = {
tabline = {}, tabline = {},
winbar = {}, winbar = {},
inactive_winbar = {}, inactive_winbar = {},
extensions = {} extensions = {},
} }
local function ins_left(component) local function ins_left(component)
@ -38,11 +38,11 @@ local function ins_right(component)
table.insert(config.sections.lualine_x, 1, component) table.insert(config.sections.lualine_x, 1, component)
end end
ins_right { ins_right({
-- Lsp server name . -- Lsp server name .
function() function()
local msg = 'No Active Lsp' local msg = "No Active Lsp"
local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype') local buf_ft = vim.api.nvim_buf_get_option(0, "filetype")
local clients = vim.lsp.get_active_clients() local clients = vim.lsp.get_active_clients()
if next(clients) == nil then if next(clients) == nil then
return msg return msg
@ -55,15 +55,15 @@ ins_right {
end end
return msg return msg
end, end,
icon = ' LSP:', icon = " LSP:",
color = { fg = '#ff6b6b' }, color = { fg = "#ff6b6b" },
} })
return { return {
"nvim-lualine/lualine.nvim", "nvim-lualine/lualine.nvim",
lazy = false, lazy = false,
opts = config, opts = config,
dependencies = { dependencies = {
"nvim-tree/nvim-web-devicons" "nvim-tree/nvim-web-devicons",
} },
} }

View file

@ -1,7 +1,7 @@
return { return {
"karb94/neoscroll.nvim", "karb94/neoscroll.nvim",
config = function() config = function()
require('neoscroll').setup {} require("neoscroll").setup({})
end, end,
lazy = false, lazy = false,
} }

View file

@ -0,0 +1,12 @@
local config = function()
require("bufferline").setup()
end
return {
"akinsho/bufferline.nvim",
opts = config,
dependencies = {
"nvim-tree/nvim-web-devicons",
},
lazy = false,
}

View file

@ -1,5 +1,5 @@
local config = function() local config = function()
require('lint').linters_by_ft = { require("lint").linters_by_ft = {
python = { "mypy" }, python = { "mypy" },
} }
@ -10,7 +10,6 @@ local config = function()
}) })
end end
return { return {
"mfussenegger/nvim-lint", "mfussenegger/nvim-lint",
opts = {}, opts = {},

View file

@ -4,6 +4,6 @@ return {
opts = { opts = {
filters = { filters = {
dotfiles = false, dotfiles = false,
} },
} },
} }

View file

@ -1,3 +1,3 @@
return { return {
'nvim-tree/nvim-web-devicons' "nvim-tree/nvim-web-devicons",
} }

View file

@ -4,6 +4,6 @@ return {
priority = 1000, priority = 1000,
opts = {}, opts = {},
config = function() config = function()
vim.cmd('colorscheme tokyonight-storm') vim.cmd("colorscheme tokyonight-storm")
end end,
} }

View file

@ -38,7 +38,7 @@ return {
toggle_fold = { "zA", "za" }, -- toggle fold of current file toggle_fold = { "zA", "za" }, -- toggle fold of current file
previous = "k", -- previous item previous = "k", -- previous item
next = "j", -- next item next = "j", -- next item
help = "?" -- help menu help = "?", -- help menu
}, },
multiline = true, -- render multi-line messages multiline = true, -- render multi-line messages
indent_lines = true, -- add an indent guide below the fold icons indent_lines = true, -- add an indent guide below the fold icons
@ -57,7 +57,7 @@ return {
information = diagnostic_signs.Info, information = diagnostic_signs.Info,
other = diagnostic_signs.Info, other = diagnostic_signs.Info,
}, },
use_diagnostic_signs = false -- enabling this will use the signs defined in your lsp client use_diagnostic_signs = false, -- enabling this will use the signs defined in your lsp client
}, },
keys = { keys = {
maplazykey("<leader>xx", function() maplazykey("<leader>xx", function()

View file

@ -1,25 +1,25 @@
local M = {} local M = {}
function M.tabline() function M.tabline()
local s = '' local s = ""
for i = 1, vim.fn.tabpagenr('$') do for i = 1, vim.fn.tabpagenr("$") do
local winnr = vim.fn.tabpagewinnr(i) local winnr = vim.fn.tabpagewinnr(i)
local buflist = vim.fn.tabpagebuflist(i) local buflist = vim.fn.tabpagebuflist(i)
local bufnr = buflist[winnr] local bufnr = buflist[winnr]
local bufname = vim.fn.bufname(bufnr) local bufname = vim.fn.bufname(bufnr)
local filename = vim.fn.fnamemodify(bufname, ':t') local filename = vim.fn.fnamemodify(bufname, ":t")
local icon = require'nvim-web-devicons'.get_icon(filename) local icon = require("nvim-web-devicons").get_icon(filename)
-- Отмечаем активный таб -- Отмечаем активный таб
if i == vim.fn.tabpagenr() then if i == vim.fn.tabpagenr() then
s = s .. '%#TabLineSel#' s = s .. "%#TabLineSel#"
else else
s = s .. '%#TabLine#' s = s .. "%#TabLine#"
end end
s = s .. ' ' .. (icon or '') .. ' ' .. filename .. ' ' s = s .. " " .. (icon or "") .. " " .. filename .. " "
end end
s = s .. '%#TabLineFill#%=' s = s .. "%#TabLineFill#%="
return s return s
end end

Binary file not shown.