fix: styling issues
This commit is contained in:
parent
93ea6464c5
commit
5ea28f0a93
61
init.lua
61
init.lua
|
|
@ -119,9 +119,7 @@ vim.o.confirm = true -- Ask before closing (unsaved changes)
|
|||
-- Schedule the setting after `UiEnter` because it can increase startup-time.
|
||||
-- Remove this option if you want your OS clipboard to remain independent.
|
||||
-- See `:help 'clipboard'`
|
||||
vim.schedule(function()
|
||||
vim.o.clipboard = 'unnamedplus'
|
||||
end)
|
||||
vim.schedule(function() vim.o.clipboard = 'unnamedplus' end)
|
||||
|
||||
-- Don't show the mode, since it's already in the status line
|
||||
vim.o.showmode = false
|
||||
|
|
@ -169,7 +167,6 @@ vim.keymap.set('n', '^[[1;9l', '<C-w>L', { desc = 'Move window to the right' })
|
|||
vim.keymap.set('n', '^[[1;9j', '<C-w>J', { desc = 'Move window to the lower' })
|
||||
vim.keymap.set('n', '^[[1;9k', '<C-w>K', { desc = 'Move window to the upper' })
|
||||
|
||||
|
||||
vim.diagnostic.config {
|
||||
update_in_insert = false,
|
||||
severity_sort = true,
|
||||
|
|
@ -241,14 +238,10 @@ vim.keymap.set('n', '<leader>ya', function()
|
|||
end)
|
||||
|
||||
-- Delete all content of the current buffer
|
||||
vim.keymap.set('n', '<leader>da', function()
|
||||
vim.api.nvim_buf_set_lines(0, 0, -1, false, {})
|
||||
end)
|
||||
vim.keymap.set('n', '<leader>da', function() vim.api.nvim_buf_set_lines(0, 0, -1, false, {}) end)
|
||||
|
||||
-- Select all content of the current buffer
|
||||
vim.keymap.set('n', '<leader>sa', function()
|
||||
vim.api.nvim_feedkeys('ggVG', 'n', false)
|
||||
end)
|
||||
vim.keymap.set('n', '<leader>sa', function() vim.api.nvim_feedkeys('ggVG', 'n', false) end)
|
||||
|
||||
-- Basic autocommands
|
||||
local augroup = vim.api.nvim_create_augroup('UserConfig', {})
|
||||
|
|
@ -257,9 +250,7 @@ local augroup = vim.api.nvim_create_augroup('UserConfig', {})
|
|||
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||
desc = 'Highlight when yanking (copying) text',
|
||||
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
|
||||
callback = function()
|
||||
vim.hl.on_yank()
|
||||
end,
|
||||
callback = function() vim.hl.on_yank() end,
|
||||
})
|
||||
|
||||
-- Return to last edit position when opening files
|
||||
|
|
@ -268,9 +259,7 @@ vim.api.nvim_create_autocmd('BufReadPost', {
|
|||
callback = function()
|
||||
local mark = vim.api.nvim_buf_get_mark(0, '"')
|
||||
local lcount = vim.api.nvim_buf_line_count(0)
|
||||
if mark[1] > 0 and mark[1] <= lcount then
|
||||
pcall(vim.api.nvim_win_set_cursor, 0, mark)
|
||||
end
|
||||
if mark[1] > 0 and mark[1] <= lcount then pcall(vim.api.nvim_win_set_cursor, 0, mark) end
|
||||
end,
|
||||
})
|
||||
|
||||
|
|
@ -297,9 +286,7 @@ vim.api.nvim_create_autocmd('FileType', {
|
|||
vim.api.nvim_create_autocmd('TermClose', {
|
||||
group = augroup,
|
||||
callback = function()
|
||||
if vim.v.event.status == 0 then
|
||||
vim.api.nvim_buf_delete(0, {})
|
||||
end
|
||||
if vim.v.event.status == 0 then vim.api.nvim_buf_delete(0, {}) end
|
||||
end,
|
||||
})
|
||||
|
||||
|
|
@ -316,21 +303,15 @@ vim.api.nvim_create_autocmd('TermOpen', {
|
|||
-- Auto-resize splits when window is resized
|
||||
vim.api.nvim_create_autocmd('VimResized', {
|
||||
group = augroup,
|
||||
callback = function()
|
||||
vim.cmd 'tabdo wincmd ='
|
||||
end,
|
||||
callback = function() vim.cmd 'tabdo wincmd =' end,
|
||||
})
|
||||
|
||||
-- Create directories when saving files
|
||||
vim.api.nvim_create_autocmd('BufWritePre', {
|
||||
callback = function()
|
||||
local filepath = vim.fn.expand '<afile>:p:h'
|
||||
if filepath:match '^oil://' or vim.uv.fs_realpath(filepath) == nil then
|
||||
return
|
||||
end
|
||||
if vim.fn.isdirectory(filepath) == 0 then
|
||||
vim.fn.mkdir(filepath, 'p')
|
||||
end
|
||||
if filepath:match '^oil://' or vim.uv.fs_realpath(filepath) == nil then return end
|
||||
if vim.fn.isdirectory(filepath) == 0 then vim.fn.mkdir(filepath, 'p') end
|
||||
end,
|
||||
})
|
||||
|
||||
|
|
@ -348,9 +329,7 @@ vim.opt.maxmempattern = 20000
|
|||
|
||||
-- Create undo directory if it doesn't exist
|
||||
local undodir = vim.fn.expand '~/.vim/undodir'
|
||||
if vim.fn.isdirectory(undodir) == 0 then
|
||||
vim.fn.mkdir(undodir, 'p')
|
||||
end
|
||||
if vim.fn.isdirectory(undodir) == 0 then vim.fn.mkdir(undodir, 'p') end
|
||||
|
||||
-- ============================================================================
|
||||
-- FLOATING TERMINAL
|
||||
|
|
@ -399,8 +378,7 @@ local function FloatingTerminal()
|
|||
vim.api.nvim_win_set_option(terminal_state.win, 'winblend', 0)
|
||||
|
||||
-- Set transparent background for the window
|
||||
vim.api.nvim_win_set_option(terminal_state.win, 'winhighlight',
|
||||
'Normal:FloatingTermNormal,FloatBorder:FloatingTermBorder')
|
||||
vim.api.nvim_win_set_option(terminal_state.win, 'winhighlight', 'Normal:FloatingTermNormal,FloatBorder:FloatingTermBorder')
|
||||
|
||||
-- Define highlight groups for transparency
|
||||
vim.api.nvim_set_hl(0, 'FloatingTermNormal', { bg = 'none' })
|
||||
|
|
@ -416,9 +394,7 @@ local function FloatingTerminal()
|
|||
end
|
||||
end
|
||||
|
||||
if not has_terminal then
|
||||
vim.fn.termopen(os.getenv 'SHELL')
|
||||
end
|
||||
if not has_terminal then vim.fn.termopen(os.getenv 'SHELL') end
|
||||
|
||||
terminal_state.is_open = true
|
||||
vim.cmd 'startinsert'
|
||||
|
|
@ -446,8 +422,7 @@ end
|
|||
|
||||
-- Key mappings
|
||||
vim.keymap.set('n', '<leader>tft', FloatingTerminal, { noremap = true, silent = true, desc = 'Toggle floating terminal' })
|
||||
vim.keymap.set('n', '<leader>tt', '<cmd>horizontal terminal<CR>',
|
||||
{ noremap = true, silent = true, desc = 'Toggle terminal' })
|
||||
vim.keymap.set('n', '<leader>tt', '<cmd>horizontal terminal<CR>', { noremap = true, silent = true, desc = 'Toggle terminal' })
|
||||
vim.keymap.set('t', '<Esc>', function()
|
||||
if terminal_state.is_open then
|
||||
vim.api.nvim_win_close(terminal_state.win, false)
|
||||
|
|
@ -480,9 +455,7 @@ vim.keymap.set('n', '<leader>t<', '<cmd>tabmove -1<CR>', { desc = 'Move tab left
|
|||
-- Function to open file in new tab
|
||||
local function open_file_in_tab()
|
||||
vim.ui.input({ prompt = 'File to open in new tab: ', completion = 'file' }, function(input)
|
||||
if input and input ~= '' then
|
||||
vim.cmd('tabnew ' .. input)
|
||||
end
|
||||
if input and input ~= '' then vim.cmd('tabnew ' .. input) end
|
||||
end)
|
||||
end
|
||||
|
||||
|
|
@ -555,10 +528,7 @@ do
|
|||
end
|
||||
|
||||
if name == 'LuaSnip' then
|
||||
if vim.fn.has 'win32' ~= 1 and vim.fn.executable 'make' == 1 then
|
||||
run_build(name, { 'make', 'install_jsregexp' },
|
||||
ev.data.path)
|
||||
end
|
||||
if vim.fn.has 'win32' ~= 1 and vim.fn.executable 'make' == 1 then run_build(name, { 'make', 'install_jsregexp' }, ev.data.path) end
|
||||
return
|
||||
end
|
||||
|
||||
|
|
@ -571,7 +541,6 @@ do
|
|||
})
|
||||
end
|
||||
|
||||
|
||||
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
|
||||
require 'kickstart.plugins'
|
||||
require 'custom.plugins'
|
||||
|
|
|
|||
|
|
@ -3,6 +3,6 @@ do
|
|||
vim.pack.add {
|
||||
gh 'OXY2DEV/markview.nvim',
|
||||
gh 'saghen/blink.lib',
|
||||
gh 'saghen/blink.cmp'
|
||||
gh 'saghen/blink.cmp',
|
||||
}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -14,8 +14,6 @@ do
|
|||
log_level = 'info', -- set to "off" to disable logging completely
|
||||
disable_inline_completion = false, -- disables inline completion for use with cmp
|
||||
disable_keymaps = false, -- disables built in keymaps for more manual control
|
||||
condition = function()
|
||||
return false
|
||||
end, -- condition to check for stopping supermaven, `true` means to stop supermaven when the condition is true.}
|
||||
condition = function() return false end, -- condition to check for stopping supermaven, `true` means to stop supermaven when the condition is true.}
|
||||
}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
-- Autocompletion
|
||||
local function gh(repo) return 'https://github.com/' .. repo end
|
||||
do
|
||||
vim.pack.add({ gh 'saghen/blink.lib' })
|
||||
vim.pack.add { gh 'saghen/blink.lib' }
|
||||
vim.pack.add { { src = gh 'saghen/blink.cmp', version = vim.version.range '2.*' } }
|
||||
vim.pack.add { { src = gh 'saghen/blink.cmp', version = vim.version.range '1.*' } }
|
||||
require('blink.cmp').setup {
|
||||
|
|
|
|||
|
|
@ -21,10 +21,8 @@ do
|
|||
vim.keymap.set('n', '<F1>', function() require('dap').step_into() end, { desc = 'Debug: Step Into' })
|
||||
vim.keymap.set('n', '<F2>', function() require('dap').step_over() end, { desc = 'Debug: Step Over' })
|
||||
vim.keymap.set('n', '<F3>', function() require('dap').step_out() end, { desc = 'Debug: Step Out' })
|
||||
vim.keymap.set('n', '<leader>b', function() require('dap').toggle_breakpoint() end,
|
||||
{ desc = 'Debug: Toggle Breakpoint' })
|
||||
vim.keymap.set('n', '<leader>B', function() require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ') end,
|
||||
{ desc = 'Debug: Set Breakpoint' })
|
||||
vim.keymap.set('n', '<leader>b', function() require('dap').toggle_breakpoint() end, { desc = 'Debug: Toggle Breakpoint' })
|
||||
vim.keymap.set('n', '<leader>B', function() require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ') end, { desc = 'Debug: Set Breakpoint' })
|
||||
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
|
||||
vim.keymap.set('n', '<F7>', function() require('dapui').toggle() end, { desc = 'Debug: See last session result.' })
|
||||
|
||||
|
|
|
|||
|
|
@ -48,6 +48,5 @@ do
|
|||
},
|
||||
}
|
||||
|
||||
vim.keymap.set({ 'n', 'v' }, '<leader>f', function() require('conform').format { async = true } end,
|
||||
{ desc = '[F]ormat buffer' })
|
||||
vim.keymap.set({ 'n', 'v' }, '<leader>f', function() require('conform').format { async = true } end, { desc = '[F]ormat buffer' })
|
||||
end
|
||||
|
|
|
|||
|
|
@ -35,10 +35,8 @@ do
|
|||
|
||||
-- Actions
|
||||
-- visual mode
|
||||
map('v', '<leader>gs', function() gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } end,
|
||||
{ desc = 'git [s]tage hunk' })
|
||||
map('v', '<leader>gr', function() gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } end,
|
||||
{ desc = 'git [r]eset hunk' })
|
||||
map('v', '<leader>gs', function() gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } end, { desc = 'git [s]tage hunk' })
|
||||
map('v', '<leader>gr', function() gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } end, { desc = 'git [r]eset hunk' })
|
||||
-- normal mode
|
||||
map('n', '<leader>gs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' })
|
||||
map('n', '<leader>gr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' })
|
||||
|
|
@ -49,8 +47,7 @@ do
|
|||
map('n', '<leader>gb', function() gitsigns.blame_line { full = true } end, { desc = 'git [b]lame line' })
|
||||
map('n', '<leader>gd', gitsigns.diffthis, { desc = 'git [d]iff against index' })
|
||||
map('n', '<leader>gD', function() gitsigns.diffthis '@' end, { desc = 'git [D]iff against last commit' })
|
||||
map('n', '<leader>gQ', function() gitsigns.setqflist 'all' end,
|
||||
{ desc = 'git hunk [Q]uickfix list (all files in repo)' })
|
||||
map('n', '<leader>gQ', function() gitsigns.setqflist 'all' end, { desc = 'git hunk [Q]uickfix list (all files in repo)' })
|
||||
map('n', '<leader>gq', gitsigns.setqflist, { desc = 'git hunk [q]uickfix list (all changes in this file)' })
|
||||
-- Toggles
|
||||
map('n', '<leader>tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' })
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
local function gh(repo) return 'https://github.com/' .. repo end
|
||||
do
|
||||
vim.pack.add {
|
||||
gh 'NMAC427/guess-indent.nvim' -- Detect tabstop and shiftwidth automatically
|
||||
gh 'NMAC427/guess-indent.nvim', -- Detect tabstop and shiftwidth automatically
|
||||
}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ do
|
|||
svelte = { 'eslint_d' },
|
||||
kotlin = { 'ktlint' },
|
||||
terraform = { 'tflint' },
|
||||
ruby = { "ruby" },
|
||||
ruby = { 'ruby' },
|
||||
}
|
||||
|
||||
-- Create autocommand which carries out the actual linting
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ do
|
|||
vim.pack.add { gh 'j-hui/fidget.nvim' }
|
||||
require('fidget').setup {}
|
||||
|
||||
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }),
|
||||
callback = function(event)
|
||||
|
|
@ -65,9 +64,7 @@ do
|
|||
--
|
||||
-- This may be unwanted, since they displace some of your code
|
||||
if client and client:supports_method('textDocument/inlayHint', event.buf) 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,
|
||||
})
|
||||
|
|
@ -119,7 +116,6 @@ do
|
|||
},
|
||||
},
|
||||
|
||||
|
||||
stylua = {}, -- Used to format Lua code
|
||||
|
||||
-- Special Lua Config, as recommended by neovim help docs
|
||||
|
|
@ -216,8 +212,6 @@ vim.diagnostic.config {
|
|||
},
|
||||
}
|
||||
|
||||
|
||||
|
||||
-- Globally configure all LSP floating preview popups (like hover, signature help, etc)
|
||||
local open_floating_preview = vim.lsp.util.open_floating_preview
|
||||
function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...)
|
||||
|
|
|
|||
|
|
@ -74,20 +74,14 @@ do
|
|||
}
|
||||
|
||||
local minifiles_toggle = function(dir)
|
||||
if not MiniFiles.close() then
|
||||
MiniFiles.open(dir)
|
||||
end
|
||||
if not MiniFiles.close() then MiniFiles.open(dir) end
|
||||
end
|
||||
|
||||
local open_file_in_minifiles = function()
|
||||
minifiles_toggle(vim.fn.expand '%:p')
|
||||
end
|
||||
local open_file_in_minifiles = function() minifiles_toggle(vim.fn.expand '%:p') end
|
||||
|
||||
local set_cwd = function()
|
||||
local path = (MiniFiles.get_fs_entry() or {}).path
|
||||
if path == nil then
|
||||
return vim.notify('Cursor is not on valid entry', vim.log.levels.ERROR)
|
||||
end
|
||||
if path == nil then return vim.notify('Cursor is not on valid entry', vim.log.levels.ERROR) end
|
||||
vim.fn.chdir(vim.fs.dirname(path))
|
||||
end
|
||||
|
||||
|
|
@ -95,9 +89,7 @@ do
|
|||
local yank_path = function()
|
||||
if MiniFiles.get_explorer_state().target_window ~= nil then
|
||||
local path = (MiniFiles.get_fs_entry() or {}).path
|
||||
if path == nil then
|
||||
vim.notify('Cursor is not on valid entry', vim.log.levels.ERROR)
|
||||
end
|
||||
if path == nil then vim.notify('Cursor is not on valid entry', vim.log.levels.ERROR) end
|
||||
vim.fn.setreg(vim.v.register, path)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ do
|
|||
vim.pack.add { { src = gh 'L3MON4D3/LuaSnip', version = vim.version.range '2.*' } }
|
||||
vim.pack.add { gh 'rafamadriz/friendly-snippets' }
|
||||
require('luasnip.loaders.from_vscode').lazy_load()
|
||||
local ls = require('luasnip')
|
||||
local ls = require 'luasnip'
|
||||
ls.setup {
|
||||
history = false,
|
||||
updateevents = 'TextChanged,TextChangedI',
|
||||
|
|
@ -14,20 +14,14 @@ do
|
|||
end
|
||||
|
||||
vim.keymap.set({ 'i', 's' }, '<c-k>', function()
|
||||
if ls.expand_or_jumpable() then
|
||||
ls.expand_or_jump()
|
||||
end
|
||||
if ls.expand_or_jumpable() then ls.expand_or_jump() end
|
||||
end, { silent = true })
|
||||
|
||||
vim.keymap.set({ 'i', 's' }, '<c-j>', function()
|
||||
if ls.jumpable(-1) then
|
||||
ls.jump(-1)
|
||||
end
|
||||
if ls.jumpable(-1) then ls.jump(-1) end
|
||||
end, { silent = true })
|
||||
|
||||
vim.keymap.set({ 'i', 's' }, '<c-l>', function()
|
||||
if ls.jumpable(1) then
|
||||
ls.jump(1)
|
||||
end
|
||||
if ls.jumpable(1) then ls.jump(1) end
|
||||
end, { silent = true })
|
||||
end
|
||||
|
|
|
|||
|
|
@ -117,15 +117,18 @@ do
|
|||
|
||||
-- It's also possible to pass additional configuration options.
|
||||
-- See `:help telescope.builtin.live_grep()` for information about particular keys
|
||||
vim.keymap.set('n', '<leader>f/', function()
|
||||
vim.keymap.set(
|
||||
'n',
|
||||
'<leader>f/',
|
||||
function()
|
||||
builtin.live_grep {
|
||||
grep_open_files = true,
|
||||
prompt_title = 'Live Grep in Open Files',
|
||||
}
|
||||
end, { desc = '[F]ind [/] in Open Files' })
|
||||
end,
|
||||
{ desc = '[F]ind [/] in Open Files' }
|
||||
)
|
||||
|
||||
-- Shortcut for searching your Neovim configuration files
|
||||
vim.keymap.set('n', '<leader>fn', function()
|
||||
builtin.find_files { cwd = vim.fn.stdpath 'config' }
|
||||
end, { desc = '[F]ind [N]eovim files' })
|
||||
vim.keymap.set('n', '<leader>fn', function() builtin.find_files { cwd = vim.fn.stdpath 'config' } end, { desc = '[F]ind [N]eovim files' })
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
-- Useful plugin to show you pending keybinds.
|
||||
local function gh(repo) return 'https://github.com/' .. repo end
|
||||
do
|
||||
vim.pack.add({ gh 'folke/which-key.nvim' })
|
||||
vim.pack.add { gh 'folke/which-key.nvim' }
|
||||
require('which-key').setup {
|
||||
-- delay between pressing a key and opening which-key (milliseconds)
|
||||
-- this setting is independent of vim.o.timeoutlen
|
||||
|
|
|
|||
Loading…
Reference in New Issue