fix: trimming down config and updating stylua
This commit is contained in:
parent
8c6b78c770
commit
7e54a4c5c8
|
|
@ -4,3 +4,4 @@ indent_type = "Spaces"
|
||||||
indent_width = 2
|
indent_width = 2
|
||||||
quote_style = "AutoPreferSingle"
|
quote_style = "AutoPreferSingle"
|
||||||
call_parentheses = "None"
|
call_parentheses = "None"
|
||||||
|
collapse_simple_statement = "Always"
|
||||||
|
|
|
||||||
108
init.lua
108
init.lua
|
|
@ -114,9 +114,7 @@ vim.o.showmode = false
|
||||||
-- Schedule the setting after `UiEnter` because it can increase startup-time.
|
-- Schedule the setting after `UiEnter` because it can increase startup-time.
|
||||||
-- Remove this option if you want your OS clipboard to remain independent.
|
-- Remove this option if you want your OS clipboard to remain independent.
|
||||||
-- See `:help 'clipboard'`
|
-- See `:help 'clipboard'`
|
||||||
vim.schedule(function()
|
vim.schedule(function() vim.o.clipboard = 'unnamedplus' end)
|
||||||
vim.o.clipboard = 'unnamedplus'
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- Enable break indent
|
-- Enable break indent
|
||||||
vim.o.breakindent = true
|
vim.o.breakindent = true
|
||||||
|
|
@ -214,9 +212,7 @@ vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper win
|
||||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||||
desc = 'Highlight when yanking (copying) text',
|
desc = 'Highlight when yanking (copying) text',
|
||||||
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
|
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
|
||||||
callback = function()
|
callback = function() vim.hl.on_yank() end,
|
||||||
vim.hl.on_yank()
|
|
||||||
end,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
-- [[ Install `lazy.nvim` plugin manager ]]
|
-- [[ Install `lazy.nvim` plugin manager ]]
|
||||||
|
|
@ -225,9 +221,7 @@ local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
||||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||||
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
|
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
|
||||||
local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
|
local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
|
||||||
if vim.v.shell_error ~= 0 then
|
if vim.v.shell_error ~= 0 then error('Error cloning lazy.nvim:\n' .. out) end
|
||||||
error('Error cloning lazy.nvim:\n' .. out)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
---@type vim.Option
|
---@type vim.Option
|
||||||
|
|
@ -249,13 +243,6 @@ require('lazy').setup({
|
||||||
-- NOTE: Plugins can be added via a link or github org/name. To run setup automatically, use `opts = {}`
|
-- NOTE: Plugins can be added via a link or github org/name. To run setup automatically, use `opts = {}`
|
||||||
{ 'NMAC427/guess-indent.nvim', opts = {} },
|
{ 'NMAC427/guess-indent.nvim', opts = {} },
|
||||||
|
|
||||||
-- NOTE: Plugins can also be added by using a table,
|
|
||||||
-- with the first argument being the link and the following
|
|
||||||
-- keys can be used to configure plugin behavior/loading/etc.
|
|
||||||
--
|
|
||||||
-- Use `opts = {}` to automatically pass options to a plugin's `setup()` function, forcing the plugin to be loaded.
|
|
||||||
--
|
|
||||||
|
|
||||||
-- Alternatively, use `config = function() ... end` for full control over the configuration.
|
-- Alternatively, use `config = function() ... end` for full control over the configuration.
|
||||||
-- If you prefer to call `setup` explicitly, use:
|
-- If you prefer to call `setup` explicitly, use:
|
||||||
-- {
|
-- {
|
||||||
|
|
@ -300,47 +287,11 @@ require('lazy').setup({
|
||||||
|
|
||||||
{ -- Useful plugin to show you pending keybinds.
|
{ -- Useful plugin to show you pending keybinds.
|
||||||
'folke/which-key.nvim',
|
'folke/which-key.nvim',
|
||||||
event = 'VimEnter', -- Sets the loading event to 'VimEnter'
|
event = 'VimEnter',
|
||||||
opts = {
|
opts = {
|
||||||
-- delay between pressing a key and opening which-key (milliseconds)
|
-- delay between pressing a key and opening which-key (milliseconds)
|
||||||
-- this setting is independent of vim.o.timeoutlen
|
|
||||||
delay = 0,
|
delay = 0,
|
||||||
icons = {
|
icons = { mappings = vim.g.have_nerd_font },
|
||||||
-- set icon mappings to true if you have a Nerd Font
|
|
||||||
mappings = vim.g.have_nerd_font,
|
|
||||||
-- If you are using a Nerd Font: set icons.keys to an empty table which will use the
|
|
||||||
-- default which-key.nvim defined Nerd Font icons, otherwise define a string table
|
|
||||||
keys = vim.g.have_nerd_font and {} or {
|
|
||||||
Up = '<Up> ',
|
|
||||||
Down = '<Down> ',
|
|
||||||
Left = '<Left> ',
|
|
||||||
Right = '<Right> ',
|
|
||||||
C = '<C-…> ',
|
|
||||||
M = '<M-…> ',
|
|
||||||
D = '<D-…> ',
|
|
||||||
S = '<S-…> ',
|
|
||||||
CR = '<CR> ',
|
|
||||||
Esc = '<Esc> ',
|
|
||||||
ScrollWheelDown = '<ScrollWheelDown> ',
|
|
||||||
ScrollWheelUp = '<ScrollWheelUp> ',
|
|
||||||
NL = '<NL> ',
|
|
||||||
BS = '<BS> ',
|
|
||||||
Space = '<Space> ',
|
|
||||||
Tab = '<Tab> ',
|
|
||||||
F1 = '<F1>',
|
|
||||||
F2 = '<F2>',
|
|
||||||
F3 = '<F3>',
|
|
||||||
F4 = '<F4>',
|
|
||||||
F5 = '<F5>',
|
|
||||||
F6 = '<F6>',
|
|
||||||
F7 = '<F7>',
|
|
||||||
F8 = '<F8>',
|
|
||||||
F9 = '<F9>',
|
|
||||||
F10 = '<F10>',
|
|
||||||
F11 = '<F11>',
|
|
||||||
F12 = '<F12>',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Document existing key chains
|
-- Document existing key chains
|
||||||
spec = {
|
spec = {
|
||||||
|
|
@ -382,9 +333,7 @@ require('lazy').setup({
|
||||||
|
|
||||||
-- `cond` is a condition used to determine whether this plugin should be
|
-- `cond` is a condition used to determine whether this plugin should be
|
||||||
-- installed and loaded.
|
-- installed and loaded.
|
||||||
cond = function()
|
cond = function() return vim.fn.executable 'make' == 1 end,
|
||||||
return vim.fn.executable 'make' == 1
|
|
||||||
end,
|
|
||||||
},
|
},
|
||||||
{ 'nvim-telescope/telescope-ui-select.nvim' },
|
{ 'nvim-telescope/telescope-ui-select.nvim' },
|
||||||
|
|
||||||
|
|
@ -497,17 +446,20 @@ require('lazy').setup({
|
||||||
|
|
||||||
-- It's also possible to pass additional configuration options.
|
-- It's also possible to pass additional configuration options.
|
||||||
-- See `:help telescope.builtin.live_grep()` for information about particular keys
|
-- See `:help telescope.builtin.live_grep()` for information about particular keys
|
||||||
vim.keymap.set('n', '<leader>s/', function()
|
vim.keymap.set(
|
||||||
builtin.live_grep {
|
'n',
|
||||||
grep_open_files = true,
|
'<leader>s/',
|
||||||
prompt_title = 'Live Grep in Open Files',
|
function()
|
||||||
}
|
builtin.live_grep {
|
||||||
end, { desc = '[S]earch [/] in Open Files' })
|
grep_open_files = true,
|
||||||
|
prompt_title = 'Live Grep in Open Files',
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
{ desc = '[S]earch [/] in Open Files' }
|
||||||
|
)
|
||||||
|
|
||||||
-- Shortcut for searching your Neovim configuration files
|
-- Shortcut for searching your Neovim configuration files
|
||||||
vim.keymap.set('n', '<leader>sn', function()
|
vim.keymap.set('n', '<leader>sn', function() builtin.find_files { cwd = vim.fn.stdpath 'config' } end, { desc = '[S]earch [N]eovim files' })
|
||||||
builtin.find_files { cwd = vim.fn.stdpath 'config' }
|
|
||||||
end, { desc = '[S]earch [N]eovim files' })
|
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -618,9 +570,7 @@ require('lazy').setup({
|
||||||
--
|
--
|
||||||
-- This may be unwanted, since they displace some of your code
|
-- This may be unwanted, since they displace some of your code
|
||||||
if client and client:supports_method('textDocument/inlayHint', event.buf) then
|
if client and client:supports_method('textDocument/inlayHint', event.buf) then
|
||||||
map('<leader>th', function()
|
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')
|
||||||
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
|
|
||||||
end, '[T]oggle Inlay [H]ints')
|
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
@ -695,9 +645,7 @@ require('lazy').setup({
|
||||||
on_init = function(client)
|
on_init = function(client)
|
||||||
if client.workspace_folders then
|
if client.workspace_folders then
|
||||||
local path = client.workspace_folders[1].name
|
local path = client.workspace_folders[1].name
|
||||||
if path ~= vim.fn.stdpath 'config' and (vim.uv.fs_stat(path .. '/.luarc.json') or vim.uv.fs_stat(path .. '/.luarc.jsonc')) then
|
if path ~= vim.fn.stdpath 'config' and (vim.uv.fs_stat(path .. '/.luarc.json') or vim.uv.fs_stat(path .. '/.luarc.jsonc')) then return end
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, {
|
client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, {
|
||||||
|
|
@ -731,9 +679,7 @@ require('lazy').setup({
|
||||||
keys = {
|
keys = {
|
||||||
{
|
{
|
||||||
'<leader>f',
|
'<leader>f',
|
||||||
function()
|
function() require('conform').format { async = true, lsp_format = 'fallback' } end,
|
||||||
require('conform').format { async = true, lsp_format = 'fallback' }
|
|
||||||
end,
|
|
||||||
mode = '',
|
mode = '',
|
||||||
desc = '[F]ormat buffer',
|
desc = '[F]ormat buffer',
|
||||||
},
|
},
|
||||||
|
|
@ -778,9 +724,7 @@ require('lazy').setup({
|
||||||
-- Build Step is needed for regex support in snippets.
|
-- Build Step is needed for regex support in snippets.
|
||||||
-- This step is not supported in many windows environments.
|
-- This step is not supported in many windows environments.
|
||||||
-- Remove the below condition to re-enable on windows.
|
-- Remove the below condition to re-enable on windows.
|
||||||
if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then
|
if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then return end
|
||||||
return
|
|
||||||
end
|
|
||||||
return 'make install_jsregexp'
|
return 'make install_jsregexp'
|
||||||
end)(),
|
end)(),
|
||||||
dependencies = {
|
dependencies = {
|
||||||
|
|
@ -914,9 +858,7 @@ require('lazy').setup({
|
||||||
-- default behavior. For example, here we set the section for
|
-- default behavior. For example, here we set the section for
|
||||||
-- cursor location to LINE:COLUMN
|
-- cursor location to LINE:COLUMN
|
||||||
---@diagnostic disable-next-line: duplicate-set-field
|
---@diagnostic disable-next-line: duplicate-set-field
|
||||||
statusline.section_location = function()
|
statusline.section_location = function() return '%2l:%-2v' end
|
||||||
return '%2l:%-2v'
|
|
||||||
end
|
|
||||||
|
|
||||||
-- ... and there is more!
|
-- ... and there is more!
|
||||||
-- Check out: https://github.com/nvim-mini/mini.nvim
|
-- Check out: https://github.com/nvim-mini/mini.nvim
|
||||||
|
|
@ -929,9 +871,7 @@ require('lazy').setup({
|
||||||
require('nvim-treesitter').install(filetypes)
|
require('nvim-treesitter').install(filetypes)
|
||||||
vim.api.nvim_create_autocmd('FileType', {
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
pattern = filetypes,
|
pattern = filetypes,
|
||||||
callback = function()
|
callback = function() vim.treesitter.start() end,
|
||||||
vim.treesitter.start()
|
|
||||||
end,
|
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -28,52 +28,38 @@ return {
|
||||||
-- Basic debugging keymaps, feel free to change to your liking!
|
-- Basic debugging keymaps, feel free to change to your liking!
|
||||||
{
|
{
|
||||||
'<F5>',
|
'<F5>',
|
||||||
function()
|
function() require('dap').continue() end,
|
||||||
require('dap').continue()
|
|
||||||
end,
|
|
||||||
desc = 'Debug: Start/Continue',
|
desc = 'Debug: Start/Continue',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'<F1>',
|
'<F1>',
|
||||||
function()
|
function() require('dap').step_into() end,
|
||||||
require('dap').step_into()
|
|
||||||
end,
|
|
||||||
desc = 'Debug: Step Into',
|
desc = 'Debug: Step Into',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'<F2>',
|
'<F2>',
|
||||||
function()
|
function() require('dap').step_over() end,
|
||||||
require('dap').step_over()
|
|
||||||
end,
|
|
||||||
desc = 'Debug: Step Over',
|
desc = 'Debug: Step Over',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'<F3>',
|
'<F3>',
|
||||||
function()
|
function() require('dap').step_out() end,
|
||||||
require('dap').step_out()
|
|
||||||
end,
|
|
||||||
desc = 'Debug: Step Out',
|
desc = 'Debug: Step Out',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'<leader>b',
|
'<leader>b',
|
||||||
function()
|
function() require('dap').toggle_breakpoint() end,
|
||||||
require('dap').toggle_breakpoint()
|
|
||||||
end,
|
|
||||||
desc = 'Debug: Toggle Breakpoint',
|
desc = 'Debug: Toggle Breakpoint',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'<leader>B',
|
'<leader>B',
|
||||||
function()
|
function() require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ') end,
|
||||||
require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ')
|
|
||||||
end,
|
|
||||||
desc = 'Debug: Set Breakpoint',
|
desc = 'Debug: Set Breakpoint',
|
||||||
},
|
},
|
||||||
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
|
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
|
||||||
{
|
{
|
||||||
'<F7>',
|
'<F7>',
|
||||||
function()
|
function() require('dapui').toggle() end,
|
||||||
require('dapui').toggle()
|
|
||||||
end,
|
|
||||||
desc = 'Debug: See last session result.',
|
desc = 'Debug: See last session result.',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -34,12 +34,8 @@ return {
|
||||||
|
|
||||||
-- Actions
|
-- Actions
|
||||||
-- visual mode
|
-- visual mode
|
||||||
map('v', '<leader>hs', function()
|
map('v', '<leader>hs', function() gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } end, { desc = 'git [s]tage hunk' })
|
||||||
gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
map('v', '<leader>hr', function() gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } end, { desc = 'git [r]eset hunk' })
|
||||||
end, { desc = 'git [s]tage hunk' })
|
|
||||||
map('v', '<leader>hr', function()
|
|
||||||
gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
|
||||||
end, { desc = 'git [r]eset hunk' })
|
|
||||||
-- normal mode
|
-- normal mode
|
||||||
map('n', '<leader>hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' })
|
map('n', '<leader>hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' })
|
||||||
map('n', '<leader>hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' })
|
map('n', '<leader>hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' })
|
||||||
|
|
@ -49,9 +45,7 @@ return {
|
||||||
map('n', '<leader>hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' })
|
map('n', '<leader>hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' })
|
||||||
map('n', '<leader>hb', gitsigns.blame_line, { desc = 'git [b]lame line' })
|
map('n', '<leader>hb', gitsigns.blame_line, { desc = 'git [b]lame line' })
|
||||||
map('n', '<leader>hd', gitsigns.diffthis, { desc = 'git [d]iff against index' })
|
map('n', '<leader>hd', gitsigns.diffthis, { desc = 'git [d]iff against index' })
|
||||||
map('n', '<leader>hD', function()
|
map('n', '<leader>hD', function() gitsigns.diffthis '@' end, { desc = 'git [D]iff against last commit' })
|
||||||
gitsigns.diffthis '@'
|
|
||||||
end, { desc = 'git [D]iff against last commit' })
|
|
||||||
-- Toggles
|
-- Toggles
|
||||||
map('n', '<leader>tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' })
|
map('n', '<leader>tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' })
|
||||||
map('n', '<leader>tD', gitsigns.preview_hunk_inline, { desc = '[T]oggle git show [D]eleted' })
|
map('n', '<leader>tD', gitsigns.preview_hunk_inline, { desc = '[T]oggle git show [D]eleted' })
|
||||||
|
|
|
||||||
|
|
@ -50,9 +50,7 @@ return {
|
||||||
-- Only run the linter in buffers that you can modify in order to
|
-- Only run the linter in buffers that you can modify in order to
|
||||||
-- avoid superfluous noise, notably within the handy LSP pop-ups that
|
-- avoid superfluous noise, notably within the handy LSP pop-ups that
|
||||||
-- describe the hovered symbol using Markdown.
|
-- describe the hovered symbol using Markdown.
|
||||||
if vim.bo.modifiable then
|
if vim.bo.modifiable then lint.try_lint() end
|
||||||
lint.try_lint()
|
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue