the cleaning begins
This commit is contained in:
parent
ee2cf704f2
commit
dd8482a6fb
510 changed files with 0 additions and 41801 deletions
|
@ -1 +0,0 @@
|
|||
require('config')
|
|
@ -1,27 +0,0 @@
|
|||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" },
|
||||
"auto-session": { "branch": "main", "commit": "fffb13dcbe8731b8650e5bf1caa749a485d20556" },
|
||||
"blink.cmp": { "branch": "main", "commit": "9bcb14b43852a6f2bfd5ac9ef29cb5cf09b1b39b" },
|
||||
"catppuccin": { "branch": "main", "commit": "fa42eb5e26819ef58884257d5ae95dd0552b9a66" },
|
||||
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" },
|
||||
"flutter-tools.nvim": { "branch": "main", "commit": "d4b0cb9cfcda4cb27e6b68bad20cba0be542b55b" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "88205953bd748322b49b26e1dfb0389932520dc9" },
|
||||
"harpoon": { "branch": "harpoon2", "commit": "ed1f853847ffd04b2b61c314865665e1dadf22c7" },
|
||||
"image.nvim": { "branch": "master", "commit": "c40215d7d7d1d8c823ee9a77be1a894d5c8df41b" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||
"lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "a94fc68960665e54408fe37dcf573193c4ce82c9" },
|
||||
"markview.nvim": { "branch": "main", "commit": "02810964cc288065c2919ea7a8d41e72f17ccd8a" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "bb30c422329e86fcaa4e4920181f6715d634e516" },
|
||||
"mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" },
|
||||
"mini.nvim": { "branch": "main", "commit": "94cae4660a8b2d95dbbd56e1fbc6fcfa2716d152" },
|
||||
"molten-nvim": { "branch": "main", "commit": "a286aa914d9a154bc359131aab788b5a077a5a99" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "99d3a0f26bfe402f45257c1398287aef252cbe2d" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
||||
"snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" },
|
||||
"todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" },
|
||||
"vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" }
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
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.highlight.on_yank()
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd('User', {
|
||||
pattern = 'MiniFilesActionRename',
|
||||
callback = function(event)
|
||||
require('snacks').rename.on_rename_file(event.data.from, event.data.to)
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "man",
|
||||
callback = function()
|
||||
vim.keymap.del("n", "k", { buffer = true })
|
||||
vim.keymap.del("n", "j", { buffer = true })
|
||||
end,
|
||||
})
|
|
@ -1,4 +0,0 @@
|
|||
require('config.options')
|
||||
require('config.plugins')
|
||||
require('config.autocmds')
|
||||
require('config.keymaps')
|
|
@ -1,217 +0,0 @@
|
|||
-- INFO: General --
|
||||
|
||||
-- hjkl to ijkl remap
|
||||
vim.keymap.set({ 'n', 'v', 'o' }, 'j', 'h', { desc = 'hjkl to ijkl' })
|
||||
vim.keymap.set({ 'n', 'v', 'o' }, 'h', 'i', { desc = 'hjkl to ijkl' })
|
||||
vim.keymap.set({ 'n', 'v', 'o' }, 'i', 'k', { desc = 'hjkl to ijkl' })
|
||||
vim.keymap.set({ 'n', 'v', 'o' }, 'k', 'j', { desc = 'hjkl to ijkl' })
|
||||
|
||||
-- indentation
|
||||
vim.keymap.set('n', '<Tab>', '>>', { desc = 'tab indent ' })
|
||||
vim.keymap.set('n', '<S-Tab>', '<<', { desc = 'S-tab unindent ' })
|
||||
vim.keymap.set({ 'v', 'o' }, '<Tab>', '>', { desc = 'tab indent ' })
|
||||
vim.keymap.set({ 'v', 'o' }, '<S-Tab>', '<', { desc = 'S-tab unindent ' })
|
||||
|
||||
-- scrolling
|
||||
vim.keymap.set({ 'n', 'v' }, '<C-d>', '<C-d>zz', { desc = 'centered scroll' })
|
||||
vim.keymap.set({ 'n', 'v' }, '<C-u>', '<C-u>zz', { desc = 'centered scroll' })
|
||||
vim.keymap.set({ 'n', 'v' }, '<C-o>', '<C-o>zz', { desc = 'centered jump back' })
|
||||
|
||||
-- start of line
|
||||
vim.keymap.set({ 'n', 'v', 'o' }, '#', '_', { desc = '# start of line' })
|
||||
|
||||
-- save / quit
|
||||
vim.keymap.set('n', '<C-s>', ':w<CR>', { desc = 'ctrl-s save' })
|
||||
vim.keymap.set('n', '<C-w>', ':bd<CR>', { desc = 'save and close', nowait = true })
|
||||
|
||||
-- delete word in insert mode
|
||||
vim.keymap.set('i', '<C-BS>', '<C-w>', { desc = 'delete word in insert mode' })
|
||||
|
||||
|
||||
|
||||
-- INFO: Right Dock: Terminal & MiniOilFiles
|
||||
|
||||
-- INFO: ctrl m
|
||||
vim.keymap.set('n', '<F27>', '<cmd>Floaterminal<CR>', { desc = 'open terminal', nowait = true })
|
||||
vim.keymap.set('t', '<F27>', '<cmd>q<CR>', { desc = 'close terminal window' })
|
||||
|
||||
vim.keymap.set('t', '<C-n>', '<cmd>Floaterminal next<CR>', { desc = 'next terminal' })
|
||||
vim.keymap.set('t', '<C-p>', '<cmd>Floaterminal prev<CR>', { desc = 'prev terminal' })
|
||||
|
||||
-- vim.keymap.set('t', '<C-l>', '<cmd>Floaterminal 1<CR>', { desc = 'terminal 1' })
|
||||
-- vim.keymap.set('t', '<C-j>', '<cmd>Floaterminal 2<CR>', { desc = 'terminal 2' })
|
||||
-- vim.keymap.set('t', '<Down>', '<cmd>Floaterminal 3<CR>', { desc = 'terminal 3' })
|
||||
-- vim.keymap.set('t', '<Up>', '<cmd>Floaterminal 4<CR>', { desc = 'terminal 4' })
|
||||
|
||||
vim.keymap.set('t', '<C-w>', '<C-d>', { desc = 'kill terminal' })
|
||||
|
||||
vim.keymap.set('t', '<Esc>', '<C-\\><C-n>', { desc = 'normal mode in terminal' })
|
||||
|
||||
vim.keymap.set('n', '<C-e>', require('mini.files').open, { desc = 'open mini files' })
|
||||
|
||||
|
||||
-- INFO: Windows
|
||||
|
||||
-- this is weird because ctrl-i => Up & ctrl-k => Down in Kitty conf
|
||||
vim.keymap.set({ 'n', 'v', 'o' }, '<leader>ki', ':wincmd k<CR>', { desc = 'move focus between windows', silent = true })
|
||||
vim.keymap.set({ 'n', 'v', 'o' }, '<leader>kk', ':wincmd j<CR>', { desc = 'move focus between windows', silent = true })
|
||||
vim.keymap.set({ 'n', 'v', 'o' }, '<leader>kl', ':wincmd l<CR>', { desc = 'move focus between windows', silent = true })
|
||||
vim.keymap.set({ 'n', 'v', 'o' }, '<leader>kj', ':wincmd h<CR>', { desc = 'move focus between windows', silent = true })
|
||||
|
||||
-- INFO: Picker
|
||||
|
||||
local Snacks = require('snacks')
|
||||
|
||||
vim.keymap.set('n', '<leader>sf', function ()
|
||||
Snacks.picker.files({ hidden = true })
|
||||
end , { desc = 'pick files' })
|
||||
vim.keymap.set('n', '<leader>sw', Snacks.picker.grep, { desc = 'grep' })
|
||||
vim.keymap.set('n', '<leader>st', function()
|
||||
Snacks.picker.todo_comments()
|
||||
end, { desc = 'search todos' })
|
||||
vim.keymap.set('n', '<leader>sh', Snacks.picker.help, { desc = 'help' })
|
||||
|
||||
vim.keymap.set('n', '<leader>/', function()
|
||||
Snacks.picker.lines({ layout = 'select' })
|
||||
end, { desc = 'fuzzily search in current buffer' })
|
||||
|
||||
vim.keymap.set('n', '<leader>sp', '<cmd>SessionSearch<CR>', { desc = 'search sessions' })
|
||||
|
||||
|
||||
-- INFO: LSP
|
||||
|
||||
vim.keymap.set('n', 'L', vim.diagnostic.open_float, { desc = 'open floating diagnostic' })
|
||||
|
||||
-- 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)
|
||||
|
||||
local map = function(keys, func, desc, mode)
|
||||
mode = mode or 'n'
|
||||
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc, nowait = true })
|
||||
end
|
||||
|
||||
-- Rename the variable under your cursor.
|
||||
-- Most Language Servers support renaming across files, etc.
|
||||
map('<F2>', function()
|
||||
vim.api.nvim_exec_autocmds('User', { pattern = 'SnacksInputRename' })
|
||||
vim.lsp.buf.rename()
|
||||
vim.api.nvim_create_autocmd('WinClosed', {
|
||||
callback = function (args)
|
||||
vim.api.nvim_exec_autocmds('User', {
|
||||
pattern = 'SnacksInputReset'
|
||||
})
|
||||
vim.api.nvim_del_autocmd(args.id)
|
||||
end
|
||||
})
|
||||
end, '[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('ga', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' })
|
||||
|
||||
-- Find references for the word under your cursor.
|
||||
map('gr', Snacks.picker.lsp_references, '[G]oto [R]eferences')
|
||||
|
||||
-- Jump to the implementation of the word under your cursor.
|
||||
-- Useful when your language has ways of declaring types without an actual implementation.
|
||||
map('gi', Snacks.picker.lsp_implementations, '[G]oto [I]mplementation')
|
||||
|
||||
-- Jump to the definition of the word under your cursor.
|
||||
-- This is where a variable was first declared, or where a function is defined, etc.
|
||||
-- To jump back, press <C-t>.
|
||||
map('gd', Snacks.picker.lsp_definitions, '[G]oto [D]efinition')
|
||||
|
||||
-- WARN: This is not Goto Definition, this is Goto Declaration.
|
||||
-- For example, in C this would take you to the header.
|
||||
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
||||
|
||||
-- Fuzzy find all the symbols in your current document.
|
||||
-- Symbols are things like variables, functions, types, etc.
|
||||
map('go', Snacks.picker.lsp_symbols, 'Open Document Symbols')
|
||||
|
||||
-- Fuzzy find all the symbols in your current workspace.
|
||||
-- Similar to document symbols, except searches over your entire project.
|
||||
map('gO', Snacks.picker.lsp_workspace_symbols, 'Open Workspace Symbols')
|
||||
|
||||
-- Jump to the type of the word under your cursor.
|
||||
-- Useful when you're not sure what type a variable is and you want to see
|
||||
-- the definition of its *type*, not where it was *defined*.
|
||||
map('gt', Snacks.picker.lsp_type_definitions, '[G]oto [T]ype Definition')
|
||||
|
||||
-- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
|
||||
---@param client vim.lsp.Client
|
||||
---@param method vim.lsp.protocol.Method
|
||||
---@param bufnr? integer some lsp support methods only in specific files
|
||||
---@return boolean
|
||||
local function client_supports_method(client, method, bufnr)
|
||||
if vim.fn.has 'nvim-0.11' == 1 then
|
||||
return client:supports_method(method, bufnr)
|
||||
else
|
||||
return client.supports_method(method, { bufnr = bufnr })
|
||||
end
|
||||
end
|
||||
|
||||
-- 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(client, vim.lsp.protocol.Methods.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,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
|
||||
buffer = event.buf,
|
||||
group = highlight_augroup,
|
||||
callback = vim.lsp.buf.clear_references,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd('LspDetach', {
|
||||
group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }),
|
||||
callback = function(event2)
|
||||
vim.lsp.buf.clear_references()
|
||||
vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf }
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
-- The following code creates a keymap to toggle inlay hints in your
|
||||
-- code, if the language server you are using supports them
|
||||
--
|
||||
-- This may be unwanted, since they displace some of your code
|
||||
if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then
|
||||
map('<leader>ih', function()
|
||||
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
|
||||
end, '[T]oggle Inlay [H]ints')
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- INFO: Molten
|
||||
vim.keymap.set('n', '<leader>mi', ':MoltenInit<CR>', { silent = true, desc = 'Initialize the plugin' })
|
||||
vim.keymap.set('n', '<leader>mo', ':MoltenEvaluateOperator<CR>', { silent = true, desc = 'run operator selection' })
|
||||
vim.keymap.set('n', '<leader>ml', ':MoltenEvaluateLine<CR>', { silent = true, desc = 'evaluate line' })
|
||||
vim.keymap.set('v', '<leader>mv', ':<C-u>MoltenEvaluateVisual<CR>gv', { silent = false, desc = 'evaluate visual selection' })
|
||||
vim.keymap.set('n', '<leader>mc', ':MoltenReevaluateCell<CR>', { silent = false, desc = 'reevaluate cell' })
|
||||
vim.keymap.set('n', '<leader>me', ':noautocmd MoltenEnterOutput<CR>', { silent = true, desc = 'show/enter output' })
|
||||
vim.keymap.set('n', '<leader>mh', ':MoltenHideOutput<CR>', { silent = true, desc = 'hide output' })
|
||||
|
||||
|
||||
-- INFO: Flutter
|
||||
vim.keymap.set('n', '<leader>fd', '<cmd>FlutterDevices<CR>', { desc = 'show flutter devices' })
|
||||
vim.keymap.set('n', '<leader>fe', '<cmd>FlutterEmulators<CR>', { desc = 'show emulators' })
|
||||
vim.keymap.set('n', '<leader>fs', '<cmd>FlutterRun<CR>', { desc = 'flutter run' })
|
||||
vim.keymap.set('n', '<leader>fr', '<cmd>FlutterRestart<CR>', { desc = 'flutter restart' })
|
||||
vim.keymap.set('n', '<leader>fq', '<cmd>FlutterQuit<CR>', { desc = 'stop flutter' })
|
||||
vim.keymap.set('n', '<leader>fl', '<cmd>FlutterLogToggle<CR>', { desc = 'flutter log' })
|
||||
vim.keymap.set('n', '<leader>fc', '<cmd>FlutterLogClear<CR>', { desc = 'clear log' })
|
|
@ -1,51 +0,0 @@
|
|||
vim.g.mapleader = ' '
|
||||
vim.g.maplocalleader = ' '
|
||||
|
||||
vim.g.have_nerd_font = true
|
||||
|
||||
vim.opt.number = true
|
||||
vim.opt.relativenumber = true
|
||||
|
||||
vim.opt.mouse = 'a'
|
||||
|
||||
vim.opt.showmode = false
|
||||
|
||||
vim.schedule(function()
|
||||
vim.opt.clipboard = 'unnamedplus'
|
||||
end)
|
||||
|
||||
vim.opt.breakindent = true
|
||||
|
||||
-- save undo history
|
||||
vim.opt.undofile = true
|
||||
|
||||
-- Case insensitve search normally
|
||||
vim.opt.ignorecase = true
|
||||
vim.opt.smartcase = true
|
||||
|
||||
-- Configure how new splits should be opened
|
||||
vim.opt.splitright = true
|
||||
vim.opt.splitbelow = true
|
||||
|
||||
-- highlight current cursor line
|
||||
vim.opt.cursorline = true
|
||||
|
||||
-- Minimal number of screen lines to keep above and below the cursor.
|
||||
vim.opt.scrolloff = 10
|
||||
|
||||
-- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`),
|
||||
-- instead raise a dialog asking if you wish to save the current file(s)
|
||||
-- See `:help 'confirm'`
|
||||
vim.opt.confirm = true
|
||||
|
||||
vim.opt.fillchars:append({ eob = ' ' })
|
||||
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.shiftwidth = 4
|
||||
|
||||
vim.opt.hlsearch = false
|
||||
vim.opt.wrap = false
|
||||
|
||||
-- Example for configring Neovim to load user-installed installed Lua rocks:
|
||||
package.path = package.path .. ';' .. vim.fn.expand('$HOME') .. '/.luarocks/share/lua/5.1/?/init.lua;'
|
||||
package.path = package.path .. ';' .. vim.fn.expand('$HOME') .. '/.luarocks/share/lua/5.1/?.lua;'
|
|
@ -1,38 +0,0 @@
|
|||
return {
|
||||
'rmagatti/auto-session',
|
||||
lazy = false,
|
||||
|
||||
---enables autocomplete for opts
|
||||
---@module 'auto-session'
|
||||
---@type AutoSession.Config
|
||||
opts = {
|
||||
suppressed_dirs = { '~/', '~/Downloads', '/' },
|
||||
pre_save_cmds = {
|
||||
function()
|
||||
local bufs = vim.api.nvim_list_bufs()
|
||||
for _, buf in ipairs(bufs) do
|
||||
if vim.bo[buf].buftype == 'terminal' then
|
||||
vim.api.nvim_buf_delete(buf, { force = true, unload = false })
|
||||
end
|
||||
end
|
||||
end
|
||||
},
|
||||
pre_restore_cmds = {
|
||||
-- might not be necessary, but save current harpoon data when we're about to restore a session
|
||||
function() require('harpoon'):sync() end,
|
||||
},
|
||||
post_restore_cmds = {
|
||||
function()
|
||||
-- vim.notify('calling harpoon sync after restore')
|
||||
local harpoon = require('harpoon')
|
||||
local hdata = require('harpoon.data')
|
||||
|
||||
-- this is the only way i found to force harpoon to reread data from the disk rather
|
||||
-- than using what's in memory
|
||||
require('harpoon').data = hdata.Data:new(harpoon.config)
|
||||
end,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
return {
|
||||
'saghen/blink.cmp',
|
||||
event = 'VimEnter',
|
||||
version = '1.*',
|
||||
dependencies = {
|
||||
{
|
||||
'L3MON4D3/LuaSnip',
|
||||
version = '2.*',
|
||||
build = (function()
|
||||
if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then
|
||||
return
|
||||
end
|
||||
return 'make install_jsregexp'
|
||||
end)(),
|
||||
dependencies = {
|
||||
-- `friendly-snippets` contains a variety of premade snippets.
|
||||
-- See the README about individual language/framework/plugin snippets:
|
||||
-- https://github.com/rafamadriz/friendly-snippets
|
||||
-- {
|
||||
-- 'rafamadriz/friendly-snippets',
|
||||
-- config = function()
|
||||
-- require('luasnip.loaders.from_vscode').lazy_load()
|
||||
-- end,
|
||||
-- },
|
||||
},
|
||||
opts = {},
|
||||
},
|
||||
'folke/lazydev.nvim',
|
||||
},
|
||||
---@module 'blink.cmp'
|
||||
---@type blink.cmp.Config
|
||||
opts = {
|
||||
keymap = {
|
||||
preset = 'default',
|
||||
|
||||
['<Tab>'] = { 'select_and_accept', 'snippet_forward', 'fallback'},
|
||||
['<S-Tab>'] = { 'snippet_backward', 'fallback'},
|
||||
['I'] = { 'scroll_documentation_up', 'fallback' },
|
||||
['K'] = { 'scroll_documentation_down', 'fallback' },
|
||||
|
||||
},
|
||||
|
||||
appearance = { nerd_font_variant = 'mono' },
|
||||
|
||||
completion = {
|
||||
-- By default, you may press `<c-space>` to show the documentation.
|
||||
-- Optionally, set `auto_show = true` to show the documentation after a delay.
|
||||
documentation = { auto_show = false, auto_show_delay_ms = 500 },
|
||||
},
|
||||
|
||||
sources = {
|
||||
default = { 'lsp', 'path', 'snippets', 'lazydev' },
|
||||
providers = {
|
||||
lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 },
|
||||
},
|
||||
},
|
||||
|
||||
snippets = { preset = 'luasnip' },
|
||||
|
||||
-- Blink.cmp includes an optional, recommended rust fuzzy matcher,
|
||||
-- which automatically downloads a prebuilt binary when enabled.
|
||||
--
|
||||
-- By default, we use the Lua implementation instead, but you may enable
|
||||
-- the rust implementation via `'prefer_rust_with_warning'`
|
||||
--
|
||||
-- See :h blink-cmp-config-fuzzy for more information
|
||||
fuzzy = { implementation = 'lua' },
|
||||
|
||||
-- Shows a signature help window while you type arguments for a function
|
||||
signature = { enabled = true },
|
||||
},
|
||||
}
|
|
@ -1,154 +0,0 @@
|
|||
return {
|
||||
{
|
||||
'lewis6991/gitsigns.nvim',
|
||||
opts = {
|
||||
signs = {
|
||||
add = { text = '┃' },
|
||||
change = { text = '┃' },
|
||||
delete = { text = '_' },
|
||||
topdelete = { text = '‾' },
|
||||
changedelete = { text = '~' },
|
||||
untracked = { text = '┆' },
|
||||
},
|
||||
signs_staged = {
|
||||
add = { text = '┃' },
|
||||
change = { text = '┃' },
|
||||
delete = { text = '_' },
|
||||
topdelete = { text = '‾' },
|
||||
changedelete = { text = '~' },
|
||||
untracked = { text = '┆' },
|
||||
},
|
||||
signs_staged_enable = true,
|
||||
signcolumn = true,
|
||||
|
||||
on_attach = function()
|
||||
local gitsigns = require('gitsigns')
|
||||
|
||||
vim.keymap.set('n', '<leader>gs', gitsigns.stage_hunk, { desc = 'stage hunk' })
|
||||
vim.keymap.set('n', '<leader>gr', gitsigns.reset_hunk, { desc = 'restore hunk' })
|
||||
|
||||
vim.keymap.set('n', '<leader>gS', gitsigns.stage_buffer, { desc = 'stage buffer' })
|
||||
vim.keymap.set('n', '<leader>gR', gitsigns.stage_hunk, { desc = 'reset buffer' })
|
||||
|
||||
vim.keymap.set('n', '<leader>gp', gitsigns.preview_hunk, { desc = 'preview hunk' })
|
||||
vim.keymap.set('n', '<leader>gb', gitsigns.blame_line, { desc = 'blame line' })
|
||||
|
||||
|
||||
end
|
||||
},
|
||||
},
|
||||
{
|
||||
'sindrets/diffview.nvim',
|
||||
config = function ()
|
||||
local actions = require('diffview.config').actions
|
||||
require('diffview').setup({
|
||||
keymaps = {
|
||||
disable_defaults = true,
|
||||
file_panel = {
|
||||
['i'] = '<Up>',
|
||||
['k'] = '<Down>',
|
||||
['j'] = false,
|
||||
|
||||
['<Space>'] = function () actions.toggle_stage_entry() end
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
end
|
||||
},
|
||||
-- {
|
||||
-- 'NeogitOrg/neogit',
|
||||
-- dependencies = {
|
||||
-- 'nvim-lua/plenary.nvim',
|
||||
-- 'nvim-telescope/telescope.nvim',
|
||||
-- },
|
||||
-- config = function()
|
||||
-- require('neogit').setup({
|
||||
--
|
||||
-- kind = 'floating',
|
||||
-- graph_style = 'kitty',
|
||||
-- disable_line_numbers = false,
|
||||
-- disable_relative_line_numbers = false,
|
||||
-- commit_editor = {
|
||||
-- kind = 'floating',
|
||||
-- },
|
||||
-- commit_select_view = {
|
||||
-- kind = 'floating',
|
||||
-- },
|
||||
-- commit_view = {
|
||||
-- kind = 'floating',
|
||||
-- verify_commit = vim.fn.executable('gpg') == 1, -- Can be set to true or false, otherwise we try to find the binary
|
||||
-- },
|
||||
-- log_view = {
|
||||
-- kind = 'floating',
|
||||
-- },
|
||||
-- rebase_editor = {
|
||||
-- kind = 'floating',
|
||||
-- },
|
||||
-- reflog_view = {
|
||||
-- kind = 'floating',
|
||||
-- },
|
||||
-- merge_editor = {
|
||||
-- kind = 'floating',
|
||||
-- },
|
||||
-- description_editor = {
|
||||
-- kind = 'floating',
|
||||
-- },
|
||||
-- tag_editor = {
|
||||
-- kind = 'floating',
|
||||
-- },
|
||||
-- preview_buffer = {
|
||||
-- kind = 'floating',
|
||||
-- },
|
||||
-- popup = {
|
||||
-- kind = 'floating',
|
||||
-- },
|
||||
-- stash = {
|
||||
-- kind = 'floating',
|
||||
-- },
|
||||
-- refs_view = {
|
||||
-- kind = 'floating',
|
||||
-- },
|
||||
-- mappings = {
|
||||
-- status = {
|
||||
-- ['i'] = 'MoveUp',
|
||||
-- ['k'] = 'MoveDown',
|
||||
-- ['j'] = false,
|
||||
-- },
|
||||
-- }
|
||||
-- })
|
||||
-- vim.keymap.set('n', '<leader>gg', '<cmd>Neogit<CR>', { desc = 'open neogit '})
|
||||
-- end
|
||||
-- }
|
||||
-- {
|
||||
-- 'tpope/vim-fugitive',
|
||||
-- }
|
||||
-- {
|
||||
-- 'sindrets/diffview.nvim',
|
||||
-- dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||
-- -- lazy, only load diffview by these commands
|
||||
-- cmd = {
|
||||
-- 'DiffviewFileHistory', 'DiffviewOpen', 'DiffviewToggleFiles', 'DiffviewFocusFiles', 'DiffviewRefresh'
|
||||
-- }
|
||||
-- },
|
||||
-- {
|
||||
-- 'SuperBo/fugit2.nvim',
|
||||
-- build = false,
|
||||
-- opts = {
|
||||
-- width = 100,
|
||||
-- },
|
||||
-- dependencies = {
|
||||
-- 'MunifTanjim/nui.nvim',
|
||||
-- 'nvim-tree/nvim-web-devicons',
|
||||
-- 'nvim-lua/plenary.nvim',
|
||||
-- -- {
|
||||
-- -- 'chrisgrieser/nvim-tinygit', -- optional: for Github PR view
|
||||
-- -- dependencies = { 'stevearc/dressing.nvim' }
|
||||
-- -- },
|
||||
-- },
|
||||
-- cmd = { 'Fugit2', 'Fugit2Diff', 'Fugit2Graph' },
|
||||
-- keys = {
|
||||
-- { '<leader>F', mode = 'n', '<cmd>Fugit2<cr>' }
|
||||
-- }
|
||||
-- },
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
return {
|
||||
'ThePrimeagen/harpoon',
|
||||
branch = 'harpoon2',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||
config = function()
|
||||
|
||||
local harpoon = require('harpoon')
|
||||
harpoon:setup({
|
||||
settings = {
|
||||
save_on_toggle = true,
|
||||
sync_on_ui_close = true
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
vim.keymap.set('n', '<leader>a', function() harpoon:list():add() end)
|
||||
vim.keymap.set('n', '<C-h>', function() harpoon.ui:toggle_quick_menu(harpoon:list()) end)
|
||||
|
||||
vim.keymap.set('n', '<C-l>', function() harpoon:list():select(1) end)
|
||||
vim.keymap.set('n', '<C-j>', function() harpoon:list():select(2) end)
|
||||
vim.keymap.set('n', '<Down>', function() harpoon:list():select(3) end)
|
||||
vim.keymap.set('n', '<Up>', function() harpoon:list():select(4) end)
|
||||
|
||||
-- -- Toggle previous & next buffers stored within Harpoon list
|
||||
-- vim.keymap.set('n', '<C-S-P>', function() harpoon:list():prev() end)
|
||||
-- vim.keymap.set('n', '<C-S-N>', function() harpoon:list():next() end)
|
||||
|
||||
end
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
-- [[ Install `lazy.nvim` plugin manager ]]
|
||||
-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
|
||||
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 }
|
||||
if vim.v.shell_error ~= 0 then
|
||||
error('Error cloning lazy.nvim:\n' .. out)
|
||||
end
|
||||
end ---@diagnostic disable-next-line: undefined-field
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
-- local keymaps = require('config.pluginmaps')
|
||||
|
||||
require('lazy').setup({
|
||||
-- INFO: General Editing --
|
||||
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
|
||||
{ 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = {} },
|
||||
|
||||
-- TODO: i dunno about this one
|
||||
-- {
|
||||
-- 'folke/noice.nvim',
|
||||
-- event = 'VeryLazy',
|
||||
-- opts = {
|
||||
-- },
|
||||
-- dependencies = {
|
||||
-- -- if you lazy-load any plugin below, make sure to add proper `module='...'` entries
|
||||
-- 'MunifTanjim/nui.nvim',
|
||||
-- -- OPTIONAL:
|
||||
-- -- `nvim-notify` is only needed, if you want to use the notification view.
|
||||
-- -- If not available, we use `mini` as the fallback
|
||||
-- 'rcarriga/nvim-notify',
|
||||
-- }
|
||||
-- },
|
||||
|
||||
-- { 'stevearc/dressing.nvim', opts = {}, },
|
||||
|
||||
-- 'ThePrimeagen/vim-be-good',
|
||||
-- { 'vuciv/golf' },
|
||||
|
||||
require('config.plugins.git'),
|
||||
require('config.plugins.ui'),
|
||||
-- require('config.plugins.telescope'),
|
||||
require('config.plugins.blinkcmp'),
|
||||
require('config.plugins.languages.lsp'),
|
||||
require('config.plugins.languages.treesitter'),
|
||||
require('config.plugins.harpoon'),
|
||||
require('config.plugins.autosession'),
|
||||
require('config.plugins.snacks'),
|
||||
require('config.plugins.mini'),
|
||||
|
||||
require('config.plugins.languages.molten'),
|
||||
require('config.plugins.languages.flutter'),
|
||||
require('config.plugins.languages.markdown'),
|
||||
|
||||
})
|
|
@ -1,13 +0,0 @@
|
|||
return {
|
||||
'nvim-flutter/flutter-tools.nvim',
|
||||
lazy = false,
|
||||
dependencies = { 'nvim-lua/plenary.nvim', },
|
||||
config = function()
|
||||
require('flutter-tools').setup({
|
||||
fvm = true,
|
||||
dev_log = {
|
||||
open_cmd = 'FloutterLog',
|
||||
}
|
||||
})
|
||||
end,
|
||||
}
|
|
@ -1,122 +0,0 @@
|
|||
return {
|
||||
{
|
||||
-- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
|
||||
-- used for completion, annotations and signatures of Neovim apis
|
||||
'folke/lazydev.nvim',
|
||||
ft = 'lua',
|
||||
opts = {
|
||||
library = {
|
||||
-- Load luvit types when the `vim.uv` word is found
|
||||
{ path = '${3rd}/luv/library', words = { 'vim%.uv' } },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{ 'williamboman/mason.nvim', opts = {} },
|
||||
|
||||
{
|
||||
'neovim/nvim-lspconfig',
|
||||
dependencies = {
|
||||
'williamboman/mason.nvim',
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
|
||||
-- Useful status updates for LSP.
|
||||
{ 'j-hui/fidget.nvim', opts = {} },
|
||||
|
||||
'saghen/blink.cmp',
|
||||
},
|
||||
config = function()
|
||||
|
||||
vim.diagnostic.config {
|
||||
severity_sort = true,
|
||||
float = { border = 'rounded', source = 'if_many' },
|
||||
underline = { severity = vim.diagnostic.severity.ERROR },
|
||||
signs = vim.g.have_nerd_font and {
|
||||
text = {
|
||||
[vim.diagnostic.severity.ERROR] = ' ',
|
||||
[vim.diagnostic.severity.WARN] = ' ',
|
||||
[vim.diagnostic.severity.INFO] = ' ',
|
||||
},
|
||||
} or {},
|
||||
virtual_text = {
|
||||
source = 'if_many',
|
||||
spacing = 2,
|
||||
format = function(diagnostic)
|
||||
local diagnostic_message = {
|
||||
[vim.diagnostic.severity.ERROR] = diagnostic.message,
|
||||
[vim.diagnostic.severity.WARN] = diagnostic.message,
|
||||
[vim.diagnostic.severity.INFO] = diagnostic.message,
|
||||
[vim.diagnostic.severity.HINT] = diagnostic.message,
|
||||
}
|
||||
return diagnostic_message[diagnostic.severity]
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
local capabilities = require('blink.cmp').get_lsp_capabilities()
|
||||
local servers = {
|
||||
bashls = {},
|
||||
|
||||
clangd = {},
|
||||
rust_analyzer = {},
|
||||
pyright = {},
|
||||
|
||||
emmet_language_server = {},
|
||||
html = { filetypes = { 'html', 'htmldjango' }, },
|
||||
cssls = {},
|
||||
vtsls = {},
|
||||
|
||||
-- kotlin_lsp = {},
|
||||
|
||||
-- kotlin_language_server = {
|
||||
-- init_options = {
|
||||
-- storagePath = vim.fn.stdpath('cache') .. '/kotlin_language_server', -- Explicit storage path
|
||||
-- },
|
||||
-- },
|
||||
|
||||
-- -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
|
||||
--
|
||||
-- Some languages (like typescript) have entire language plugins that can be useful:
|
||||
-- https://github.com/pmizio/typescript-tools.nvim
|
||||
--
|
||||
-- But for many setups, the LSP (`ts_ls`) will work just fine
|
||||
-- ts_ls = {},
|
||||
--
|
||||
|
||||
lua_ls = {
|
||||
-- cmd = { ... },
|
||||
-- filetypes = { ... },
|
||||
-- capabilities = {},
|
||||
settings = {
|
||||
Lua = {
|
||||
completion = {
|
||||
callSnippet = 'Replace',
|
||||
},
|
||||
-- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
|
||||
-- diagnostics = { disable = { 'missing-fields' } },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
local ensure_installed = vim.tbl_keys(servers or {})
|
||||
|
||||
require('mason-lspconfig').setup {
|
||||
ensure_installed = ensure_installed,
|
||||
automatic_installation = false,
|
||||
handlers = {
|
||||
function(server_name)
|
||||
local server = servers[server_name] or {}
|
||||
-- This handles overriding only values explicitly passed
|
||||
-- by the server configuration above. Useful when disabling
|
||||
-- certain features of an LSP (for example, turning off formatting for ts_ls)
|
||||
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
|
||||
require('lspconfig')[server_name].setup(server)
|
||||
end,
|
||||
}
|
||||
}
|
||||
-- WARN: Temoraray workaround because of naming issue i.e. djlsp and django-template-server
|
||||
require('lspconfig').djlsp.setup({})
|
||||
end
|
||||
},
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
return {
|
||||
"OXY2DEV/markview.nvim",
|
||||
lazy = false,
|
||||
opts = {}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
return {
|
||||
{
|
||||
'3rd/image.nvim',
|
||||
version = '1.1.0',
|
||||
build = false, -- so that it doesn't build the rock https://github.com/3rd/image.nvim/issues/91#issuecomment-2453430239
|
||||
opts = {
|
||||
backend = 'kitty', -- whatever backend you would like to use
|
||||
max_width = 100,
|
||||
max_height = 20,
|
||||
max_height_window_percentage = math.huge,
|
||||
max_width_window_percentage = math.huge,
|
||||
window_overlap_clear_enabled = true, -- toggles images when windows are overlapped
|
||||
window_overlap_clear_ft_ignore = { 'cmp_menu', 'cmp_docs', '' },
|
||||
}
|
||||
|
||||
},
|
||||
{
|
||||
'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'
|
||||
end,
|
||||
}
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
return {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
build = ':TSUpdate',
|
||||
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
'bash',
|
||||
'c',
|
||||
'cpp',
|
||||
'diff',
|
||||
'html',
|
||||
'css',
|
||||
'lua',
|
||||
'luadoc',
|
||||
'markdown',
|
||||
'markdown_inline',
|
||||
'query',
|
||||
'vim',
|
||||
'vimdoc',
|
||||
'rust',
|
||||
'python',
|
||||
'htmldjango',
|
||||
'r',
|
||||
'dart',
|
||||
'javascript',
|
||||
'typescript',
|
||||
'tsx',
|
||||
'regex',
|
||||
'kotlin'
|
||||
},
|
||||
auto_install = false,
|
||||
highlight = { enable = true, },
|
||||
indent = { enable = true },
|
||||
},
|
||||
-- There are additional nvim-treesitter modules that you can use to interact
|
||||
-- with nvim-treesitter. You should go explore a few and see what interests you:
|
||||
--
|
||||
-- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod`
|
||||
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
|
||||
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
return {
|
||||
'echasnovski/mini.nvim',
|
||||
version = '*' ,
|
||||
config = function()
|
||||
require('mini.pairs').setup({})
|
||||
require('mini.ai').setup({
|
||||
mappings = {
|
||||
around = 'a',
|
||||
inside = 'h',
|
||||
|
||||
around_next = 'an',
|
||||
inside_next = 'hn',
|
||||
around_last = 'al',
|
||||
inside_last = 'hl',
|
||||
|
||||
goto_left = 'g[',
|
||||
goto_right = 'g]',
|
||||
},
|
||||
silent = true,
|
||||
})
|
||||
require('mini.surround').setup({
|
||||
silent = true,
|
||||
})
|
||||
require('mini.files').setup({
|
||||
mappings = {
|
||||
go_in = 'l',
|
||||
go_out = 'j',
|
||||
go_in_plus = 'L',
|
||||
go_out_plus = 'J',
|
||||
synchronize = '<C-s>'
|
||||
}
|
||||
})
|
||||
end
|
||||
}
|
|
@ -1,132 +0,0 @@
|
|||
return {
|
||||
'folke/snacks.nvim',
|
||||
priority = 1000,
|
||||
lazy = false,
|
||||
|
||||
init = function()
|
||||
local Snacks = require('snacks')
|
||||
vim.api.nvim_create_autocmd('User', {
|
||||
pattern = 'SnacksInputRename',
|
||||
callback = function ()
|
||||
Snacks.config.input.win.relative = 'cursor'
|
||||
Snacks.config.input.win.col = -1
|
||||
Snacks.config.input.win.row = -3
|
||||
Snacks.config.input.win.title_pos = 'left'
|
||||
end
|
||||
})
|
||||
vim.api.nvim_create_autocmd('User', {
|
||||
pattern = 'SnacksInputReset',
|
||||
callback = function ()
|
||||
Snacks.config.input.win.relative = 'editor'
|
||||
Snacks.config.input.win.col = nil
|
||||
Snacks.config.input.win.row = 6
|
||||
Snacks.config.input.win.title_pos = 'center'
|
||||
end
|
||||
})
|
||||
end,
|
||||
|
||||
|
||||
---@type snacks.Config
|
||||
opts = {
|
||||
-- your configuration comes here
|
||||
-- or leave it empty to use the default settings
|
||||
-- refer to the configuration section below
|
||||
bigfile = { enabled = true },
|
||||
dashboard = {
|
||||
enabled = true,
|
||||
preset = {
|
||||
header = [[
|
||||
███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗
|
||||
████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║
|
||||
██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║
|
||||
██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║
|
||||
██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║
|
||||
╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝]],
|
||||
},
|
||||
sections = {
|
||||
{ section = 'header' },
|
||||
{ section = 'startup' },
|
||||
}
|
||||
},
|
||||
|
||||
indent = {
|
||||
enabled = true,
|
||||
animate = { enabled = false },
|
||||
},
|
||||
input = {
|
||||
enabled = true,
|
||||
win = {},
|
||||
},
|
||||
quickfile = { enabled = true },
|
||||
rename = { enabled = true },
|
||||
|
||||
picker = {
|
||||
enabled = true,
|
||||
matcher = { frecency = true, },
|
||||
layout = {
|
||||
cycle = true,
|
||||
preset = 'telescope',
|
||||
},
|
||||
ui_select = true,
|
||||
win = {
|
||||
input = {
|
||||
keys = {
|
||||
['<Esc>'] = { 'close', mode = 'i' },
|
||||
['<C-s>'] = { 'edit_split', mode = 'i' },
|
||||
['<C-v>'] = { 'edit_vsplit', mode = 'i' },
|
||||
['<c-d>'] = { 'preview_scroll_down', mode = 'i' },
|
||||
['<c-u>'] = { 'preview_scroll_up', mode = 'i' },
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
layouts = {
|
||||
telescope = {
|
||||
reverse = true,
|
||||
layout = {
|
||||
box = 'horizontal',
|
||||
backdrop = false,
|
||||
width = 0.8,
|
||||
height = 0.9,
|
||||
border = 'none',
|
||||
{
|
||||
box = 'vertical',
|
||||
{ win = 'list', title = ' Results ', title_pos = 'center', border = 'rounded' },
|
||||
{ win = 'input', height = 1, border = 'rounded', title = '{title} {live} {flags}', title_pos = 'center' },
|
||||
},
|
||||
{
|
||||
win = 'preview',
|
||||
title = '{preview:Preview}',
|
||||
width = 0.55,
|
||||
border = 'rounded',
|
||||
title_pos = 'center',
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
bufdelete = { enabled = false },
|
||||
debug = { enabled = false },
|
||||
dim = { enabled = false },
|
||||
explorer = { enabled = false },
|
||||
git = { enabled = false },
|
||||
gitbrowse = { enabled = false },
|
||||
image = { enabled = false },
|
||||
layout = { enabled = false },
|
||||
lazygit = { enabled = false },
|
||||
notifier = { enabled = false },
|
||||
notify = { enabled = false },
|
||||
profiler = { enabled = false },
|
||||
scope = { enabled = false },
|
||||
scratch = { enabled = false },
|
||||
scroll = { enabled = false },
|
||||
statuscolumn = { enabled = false },
|
||||
terminal = { enabled = false },
|
||||
toggle = { enabled = false },
|
||||
win = { enabled = false },
|
||||
words = { enabled = false },
|
||||
zed = { enabled = false },
|
||||
},
|
||||
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
return {
|
||||
{
|
||||
'nvim-lualine/lualine.nvim',
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||
opts = {}
|
||||
},
|
||||
|
||||
{
|
||||
'catppuccin/nvim',
|
||||
name = 'catppuccin',
|
||||
priority = 1000,
|
||||
opts = {
|
||||
flavour = 'mocha',
|
||||
no_italic = true,
|
||||
},
|
||||
config = function()
|
||||
vim.cmd('colorscheme catppuccin')
|
||||
end
|
||||
}
|
||||
}
|
|
@ -1,777 +0,0 @@
|
|||
--[[
|
||||
|
||||
=====================================================================
|
||||
==================== READ THIS BEFORE CONTINUING ====================
|
||||
=====================================================================
|
||||
|
||||
Kickstart.nvim is *not* a distribution.
|
||||
|
||||
Kickstart.nvim is a template for your own configuration.
|
||||
The goal is that you can read every line of code, top-to-bottom, understand
|
||||
what your configuration is doing, and modify it to suit your needs.
|
||||
|
||||
Once you've done that, you should start exploring, configuring and tinkering to
|
||||
explore Neovim!
|
||||
|
||||
If you don't know anything about Lua, I recommend taking some time to read through
|
||||
a guide. One possible example:
|
||||
- https://learnxinyminutes.com/docs/lua/
|
||||
|
||||
|
||||
And then you can explore or search through `:help lua-guide`
|
||||
- https://neovim.io/doc/user/lua-guide.html
|
||||
|
||||
|
||||
Kickstart Guide:
|
||||
|
||||
I have left several `:help X` comments throughout the init.lua
|
||||
You should run that command and read that help section for more information.
|
||||
|
||||
In addition, I have some `NOTE:` items throughout the file.
|
||||
These are for you, the reader to help understand what is happening. Feel free to delete
|
||||
them once you know what you're doing, but they should serve as a guide for when you
|
||||
are first encountering a few different constructs in your nvim config.
|
||||
|
||||
I hope you enjoy your Neovim journey,
|
||||
- TJ
|
||||
|
||||
P.S. You can delete this when you're done too. It's your config now :)
|
||||
--]]
|
||||
|
||||
-- Set <space> as the leader key
|
||||
-- See `:help mapleader`
|
||||
-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used)
|
||||
vim.g.mapleader = ' '
|
||||
vim.g.maplocalleader = ' '
|
||||
|
||||
-- [[ Install `lazy.nvim` plugin manager ]]
|
||||
-- https://github.com/folke/lazy.nvim
|
||||
-- `:help lazy.nvim.txt` for more info
|
||||
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system {
|
||||
'git',
|
||||
'clone',
|
||||
'--filter=blob:none',
|
||||
'https://github.com/folke/lazy.nvim.git',
|
||||
'--branch=stable', -- latest stable release
|
||||
lazypath,
|
||||
}
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
-- [[ Configure plugins ]]
|
||||
-- NOTE: Here is where you install your plugins.
|
||||
-- You can configure plugins using the `config` key.
|
||||
--
|
||||
-- You can also configure plugins after the setup call,
|
||||
-- as they will be available in your neovim runtime.
|
||||
require('lazy').setup({
|
||||
-- NOTE: First, some plugins that don't require any configuration
|
||||
|
||||
-- Git related plugins
|
||||
'tpope/vim-fugitive',
|
||||
'tpope/vim-rhubarb',
|
||||
|
||||
-- Detect tabstop and shiftwidth automatically
|
||||
'tpope/vim-sleuth',
|
||||
|
||||
-- NOTE: This is where your plugins related to LSP can be installed.
|
||||
-- The configuration is done below. Search for lspconfig to find it below.
|
||||
{
|
||||
-- LSP Configuration & Plugins
|
||||
'neovim/nvim-lspconfig',
|
||||
dependencies = {
|
||||
-- Automatically install LSPs to stdpath for neovim
|
||||
'williamboman/mason.nvim',
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
|
||||
-- Useful status updates for LSP
|
||||
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
|
||||
{ 'j-hui/fidget.nvim', opts = {} },
|
||||
|
||||
-- Additional lua configuration, makes nvim stuff amazing!
|
||||
'folke/neodev.nvim',
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
-- Autocompletion
|
||||
'hrsh7th/nvim-cmp',
|
||||
dependencies = {
|
||||
-- Snippet Engine & its associated nvim-cmp source
|
||||
'L3MON4D3/LuaSnip',
|
||||
'saadparwaiz1/cmp_luasnip',
|
||||
|
||||
-- Adds LSP completion capabilities
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'hrsh7th/cmp-path',
|
||||
|
||||
-- Adds a number of user-friendly snippets
|
||||
'rafamadriz/friendly-snippets',
|
||||
},
|
||||
},
|
||||
|
||||
-- Useful plugin to show you pending keybinds.
|
||||
-- { 'folke/which-key.nvim', opts = {} },
|
||||
|
||||
{
|
||||
-- Adds git related signs to the gutter, as well as utilities for managing changes
|
||||
'lewis6991/gitsigns.nvim',
|
||||
opts = {
|
||||
-- See `:help gitsigns.txt`
|
||||
signs = {
|
||||
add = { text = '+' },
|
||||
change = { text = '~' },
|
||||
delete = { text = '_' },
|
||||
topdelete = { text = '‾' },
|
||||
changedelete = { text = '~' },
|
||||
},
|
||||
on_attach = function(bufnr)
|
||||
local gs = package.loaded.gitsigns
|
||||
|
||||
local function map(mode, l, r, opts)
|
||||
opts = opts or {}
|
||||
opts.buffer = bufnr
|
||||
vim.keymap.set(mode, l, r, opts)
|
||||
end
|
||||
|
||||
-- Navigation
|
||||
map({ 'n', 'v' }, ']c', function()
|
||||
if vim.wo.diff then
|
||||
return ']c'
|
||||
end
|
||||
vim.schedule(function()
|
||||
gs.next_hunk()
|
||||
end)
|
||||
return '<Ignore>'
|
||||
end, { expr = true, desc = 'Jump to next hunk' })
|
||||
|
||||
map({ 'n', 'v' }, '[c', function()
|
||||
if vim.wo.diff then
|
||||
return '[c'
|
||||
end
|
||||
vim.schedule(function()
|
||||
gs.prev_hunk()
|
||||
end)
|
||||
return '<Ignore>'
|
||||
end, { expr = true, desc = 'Jump to previous hunk' })
|
||||
|
||||
-- Actions
|
||||
-- visual mode
|
||||
map('v', '<leader>hs', function()
|
||||
gs.stage_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
||||
end, { desc = 'stage git hunk' })
|
||||
map('v', '<leader>hr', function()
|
||||
gs.reset_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
||||
end, { desc = 'reset git hunk' })
|
||||
-- normal mode
|
||||
map('n', '<leader>hs', gs.stage_hunk, { desc = 'git stage hunk' })
|
||||
map('n', '<leader>hr', gs.reset_hunk, { desc = 'git reset hunk' })
|
||||
map('n', '<leader>hS', gs.stage_buffer, { desc = 'git Stage buffer' })
|
||||
map('n', '<leader>hu', gs.undo_stage_hunk, { desc = 'undo stage hunk' })
|
||||
map('n', '<leader>hR', gs.reset_buffer, { desc = 'git Reset buffer' })
|
||||
map('n', '<leader>hp', gs.preview_hunk, { desc = 'preview git hunk' })
|
||||
map('n', '<leader>hb', function()
|
||||
gs.blame_line { full = false }
|
||||
end, { desc = 'git blame line' })
|
||||
map('n', '<leader>hd', gs.diffthis, { desc = 'git diff against index' })
|
||||
map('n', '<leader>hD', function()
|
||||
gs.diffthis '~'
|
||||
end, { desc = 'git diff against last commit' })
|
||||
|
||||
-- Toggles
|
||||
map('n', '<leader>tb', gs.toggle_current_line_blame, { desc = 'toggle git blame line' })
|
||||
map('n', '<leader>td', gs.toggle_deleted, { desc = 'toggle git show deleted' })
|
||||
|
||||
-- Text object
|
||||
map({ 'o', 'x' }, 'ih', ':<C-U>Gitsigns select_hunk<CR>', { desc = 'select git hunk' })
|
||||
end,
|
||||
},
|
||||
},
|
||||
{
|
||||
'Mofiqul/vscode.nvim',
|
||||
priority = 1000,
|
||||
config = function()
|
||||
vim.cmd.colorscheme 'vscode'
|
||||
end,
|
||||
},
|
||||
-- auto bracket closing
|
||||
{
|
||||
'm4xshen/autoclose.nvim',
|
||||
},
|
||||
-- {
|
||||
-- -- Theme inspired by Atom
|
||||
-- 'navarasu/onedark.nvim',
|
||||
-- priority = 100,
|
||||
-- config = function()
|
||||
-- vim.cmd.colorscheme 'onedark'
|
||||
-- end,
|
||||
-- },
|
||||
|
||||
{
|
||||
-- Set lualine as statusline
|
||||
'nvim-lualine/lualine.nvim',
|
||||
-- See `:help lualine.txt`
|
||||
opts = {
|
||||
options = {
|
||||
icons_enabled = false,
|
||||
theme = 'onedark',
|
||||
component_separators = '|',
|
||||
section_separators = '',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
-- Add indentation guides even on blank lines
|
||||
'lukas-reineke/indent-blankline.nvim',
|
||||
-- Enable `lukas-reineke/indent-blankline.nvim`
|
||||
-- See `:help ibl`
|
||||
main = 'ibl',
|
||||
opts = {},
|
||||
},
|
||||
|
||||
-- "gc" to comment visual regions/lines
|
||||
{ 'numToStr/Comment.nvim', opts = {} },
|
||||
|
||||
-- Fuzzy Finder (files, lsp, etc)
|
||||
{
|
||||
'nvim-telescope/telescope.nvim',
|
||||
branch = '0.1.x',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
|
||||
-- Only load if `make` is available. Make sure you have the system
|
||||
-- requirements installed.
|
||||
{
|
||||
'nvim-telescope/telescope-fzf-native.nvim',
|
||||
-- NOTE: If you are having trouble with this installation,
|
||||
-- refer to the README for telescope-fzf-native for more instructions.
|
||||
build = 'make',
|
||||
cond = function()
|
||||
return vim.fn.executable 'make' == 1
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
-- Highlight, edit, and navigate code
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
dependencies = {
|
||||
'nvim-treesitter/nvim-treesitter-textobjects',
|
||||
},
|
||||
build = ':TSUpdate',
|
||||
},
|
||||
|
||||
-- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart
|
||||
-- These are some example plugins that I've included in the kickstart repository.
|
||||
-- Uncomment any of the lines below to enable them.
|
||||
-- require 'kickstart.plugins.autoformat',
|
||||
-- require 'kickstart.plugins.debug',
|
||||
|
||||
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
|
||||
-- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping
|
||||
-- up-to-date with whatever is in the kickstart repo.
|
||||
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
|
||||
--
|
||||
-- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins
|
||||
-- { import = 'custom.plugins' },
|
||||
}, {})
|
||||
|
||||
-- [[ Setting options ]]
|
||||
-- See `:help vim.o`
|
||||
-- NOTE: You can change these options as you wish!
|
||||
|
||||
-- Set highlight on search
|
||||
vim.o.hlsearch = false
|
||||
|
||||
-- Make line numbers default
|
||||
vim.wo.number = true
|
||||
|
||||
-- Enable mouse mode
|
||||
vim.o.mouse = 'a'
|
||||
|
||||
-- Sync clipboard between OS and Neovim.
|
||||
-- Remove this option if you want your OS clipboard to remain independent.
|
||||
-- See `:help 'clipboard'`
|
||||
vim.o.clipboard = 'unnamedplus'
|
||||
|
||||
-- Enable break indent
|
||||
vim.o.breakindent = true
|
||||
|
||||
--tabwitdh
|
||||
vim.o.tabstop = 4
|
||||
vim.o.shiftwidth = 4
|
||||
|
||||
-- relative line numbers
|
||||
vim.o.relativenumber = true
|
||||
|
||||
-- Save undo history
|
||||
vim.o.undofile = true
|
||||
|
||||
-- Case-insensitive searching UNLESS \C or capital in search
|
||||
vim.o.ignorecase = true
|
||||
vim.o.smartcase = true
|
||||
|
||||
-- Keep signcolumn on by default
|
||||
vim.wo.signcolumn = 'yes'
|
||||
|
||||
-- Decrease update time
|
||||
vim.o.updatetime = 250
|
||||
vim.o.timeoutlen = 300
|
||||
|
||||
-- Set completeopt to have a better completion experience
|
||||
vim.o.completeopt = 'menuone,noselect'
|
||||
|
||||
-- NOTE: You should make sure your terminal supports this
|
||||
vim.o.termguicolors = true
|
||||
|
||||
-- [[ Basic Keymaps ]]
|
||||
|
||||
-- Keymaps for better default experience
|
||||
-- See `:help vim.keymap.set()`
|
||||
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
|
||||
|
||||
-- Remap for dealing with word wrap
|
||||
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
||||
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
||||
|
||||
-- Diagnostic keymaps
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' })
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' })
|
||||
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' })
|
||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' })
|
||||
|
||||
|
||||
|
||||
-- [[ Highlight on yank ]]
|
||||
-- See `:help vim.highlight.on_yank()`
|
||||
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
|
||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||
callback = function()
|
||||
vim.highlight.on_yank()
|
||||
end,
|
||||
group = highlight_group,
|
||||
pattern = '*',
|
||||
})
|
||||
|
||||
-- configure autoclose
|
||||
require("autoclose").setup({
|
||||
keys = {
|
||||
["("] = { escape = false, close = true, pair = "()" },
|
||||
["["] = { escape = false, close = true, pair = "[]" },
|
||||
["{"] = { escape = false, close = true, pair = "{}" },
|
||||
|
||||
[">"] = { escape = true, close = false, pair = "<>" },
|
||||
[")"] = { escape = true, close = false, pair = "()" },
|
||||
["]"] = { escape = true, close = false, pair = "[]" },
|
||||
["}"] = { escape = true, close = false, pair = "{}" },
|
||||
|
||||
['"'] = { escape = true, close = true, pair = '""' },
|
||||
["'"] = { escape = true, close = true, pair = "''" },
|
||||
["`"] = { escape = true, close = true, pair = "``" },
|
||||
},
|
||||
options = {
|
||||
disabled_filetypes = { "text" },
|
||||
disable_when_touch = true,
|
||||
touch_regex = "[%w(%[{]",
|
||||
pair_spaces = false,
|
||||
auto_indent = true,
|
||||
disable_command_mode = false,
|
||||
},
|
||||
})
|
||||
|
||||
-- [[ Configure Telescope ]]
|
||||
-- See `:help telescope` and `:help telescope.setup()`
|
||||
require('telescope').setup {
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
['<C-u>'] = false,
|
||||
['<C-d>'] = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Enable telescope fzf native, if installed
|
||||
pcall(require('telescope').load_extension, 'fzf')
|
||||
|
||||
-- Telescope live_grep in git root
|
||||
-- Function to find the git root directory based on the current buffer's path
|
||||
local function find_git_root()
|
||||
-- Use the current buffer's path as the starting point for the git search
|
||||
local current_file = vim.api.nvim_buf_get_name(0)
|
||||
local current_dir
|
||||
local cwd = vim.fn.getcwd()
|
||||
-- If the buffer is not associated with a file, return nil
|
||||
if current_file == '' then
|
||||
current_dir = cwd
|
||||
else
|
||||
-- Extract the directory from the current file's path
|
||||
current_dir = vim.fn.fnamemodify(current_file, ':h')
|
||||
end
|
||||
|
||||
-- Find the Git root directory from the current file's path
|
||||
local git_root = vim.fn.systemlist('git -C ' .. vim.fn.escape(current_dir, ' ') .. ' rev-parse --show-toplevel')[1]
|
||||
if vim.v.shell_error ~= 0 then
|
||||
print 'Not a git repository. Searching on current working directory'
|
||||
return cwd
|
||||
end
|
||||
return git_root
|
||||
end
|
||||
|
||||
-- Custom live_grep function to search in git root
|
||||
local function live_grep_git_root()
|
||||
local git_root = find_git_root()
|
||||
if git_root then
|
||||
require('telescope.builtin').live_grep {
|
||||
search_dirs = { git_root },
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command('LiveGrepGitRoot', live_grep_git_root, {})
|
||||
|
||||
-- See `:help telescope.builtin`
|
||||
vim.keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' })
|
||||
vim.keymap.set('n', '<leader><space>', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' })
|
||||
vim.keymap.set('n', '<leader>/', function()
|
||||
-- You can pass additional configuration to telescope to change theme, layout, etc.
|
||||
require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
||||
winblend = 10,
|
||||
previewer = false,
|
||||
})
|
||||
end, { desc = '[/] Fuzzily search in current buffer' })
|
||||
|
||||
local function telescope_live_grep_open_files()
|
||||
require('telescope.builtin').live_grep {
|
||||
grep_open_files = true,
|
||||
prompt_title = 'Live Grep in Open Files',
|
||||
}
|
||||
end
|
||||
vim.keymap.set('n', '<leader>s/', telescope_live_grep_open_files, { desc = '[S]earch [/] in Open Files' })
|
||||
vim.keymap.set('n', '<leader>ss', require('telescope.builtin').builtin, { desc = '[S]earch [S]elect Telescope' })
|
||||
vim.keymap.set('n', '<leader>gf', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' })
|
||||
vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' })
|
||||
vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' })
|
||||
vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
|
||||
vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
|
||||
vim.keymap.set('n', '<leader>sG', ':LiveGrepGitRoot<cr>', { desc = '[S]earch by [G]rep on Git Root' })
|
||||
vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
|
||||
vim.keymap.set('n', '<leader>sr', require('telescope.builtin').resume, { desc = '[S]earch [R]esume' })
|
||||
|
||||
-- [[ Configure Treesitter ]]
|
||||
-- See `:help nvim-treesitter`
|
||||
-- Defer Treesitter setup after first render to improve startup time of 'nvim {filename}'
|
||||
vim.defer_fn(function()
|
||||
require('nvim-treesitter.configs').setup {
|
||||
-- Add languages to be installed here that you want installed for treesitter
|
||||
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim', 'bash' },
|
||||
|
||||
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
|
||||
auto_install = false,
|
||||
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = '<c-space>',
|
||||
node_incremental = '<c-space>',
|
||||
scope_incremental = '<c-s>',
|
||||
node_decremental = '<M-space>',
|
||||
},
|
||||
},
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
|
||||
keymaps = {
|
||||
-- You can use the capture groups defined in textobjects.scm
|
||||
['aa'] = '@parameter.outer',
|
||||
['ia'] = '@parameter.inner',
|
||||
['af'] = '@function.outer',
|
||||
['if'] = '@function.inner',
|
||||
['ac'] = '@class.outer',
|
||||
['ic'] = '@class.inner',
|
||||
},
|
||||
},
|
||||
move = {
|
||||
enable = true,
|
||||
set_jumps = true, -- whether to set jumps in the jumplist
|
||||
goto_next_start = {
|
||||
[']m'] = '@function.outer',
|
||||
[']]'] = '@class.outer',
|
||||
},
|
||||
goto_next_end = {
|
||||
[']M'] = '@function.outer',
|
||||
[']['] = '@class.outer',
|
||||
},
|
||||
goto_previous_start = {
|
||||
['[m'] = '@function.outer',
|
||||
['[['] = '@class.outer',
|
||||
},
|
||||
goto_previous_end = {
|
||||
['[M'] = '@function.outer',
|
||||
['[]'] = '@class.outer',
|
||||
},
|
||||
},
|
||||
swap = {
|
||||
enable = true,
|
||||
swap_next = {
|
||||
['<leader>a'] = '@parameter.inner',
|
||||
},
|
||||
swap_previous = {
|
||||
['<leader>A'] = '@parameter.inner',
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
end, 0)
|
||||
|
||||
-- [[ Configure LSP ]]
|
||||
-- This function gets run when an LSP connects to a particular buffer.
|
||||
local on_attach = function(_, bufnr)
|
||||
-- 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
|
||||
-- many times.
|
||||
--
|
||||
-- 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 nmap = function(keys, func, desc)
|
||||
if desc then
|
||||
desc = 'LSP: ' .. desc
|
||||
end
|
||||
|
||||
vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc })
|
||||
end
|
||||
|
||||
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
|
||||
nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
|
||||
|
||||
nmap('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
|
||||
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
||||
nmap('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
|
||||
nmap('<leader>D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition')
|
||||
nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
|
||||
nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
||||
|
||||
-- See `:help K` for why this keymap
|
||||
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
|
||||
nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
|
||||
|
||||
-- Lesser used LSP functionality
|
||||
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
||||
nmap('<leader>wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder')
|
||||
nmap('<leader>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
|
||||
nmap('<leader>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, '[W]orkspace [L]ist Folders')
|
||||
|
||||
-- Create a command `:Format` local to the LSP buffer
|
||||
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
|
||||
vim.lsp.buf.format()
|
||||
end, { desc = 'Format current buffer with LSP' })
|
||||
end
|
||||
|
||||
-- document existing key chains
|
||||
-- require('which-key').register {
|
||||
-- ['<leader>c'] = { name = '[C]ode', _ = 'which_key_ignore' },
|
||||
-- ['<leader>d'] = { name = '[D]ocument', _ = 'which_key_ignore' },
|
||||
-- ['<leader>g'] = { name = '[G]it', _ = 'which_key_ignore' },
|
||||
-- ['<leader>h'] = { name = 'Git [H]unk', _ = 'which_key_ignore' },
|
||||
-- ['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
|
||||
-- ['<leader>s'] = { name = '[S]earch', _ = 'which_key_ignore' },
|
||||
-- ['<leader>t'] = { name = '[T]oggle', _ = 'which_key_ignore' },
|
||||
-- ['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
|
||||
-- }
|
||||
-- -- register which-key VISUAL mode
|
||||
-- -- required for visual <leader>hs (hunk stage) to work
|
||||
-- require('which-key').register({
|
||||
-- ['<leader>'] = { name = 'VISUAL <leader>' },
|
||||
-- ['<leader>h'] = { 'Git [H]unk' },
|
||||
-- }, { mode = 'v' })
|
||||
|
||||
|
||||
-- mason-lspconfig requires that these setup functions are called in this order
|
||||
-- before setting up the servers.
|
||||
require('mason').setup()
|
||||
require('mason-lspconfig').setup()
|
||||
|
||||
-- Enable the following language servers
|
||||
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
|
||||
--
|
||||
-- Add any additional override configuration in the following tables. They will be passed to
|
||||
-- the `settings` field of the server config. You must look up that documentation yourself.
|
||||
--
|
||||
-- If you want to override the default filetypes that your language server will attach to you can
|
||||
-- define the property 'filetypes' to the map in question.
|
||||
local servers = {
|
||||
-- clangd = {},
|
||||
-- gopls = {},
|
||||
-- pyright = {},
|
||||
-- rust_analyzer = {},
|
||||
-- tsserver = {},
|
||||
-- html = { filetypes = { 'html', 'twig', 'hbs'} },
|
||||
|
||||
lua_ls = {
|
||||
Lua = {
|
||||
workspace = { checkThirdParty = false },
|
||||
telemetry = { enable = false },
|
||||
-- NOTE: toggle below to ignore Lua_LS's noisy `missing-fields` warnings
|
||||
-- diagnostics = { disable = { 'missing-fields' } },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Setup neovim lua configuration
|
||||
require('neodev').setup()
|
||||
|
||||
-- nvim-cmp supports additional completion capabilities, so broadcast that to servers
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
|
||||
|
||||
-- Ensure the servers above are installed
|
||||
local mason_lspconfig = require 'mason-lspconfig'
|
||||
|
||||
mason_lspconfig.setup {
|
||||
ensure_installed = vim.tbl_keys(servers),
|
||||
}
|
||||
|
||||
mason_lspconfig.setup_handlers {
|
||||
function(server_name)
|
||||
require('lspconfig')[server_name].setup {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
settings = servers[server_name],
|
||||
filetypes = (servers[server_name] or {}).filetypes,
|
||||
}
|
||||
end,
|
||||
}
|
||||
|
||||
|
||||
local nvim_lsp = require('lspconfig')
|
||||
|
||||
-- Configure JDTLS with completion disabled
|
||||
nvim_lsp.jdtls.setup {
|
||||
capabilities = {
|
||||
textDocument = {
|
||||
completion = {
|
||||
completionItem = {
|
||||
snippetSupport = false,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-- My Keymaps
|
||||
vim.opt.clipboard = 'unnamedplus'
|
||||
|
||||
|
||||
-- HJKL Remap
|
||||
-- normal mode
|
||||
vim.api.nvim_set_keymap('n', 'i', 'k', { noremap = true, silent = true})
|
||||
vim.api.nvim_set_keymap('n', 'k', 'j', { noremap = true, silent = true})
|
||||
vim.api.nvim_set_keymap('n', 'j', 'h', { noremap = true, silent = true})
|
||||
vim.api.nvim_set_keymap('n', 'h', 'i', { noremap = true, silent = true})
|
||||
-- visual mode
|
||||
vim.api.nvim_set_keymap('v', 'i', 'k', { noremap = true, silent = true})
|
||||
vim.api.nvim_set_keymap('v', 'k', 'j', { noremap = true, silent = true})
|
||||
vim.api.nvim_set_keymap('v', 'j', 'h', { noremap = true, silent = true})
|
||||
vim.api.nvim_set_keymap('v', 'h', 'i', { noremap = true, silent = true})
|
||||
-- operator pending mode
|
||||
vim.api.nvim_set_keymap('o', 'i', 'k', { noremap = true, silent = true})
|
||||
vim.api.nvim_set_keymap('o', 'k', 'j', { noremap = true, silent = true})
|
||||
vim.api.nvim_set_keymap('o', 'j', 'h', { noremap = true, silent = true})
|
||||
vim.api.nvim_set_keymap('o', 'h', 'i', { noremap = true, silent = true})
|
||||
|
||||
-- vim.api.nvim_set_keymap('i', '<C-k>', '<down>', { noremap = true, silent = true})
|
||||
-- Goto start of line
|
||||
vim.api.nvim_set_keymap('n', '#', '_', { noremap = true, silent = true})
|
||||
|
||||
-- Switch buffers
|
||||
vim.api.nvim_set_keymap('n', '<leader><Tab>', ':bnext<CR>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', '<leader><S-Tab>', ':bprev<CR>', { noremap = true, silent = true })
|
||||
|
||||
-- [[ Configure nvim-cmp ]]
|
||||
-- See `:help cmp`
|
||||
local cmp = require 'cmp'
|
||||
local luasnip = require 'luasnip'
|
||||
require('luasnip.loaders.from_vscode').lazy_load()
|
||||
|
||||
-- Custom function to handle Esc key in insert mode
|
||||
function close_completion_or_escape()
|
||||
if cmp.visible() then
|
||||
cmp.close()
|
||||
else
|
||||
return vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<Esc>", true, true, true), "n", true)
|
||||
end
|
||||
end
|
||||
|
||||
-- Map <Esc> in insert mode to call the custom function
|
||||
vim.api.nvim_set_keymap('i', '<Esc>', '<Cmd>lua close_completion_or_escape()<CR>', { noremap = true, expr = false, silent = true })
|
||||
|
||||
luasnip.config.setup {}
|
||||
|
||||
luasnip.config.set_config({
|
||||
region_check_events = 'InsertEnter',
|
||||
delete_check_events = 'InsertLeave'
|
||||
})
|
||||
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
completion = {
|
||||
completeopt = 'menu,menuone,noinsert',
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert {
|
||||
['<C-n>'] = cmp.mapping.select_next_item(),
|
||||
['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete {},
|
||||
['<CR>'] = cmp.mapping.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
},
|
||||
['<Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.confirm { select = true }
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
-- if cmp.visible() then
|
||||
-- cmp.select_next_item()
|
||||
-- elseif luasnip.expand_or_locally_jumpable() then
|
||||
-- luasnip.expand_or_jump()
|
||||
-- else
|
||||
-- fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.locally_jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
},
|
||||
sources = {
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'path' },
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
-- The line beneath this is called `modeline`. See `:help modeline`
|
||||
-- vim: ts=2 sts=2 sw=2 et
|
|
@ -1,148 +0,0 @@
|
|||
---Opens a floating windo
|
||||
---@param buf? integer buffer-ID of buffer to put in thw window
|
||||
---@param w_percent? decimal width of floating window will be this * full width
|
||||
---@param h_percent? decimal height of floating window will be this * full height
|
||||
---@param opts any options to pass to nvim_open_win
|
||||
local function open_floating_win(buf, w_percent, h_percent, opts)
|
||||
buf = buf or vim.api.nvim_create_buf(true, false)
|
||||
w_percent = w_percent or 0.8
|
||||
h_percent = h_percent or 0.8
|
||||
local default_opts = {
|
||||
relative = 'editor',
|
||||
row = (vim.o.lines - vim.o.lines * h_percent)/2,
|
||||
col = (vim.o.columns - vim.o.columns * w_percent)/2,
|
||||
width = math.floor(vim.o.columns * w_percent),
|
||||
height = math.floor(vim.o.lines * h_percent),
|
||||
style = 'minimal',
|
||||
border = 'rounded'
|
||||
}
|
||||
opts = vim.tbl_deep_extend('force', default_opts, opts or {})
|
||||
vim.api.nvim_open_win(buf, true, opts)
|
||||
end
|
||||
|
||||
---@class TermState
|
||||
---@field bufs integer[]
|
||||
---@field last_used integer[]
|
||||
---@field curr_buf_index integer
|
||||
---@field win integer
|
||||
local term_state = {
|
||||
bufs = { -1, -1, -1, -1 },
|
||||
last_used = { 1, 2, 3, 4 },
|
||||
curr_buf_index = 1,
|
||||
win = -1,
|
||||
}
|
||||
|
||||
vim.api.nvim_create_user_command('Floaterminal', function(args_table)
|
||||
|
||||
local is_new = false
|
||||
if args_table.args ~= '' then
|
||||
|
||||
local operation = args_table.args
|
||||
|
||||
if operation == 'next' then
|
||||
term_state.curr_buf_index = term_state.curr_buf_index + 1
|
||||
if term_state.curr_buf_index > 4 then
|
||||
term_state.curr_buf_index = 1
|
||||
end
|
||||
elseif operation == 'prev' then
|
||||
term_state.curr_buf_index = term_state.curr_buf_index - 1
|
||||
if term_state.curr_buf_index < 1 then
|
||||
term_state.curr_buf_index = 4
|
||||
end
|
||||
else
|
||||
error('invalid argument, use next or prev')
|
||||
end
|
||||
|
||||
if not vim.api.nvim_buf_is_valid(term_state.bufs[term_state.curr_buf_index]) then
|
||||
term_state.bufs[term_state.curr_buf_index] = vim.api.nvim_create_buf(true, false)
|
||||
is_new = true
|
||||
end
|
||||
|
||||
for index, value in ipairs(term_state.last_used) do
|
||||
if value == term_state.curr_buf_index then
|
||||
table.remove(term_state.last_used, index)
|
||||
break
|
||||
end
|
||||
end
|
||||
table.insert(term_state.last_used, 1, term_state.curr_buf_index)
|
||||
|
||||
vim.api.nvim_set_current_buf(term_state.bufs[term_state.curr_buf_index])
|
||||
|
||||
else
|
||||
|
||||
for _ = 1, 4 do
|
||||
if not vim.api.nvim_buf_is_valid(term_state.bufs[term_state.last_used[1]]) then
|
||||
local invalid_buf_index = table.remove(term_state.last_used, 1)
|
||||
table.insert(term_state.last_used, 4, invalid_buf_index)
|
||||
end
|
||||
end
|
||||
|
||||
if not vim.api.nvim_buf_is_valid(term_state.bufs[term_state.last_used[1]]) then
|
||||
term_state.bufs[term_state.last_used[1]] = vim.api.nvim_create_buf(true, false)
|
||||
is_new = true
|
||||
end
|
||||
|
||||
open_floating_win(term_state.bufs[term_state.last_used[1]])
|
||||
|
||||
term_state.win = vim.api.nvim_get_current_win()
|
||||
|
||||
end
|
||||
|
||||
if is_new then
|
||||
vim.cmd.term()
|
||||
end
|
||||
if vim.api.nvim_get_mode().mode == 'nt' then
|
||||
vim.api.nvim_feedkeys('a', 'n', true)
|
||||
end
|
||||
|
||||
end, { nargs = '?', desc = 'open the floaterminaaal' })
|
||||
|
||||
|
||||
local oil_buf = -1
|
||||
|
||||
vim.api.nvim_create_user_command('Floateroil', function()
|
||||
local is_new = false
|
||||
if not vim.api.nvim_buf_is_valid(oil_buf) then
|
||||
oil_buf = vim.api.nvim_create_buf(true, false)
|
||||
is_new = true
|
||||
end
|
||||
|
||||
open_floating_win(oil_buf)
|
||||
if is_new then
|
||||
vim.cmd('Oil')
|
||||
end
|
||||
|
||||
end, { desc = 'open the floateroil' })
|
||||
|
||||
|
||||
local dev_log_buf = -1
|
||||
vim.api.nvim_create_user_command('FloutterLog', function (args)
|
||||
local name = args.args
|
||||
if not vim.api.nvim_buf_is_valid(dev_log_buf) then
|
||||
dev_log_buf = vim.api.nvim_create_buf(true, false)
|
||||
vim.api.nvim_buf_set_name(dev_log_buf, name)
|
||||
end
|
||||
vim.keymap.set('n', '<F27>', '<cmd>q<CR>', { desc = 'close dev log', buffer = dev_log_buf })
|
||||
open_floating_win(dev_log_buf)
|
||||
|
||||
-- AutoScroll Logic
|
||||
local lines = vim.api.nvim_buf_line_count(dev_log_buf)
|
||||
local cursor = vim.api.nvim_win_get_cursor(0)[1]
|
||||
vim.api.nvim_create_autocmd('TextChanged', {
|
||||
buffer = dev_log_buf,
|
||||
callback = function ()
|
||||
if cursor == lines then
|
||||
vim.cmd('normal! G')
|
||||
end
|
||||
lines = vim.api.nvim_buf_line_count(dev_log_buf)
|
||||
end
|
||||
})
|
||||
vim.api.nvim_create_autocmd('CursorMoved', {
|
||||
buffer = dev_log_buf,
|
||||
callback = function ()
|
||||
cursor = vim.api.nvim_win_get_cursor(0)[1]
|
||||
end
|
||||
})
|
||||
|
||||
end, { desc = 'flutter dev log floating', nargs = 1 })
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue