chore: run stylua

This commit is contained in:
Matej Janezic 2023-03-27 14:42:59 +02:00
parent 15770ed51a
commit adb41f63b0
Signed by: janezicmatej
GPG Key ID: 4298E230ED37B2C0
7 changed files with 87 additions and 88 deletions

View File

@ -1,10 +1,7 @@
vim.api.nvim_create_autocmd({ "BufEnter, BufWinEnter" }, vim.api.nvim_create_autocmd({ 'BufEnter, BufWinEnter' },
{ command = "set colorcolumn=120,80,88", pattern = { "*.py", "*.pyi" } }) { command = 'set colorcolumn=120,80,88', pattern = { '*.py', '*.pyi' } })
vim.api.nvim_create_autocmd({ "BufEnter, BufWinEnter" }, vim.api.nvim_create_autocmd({ 'BufEnter, BufWinEnter' }, { command = 'set colorcolumn=80,100', pattern = { '*.rs' } })
{ command = "set colorcolumn=80,100", pattern = { "*.rs" } }) vim.api.nvim_create_autocmd({ 'BufEnter, BufWinEnter' }, { command = 'set splitright', pattern = { '*' } })
vim.api.nvim_create_autocmd({ "BufEnter, BufWinEnter" }, vim.api.nvim_create_autocmd({ 'BufEnter, BufWinEnter' }, { command = 'set splitbelow', pattern = { '*' } })
{ command = "set splitright", pattern = { "*" } })
vim.api.nvim_create_autocmd({ "BufEnter, BufWinEnter" },
{ command = "set splitbelow", pattern = { "*" } })
return {} return {}

View File

@ -31,6 +31,9 @@ vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float) vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float)
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist) vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist)
-- Plugins
vim.keymap.set('n', '<leader>nb', ":Navbuddy<CR>", { desc = '[N]av[b]uddy' })
-- terminal keymaps -- terminal keymaps
function _G.set_terminal_keymaps() function _G.set_terminal_keymaps()
local opts = { buffer = 0 } local opts = { buffer = 0 }
@ -43,7 +46,6 @@ end
-- --
-- if you only want these mappings for toggle term use term://*toggleterm#* instead -- if you only want these mappings for toggle term use term://*toggleterm#* instead
vim.cmd('autocmd! TermOpen term://* lua set_terminal_keymaps()') vim.cmd 'autocmd! TermOpen term://* lua set_terminal_keymaps()'
return {} return {}

View File

@ -1,5 +1,6 @@
function leave_snippet() function leave_snippet()
if ((vim.v.event.old_mode == 's' and vim.v.event.new_mode == 'n') or vim.v.event.old_mode == 'i') if
((vim.v.event.old_mode == 's' and vim.v.event.new_mode == 'n') or vim.v.event.old_mode == 'i')
and require('luasnip').session.current_nodes[vim.api.nvim_get_current_buf()] and require('luasnip').session.current_nodes[vim.api.nvim_get_current_buf()]
and not require('luasnip').session.jump_active and not require('luasnip').session.jump_active
then then
@ -20,7 +21,7 @@ local border = {
vim.api.nvim_command [[ vim.api.nvim_command [[
autocmd ModeChanged * lua leave_snippet() autocmd ModeChanged * lua leave_snippet()
]]) ]]
return { return {
{ {
@ -30,17 +31,18 @@ return {
'L3MON4D3/LuaSnip', 'L3MON4D3/LuaSnip',
'saadparwaiz1/cmp_luasnip', 'saadparwaiz1/cmp_luasnip',
{ -- copilot {
-- copilot
'zbirenbaum/copilot.lua', 'zbirenbaum/copilot.lua',
opts = { suggestion = { enabled = false }, panel = { enabled = false } } opts = { suggestion = { enabled = false }, panel = { enabled = false } },
}, },
{ -- copilot-cmp source {
-- copilot-cmp source
'zbirenbaum/copilot-cmp', 'zbirenbaum/copilot-cmp',
opts = { clear_after_cursor = true } opts = { clear_after_cursor = true },
} },
}, },
config = function() config = function()
-- nvim-cmp setup -- nvim-cmp setup
local cmp = require 'cmp' local cmp = require 'cmp'
@ -92,6 +94,6 @@ return {
}, },
}, },
} }
end end,
}, },
} }

View File

@ -2,7 +2,6 @@ return {
-- NOTE: Theme -- NOTE: Theme
{ {
'sainnhe/gruvbox-material', 'sainnhe/gruvbox-material',
priority = 1000, priority = 1000,
config = function() config = function()
vim.g.gruvbox_material_background = 'soft' vim.g.gruvbox_material_background = 'soft'
@ -31,29 +30,30 @@ return {
{ 'numToStr/Comment.nvim', opts = {} }, { 'numToStr/Comment.nvim', opts = {} },
-- colorize in files -- colorize in files
{ "norcalli/nvim-colorizer.lua", opts = {} }, { 'norcalli/nvim-colorizer.lua', opts = {} },
-- highlighting for comments -- highlighting for comments
{ "folke/todo-comments.nvim", dependencies = "nvim-lua/plenary.nvim", opts = {} }, { 'folke/todo-comments.nvim', dependencies = 'nvim-lua/plenary.nvim', opts = {} },
-- markdown preview using glow -- markdown preview using glow
{ "ellisonleao/glow.nvim", config = true, cmd = "Glow" }, { 'ellisonleao/glow.nvim', config = true, cmd = 'Glow' },
-- permanent links to fileranges -- permanent links to fileranges
{ 'ruifm/gitlinker.nvim',
config = function()
require('gitlinker').setup(
{ {
'ruifm/gitlinker.nvim',
config = function()
require('gitlinker').setup {
callbacks = { callbacks = {
['git.aflabs.org'] = require('gitlinker.hosts').get_gitlab_type_url } ['git.aflabs.org'] = require('gitlinker.hosts').get_gitlab_type_url,
},
} }
) end,
end
}, },
-- NOTE: Third, plugins that require some setup, but not enugh for separate file -- NOTE: Third, plugins that require some setup, but not enugh for separate file
{ -- 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`
@ -67,7 +67,8 @@ return {
}, },
}, },
{ -- 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 = {
@ -81,7 +82,8 @@ return {
}, },
}, },
{ -- 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`
@ -91,38 +93,39 @@ return {
}, },
}, },
{ -- git blame annotations {
-- git blame annotations
'f-person/git-blame.nvim', 'f-person/git-blame.nvim',
config = function() config = function()
vim.api.nvim_set_keymap('n', '<leader>gt', ':GitBlameToggle<CR>', { desc = '[G]it Blame [T]oggle', noremap = true }) vim.api.nvim_set_keymap('n', '<leader>gt', ':GitBlameToggle<CR>', { desc = '[G]it Blame [T]oggle', noremap = true })
vim.api.nvim_set_keymap('n', '<leader>gu', ':GitBlameOpenCommitURL<CR>', vim.api.nvim_set_keymap('n', '<leader>gu', ':GitBlameOpenCommitURL<CR>',
{ desc = '[G]it Blame Open Commit [U]rl', noremap = true }) { desc = '[G]it Blame Open Commit [U]rl', noremap = true })
end end,
}, },
{ -- a more adventurous wildmenu {
-- a more adventurous wildmenu
'gelguy/wilder.nvim', 'gelguy/wilder.nvim',
dependencies = { 'romgrk/fzy-lua-native' }, dependencies = { 'romgrk/fzy-lua-native' },
config = function() config = function()
local wilder = require('wilder') local wilder = require 'wilder'
wilder.setup({ modes = { ':', '/', '?' } }) wilder.setup { modes = { ':', '/', '?' } }
-- Disable Python remote plugin -- Disable Python remote plugin
wilder.set_option('use_python_remote_plugin', 0) wilder.set_option('use_python_remote_plugin', 0)
wilder.set_option('pipeline', { wilder.set_option('pipeline', {
wilder.branch( wilder.branch(
wilder.cmdline_pipeline({ wilder.cmdline_pipeline {
fuzzy = 1, fuzzy = 1,
fuzzy_filter = wilder.lua_fzy_filter(), fuzzy_filter = wilder.lua_fzy_filter(),
}), },
wilder.vim_search_pipeline() wilder.vim_search_pipeline()
) ),
}) })
wilder.set_option('renderer', wilder.popupmenu_renderer( wilder.set_option(
wilder.popupmenu_border_theme({ 'renderer',
wilder.popupmenu_renderer(wilder.popupmenu_border_theme {
highlights = { highlights = {
border = 'Normal', border = 'Normal',
}, },
@ -131,21 +134,22 @@ return {
left = { ' ', wilder.popupmenu_devicons() }, left = { ' ', wilder.popupmenu_devicons() },
right = { ' ', wilder.popupmenu_scrollbar() }, right = { ' ', wilder.popupmenu_scrollbar() },
}) })
)) )
end, end,
}, },
{ -- file tree {
"nvim-neo-tree/neo-tree.nvim", -- file tree
version = "*", 'nvim-neo-tree/neo-tree.nvim',
version = '*',
dependencies = { dependencies = {
"nvim-lua/plenary.nvim", 'nvim-lua/plenary.nvim',
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended 'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
"MunifTanjim/nui.nvim", 'MunifTanjim/nui.nvim',
}, },
config = function() config = function()
-- Unless you are still migrating, remove the deprecated commands from v1.x -- Unless you are still migrating, remove the deprecated commands from v1.x
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]]) vim.cmd [[ let g:neo_tree_remove_legacy_commands = 1 ]]
require('neo-tree').setup { require('neo-tree').setup {
filesystem = { filesystem = {
@ -154,7 +158,7 @@ return {
hide_dotfiles = false, hide_dotfiles = false,
hide_gitignored = false, hide_gitignored = false,
}, },
} },
} }
end, end,
}, },

View File

