fix: restore lazy.nvim init.lua and apply stylua
Merge spliced upstream vim.pack rewrite into lazy.nvim config, breaking init.lua parse. Restore branch version, reformat all lua to satisfy stylua --check.
This commit is contained in:
parent
c1c53aa117
commit
e7c217a876
|
|
@ -1,13 +1,13 @@
|
|||
-- Bootstrap lazy.nvim
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
|
||||
local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo({
|
||||
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||
{ out, "WarningMsg" },
|
||||
{ "\nPress any key to exit..." },
|
||||
{ 'Failed to clone lazy.nvim:\n', 'ErrorMsg' },
|
||||
{ out, 'WarningMsg' },
|
||||
{ '\nPress any key to exit...' },
|
||||
}, true, {})
|
||||
vim.fn.getchar()
|
||||
os.exit(1)
|
||||
|
|
@ -18,18 +18,18 @@ vim.opt.rtp:prepend(lazypath)
|
|||
-- Make sure to setup `mapleader` and `maplocalleader` before
|
||||
-- loading lazy.nvim so that mappings are correct.
|
||||
-- This is also a good place to setup other settings (vim.opt)
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = "\\"
|
||||
vim.g.mapleader = ' '
|
||||
vim.g.maplocalleader = '\\'
|
||||
|
||||
-- Setup lazy.nvim
|
||||
require("lazy").setup({
|
||||
require('lazy').setup {
|
||||
spec = {
|
||||
-- import your plugins
|
||||
{ import = "plugins" },
|
||||
{ import = 'plugins' },
|
||||
},
|
||||
-- Configure any other settings here. See the documentation for more details.
|
||||
-- colorscheme that will be used when installing plugins.
|
||||
install = { colorscheme = { "habamax" } },
|
||||
install = { colorscheme = { 'habamax' } },
|
||||
-- automatically check for plugin updates
|
||||
checker = { enabled = true },
|
||||
})
|
||||
}
|
||||
|
|
|
|||
398
init.lua
398
init.lua
|
|
@ -85,7 +85,7 @@ P.S. You can delete this when you're done too. It's your config now! :)
|
|||
--]]
|
||||
|
||||
-- ============================================================
|
||||
-- SECTION 1: OPTIONS
|
||||
-- SECTION 1: FOUNDATION
|
||||
-- Core Neovim settings, leaders, options, basic keymaps, basic autocmds
|
||||
-- ============================================================
|
||||
do
|
||||
|
|
@ -171,13 +171,7 @@ do
|
|||
-- instead raise a dialog asking if you wish to save the current file(s)
|
||||
-- See `:help 'confirm'`
|
||||
vim.o.confirm = true
|
||||
end
|
||||
|
||||
-- ============================================================
|
||||
-- SECTION 2: KEYMAPS
|
||||
-- basic keymaps
|
||||
-- ============================================================
|
||||
do
|
||||
-- [[ Basic Keymaps ]]
|
||||
-- See `:help vim.keymap.set()`
|
||||
|
||||
|
|
@ -259,12 +253,16 @@ end
|
|||
-- ============================================================
|
||||
|
||||
-- Bootstrap lazy.nvim
|
||||
local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
|
||||
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
local out = vim.fn.system({
|
||||
'git', 'clone', '--filter=blob:none', '--branch=stable',
|
||||
'https://github.com/folke/lazy.nvim.git', lazypath,
|
||||
})
|
||||
local out = vim.fn.system {
|
||||
'git',
|
||||
'clone',
|
||||
'--filter=blob:none',
|
||||
'--branch=stable',
|
||||
'https://github.com/folke/lazy.nvim.git',
|
||||
lazypath,
|
||||
}
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo({ { 'Failed to clone lazy.nvim:\n', 'ErrorMsg' }, { out, 'WarningMsg' }, { '\nPress any key to exit...' } }, true, {})
|
||||
vim.fn.getchar()
|
||||
|
|
@ -273,7 +271,7 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
|||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require('lazy').setup({
|
||||
require('lazy').setup {
|
||||
spec = {
|
||||
-- ============================================================
|
||||
-- SECTION 3: UI / CORE UX PLUGINS
|
||||
|
|
@ -284,45 +282,6 @@ require('lazy').setup({
|
|||
{
|
||||
'nvim-tree/nvim-web-devicons',
|
||||
cond = vim.g.have_nerd_font,
|
||||
---Because most plugins are hosted on GitHub, you can use the helper
|
||||
---function to have less repetition in the following sections.
|
||||
---@param repo string
|
||||
---@return string
|
||||
local function gh(repo) return 'https://github.com/' .. repo end
|
||||
|
||||
-- ============================================================
|
||||
-- SECTION 4: UI / CORE UX PLUGINS
|
||||
-- guess-indent, gitsigns, which-key, colorscheme, todo-comments, mini modules
|
||||
-- ============================================================
|
||||
do
|
||||
-- [[ Installing and Configuring Plugins ]]
|
||||
--
|
||||
-- To install a plugin simply call `vim.pack.add` with its git url.
|
||||
-- This will download the default branch of the plugin, which will usually be `main` or `master`
|
||||
-- You can also have more advanced specs, which we will talk about later.
|
||||
--
|
||||
-- For most plugins its not enough to install them, you also need to call their `.setup()` to start them.
|
||||
--
|
||||
-- For example, lets say we want to install `guess-indent.nvim` - a plugin for
|
||||
-- automatically detecting and setting the indentation.
|
||||
--
|
||||
-- We first install it from https://github.com/NMAC427/guess-indent.nvim
|
||||
-- and then call its `setup()` function to start it with default settings.
|
||||
vim.pack.add { gh 'NMAC427/guess-indent.nvim' }
|
||||
require('guess-indent').setup {}
|
||||
|
||||
-- Here is a more advanced configuration example that passes options to `gitsigns.nvim`
|
||||
--
|
||||
-- See `:help gitsigns` to understand what each configuration key does.
|
||||
-- Adds git related signs to the gutter, as well as utilities for managing changes
|
||||
vim.pack.add { gh 'lewis6991/gitsigns.nvim' }
|
||||
require('gitsigns').setup {
|
||||
signs = {
|
||||
add = { text = '+' }, ---@diagnostic disable-line: missing-fields
|
||||
change = { text = '~' }, ---@diagnostic disable-line: missing-fields
|
||||
delete = { text = '_' }, ---@diagnostic disable-line: missing-fields
|
||||
topdelete = { text = '‾' }, ---@diagnostic disable-line: missing-fields
|
||||
changedelete = { text = '~' }, ---@diagnostic disable-line: missing-fields
|
||||
},
|
||||
|
||||
{
|
||||
|
|
@ -385,7 +344,7 @@ do
|
|||
{
|
||||
'nvim-telescope/telescope-fzf-native.nvim',
|
||||
build = 'make',
|
||||
cond = vim.fn.executable('make') == 1,
|
||||
cond = vim.fn.executable 'make' == 1,
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
|
|
@ -423,90 +382,22 @@ do
|
|||
end,
|
||||
})
|
||||
|
||||
vim.keymap.set('n', '<leader>/', function()
|
||||
builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { winblend = 10, previewer = false })
|
||||
end, { desc = '[/] Fuzzily search in current buffer' })
|
||||
-- If a nerd font is available, load the icons module for pretty icons in various plugins.
|
||||
if vim.g.have_nerd_font then
|
||||
require('mini.icons').setup()
|
||||
-- Used for backwards compatibility with plugins that require `nvim-web-devicons` (e.g. telescope.nvim)
|
||||
MiniIcons.mock_nvim_web_devicons()
|
||||
end
|
||||
vim.keymap.set(
|
||||
'n',
|
||||
'<leader>/',
|
||||
function() builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { winblend = 10, previewer = false }) end,
|
||||
{ desc = '[/] Fuzzily search in current buffer' }
|
||||
)
|
||||
|
||||
-- Better Around/Inside textobjects
|
||||
--
|
||||
-- Examples:
|
||||
-- - va) - [V]isually select [A]round [)]paren
|
||||
-- - yiiq - [Y]ank [I]nside [I]+1 [Q]uote
|
||||
-- - ci' - [C]hange [I]nside [']quote
|
||||
require('mini.ai').setup {
|
||||
-- NOTE: Avoid conflicts with the built-in incremental selection mappings on Neovim>=0.12 (see `:help treesitter-incremental-selection`)
|
||||
mappings = {
|
||||
around_next = 'aa',
|
||||
inside_next = 'ii',
|
||||
},
|
||||
n_lines = 500,
|
||||
}
|
||||
|
||||
vim.keymap.set('n', '<leader>s/', function()
|
||||
builtin.live_grep { grep_open_files = true, prompt_title = 'Live Grep in Open Files' }
|
||||
end, { desc = '[S]earch [/] in Open Files' })
|
||||
vim.keymap.set(
|
||||
'n',
|
||||
'<leader>s/',
|
||||
function() builtin.live_grep { grep_open_files = true, prompt_title = 'Live Grep in Open Files' } end,
|
||||
{ desc = '[S]earch [/] in Open Files' }
|
||||
)
|
||||
|
||||
vim.keymap.set('n', '<leader>sn', function() builtin.find_files { cwd = vim.fn.stdpath 'config' } end, { desc = '[S]earch [N]eovim files' })
|
||||
end,
|
||||
-- ============================================================
|
||||
-- SECTION 5: SEARCH & NAVIGATION
|
||||
-- Telescope setup, keymaps, LSP picker mappings
|
||||
-- ============================================================
|
||||
do
|
||||
-- [[ Fuzzy Finder (files, lsp, etc) ]]
|
||||
--
|
||||
-- Telescope is a fuzzy finder that comes with a lot of different things that
|
||||
-- it can fuzzy find! It's more than just a "file finder", it can search
|
||||
-- many different aspects of Neovim, your workspace, LSP, and more!
|
||||
--
|
||||
-- There are lots of other alternative pickers (like snacks.picker, or fzf-lua)
|
||||
-- so feel free to experiment and see what you like!
|
||||
--
|
||||
-- The easiest way to use Telescope, is to start by doing something like:
|
||||
-- :Telescope help_tags
|
||||
--
|
||||
-- After running this command, a window will open up and you're able to
|
||||
-- type in the prompt window. You'll see a list of `help_tags` options and
|
||||
-- a corresponding preview of the help.
|
||||
--
|
||||
-- Two important keymaps to use while in Telescope are:
|
||||
-- - Insert mode: <c-/>
|
||||
-- - Normal mode: ?
|
||||
--
|
||||
-- This opens a window that shows you all of the keymaps for the current
|
||||
-- Telescope picker. This is really useful to discover what Telescope can
|
||||
-- do as well as how to actually do it!
|
||||
|
||||
---@type (string|vim.pack.Spec)[]
|
||||
local telescope_plugins = {
|
||||
gh 'nvim-lua/plenary.nvim',
|
||||
gh 'nvim-telescope/telescope.nvim',
|
||||
gh 'nvim-telescope/telescope-ui-select.nvim',
|
||||
}
|
||||
if vim.fn.executable 'make' == 1 then table.insert(telescope_plugins, gh 'nvim-telescope/telescope-fzf-native.nvim') end
|
||||
|
||||
-- NOTE: You can install multiple plugins at once
|
||||
vim.pack.add(telescope_plugins)
|
||||
|
||||
-- See `:help telescope` and `:help telescope.setup()`
|
||||
require('telescope').setup {
|
||||
-- You can put your default mappings / updates / etc. in here
|
||||
-- All the info you're looking for is in `:help telescope.setup()`
|
||||
--
|
||||
-- defaults = {
|
||||
-- mappings = {
|
||||
-- i = { ['<c-enter>'] = 'to_fuzzy_refine' },
|
||||
-- },
|
||||
-- },
|
||||
-- pickers = {}
|
||||
extensions = {
|
||||
['ui-select'] = { require('telescope.themes').get_dropdown() },
|
||||
},
|
||||
|
||||
-- ============================================================
|
||||
|
|
@ -561,109 +452,6 @@ do
|
|||
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,
|
||||
-- Override default behavior and theme when searching
|
||||
vim.keymap.set('n', '<leader>/', function()
|
||||
-- You can pass additional configuration to Telescope to change the theme, layout, etc.
|
||||
builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
||||
winblend = 10,
|
||||
previewer = false,
|
||||
})
|
||||
end, { desc = '[/] Fuzzily search in current buffer' })
|
||||
|
||||
-- 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>s/',
|
||||
function()
|
||||
builtin.live_grep {
|
||||
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
|
||||
vim.keymap.set('n', '<leader>sn', function() builtin.find_files { cwd = vim.fn.stdpath 'config', follow = true } end, { desc = '[S]earch [N]eovim files' })
|
||||
end
|
||||
|
||||
-- ============================================================
|
||||
-- SECTION 6: LSP
|
||||
-- LSP keymaps, server configuration, Mason tools installations
|
||||
-- ============================================================
|
||||
do
|
||||
-- [[ LSP Configuration ]]
|
||||
-- Brief aside: **What is LSP?**
|
||||
--
|
||||
-- LSP is an initialism you've probably heard, but might not understand what it is.
|
||||
--
|
||||
-- LSP stands for Language Server Protocol. It's a protocol that helps editors
|
||||
-- and language tooling communicate in a standardized fashion.
|
||||
--
|
||||
-- In general, you have a "server" which is some tool built to understand a particular
|
||||
-- language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc.). These Language Servers
|
||||
-- (sometimes called LSP servers, but that's kind of like ATM Machine) are standalone
|
||||
-- processes that communicate with some "client" - in this case, Neovim!
|
||||
--
|
||||
-- LSP provides Neovim with features like:
|
||||
-- - Go to definition
|
||||
-- - Find references
|
||||
-- - Autocompletion
|
||||
-- - Symbol Search
|
||||
-- - and more!
|
||||
--
|
||||
-- Thus, Language Servers are external tools that must be installed separately from
|
||||
-- Neovim. This is where `mason` and related plugins come into play.
|
||||
--
|
||||
-- If you're wondering about lsp vs treesitter, you can check out the wonderfully
|
||||
-- and elegantly composed help section, `:help lsp-vs-treesitter`
|
||||
|
||||
-- Useful status updates for LSP.
|
||||
vim.pack.add { gh 'j-hui/fidget.nvim' }
|
||||
require('fidget').setup {}
|
||||
|
||||
-- This function gets run when an LSP attaches to a particular buffer.
|
||||
-- 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 }),
|
||||
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.
|
||||
--
|
||||
-- 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 })
|
||||
end
|
||||
|
||||
-- Rename the variable under your cursor.
|
||||
-- Most Language Servers support renaming across files, etc.
|
||||
map('grn', 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('gra', vim.lsp.buf.code_action, '[G]oto Code [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('grD', 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.
|
||||
-- See `:help CursorHold` for information about when this is executed
|
||||
--
|
||||
-- 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('textDocument/documentHighlight', event.buf) then
|
||||
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,
|
||||
})
|
||||
|
||||
---@type table<string, vim.lsp.Config>
|
||||
|
|
@ -752,9 +540,7 @@ do
|
|||
require('conform').setup {
|
||||
notify_on_error = false,
|
||||
format_on_save = function(bufnr)
|
||||
if formatters_by_ft[vim.bo[bufnr].filetype] then
|
||||
return { timeout_ms = 500, lsp_format = 'fallback' }
|
||||
end
|
||||
if formatters_by_ft[vim.bo[bufnr].filetype] then return { timeout_ms = 500, lsp_format = 'fallback' } end
|
||||
return nil
|
||||
end,
|
||||
default_format_opts = {
|
||||
|
|
@ -764,38 +550,6 @@ do
|
|||
}
|
||||
vim.keymap.set({ 'n', 'v' }, '<leader>f', function() require('conform').format { async = true } end, { desc = '[F]ormat buffer' })
|
||||
end,
|
||||
-- ============================================================
|
||||
-- SECTION 7: FORMATTING
|
||||
-- conform.nvim setup and keymap
|
||||
-- ============================================================
|
||||
do
|
||||
-- [[ Formatting ]]
|
||||
vim.pack.add { gh 'stevearc/conform.nvim' }
|
||||
require('conform').setup {
|
||||
notify_on_error = false,
|
||||
format_on_save = function(bufnr)
|
||||
-- You can specify filetypes to autoformat on save here:
|
||||
local enabled_filetypes = {
|
||||
-- lua = true,
|
||||
-- python = true,
|
||||
}
|
||||
if enabled_filetypes[vim.bo[bufnr].filetype] then
|
||||
return { timeout_ms = 500 }
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end,
|
||||
default_format_opts = {
|
||||
lsp_format = 'fallback', -- Use external formatters if configured below, otherwise use LSP formatting. Set to `false` to disable LSP formatting entirely.
|
||||
},
|
||||
-- You can also specify external formatters in here.
|
||||
formatters_by_ft = {
|
||||
-- rust = { 'rustfmt' },
|
||||
-- Conform can also run multiple formatters sequentially
|
||||
-- python = { "isort", "black" },
|
||||
--
|
||||
-- You can use 'stop_after_first' to run the first available formatter from the list
|
||||
-- javascript = { "prettierd", "prettier", stop_after_first = true },
|
||||
},
|
||||
|
||||
-- ============================================================
|
||||
|
|
@ -805,60 +559,12 @@ do
|
|||
{
|
||||
'L3MON4D3/LuaSnip',
|
||||
version = '2.*',
|
||||
build = (vim.fn.has('win32') ~= 1 and vim.fn.executable('make') == 1) and 'make install_jsregexp' or nil,
|
||||
build = (vim.fn.has 'win32' ~= 1 and vim.fn.executable 'make' == 1) and 'make install_jsregexp' or nil,
|
||||
config = function()
|
||||
require('luasnip').setup {}
|
||||
-- vim.pack.add { gh 'rafamadriz/friendly-snippets' }
|
||||
-- require('luasnip.loaders.from_vscode').lazy_load()
|
||||
end,
|
||||
-- ============================================================
|
||||
-- SECTION 8: AUTOCOMPLETE & SNIPPETS
|
||||
-- blink.cmp and luasnip setup
|
||||
-- ============================================================
|
||||
do
|
||||
-- [[ Snippet Engine ]]
|
||||
|
||||
-- NOTE: You can also specify plugin using a version range for its git tag.
|
||||
-- See `:help vim.version.range()` for more info
|
||||
vim.pack.add { { src = gh 'L3MON4D3/LuaSnip', version = vim.version.range '2.*' } }
|
||||
require('luasnip').setup {}
|
||||
|
||||
-- `friendly-snippets` contains a variety of premade snippets.
|
||||
-- See the README about individual language/framework/plugin snippets:
|
||||
-- https://github.com/rafamadriz/friendly-snippets
|
||||
--
|
||||
-- vim.pack.add { gh 'rafamadriz/friendly-snippets' }
|
||||
-- require('luasnip.loaders.from_vscode').lazy_load()
|
||||
|
||||
-- [[ Autocomplete Engine ]]
|
||||
vim.pack.add { { src = gh 'saghen/blink.cmp', version = vim.version.range '1.*' } }
|
||||
require('blink.cmp').setup {
|
||||
keymap = {
|
||||
-- 'default' (recommended) for mappings similar to built-in completions
|
||||
-- <c-y> to accept ([y]es) the completion.
|
||||
-- This will auto-import if your LSP supports it.
|
||||
-- This will expand snippets if the LSP sent a snippet.
|
||||
-- 'super-tab' for tab to accept
|
||||
-- 'enter' for enter to accept
|
||||
-- 'none' for no mappings
|
||||
--
|
||||
-- For an understanding of why the 'default' preset is recommended,
|
||||
-- you will need to read `:help ins-completion`
|
||||
--
|
||||
-- No, but seriously. Please read `:help ins-completion`, it is really good!
|
||||
--
|
||||
-- All presets have the following mappings:
|
||||
-- <tab>/<s-tab>: move to right/left of your snippet expansion
|
||||
-- <c-space>: Open menu or open docs if already open
|
||||
-- <c-n>/<c-p> or <up>/<down>: Select next/previous item
|
||||
-- <c-e>: Hide menu
|
||||
-- <c-k>: Toggle signature help
|
||||
--
|
||||
-- See `:help blink-cmp-config-keymap` for defining your own keymap
|
||||
preset = 'default',
|
||||
|
||||
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
|
||||
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
|
||||
},
|
||||
|
||||
{
|
||||
|
|
@ -943,59 +649,13 @@ do
|
|||
|
||||
{ import = 'custom.plugins' },
|
||||
},
|
||||
-- ============================================================
|
||||
-- SECTION 9: TREESITTER
|
||||
-- Parser installation, syntax highlighting, folds, indentation
|
||||
-- ============================================================
|
||||
do
|
||||
-- [[ Configure Treesitter ]]
|
||||
-- Used to highlight, edit, and navigate code
|
||||
--
|
||||
-- See `:help nvim-treesitter-intro`
|
||||
|
||||
-- NOTE: You can also specify a branch or a specific commit
|
||||
vim.pack.add { { src = gh 'nvim-treesitter/nvim-treesitter', version = 'main' } }
|
||||
|
||||
-- Ensure basic parsers are installed
|
||||
local parsers = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }
|
||||
require('nvim-treesitter').install(parsers)
|
||||
|
||||
---@param buf integer
|
||||
---@param language string
|
||||
local function treesitter_try_attach(buf, language)
|
||||
-- Check if a parser exists and load it
|
||||
if not vim.treesitter.language.add(language) then return end
|
||||
-- Enable syntax highlighting and other treesitter features
|
||||
vim.treesitter.start(buf, language)
|
||||
|
||||
-- Enable treesitter based folds
|
||||
-- For more info on folds see `:help folds`
|
||||
-- vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
|
||||
-- vim.wo.foldmethod = 'expr'
|
||||
|
||||
-- Check if treesitter indentation is available for this language, and if so enable it
|
||||
-- in case there is no indent query, the indentexpr will fallback to the vim's built in one
|
||||
local has_indent_query = vim.treesitter.query.get(language, 'indents') ~= nil
|
||||
|
||||
-- Enable treesitter based indentation
|
||||
if has_indent_query then vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" end
|
||||
end
|
||||
|
||||
install = { colorscheme = { 'gruvbox-medium', 'habamax' } },
|
||||
checker = { enabled = false },
|
||||
})
|
||||
|
||||
-- Open Oil in a floating window
|
||||
vim.keymap.set("n", "<leader>of", "<CMD>Oil --float<CR>", { desc = "Open Oil float" })
|
||||
-- ============================================================
|
||||
-- SECTION 10: OPTIONAL EXAMPLES / NEXT STEPS
|
||||
-- kickstart.plugins.* examples
|
||||
-- ============================================================
|
||||
do
|
||||
-- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the
|
||||
-- init.lua. If you want these files, they are in the repository, so you can just download them and
|
||||
-- place them in the correct locations.
|
||||
}
|
||||
|
||||
-- Open Oil in a floating window
|
||||
vim.keymap.set('n', '<leader>of', '<CMD>Oil --float<CR>', { desc = 'Open Oil float' })
|
||||
|
||||
-- The line beneath this is called `modeline`. See `:help modeline`
|
||||
-- vim: ts=2 sts=2 sw=2 et
|
||||
|
|
|
|||
|
|
@ -1,24 +1,24 @@
|
|||
return {
|
||||
"coder/claudecode.nvim",
|
||||
dependencies = { "folke/snacks.nvim" },
|
||||
'coder/claudecode.nvim',
|
||||
dependencies = { 'folke/snacks.nvim' },
|
||||
config = true,
|
||||
keys = {
|
||||
{ "<leader>a", nil, desc = "AI/Claude Code" },
|
||||
{ "<leader>ac", "<cmd>ClaudeCode<cr>", desc = "Toggle Claude" },
|
||||
{ "<leader>af", "<cmd>ClaudeCodeFocus<cr>", desc = "Focus Claude" },
|
||||
{ "<leader>ar", "<cmd>ClaudeCode --resume<cr>", desc = "Resume Claude" },
|
||||
{ "<leader>aC", "<cmd>ClaudeCode --continue<cr>", desc = "Continue Claude" },
|
||||
{ "<leader>am", "<cmd>ClaudeCodeSelectModel<cr>", desc = "Select Claude model" },
|
||||
{ "<leader>ab", "<cmd>ClaudeCodeAdd %<cr>", desc = "Add current buffer" },
|
||||
{ "<leader>as", "<cmd>ClaudeCodeSend<cr>", mode = "v", desc = "Send to Claude" },
|
||||
{ '<leader>a', nil, desc = 'AI/Claude Code' },
|
||||
{ '<leader>ac', '<cmd>ClaudeCode<cr>', desc = 'Toggle Claude' },
|
||||
{ '<leader>af', '<cmd>ClaudeCodeFocus<cr>', desc = 'Focus Claude' },
|
||||
{ '<leader>ar', '<cmd>ClaudeCode --resume<cr>', desc = 'Resume Claude' },
|
||||
{ '<leader>aC', '<cmd>ClaudeCode --continue<cr>', desc = 'Continue Claude' },
|
||||
{ '<leader>am', '<cmd>ClaudeCodeSelectModel<cr>', desc = 'Select Claude model' },
|
||||
{ '<leader>ab', '<cmd>ClaudeCodeAdd %<cr>', desc = 'Add current buffer' },
|
||||
{ '<leader>as', '<cmd>ClaudeCodeSend<cr>', mode = 'v', desc = 'Send to Claude' },
|
||||
{
|
||||
"<leader>as",
|
||||
"<cmd>ClaudeCodeTreeAdd<cr>",
|
||||
desc = "Add file",
|
||||
ft = { "NvimTree", "neo-tree", "oil", "minifiles", "netrw" },
|
||||
'<leader>as',
|
||||
'<cmd>ClaudeCodeTreeAdd<cr>',
|
||||
desc = 'Add file',
|
||||
ft = { 'NvimTree', 'neo-tree', 'oil', 'minifiles', 'netrw' },
|
||||
},
|
||||
-- Diff management
|
||||
{ "<leader>aa", "<cmd>ClaudeCodeDiffAccept<cr>", desc = "Accept diff" },
|
||||
{ "<leader>ad", "<cmd>ClaudeCodeDiffDeny<cr>", desc = "Deny diff" },
|
||||
{ '<leader>aa', '<cmd>ClaudeCodeDiffAccept<cr>', desc = 'Accept diff' },
|
||||
{ '<leader>ad', '<cmd>ClaudeCodeDiffDeny<cr>', desc = 'Deny diff' },
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
return {
|
||||
"tpope/vim-fugitive",
|
||||
'tpope/vim-fugitive',
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,6 @@ vim.lsp.config('dbt', {
|
|||
root_markers = { 'dbt_project.yml' },
|
||||
settings = {},
|
||||
})
|
||||
vim.lsp.enable('dbt')
|
||||
vim.lsp.enable 'dbt'
|
||||
|
||||
return {}
|
||||
|
|
|
|||
|
|
@ -1,21 +1,19 @@
|
|||
return {
|
||||
"ErichDonGubler/lsp_lines.nvim",
|
||||
'ErichDonGubler/lsp_lines.nvim',
|
||||
config = function()
|
||||
require("lsp_lines").setup()
|
||||
require('lsp_lines').setup()
|
||||
|
||||
-- Disable default virtual text to prevent overlapping/duplicate diagnostic lines
|
||||
vim.diagnostic.config({
|
||||
vim.diagnostic.config {
|
||||
virtual_text = false,
|
||||
})
|
||||
}
|
||||
end,
|
||||
-- Keymap to toggle lsp_lines
|
||||
keys = {
|
||||
{
|
||||
"<leader>ll",
|
||||
function()
|
||||
require("lsp_lines").toggle()
|
||||
end,
|
||||
desc = "Toggle lsp_lines",
|
||||
'<leader>ll',
|
||||
function() require('lsp_lines').toggle() end,
|
||||
desc = 'Toggle lsp_lines',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,26 +1,26 @@
|
|||
return {
|
||||
{
|
||||
"benlubas/molten-nvim",
|
||||
version = "^1.0.0", -- use version <2.0.0 to avoid breaking changes
|
||||
dependencies = { "3rd/image.nvim" },
|
||||
build = ":UpdateRemotePlugins",
|
||||
'benlubas/molten-nvim',
|
||||
version = '^1.0.0', -- use version <2.0.0 to avoid breaking changes
|
||||
dependencies = { '3rd/image.nvim' },
|
||||
build = ':UpdateRemotePlugins',
|
||||
init = function()
|
||||
-- these are examples, not defaults. Please see the readme
|
||||
vim.g.molten_image_provider = "image.nvim"
|
||||
vim.g.molten_image_provider = 'image.nvim'
|
||||
vim.g.molten_output_win_max_height = 20
|
||||
end,
|
||||
},
|
||||
{
|
||||
'willothy/wezterm.nvim',
|
||||
cond = vim.fn.executable('wezterm') == 1,
|
||||
config = true
|
||||
cond = vim.fn.executable 'wezterm' == 1,
|
||||
config = true,
|
||||
},
|
||||
|
||||
{
|
||||
"3rd/image.nvim",
|
||||
'3rd/image.nvim',
|
||||
build = false, -- so that it doesn't build the rock https://github.com/3rd/image.nvim/issues/91#issuecomment-2453430239
|
||||
opts = {
|
||||
processor = "magick_cli",
|
||||
}
|
||||
}
|
||||
processor = 'magick_cli',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,12 +11,8 @@ return {
|
|||
},
|
||||
view_options = {
|
||||
show_hidden = false,
|
||||
is_hidden_file = function(name, bufnr)
|
||||
return vim.startswith(name, '.')
|
||||
end,
|
||||
is_always_hidden = function(name, bufnr)
|
||||
return false
|
||||
end,
|
||||
is_hidden_file = function(name, bufnr) return vim.startswith(name, '.') end,
|
||||
is_always_hidden = function(name, bufnr) return false end,
|
||||
natural_order = false,
|
||||
sort = {
|
||||
{ 'type', 'asc' },
|
||||
|
|
@ -25,9 +21,7 @@ return {
|
|||
},
|
||||
keymaps = {
|
||||
['<leader>th'] = {
|
||||
callback = function()
|
||||
require('oil').toggle_hidden()
|
||||
end,
|
||||
callback = function() require('oil').toggle_hidden() end,
|
||||
desc = 'Toggle hidden files',
|
||||
mode = 'n',
|
||||
},
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ return {
|
|||
priority = 1000,
|
||||
config = function()
|
||||
require('gruvbox').setup()
|
||||
vim.cmd('colorscheme gruvbox-medium')
|
||||
vim.cmd 'colorscheme gruvbox-medium'
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@ return {
|
|||
require('toggleterm').setup(opts)
|
||||
vim.keymap.set('t', '<Esc>', [[<C-\><C-n>]], { desc = 'Exit terminal mode' })
|
||||
|
||||
local lazygit = require('toggleterm.terminal').Terminal:new({
|
||||
local lazygit = require('toggleterm.terminal').Terminal:new {
|
||||
cmd = 'lazygit',
|
||||
direction = 'float',
|
||||
hidden = true,
|
||||
})
|
||||
}
|
||||
vim.keymap.set('n', '<leader>tg', function() lazygit:toggle() end, { desc = 'Toggle lazygit' })
|
||||
end,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,37 +1,37 @@
|
|||
return {
|
||||
"folke/trouble.nvim",
|
||||
'folke/trouble.nvim',
|
||||
opts = {}, -- for default options, refer to the configuration section for custom setup.
|
||||
cmd = "Trouble",
|
||||
cmd = 'Trouble',
|
||||
keys = {
|
||||
{
|
||||
"<leader>xx",
|
||||
"<cmd>Trouble diagnostics toggle<cr>",
|
||||
desc = "Diagnostics (Trouble)",
|
||||
'<leader>xx',
|
||||
'<cmd>Trouble diagnostics toggle<cr>',
|
||||
desc = 'Diagnostics (Trouble)',
|
||||
},
|
||||
{
|
||||
"<leader>xX",
|
||||
"<cmd>Trouble diagnostics toggle filter.buf=0<cr>",
|
||||
desc = "Buffer Diagnostics (Trouble)",
|
||||
'<leader>xX',
|
||||
'<cmd>Trouble diagnostics toggle filter.buf=0<cr>',
|
||||
desc = 'Buffer Diagnostics (Trouble)',
|
||||
},
|
||||
{
|
||||
"<leader>cs",
|
||||
"<cmd>Trouble symbols toggle focus=false<cr>",
|
||||
desc = "Symbols (Trouble)",
|
||||
'<leader>cs',
|
||||
'<cmd>Trouble symbols toggle focus=false<cr>',
|
||||
desc = 'Symbols (Trouble)',
|
||||
},
|
||||
{
|
||||
"<leader>cl",
|
||||
"<cmd>Trouble lsp toggle focus=false win.position=right<cr>",
|
||||
desc = "LSP Definitions / references / ... (Trouble)",
|
||||
'<leader>cl',
|
||||
'<cmd>Trouble lsp toggle focus=false win.position=right<cr>',
|
||||
desc = 'LSP Definitions / references / ... (Trouble)',
|
||||
},
|
||||
{
|
||||
"<leader>xL",
|
||||
"<cmd>Trouble loclist toggle<cr>",
|
||||
desc = "Location List (Trouble)",
|
||||
'<leader>xL',
|
||||
'<cmd>Trouble loclist toggle<cr>',
|
||||
desc = 'Location List (Trouble)',
|
||||
},
|
||||
{
|
||||
"<leader>xQ",
|
||||
"<cmd>Trouble qflist toggle<cr>",
|
||||
desc = "Quickfix List (Trouble)",
|
||||
'<leader>xQ',
|
||||
'<cmd>Trouble qflist toggle<cr>',
|
||||
desc = 'Quickfix List (Trouble)',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue