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" },
"LuaSnip": { "branch": "master", "commit": "8ae1dedd988eb56441b7858bd1e8554dfadaa46d" },
"bufferline.nvim": { "branch": "main", "commit": "e48ce1805697e4bb97bc171c081e849a65859244" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },

View file

@ -26,8 +26,7 @@ opt.scrolloff = 10
opt.completeopt = "menuone,noinsert,noselect"
-- opt.guicursor = ""
opt.showmode = false
opt.tabline = '%!v:lua.require("utils").tabline()'
-- opt.tabline = '%!v:lua.require("utils").tabline()'
-- Behaviour
opt.hidden = true
@ -47,4 +46,4 @@ opt.modifiable = true
-- 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"
opt.encoding = "UTF-8"
opt.cursorline = true
opt.cursorline = false

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,6 @@
local config = function()
local lsp_zero = require 'lsp-zero'
local luasnip = require 'luasnip'
local lsp_zero = require("lsp-zero")
local luasnip = require("luasnip")
local diagnostic_signs = require("utils.icons").diagnostic_signs
lsp_zero.on_attach(function(_, bufnr)
@ -28,34 +28,60 @@ local config = function()
border = "rounded",
})
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", "K", function() vim.lsp.buf.hover() end, opts)
vim.keymap.set("n", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts)
vim.keymap.set("n", "<leader>vd", function() 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)
vim.keymap.set("n", "gd", function()
vim.lsp.buf.definition()
end, opts)
vim.keymap.set("n", "K", function()
vim.lsp.buf.hover()
end, opts)
vim.keymap.set("n", "<leader>vws", function()
vim.lsp.buf.workspace_symbol()
end, opts)
vim.keymap.set("n", "<leader>vd", function()
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
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
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)
lsp_zero.set_sign_icons({
error = diagnostic_signs.Error,
warn = diagnostic_signs.Warn,
hint = diagnostic_signs.Hint,
info = diagnostic_signs.Info
info = diagnostic_signs.Info,
})
require('mason').setup({})
require('mason-lspconfig').setup({
require("mason").setup({})
require("mason-lspconfig").setup({
ensure_installed = {
"bashls",
"tsserver",
@ -64,34 +90,34 @@ local config = function()
"jsonls",
"clangd",
"ruff_lsp",
"biome" -- will install for formatting only
"biome", -- will install for formatting only
},
automatic_installation = true,
handlers = {
lsp_zero.default_setup,
lua_ls = function()
local lua_opts = lsp_zero.nvim_lua_ls()
require('lspconfig').lua_ls.setup(lua_opts)
require("lspconfig").lua_ls.setup(lua_opts)
end,
pyright = function()
require('lspconfig').pyright.setup({
require("lspconfig").pyright.setup({
settings = {
python = {
analysis = {
typeCheckingMode = "off"
}
}
}
typeCheckingMode = "off",
},
},
},
})
end,
biome = function() -- use tsserver instead
return {}
end,
}
},
})
local cmp = require('cmp')
local cmp_select = {behavior = cmp.SelectBehavior.Select}
local cmp = require("cmp")
local cmp_select = { behavior = cmp.SelectBehavior.Select }
require("luasnip/loaders/from_vscode").lazy_load()
cmp.setup({
@ -100,46 +126,46 @@ local config = function()
luasnip.lsp_expand(args.body)
end,
},
preselect = 'item',
preselect = "item",
completion = {
completeopt = 'menu,menuone,noinsert'
completeopt = "menu,menuone,noinsert",
},
sources = {
{name = 'luasnip'},
{name = 'path'},
{name = 'nvim_lsp'},
{name = 'nvim_lua'},
{name = 'buffer'},
{ name = "luasnip" },
{ name = "path" },
{ name = "nvim_lsp" },
{ name = "nvim_lua" },
{ name = "buffer" },
},
formatting = lsp_zero.cmp_format(),
mapping = cmp.mapping.preset.insert({
-- ['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
['<Tab>'] = cmp.mapping.select_next_item(cmp_select),
['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
['<CR>'] = cmp.mapping.confirm({ select = true }),
['<C-Space>'] = cmp.mapping.complete(),
['<C-f>'] = cmp.mapping(function(fallback)
["<Tab>"] = cmp.mapping.select_next_item(cmp_select),
["<C-n>"] = cmp.mapping.select_next_item(cmp_select),
["<CR>"] = cmp.mapping.confirm({ select = true }),
["<C-Space>"] = cmp.mapping.complete(),
["<C-f>"] = cmp.mapping(function(fallback)
if luasnip.jumpable(1) then
luasnip.jump(1)
else
fallback()
end
end, {'i', 's'}),
end, { "i", "s" }),
['<C-b>'] = cmp.mapping(function(fallback)
["<C-b>"] = cmp.mapping(function(fallback)
if luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, {'i', 's'}),
end, { "i", "s" }),
}),
})
end
return {
"VonHeikemen/lsp-zero.nvim",
branch = 'v3.x',
branch = "v3.x",
config = config,
lazy = false,
dependencies = {
@ -151,6 +177,11 @@ return {
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"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,
tabline = 1000,
winbar = 1000,
}
},
},
sections = {
lualine_a = { "mode" },
lualine_b = { "buffers" },
lualine_b = { "" },
lualine_x = { "diagnostics", "encoding", "fileformat", "filetype" },
lualine_y = { "progress" },
lualine_z = { "location" },
@ -27,7 +27,7 @@ local config = {
tabline = {},
winbar = {},
inactive_winbar = {},
extensions = {}
extensions = {},
}
local function ins_left(component)
@ -38,11 +38,11 @@ local function ins_right(component)
table.insert(config.sections.lualine_x, 1, component)
end
ins_right {
ins_right({
-- Lsp server name .
function()
local msg = 'No Active Lsp'
local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype')
local msg = "No Active Lsp"
local buf_ft = vim.api.nvim_buf_get_option(0, "filetype")
local clients = vim.lsp.get_active_clients()
if next(clients) == nil then
return msg
@ -55,15 +55,15 @@ ins_right {
end
return msg
end,
icon = ' LSP:',
color = { fg = '#ff6b6b' },
}
icon = " LSP:",
color = { fg = "#ff6b6b" },
})
return {
"nvim-lualine/lualine.nvim",
lazy = false,
opts = config,
dependencies = {
"nvim-tree/nvim-web-devicons"
}
"nvim-tree/nvim-web-devicons",
},
}

View file

@ -1,7 +1,7 @@
return {
"karb94/neoscroll.nvim",
config = function ()
require('neoscroll').setup {}
config = function()
require("neoscroll").setup({})
end,
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()
require('lint').linters_by_ft = {
require("lint").linters_by_ft = {
python = { "mypy" },
}
@ -10,7 +10,6 @@ local config = function()
})
end
return {
"mfussenegger/nvim-lint",
opts = {},

View file

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

View file

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

View file

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

View file

@ -26,19 +26,19 @@ return {
open_split = { "<c-x>" }, -- open buffer in new split
open_vsplit = { "<c-v>" }, -- open buffer in new vsplit
open_tab = { "<c-t>" }, -- open buffer in new tab
jump_close = {"o"}, -- jump to the diagnostic and close the list
jump_close = { "o" }, -- jump to the diagnostic and close the list
toggle_mode = "m", -- toggle between "workspace" and "document" diagnostics mode
switch_severity = "s", -- switch "diagnostics" severity filter level to HINT / INFO / WARN / ERROR
toggle_preview = "P", -- toggle auto_preview
hover = "K", -- opens a small popup with the full multiline message
preview = "p", -- preview the diagnostic location
open_code_href = "c", -- if present, open a URI with more information about the diagnostic error
close_folds = {"zM", "zm"}, -- close all folds
open_folds = {"zR", "zr"}, -- open all folds
toggle_fold = {"zA", "za"}, -- toggle fold of current file
close_folds = { "zM", "zm" }, -- close all folds
open_folds = { "zR", "zr" }, -- open all folds
toggle_fold = { "zA", "za" }, -- toggle fold of current file
previous = "k", -- previous item
next = "j", -- next item
help = "?" -- help menu
help = "?", -- help menu
},
multiline = true, -- render multi-line messages
indent_lines = true, -- add an indent guide below the fold icons
@ -47,7 +47,7 @@ return {
auto_close = false, -- automatically close the list when you have no diagnostics
auto_preview = true, -- automatically preview the location of the diagnostic. <esc> to close preview and go back to last window
auto_fold = false, -- automatically fold a file trouble list at creation
auto_jump = {"lsp_definitions"}, -- for the given modes, automatically jump if there is only a single result
auto_jump = { "lsp_definitions" }, -- for the given modes, automatically jump if there is only a single result
include_declaration = { "lsp_references", "lsp_implementations", "lsp_definitions" }, -- for the given modes, include the declaration of the current symbol in the results
signs = {
-- icons / text used for a diagnostic
@ -57,7 +57,7 @@ return {
information = 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 = {
maplazykey("<leader>xx", function()

View file

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

Binary file not shown.