@ -1,6 +1,6 @@
-- LSP settings. -- LSP settings.
-- This function gets run when an LSP connects to a particular buffer. -- This function gets run when an LSP connects to a particular buffer.
local on_attach = function(_, bufnr) local on_attach = function(client, bufnr)
-- NOTE: Remember that lua is a real programming language, and as such it is possible -- 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 -- to define small helper and utility functions so you don't have to repeat yourself
-- many times. -- many times.
@ -16,7 +16,7 @@ local on_attach = function(_, bufnr)
end end
local delayed_format = function() local delayed_format = function()
vim.lsp.buf.format({ timeout_ms = 2000 }) vim.lsp.buf.format { timeout_ms = 2000 }
end end
require('nvim-navbuddy').attach(client, bufnr) require('nvim-navbuddy').attach(client, bufnr)
@ -51,7 +51,8 @@ local on_attach = function(_, bufnr)
end end
return { return {
{ -- 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
@ -73,11 +74,10 @@ return {
-- Additional lua configuration, makes nvim stuff amazing! -- Additional lua configuration, makes nvim stuff amazing!
'folke/neodev.nvim', 'folke/neodev.nvim',
}, },
config = function() config = function()
local servers = { local servers = {
-- clangd = {}, clangd = {},
-- gopls = {}, gopls = {},
marksman = {}, marksman = {},
pyright = {}, pyright = {},
tsserver = {}, tsserver = {},
@ -116,18 +116,17 @@ return {
} }
end, end,
} }
end end,
}, },
{ -- inject lsp formatting, diagonstics etc {
-- inject lsp formatting, diagonstics etc
'jose-elias-alvarez/null-ls.nvim', 'jose-elias-alvarez/null-ls.nvim',
dependencies = { 'nvim-lua/plenary.nvim' }, dependencies = { 'nvim-lua/plenary.nvim' },
config = function() config = function()
local null_ls = require("null-ls") local null_ls = require 'null-ls'
null_ls.setup({ null_ls.setup {
sources = { sources = {
-- general -- general
null_ls.builtins.code_actions.gitsigns, null_ls.builtins.code_actions.gitsigns,
@ -137,10 +136,10 @@ return {
null_ls.builtins.formatting.isort, null_ls.builtins.formatting.isort,
-- typescript -- typescript
null_ls.builtins.formatting.prettier, null_ls.builtins.formatting.prettier,
-- rust -- lua
-- null_ls.builtins.formatting.rustfmt, null_ls.builtins.formatting.stylua,
}, },
})
end
} }
end,
},
} }

View File

@ -1,9 +1,8 @@
return { return {
{ -- Fuzzy Finder (files, lsp, etc) {
-- Fuzzy Finder (files, lsp, etc)
'nvim-telescope/telescope.nvim', 'nvim-telescope/telescope.nvim',
version = '*', version = '*',
dependencies = { dependencies = {
'nvim-lua/plenary.nvim', 'nvim-lua/plenary.nvim',
@ -18,7 +17,6 @@ return {
end, end,
}, },
}, },
config = function() config = function()
-- [[ Configure Telescope ]] -- [[ Configure Telescope ]]
-- See `:help telescope` and `:help telescope.setup()` -- See `:help telescope` and `:help telescope.setup()`
@ -33,8 +31,8 @@ return {
}, },
pickers = { pickers = {
find_files = { find_files = {
find_command = { "rg", "-S", "--no-ignore-vcs", "--hidden", "--files", "-g", "!.git", }, find_command = { 'rg', '-S', '--no-ignore-vcs', '--hidden', '--files', '-g', '!.git' },
} },
}, },
} }
@ -60,17 +58,16 @@ return {
vim.keymap.set('n', '<leader>ss', require('telescope.builtin').spell_suggest, { desc = '[S]pell [S]suggest' }) vim.keymap.set('n', '<leader>ss', require('telescope.builtin').spell_suggest, { desc = '[S]pell [S]suggest' })
vim.keymap.set('n', '<leader>sc', function() vim.keymap.set('n', '<leader>sc', function()
require('telescope.builtin').colorscheme({ enable_preview = true }) require('telescope.builtin').colorscheme { enable_preview = true }
end, { desc = '[S]earch [C]olorscheme' }) end, { desc = '[S]earch [C]olorscheme' })
-- extensions -- extensions
-- vim.keymap.set('n', '<leader>fb', require('telescope').extensions.file_browser.file_browser, { desc = '[F]ile [B]rowser' }) -- vim.keymap.set('n', '<leader>fb', require('telescope').extensions.file_browser.file_browser, { desc = '[F]ile [B]rowser' })
vim.api.nvim_set_keymap('n', '<leader>tc', ':TodoTelescope<CR>', { desc = '[T]odo [C]omments', noremap = true }) vim.api.nvim_set_keymap('n', '<leader>tc', ':TodoTelescope<CR>', { desc = '[T]odo [C]omments', noremap = true })
end end,
}, },
-- 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
-- requirements installed. -- requirements installed.
} }

View File

@ -1,5 +1,4 @@
return { return {
-- Highlight, edit, and navigate code -- Highlight, edit, and navigate code
'nvim-treesitter/nvim-treesitter', 'nvim-treesitter/nvim-treesitter',
dependencies = { dependencies = {
@ -80,6 +79,5 @@ return {
}, },
}, },
} }
end, end,
} }