Fixed formatting

This commit is contained in:
Dreaded_X 2023-04-11 00:06:37 +02:00
parent 4edc2a87b0
commit 1640e1c3b6
Signed by: Dreaded_X
GPG Key ID: FA5F485356B0D2D4
19 changed files with 119 additions and 93 deletions

View File

@ -35,7 +35,6 @@ I hope you enjoy your Neovim journey,
P.S. You can delete this when you're done too. It's your config now :) P.S. You can delete this when you're done too. It's your config now :)
--]] --]]
-- Set <space> as the leader key -- Set <space> as the leader key
-- See `:help mapleader` -- See `:help mapleader`
-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used) -- NOTE: Must happen before plugins are required (otherwise wrong leader will be used)
@ -69,7 +68,8 @@ require('lazy').setup({
-- NOTE: This is where your plugins related to LSP can be installed. -- NOTE: This is where your plugins related to LSP can be installed.
-- The configuration is done below. Search for lspconfig to find it below. -- The configuration is done below. Search for lspconfig to find it below.
{ -- LSP Configuration & Plugins {
-- LSP Configuration & Plugins
'neovim/nvim-lspconfig', 'neovim/nvim-lspconfig',
dependencies = { dependencies = {
-- Automatically install LSPs to stdpath for neovim -- Automatically install LSPs to stdpath for neovim
@ -111,17 +111,21 @@ require('lazy').setup({
handler_opts = { handler_opts = {
-- TODO: Setup borders for other lsp stuff (Maybe using noice?) -- TODO: Setup borders for other lsp stuff (Maybe using noice?)
border = "single" border = "single"
}} }
}
}, },
{ -- Autocompletion {
-- Autocompletion
'hrsh7th/nvim-cmp', 'hrsh7th/nvim-cmp',
dependencies = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip', 'hrsh7th/cmp-path', 'onsails/lspkind-nvim', }, dependencies = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip', 'hrsh7th/cmp-path',
'onsails/lspkind-nvim', },
}, },
-- Useful plugin to show you pending keybinds. -- Useful plugin to show you pending keybinds.
{ 'folke/which-key.nvim', opts = {} }, { 'folke/which-key.nvim', opts = {} },
{ -- Adds git releated signs to the gutter, as well as utilities for managing changes {
-- Adds git releated signs to the gutter, as well as utilities for managing changes
'lewis6991/gitsigns.nvim', 'lewis6991/gitsigns.nvim',
opts = { opts = {
-- See `:help gitsigns.txt` -- See `:help gitsigns.txt`
@ -135,24 +139,26 @@ require('lazy').setup({
}, },
}, },
{ -- Set lualine as statusline {
-- Set lualine as statusline
'nvim-lualine/lualine.nvim', 'nvim-lualine/lualine.nvim',
-- See `:help lualine.txt` -- See `:help lualine.txt`
opts = { opts = {
options = { options = {
icons_enabled = true, icons_enabled = true,
theme = 'gruvbox', theme = 'gruvbox',
component_separators = { left = '', right = ''}, component_separators = { left = '', right = '' },
section_separators = { left = '', right = ''}, section_separators = { left = '', right = '' },
}, },
sections = { sections = {
lualine_b = { lualine_b = {
'branch', 'branch',
'diff', 'diff',
{ 'diagnostics', symbols = {error = '', warn = '', info = '', hint = ''} }, { 'diagnostics', symbols = { error = '', warn = '', info = '', hint = '' } },
}, },
lualine_c = { lualine_c = {
{ 'filename', {
'filename',
path = 1, path = 1,
symbols = { symbols = {
modified = symbols.file.modified, modified = symbols.file.modified,
@ -172,7 +178,8 @@ require('lazy').setup({
}, },
}, },
{ -- Add indentation guides even on blank lines {
-- Add indentation guides even on blank lines
'lukas-reineke/indent-blankline.nvim', 'lukas-reineke/indent-blankline.nvim',
-- Enable `lukas-reineke/indent-blankline.nvim` -- Enable `lukas-reineke/indent-blankline.nvim`
-- See `:help indent_blankline.txt` -- See `:help indent_blankline.txt`
@ -184,7 +191,9 @@ require('lazy').setup({
-- Fuzzy Finder (files, lsp, etc) -- Fuzzy Finder (files, lsp, etc)
{ 'nvim-telescope/telescope.nvim', version = '*', dependencies = { 'nvim-lua/plenary.nvim', 'nvim-telescope/telescope-ui-select.nvim' } }, { 'nvim-telescope/telescope.nvim', version = '*',
dependencies = { 'nvim-lua/plenary.nvim',
'nvim-telescope/telescope-ui-select.nvim' } },
-- Fuzzy Finder Algorithm which requires local dependencies to be built. -- Fuzzy Finder Algorithm which requires local dependencies to be built.
-- Only load if `make` is available. Make sure you have the system -- Only load if `make` is available. Make sure you have the system
@ -199,7 +208,8 @@ require('lazy').setup({
end, end,
}, },
{ -- Highlight, edit, and navigate code {
-- Highlight, edit, and navigate code
'nvim-treesitter/nvim-treesitter', 'nvim-treesitter/nvim-treesitter',
dependencies = { dependencies = {
'nvim-treesitter/nvim-treesitter-textobjects', 'nvim-treesitter/nvim-treesitter-textobjects',
@ -351,7 +361,8 @@ require('nvim-treesitter.configs').setup {
-- LSP settings. -- LSP settings.
-- Set the diagnostic symbols (Also used by Neo-tree) -- Set the diagnostic symbols (Also used by Neo-tree)
local signs = { Error = symbols.diagnostic.error, Warn = symbols.diagnostic.warning, Hint = symbols.diagnostic.hint, Info = symbols.diagnostic.info } local signs = { Error = symbols.diagnostic.error, Warn = symbols.diagnostic.warning, Hint = symbols.diagnostic.hint,
Info = symbols.diagnostic.info }
for type, icon in pairs(signs) do for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
@ -379,7 +390,8 @@ local on_attach = function(client, bufnr)
-- nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction') -- nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
-- Should allow code actions in visual mode -- Should allow code actions in visual mode
vim.keymap.set({'v', 'n'}, '<leader>ca', vim.lsp.buf.code_action, { buffer = bufnr, desc = 'LSP: [C]ode [A]ction', remap=true }) vim.keymap.set({ 'v', 'n' }, '<leader>ca', vim.lsp.buf.code_action,
{ buffer = bufnr, desc = 'LSP: [C]ode [A]ction', remap = true })
-- nmap('<leader>ca', require('telescope.builtin')., '[C]ode [A]ction') -- nmap('<leader>ca', require('telescope.builtin')., '[C]ode [A]ction')
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition') nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
@ -419,10 +431,10 @@ local on_attach = function(client, bufnr)
}) })
end end
-- Attach document colour support -- Attach document colour support
if client.server_capabilities.colorProvider then if client.server_capabilities.colorProvider then
require("document-color").buf_attach(bufnr) require("document-color").buf_attach(bufnr)
end end
end end
-- Enable the following language servers -- Enable the following language servers
@ -475,7 +487,7 @@ require('neodev').setup()
local capabilities = vim.lsp.protocol.make_client_capabilities() local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
capabilities.textDocument.colorProvider = { capabilities.textDocument.colorProvider = {
dynamicRegistration = true dynamicRegistration = true
} }
-- Setup mason so it can manage external tooling -- Setup mason so it can manage external tooling

View File

@ -1,34 +1,34 @@
-- Highlight on yank -- Highlight on yank
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true }) local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
vim.api.nvim_create_autocmd('TextYankPost', { vim.api.nvim_create_autocmd('TextYankPost', {
callback = function() callback = function()
vim.highlight.on_yank({ higroup = 'YankHighlight'}) vim.highlight.on_yank({ higroup = 'YankHighlight' })
end, end,
group = highlight_group, group = highlight_group,
pattern = '*', pattern = '*',
}) })
-- show cursor line only in active window -- show cursor line only in active window
local cursor_group = vim.api.nvim_create_augroup('ActiveCursor', { clear = true }) local cursor_group = vim.api.nvim_create_augroup('ActiveCursor', { clear = true })
vim.api.nvim_create_autocmd({ "InsertLeave", "WinEnter" }, { vim.api.nvim_create_autocmd({ "InsertLeave", "WinEnter" }, {
callback = function() callback = function()
local ok, cl = pcall(vim.api.nvim_win_get_var, 0, "auto-cursorline") local ok, cl = pcall(vim.api.nvim_win_get_var, 0, "auto-cursorline")
if ok and cl then if ok and cl then
vim.wo.cursorline = true vim.wo.cursorline = true
vim.api.nvim_win_del_var(0, "auto-cursorline") vim.api.nvim_win_del_var(0, "auto-cursorline")
end end
end, end,
group = cursor_group, group = cursor_group,
pattern = '*', pattern = '*',
}) })
vim.api.nvim_create_autocmd({ "InsertEnter", "WinLeave" }, { vim.api.nvim_create_autocmd({ "InsertEnter", "WinLeave" }, {
callback = function() callback = function()
local cl = vim.wo.cursorline local cl = vim.wo.cursorline
if cl then if cl then
vim.api.nvim_win_set_var(0, "auto-cursorline", cl) vim.api.nvim_win_set_var(0, "auto-cursorline", cl)
vim.wo.cursorline = false vim.wo.cursorline = false
end end
end, end,
group = cursor_group, group = cursor_group,
pattern = '*', pattern = '*',
}) })

View File

@ -1,16 +1,15 @@
-- Symbols to use for diagnostics -- Symbols to use for diagnostics
return { return {
-- LSP Status symbols -- LSP Status symbols
error = "", error = "",
warning = "", warning = "",
info = "", info = "",
hint = "", hint = "",
-- Comment type symbols -- Comment type symbols
bug = "", bug = "",
todo = "", todo = "",
hack = "", hack = "",
performance = "", performance = "",
note = "", note = "",
test = "", test = "",
} }

View File

@ -1,6 +1,6 @@
-- Symbols to use for files -- Symbols to use for files
return { return {
icon = '', icon = '',
modified = '', modified = '',
readonly = '' readonly = ''
} }

View File

@ -1,6 +1,6 @@
-- Symbols to use for folds -- Symbols to use for folds
return { return {
open = '', open = '',
closed = '', closed = '',
empty = '' empty = ''
} }

View File

@ -5,7 +5,6 @@ return {
modified = '', modified = '',
deleted = '', deleted = '',
renamed = '', renamed = '',
-- Status type -- Status type
untracked = '', untracked = '',
ignored = '', ignored = '',

View File

@ -1,6 +1,6 @@
return { return {
diagnostic = require("constant.symbols.diagnostic"), diagnostic = require("constant.symbols.diagnostic"),
fold = require("constant.symbols.fold"), fold = require("constant.symbols.fold"),
file = require("constant.symbols.file"), file = require("constant.symbols.file"),
git = require("constant.symbols.git"), git = require("constant.symbols.git"),
} }

View File

@ -1,4 +1,3 @@
-- vim: ts=4 sts=4 sw=4 noet
-- https://github.com/windwp/nvim-autopairs -- https://github.com/windwp/nvim-autopairs
return { return {
'windwp/nvim-autopairs', 'windwp/nvim-autopairs',

View File

@ -3,11 +3,21 @@ return {
'ojroques/nvim-bufdel', 'ojroques/nvim-bufdel',
cmd = { "BufDel", "BuffDelOthers" }, cmd = { "BufDel", "BuffDelOthers" },
keys = { keys = {
{ '<leader>bd', function() {
require('bufdel').delete_buffer_expr(nil, false) '<leader>bd',
end, silent = true, desc = '[B]uffer [d]elete' }, function()
{ '<leader>bD', function() require('bufdel').delete_buffer_expr(nil, false)
require('bufdel').delete_buffer_others(false) end,
end, silent = true, desc = '[B]uffer [D]elete others' }, silent = true,
desc = '[B]uffer [d]elete'
},
{
'<leader>bD',
function()
require('bufdel').delete_buffer_others(false)
end,
silent = true,
desc = '[B]uffer [D]elete others'
},
}, },
} }

View File

@ -49,8 +49,8 @@ return {
local s = " " local s = " "
for e, n in pairs(diagnostics_dict) do for e, n in pairs(diagnostics_dict) do
local sym = e == "error" and symbols.diagnostic.error .. ' ' local sym = e == "error" and symbols.diagnostic.error .. ' '
or (e == "warning" and symbols.diagnostic.warning .. ' ') or (e == "warning" and symbols.diagnostic.warning .. ' ')
or (e == "info" and symbols.diagnostic.info .. ' ' or symbols.diagnostic.hint .. ' ' ) or (e == "info" and symbols.diagnostic.info .. ' ' or symbols.diagnostic.hint .. ' ')
s = s .. n .. sym s = s .. n .. sym
end end
return s return s

View File

@ -2,7 +2,7 @@
return { return {
'NvChad/nvim-colorizer.lua', 'NvChad/nvim-colorizer.lua',
event = "VeryLazy", event = "VeryLazy",
opts = { opts = {
filetypes = { filetypes = {
'*', -- Enable color highlighting for all files '*', -- Enable color highlighting for all files
'!neo-tree', -- Exclude neo-tree '!neo-tree', -- Exclude neo-tree

View File

@ -1,6 +1,6 @@
-- https://github.com/numToStr/Comment.nvim -- https://github.com/numToStr/Comment.nvim
return { return {
'numToStr/Comment.nvim', 'numToStr/Comment.nvim',
event = "VeryLazy", event = "VeryLazy",
opts = {}, opts = {},
} }

View File

@ -11,7 +11,7 @@ return {
keys = { keys = {
{ '<F2>', '<cmd>Neotree toggle reveal filesystem float<cr>', desc = 'Open floating Neo-tree window' }, { '<F2>', '<cmd>Neotree toggle reveal filesystem float<cr>', desc = 'Open floating Neo-tree window' },
}, },
config = function () config = function()
local symbols = require('constant.symbols'); local symbols = require('constant.symbols');
require('neo-tree').setup { require('neo-tree').setup {

View File

@ -1,6 +1,6 @@
return { return {
'jose-elias-alvarez/null-ls.nvim', 'jose-elias-alvarez/null-ls.nvim',
config = function () config = function()
local null_ls = require('null-ls') local null_ls = require('null-ls')
null_ls.setup { null_ls.setup {

View File

@ -1,10 +1,10 @@
-- https://github.com/toppair/peek.nvim -- https://github.com/toppair/peek.nvim
return { return {
'toppair/peek.nvim', 'toppair/peek.nvim',
build = 'deno task --quiet build:fast', build = 'deno task --quiet build:fast',
cond = function() cond = function()
return vim.fn.executable 'deno' == 1 return vim.fn.executable 'deno' == 1
end, end,
lazy = true, lazy = true,
cmds = { "PeekOpen", "PeekClose" }, cmds = { "PeekOpen", "PeekClose" },
init = function() init = function()
@ -14,7 +14,7 @@ return {
local augroup = vim.api.nvim_create_augroup('Peek', { clear = true }) local augroup = vim.api.nvim_create_augroup('Peek', { clear = true })
-- Automatically open a markdown preview window -- Automatically open a markdown preview window
vim.api.nvim_create_autocmd({ "FileType"}, { vim.api.nvim_create_autocmd({ "FileType" }, {
callback = function() callback = function()
require('peek').open() require('peek').open()
end, end,

View File

@ -2,9 +2,13 @@
return { return {
'simrat39/symbols-outline.nvim', 'simrat39/symbols-outline.nvim',
keys = { keys = {
{ '<F5>', function() {
require('symbols-outline').toggle_outline() '<F5>',
end, desc = 'Toggle symbols outline' }, function()
require('symbols-outline').toggle_outline()
end,
desc = 'Toggle symbols outline'
},
}, },
opts = {}, opts = {},
} }

View File

@ -2,12 +2,16 @@
return { return {
'Wansmer/treesj', 'Wansmer/treesj',
keys = { keys = {
{ '<space>m', function() {
require('treesj').toggle() '<space>m',
end, desc = "Split or Join code block" }, function()
require('treesj').toggle()
end,
desc = "Split or Join code block"
},
}, },
dependencies = { 'nvim-treesitter/nvim-treesitter' }, dependencies = { 'nvim-treesitter/nvim-treesitter' },
opts = { opts = {
use_default_keymaps = false, use_default_keymaps = false,
} }
} }

View File

@ -5,7 +5,7 @@ return {
keys = { keys = {
{ '<F3>', '<cmd>TroubleToggle workspace_diagnostics<cr>', desc = 'Goto previous buffer' }, { '<F3>', '<cmd>TroubleToggle workspace_diagnostics<cr>', desc = 'Goto previous buffer' },
}, },
config = function () config = function()
local symbols = require('constant.symbols'); local symbols = require('constant.symbols');
require('trouble').setup { require('trouble').setup {
icons = false, icons = false,

View File

@ -1,13 +1,12 @@
return { return {
'johnfrankmorgan/whitespace.nvim', 'johnfrankmorgan/whitespace.nvim',
config = function () config = function()
require('whitespace-nvim').setup({ require('whitespace-nvim').setup({
-- configuration options and their defaults -- configuration options and their defaults
-- `highlight` configures which highlight is used to display -- `highlight` configures which highlight is used to display
-- trailing whitespace -- trailing whitespace
highlight = 'CursorLine', highlight = 'CursorLine',
-- `ignored_filetypes` configures which filetypes to ignore when -- `ignored_filetypes` configures which filetypes to ignore when
-- displaying trailing whitespace -- displaying trailing whitespace
ignored_filetypes = { 'TelescopePrompt', 'Trouble', 'help' }, ignored_filetypes = { 'TelescopePrompt', 'Trouble', 'help' },