Delete image preview support

This commit is contained in:
Buliway 2025-03-25 13:37:52 +03:00
parent af4453fe00
commit d3db7074ec
3 changed files with 302 additions and 294 deletions

View file

@ -1,4 +1,17 @@
Сделай бекап старого конфига, если он есть и если он нужен. Конфиг находится тут: `~/.config/nvim`
Первый запуск конфига может быть долгим. Не прерывай этот процесс, пока не появится меню плагин манагера.
Надо скачать:
- `neovim`
- `git`
- `ripgrep`
- `fd`
- `unzip`
- `npm` (на некоторых дистрах он отдельно, на некоторых является частью `nodejs`, на всякий качаю оба пакета)
- Что-то для буфера обмена. На X11 это `xclip`, на Wayland это `wl-clipboard`. На маке и винде не знаю что надо качать.
- Любой nerd font. У меня это `JetBrainsMono Nerd Font Mono`
Установить этот конфиг на Linux или Mac можно так:
```sh
git clone https://github.com/buliway/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim

View file

@ -9,14 +9,14 @@ return {
'nvim-lua/plenary.nvim',
'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
'MunifTanjim/nui.nvim',
{ -- Optional image support in preview window: See `# Preview Mode` for more information
'3rd/image.nvim',
build = false, -- so that it doesn't build the rock
opts = {
backend = 'ueberzug', -- or "kitty"
processor = 'magick_cli', -- or "magick_rock"
},
},
-- { -- Optional image support in preview window: See `# Preview Mode` for more information
-- '3rd/image.nvim',
-- build = false, -- so that it doesn't build the rock
-- opts = {
-- backend = 'ueberzug', -- or "kitty"
-- processor = 'magick_cli', -- or "magick_rock"
-- },
-- },
},
cmd = 'Neotree',
keys = {

View file

@ -4,31 +4,31 @@ return {
{
-- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
-- used for completion, annotations and signatures of Neovim apis
"folke/lazydev.nvim",
ft = "lua",
'folke/lazydev.nvim',
ft = 'lua',
opts = {
library = {
-- Load luvit types when the `vim.uv` word is found
{ path = "luvit-meta/library", words = { "vim%.uv" } },
{ path = 'luvit-meta/library', words = { 'vim%.uv' } },
},
},
},
{ "Bilal2453/luvit-meta", lazy = true },
{ 'Bilal2453/luvit-meta', lazy = true },
{
-- Main LSP Configuration
"neovim/nvim-lspconfig",
'neovim/nvim-lspconfig',
dependencies = {
-- Automatically install LSPs and related tools to stdpath for Neovim
{ "williamboman/mason.nvim", config = true }, -- NOTE: Must be loaded before dependants
"williamboman/mason-lspconfig.nvim",
"WhoIsSethDaniel/mason-tool-installer.nvim",
{ 'williamboman/mason.nvim', config = true }, -- NOTE: Must be loaded before dependants
'williamboman/mason-lspconfig.nvim',
'WhoIsSethDaniel/mason-tool-installer.nvim',
-- Useful status updates for LSP.
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
{ "j-hui/fidget.nvim", opts = {} },
{ 'j-hui/fidget.nvim', opts = {} },
-- Allows extra capabilities provided by nvim-cmp
"hrsh7th/cmp-nvim-lsp",
'hrsh7th/cmp-nvim-lsp',
},
config = function()
-- Brief aside: **What is LSP?**
@ -60,8 +60,8 @@ return {
-- That is to say, every time a new file is opened that is associated with
-- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this
-- function will be executed to configure the current buffer
vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("kickstart-lsp-attach", { clear = true }),
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }),
callback = function(event)
-- NOTE: Remember that Lua is a real programming language, and as such it is possible
-- to define small helper and utility functions so you don't have to repeat yourself.
@ -69,51 +69,47 @@ return {
-- In this case, we create a function that lets us more easily define mappings specific
-- for LSP related items. It sets the mode, buffer and description for us each time.
local map = function(keys, func, desc, mode)
mode = mode or "n"
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = "LSP: " .. desc })
mode = mode or 'n'
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
end
-- Jump to the definition of the word under your cursor.
-- This is where a variable was first declared, or where a function is defined, etc.
-- To jump back, press <C-t>.
map("gd", require("telescope.builtin").lsp_definitions, "[G]oto [D]efinition")
map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
-- Find references for the word under your cursor.
map("gr", require("telescope.builtin").lsp_references, "[G]oto [R]eferences")
map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
-- Jump to the implementation of the word under your cursor.
-- Useful when your language has ways of declaring types without an actual implementation.
map("gI", require("telescope.builtin").lsp_implementations, "[G]oto [I]mplementation")
map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
-- Jump to the type of the word under your cursor.
-- Useful when you're not sure what type a variable is and you want to see
-- the definition of its *type*, not where it was *defined*.
map("<leader>D", require("telescope.builtin").lsp_type_definitions, "Type [D]efinition")
map('<leader>D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition')
-- Fuzzy find all the symbols in your current document.
-- Symbols are things like variables, functions, types, etc.
-- Было <leader>ds [D]ocument [S]ymbols
map("<leader>ss", require("telescope.builtin").lsp_document_symbols, "Document [S]ymbols")
map('<leader>ss', require('telescope.builtin').lsp_document_symbols, 'Document [S]ymbols')
-- Fuzzy find all the symbols in your current workspace.
-- Similar to document symbols, except searches over your entire project.
map(
"<leader>ws",
require("telescope.builtin").lsp_dynamic_workspace_symbols,
"[W]orkspace [S]ymbols"
)
map('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
-- Rename the variable under your cursor.
-- Most Language Servers support renaming across files, etc.
map("<leader>rn", vim.lsp.buf.rename, "[R]e[n]ame")
map('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
-- Execute a code action, usually your cursor needs to be on top of an error
-- or a suggestion from your LSP for this to activate.
map("<leader>ca", vim.lsp.buf.code_action, "[C]ode [A]ction", { "n", "x" })
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' })
-- WARN: This is not Goto Definition, this is Goto Declaration.
-- For example, in C this would take you to the header.
map("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration")
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
-- The following two autocommands are used to highlight references of the
-- word under your cursor when your cursor rests there for a little while.
@ -122,25 +118,24 @@ return {
-- When you move your cursor, the highlights will be cleared (the second autocommand).
local client = vim.lsp.get_client_by_id(event.data.client_id)
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then
local highlight_augroup =
vim.api.nvim_create_augroup("kickstart-lsp-highlight", { clear = false })
vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, {
local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false })
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
buffer = event.buf,
group = highlight_augroup,
callback = vim.lsp.buf.document_highlight,
})
vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, {
vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
buffer = event.buf,
group = highlight_augroup,
callback = vim.lsp.buf.clear_references,
})
vim.api.nvim_create_autocmd("LspDetach", {
group = vim.api.nvim_create_augroup("kickstart-lsp-detach", { clear = true }),
vim.api.nvim_create_autocmd('LspDetach', {
group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }),
callback = function(event2)
vim.lsp.buf.clear_references()
vim.api.nvim_clear_autocmds({ group = "kickstart-lsp-highlight", buffer = event2.buf })
vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf }
end,
})
end
@ -150,21 +145,21 @@ return {
--
-- This may be unwanted, since they displace some of your code
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then
map("<leader>th", function()
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = event.buf }))
end, "[T]oggle Inlay [H]ints")
map('<leader>th', function()
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
end, '[T]oggle Inlay [H]ints')
end
end,
})
-- Change diagnostic symbols in the sign column (gutter)
if vim.g.have_nerd_font then
local signs = { ERROR = "", WARN = "", INFO = "", HINT = "" }
local signs = { ERROR = '', WARN = '', INFO = '', HINT = '' }
local diagnostic_signs = {}
for type, icon in pairs(signs) do
diagnostic_signs[vim.diagnostic.severity[type]] = icon
end
vim.diagnostic.config({ signs = { text = diagnostic_signs } })
vim.diagnostic.config { signs = { text = diagnostic_signs } }
end
-- LSP servers and clients are able to communicate to each other what features they support.
@ -172,7 +167,7 @@ return {
-- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities.
-- So, we create new capabilities with nvim cmp, and then broadcast that to the servers.
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = vim.tbl_deep_extend("force", capabilities, require("cmp_nvim_lsp").default_capabilities())
capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities())
-- Настройки для некоторых lsp серверов. Приходится делать так.
local cap_css = vim.lsp.protocol.make_client_capabilities()
@ -210,25 +205,25 @@ return {
-- Golang
gopls = {},
templ = {},
-- templ = {},
-- Frontend
tailwindcss = {},
ts_ls = {},
htmx = {},
-- tailwindcss = {},
-- htmx = {},
emmet_language_server = {
filetypes = {
"templ",
"css",
"eruby",
"html",
"javascript",
"javascriptreact",
"less",
"sass",
"scss",
"pug",
"typescriptreact",
'templ',
'css',
'eruby',
'html',
'javascript',
'javascriptreact',
'less',
'sass',
'scss',
'pug',
'typescriptreact',
},
},
cssls = {
@ -238,8 +233,8 @@ return {
capabilities = cap_html,
on_attach = function(client, bufnr)
-- Отключаем форматирование для файлов .templ
local ft = vim.api.nvim_buf_get_option(bufnr, "filetype")
if ft == "templ" then
local ft = vim.api.nvim_buf_get_option(bufnr, 'filetype')
if ft == 'templ' then
client.server_capabilities.documentFormattingProvider = false
end
end,
@ -250,7 +245,7 @@ return {
settings = {
Lua = {
completion = {
callSnippet = "Replace",
callSnippet = 'Replace',
},
-- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
-- diagnostics = { disable = { 'missing-fields' } },
@ -260,7 +255,7 @@ return {
-- C/C++
clangd = {
filetypes = { "c", "cpp", "objc", "objcpp", "cuda" }, -- Удалил "proto"
filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' }, -- Удалил "proto"
},
cmake = {},
@ -296,28 +291,28 @@ return {
-- :Mason
--
-- You can press `g?` for help in this menu.
require("mason").setup()
require('mason').setup()
-- You can add other tools here that you want Mason to install
-- for you, so that they are available from within Neovim.
local ensure_installed = vim.tbl_keys(servers or {})
vim.list_extend(ensure_installed, {
"stylua", -- Used to format Lua code
'stylua', -- Used to format Lua code
})
require("mason-tool-installer").setup({ ensure_installed = ensure_installed })
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
require("mason-lspconfig").setup({
require('mason-lspconfig').setup {
handlers = {
function(server_name)
local server = servers[server_name] or {}
-- This handles overriding only values explicitly passed
-- by the server configuration above. Useful when disabling
-- certain features of an LSP (for example, turning off formatting for ts_ls)
server.capabilities = vim.tbl_deep_extend("force", {}, capabilities, server.capabilities or {})
require("lspconfig")[server_name].setup(server)
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
require('lspconfig')[server_name].setup(server)
end,
},
})
}
end,
},
}