refactor: minimal setup
This commit is contained in:
98
after/plugin/cmp.lua
Normal file
98
after/plugin/cmp.lua
Normal file
@@ -0,0 +1,98 @@
|
||||
vim.api.nvim_set_hl(0, 'CmpGhostText', { link = 'Comment', default = true });
|
||||
vim.o.pumheight = 20;
|
||||
|
||||
local cmp = require('cmp');
|
||||
local cmp_defaults = require('cmp.config.default')();
|
||||
|
||||
local luasnip = require('luasnip');
|
||||
local lspkind = require('lspkind');
|
||||
|
||||
require('luasnip.loaders.from_vscode').lazy_load();
|
||||
luasnip.config.setup({});
|
||||
|
||||
local has_words_before = function()
|
||||
unpack = unpack or table.unpack;
|
||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0));
|
||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]
|
||||
:sub(col, col)
|
||||
:match('%s') == nil;
|
||||
end
|
||||
|
||||
cmp.setup({
|
||||
enabled = true,
|
||||
competion = {
|
||||
autocomplete = cmp_defaults.completion.autocomplete,
|
||||
get_trigger_characters = cmp_defaults.completion.get_trigger_characters,
|
||||
keyword_length = cmp_defaults.completion.keyword_length,
|
||||
keyword_pattern = cmp_defaults.completion.keyword_pattern,
|
||||
completeopt = 'menu,menuone,noinsert,noselect',
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body);
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
||||
['<Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item({
|
||||
behavior = cmp.SelectBehavior.Insert,
|
||||
});
|
||||
elseif luasnip.expand_or_locally_jumpable() then
|
||||
luasnip.expand_or_jump();
|
||||
elseif has_words_before() then
|
||||
cmp.complete();
|
||||
else
|
||||
fallback();
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item({
|
||||
behavior = cmp.SelectBehavior.Insert,
|
||||
});
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.expand_or_jump(-1);
|
||||
else
|
||||
fallback();
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'nvim_lsp' },
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
}),
|
||||
experimental = {
|
||||
ghost_text = {
|
||||
hl_group = 'CmpGhostText',
|
||||
},
|
||||
},
|
||||
formatting = {
|
||||
format = lspkind.cmp_format({
|
||||
mode = 'symbol_text',
|
||||
menu = ({
|
||||
buffer = '[Buffer]',
|
||||
nvim_lsp = '[LSP]',
|
||||
luasnip = '[LuaSnip]'
|
||||
}),
|
||||
}),
|
||||
fields = cmp_defaults.formatting.fields,
|
||||
expandable_indicator = cmp_defaults.formatting.expandable_indicator,
|
||||
},
|
||||
view = {
|
||||
entries = { name = 'custom', selection_order = 'near_cursor' },
|
||||
docs = cmp_defaults.view.docs,
|
||||
},
|
||||
sorting = cmp_defaults.sorting,
|
||||
performance = cmp_defaults.performance,
|
||||
preselect = cmp_defaults.preselect,
|
||||
confirmation = cmp_defaults.confirmation,
|
||||
matching = cmp_defaults.matching,
|
||||
revision = cmp_defaults.revision,
|
||||
});
|
||||
68
after/plugin/lsp.lua
Normal file
68
after/plugin/lsp.lua
Normal file
@@ -0,0 +1,68 @@
|
||||
local on_attach = function(_, bufnr)
|
||||
local bmap = function(keys, func, desc)
|
||||
if desc then desc = 'LSP: ' .. '[' .. keys .. '] ' .. desc end
|
||||
vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc });
|
||||
end
|
||||
|
||||
bmap('<leader>r', vim.lsp.buf.rename, 'Rename');
|
||||
bmap('<leader>a', vim.lsp.buf.code_action, 'Code action');
|
||||
|
||||
bmap('gd', vim.lsp.buf.definition, 'Goto Definition');
|
||||
bmap('gD', vim.lsp.buf.declaration, 'Goto Declaration');
|
||||
bmap('gI', vim.lsp.buf.implementation, 'Goto Implementation');
|
||||
bmap('<leader>D', vim.lsp.buf.type_definition, 'Type Definition');
|
||||
|
||||
bmap('K', vim.lsp.buf.hover, 'Hover docs');
|
||||
bmap('<C-k>', vim.lsp.buf.signature_help, 'Signature docs');
|
||||
|
||||
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
|
||||
vim.lsp.buf.format()
|
||||
end, {});
|
||||
|
||||
local format_is_enabled = true;
|
||||
vim.api.nvim_buf_create_user_command('AutoFormatToggle', function()
|
||||
format_is_enabled = not format_is_enabled;
|
||||
print('Setting autoformatting to:' .. tostring(format_is_enabled));
|
||||
end, {});
|
||||
end
|
||||
|
||||
require('which-key').register({
|
||||
['<leader>c'] = { name = '[c] Code', _ = 'which_key_ignore' },
|
||||
['<leader>d'] = { name = '[d] Document', _ = 'which_key_ignore' },
|
||||
['<leader>g'] = { name = '[g] Git', _ = 'which_key_ignore' },
|
||||
['<leader>h'] = { name = '[h] More Git', _ = 'which_key_ignore' },
|
||||
['<leader>r'] = { name = '[r] Rename', _ = 'which_key_ignore' },
|
||||
['<leader>s'] = { name = '[s] Search', _ = 'which_key_ignore' },
|
||||
['<leader>w'] = { name = '[w] Workspace', _ = 'which_key_ignore' },
|
||||
});
|
||||
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities();
|
||||
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities);
|
||||
|
||||
require('mason').setup();
|
||||
require('mason-lspconfig').setup_handlers({
|
||||
function(server_name)
|
||||
require('lspconfig')[server_name].setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
});
|
||||
end,
|
||||
['lua_ls'] = function()
|
||||
require('neodev').setup();
|
||||
require('lspconfig').lua_ls.setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
Lua = {
|
||||
workspace = { checkThirdParty = false },
|
||||
telemetry = { enable = false },
|
||||
},
|
||||
});
|
||||
end,
|
||||
['html'] = function()
|
||||
require('lspconfig').html.setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
filetypes = { 'html', 'svg', 'xml' },
|
||||
});
|
||||
end
|
||||
});
|
||||
26
after/plugin/telescope.lua
Normal file
26
after/plugin/telescope.lua
Normal file
@@ -0,0 +1,26 @@
|
||||
local telescope = require('telescope');
|
||||
local builtin = require('telescope.builtin');
|
||||
|
||||
local nmap = function(key, func, desc)
|
||||
if desc then desc = '[' .. key .. '] ' .. desc end
|
||||
vim.keymap.set('n', key, func, { desc = desc });
|
||||
end
|
||||
|
||||
nmap('<leader><space>', builtin.buffers, 'Find existing buffers');
|
||||
nmap('/', function ()
|
||||
builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown({
|
||||
windblend = 10,
|
||||
previewer = false,
|
||||
}));
|
||||
end, 'Find in current buffer');
|
||||
|
||||
nmap('fr', builtin.oldfiles, 'Find recent files');
|
||||
nmap('ff', builtin.find_files, 'Find files');
|
||||
nmap('fw', builtin.grep_string, 'Find word');
|
||||
nmap('gf', builtin.git_files, 'Git files');
|
||||
nmap('rs', builtin.resume, 'Resume search');
|
||||
|
||||
telescope.setup({});
|
||||
|
||||
pcall(require('telescope').load_extensions, 'fnf');
|
||||
|
||||
97
init.lua
97
init.lua
@@ -1,91 +1,25 @@
|
||||
vim.g.mapleader = ' ';
|
||||
vim.g.maplocalleader = ' ';
|
||||
|
||||
vim.g.loaded_netrw = 1;
|
||||
vim.g.loaded_netrwPlugin = 1;
|
||||
|
||||
local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim';
|
||||
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',
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable", -- latest stable release
|
||||
lazypath,
|
||||
});
|
||||
})
|
||||
end
|
||||
|
||||
vim.opt.rtp:prepend(lazypath);
|
||||
|
||||
require('lazy').setup('plugins');
|
||||
require('lazy').setup('pluginlist');
|
||||
|
||||
-- Custom keybindings
|
||||
require('keybindings');
|
||||
|
||||
vim.wo.number = true;
|
||||
vim.o.mouse = true;
|
||||
--[[
|
||||
-- Auto reload
|
||||
vim.o.autoread = true;
|
||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'CursorHold', 'CursorHoldI', 'Focusgained' }, {
|
||||
command = "if mode() != 'c' | checktime | endif",
|
||||
pattern = { '*' },
|
||||
});
|
||||
]]
|
||||
-- True colors
|
||||
vim.o.termguicolors = true;
|
||||
|
||||
-- Enable filetype plugins
|
||||
vim.o.filetype = true;
|
||||
|
||||
-- Enable spell checking by default
|
||||
vim.o.spell = true;
|
||||
|
||||
-- Set relative line numbers
|
||||
vim.o.number = true;
|
||||
vim.o.relativenumber = true;
|
||||
vim.o.signcolumn = 'number';
|
||||
|
||||
-- Set indentation
|
||||
vim.o.noexpandtab = true;
|
||||
vim.o.tabstop = 4;
|
||||
vim.o.softtabstop = 4;
|
||||
vim.o.shiftwidth = 4;
|
||||
-- vim.o.expandtab = 4;
|
||||
vim.o.breakindent = true;
|
||||
|
||||
-- Scroll off
|
||||
vim.o.scrolloff = 10;
|
||||
|
||||
-- Line length column
|
||||
vim.o.colorcolumn = '80';
|
||||
|
||||
-- Sync NeoVim and OS clipboards
|
||||
vim.o.clipboard = 'unnamedplus';
|
||||
|
||||
-- Highlight search
|
||||
vim.o.hlsearch = false;
|
||||
vim.o.incsearch = true;
|
||||
|
||||
-- Save undo history
|
||||
vim.o.undofile = true;
|
||||
|
||||
-- Case-insensitive search, unless \C or capital in search
|
||||
vim.o.ignorecase = true;
|
||||
vim.o.smartcase = true;
|
||||
|
||||
vim.wo.signcolumn = 'yes';
|
||||
|
||||
vim.o.updatetime = 250;
|
||||
vim.o.timeoutlen = 300;
|
||||
|
||||
vim.o.completeopt = 'menuone,noselect';
|
||||
|
||||
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 });
|
||||
require('keymaps');
|
||||
require('options');
|
||||
|
||||
-- Highlight on yank
|
||||
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true });
|
||||
@@ -97,12 +31,3 @@ vim.api.nvim_create_autocmd('TextYankPost', {
|
||||
pattern = '*',
|
||||
});
|
||||
|
||||
-- Vimtex config
|
||||
vim.g['vimtex_compiler_progname'] = 'nvr';
|
||||
vim.g['vimtex_view_method'] = 'zathura';
|
||||
vim.g['vimtex_log_ignore'] = {
|
||||
'Underfull',
|
||||
'Overfull',
|
||||
'specifier changed to',
|
||||
'Token not allowed in a PDF string',
|
||||
}
|
||||
|
||||
@@ -1,45 +1,21 @@
|
||||
{
|
||||
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
|
||||
"LuaSnip": { "branch": "master", "commit": "82108e7e31cc6fc223cc5df5cae6d89f70bb199f" },
|
||||
"auto-save.nvim": { "branch": "main", "commit": "e98cafef75271ec83dc84c933f124ab1bb675ef8" },
|
||||
"barbar.nvim": { "branch": "master", "commit": "dd852401ee902745b67fc09a83d113b3fe82a96f" },
|
||||
"catppuccin": { "branch": "main", "commit": "5e36ca599f4aa41bdd87fbf2c5aae4397ac55074" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
|
||||
"conform.nvim": { "branch": "master", "commit": "75e7c5c7eb5fbd53f8b12dc420b31ec70770b231" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" },
|
||||
"firenvim": { "branch": "master", "commit": "138424db463e6c0e862a05166a4ccc781cd7c19d" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "69a2c1675b66e002799f5eef803b87a12f593049" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "3e6e91b09f0468c32d3b96dcacf4b947f037ce25" },
|
||||
"hover.nvim": { "branch": "main", "commit": "bbd59ddfae4e64459944acf2abcda4d81ba8bac6" },
|
||||
"image.nvim": { "branch": "master", "commit": "245422e5c4774f0640d41c0eadec77396f2be4a9" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "3c8a185da4b8ab7aef487219f5e001b11d4b6aaf" },
|
||||
"joshuto.nvim": { "branch": "master", "commit": "68be5740d32a1a5bb4ed5f8a3df3f9ca2be725fb" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" },
|
||||
"lazygit.nvim": { "branch": "main", "commit": "1e08e3f5ac1152339690140e61a4a32b3bdc7de5" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "28126922c9b54e35a192ac415788f202c3944c9f" },
|
||||
"lspkind.nvim": { "branch": "master", "commit": "7f26cf5e27e2bd910ce0ea00c514da2bf97423b8" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "566b7036f717f3d676362742630518a47f132fff" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "0989bdf4fdf7b5aa4c74131d7ffccc3f399ac788" },
|
||||
"mason.nvim": { "branch": "main", "commit": "e110bc3be1a7309617cecd77bfe4bf86ba1b8134" },
|
||||
"neo-tree.nvim": { "branch": "main", "commit": "2f2d08894bbc679d4d181604c16bb7079f646384" },
|
||||
"neodev.nvim": { "branch": "main", "commit": "be8d4d4cab6c13c6a572269c9d6a63774baba9a0" },
|
||||
"nui.nvim": { "branch": "main", "commit": "35da9ca1de0fc4dda96c2e214d93d363c145f418" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "796394fd19fb878e8dbc4fd1e9c9c186ed07a5f4" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "8cd2b230174efbf7b5d9f49fe2f90bda6b5eb16e" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "85b9d0cbd4ff901abcda862b50dbb34e0901848b" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "db0c864375c198cacc171ff373e76bfce2a85045" },
|
||||
"peek.nvim": { "branch": "master", "commit": "4163a48f190d2b2d94840be3eb38b4af83961ebe" },
|
||||
"playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" },
|
||||
"suda.vim": { "branch": "master", "commit": "8b0fc3711760195aba104e2d190cff9af8267052" },
|
||||
"telescope.nvim": { "branch": "0.1.x", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" },
|
||||
"tmux.nvim": { "branch": "main", "commit": "ea67d59721eb7e12144ce2963452e869bfd60526" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" },
|
||||
"vim-fugitive": { "branch": "master", "commit": "59659093581aad2afacedc81f009ed6a4bfad275" },
|
||||
"vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" },
|
||||
"vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" },
|
||||
"vimtex": { "branch": "master", "commit": "f9b19d09ee6f0ba70dad0b5c2e710dd700681000" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" },
|
||||
"yuck.vim": { "branch": "master", "commit": "9b5e0370f70cc30383e1dabd6c215475915fe5c3" }
|
||||
"which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" }
|
||||
}
|
||||
@@ -43,3 +43,10 @@ vim.keymap.set('n', '<leader>st', function()
|
||||
end, { desc = '[st] Toggle spelling correction' });
|
||||
|
||||
vim.keymap.set('n', '<leader>ee', vim.diagnostic.open_float, { desc = '[ee] Open diagnostic' });
|
||||
|
||||
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 });
|
||||
|
||||
60
lua/options.lua
Normal file
60
lua/options.lua
Normal file
@@ -0,0 +1,60 @@
|
||||
|
||||
vim.g.mapleader = ' ';
|
||||
vim.g.maplocalleader = ' ';
|
||||
|
||||
-- vim.g.loaded_netrw = 1;
|
||||
-- vim.g.loaded_netrwPlugin = 1;
|
||||
|
||||
vim.wo.number = true;
|
||||
vim.o.mouse = true;
|
||||
|
||||
-- True colors
|
||||
vim.o.termguicolors = true;
|
||||
|
||||
-- Enable filetype plugins
|
||||
vim.o.filetype = true;
|
||||
|
||||
-- Enable spell checking by default
|
||||
vim.o.spell = true;
|
||||
|
||||
-- Set relative line numbers
|
||||
vim.o.number = true;
|
||||
vim.o.relativenumber = true;
|
||||
vim.o.signcolumn = 'number';
|
||||
|
||||
-- Set indentation
|
||||
vim.o.noexpandtab = true;
|
||||
vim.o.tabstop = 4;
|
||||
vim.o.softtabstop = 4;
|
||||
vim.o.shiftwidth = 4;
|
||||
-- vim.o.expandtab = 4;
|
||||
vim.o.breakindent = true;
|
||||
|
||||
-- Scroll off
|
||||
vim.o.scrolloff = 10;
|
||||
|
||||
-- Line length column
|
||||
vim.o.colorcolumn = '80';
|
||||
|
||||
-- Sync NeoVim and OS clipboards
|
||||
vim.o.clipboard = 'unnamedplus';
|
||||
|
||||
-- Highlight search
|
||||
vim.o.hlsearch = false;
|
||||
vim.o.incsearch = true;
|
||||
|
||||
-- Save undo history
|
||||
vim.o.undofile = true;
|
||||
|
||||
-- Case-insensitive search, unless \C or capital in search
|
||||
vim.o.ignorecase = true;
|
||||
vim.o.smartcase = true;
|
||||
|
||||
vim.wo.signcolumn = 'yes';
|
||||
|
||||
vim.o.updatetime = 250;
|
||||
vim.o.timeoutlen = 300;
|
||||
|
||||
vim.o.completeopt = 'menuone,noselect';
|
||||
|
||||
|
||||
95
lua/pluginlist.lua
Normal file
95
lua/pluginlist.lua
Normal file
@@ -0,0 +1,95 @@
|
||||
return {
|
||||
{
|
||||
'catppuccin/nvim',
|
||||
name = 'catppuccin',
|
||||
priority = 1000,
|
||||
config = function()
|
||||
require('catppuccin').setup({
|
||||
flavour = 'mocha',
|
||||
transparent_background = true,
|
||||
});
|
||||
vim.cmd.colorscheme('catppuccin');
|
||||
end,
|
||||
},
|
||||
{
|
||||
'nvim-lualine/lualine.nvim',
|
||||
opts = {
|
||||
options = {
|
||||
icons_enabled = false,
|
||||
theme = 'catppuccin',
|
||||
component_separators = '|',
|
||||
section_separators = '',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
'lukas-reineke/indent-blankline.nvim',
|
||||
main = 'ibl',
|
||||
opts = {},
|
||||
},
|
||||
{ 'j-hui/fidget.nvim', },
|
||||
{ "williamboman/mason.nvim", },
|
||||
{ "williamboman/mason-lspconfig.nvim", },
|
||||
{ "neovim/nvim-lspconfig", },
|
||||
{ 'folke/which-key.nvim', },
|
||||
{ 'folke/neodev.nvim', },
|
||||
{ 'nvim-tree/nvim-web-devicons', },
|
||||
{
|
||||
'lewis6991/gitsigns.nvim',
|
||||
opts = {
|
||||
signs = {
|
||||
add = { text = '+' },
|
||||
change = { text = '~' },
|
||||
delete = { text = '+' },
|
||||
topdelete = { text = '-' },
|
||||
changedelete = { text = '~' },
|
||||
},
|
||||
on_attach = function (bufnr)
|
||||
vim.keymap.set('n', '<leader>hp', require('gitsigns').preview_hunk, { buffer = bufnr, desc = 'Preview git hunk' });
|
||||
local gs = package.loaded.gitsigns;
|
||||
vim.keymap.set({ 'n', 'v' }, ']c', function()
|
||||
if vim.wo.diff then
|
||||
return ']c';
|
||||
end
|
||||
vim.schedule(function ()
|
||||
gs.next_hunk()
|
||||
end);
|
||||
return '<Ignore>';
|
||||
end, { expr = true, buffer = bufnr, desc = 'Jump to next hunk' });
|
||||
vim.keymap.set({ 'n', 'v' }, '[c', function()
|
||||
if vim.wo.diff then
|
||||
return '[c';
|
||||
end
|
||||
vim.schedule(function ()
|
||||
gs.next_hunk()
|
||||
end);
|
||||
return '<Ignore>';
|
||||
end, { expr = true, buffer = bufnr, desc = 'Jump to previous hunk' });
|
||||
end,
|
||||
},
|
||||
},
|
||||
{
|
||||
'hrsh7th/nvim-cmp',
|
||||
dependencies = {
|
||||
'L3MON4D3/LuaSnip',
|
||||
'saadparwaiz1/cmp_luasnip',
|
||||
'rafamadriz/friendly-snippets',
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'onsails/lspkind.nvim',
|
||||
},
|
||||
},
|
||||
{
|
||||
'nvim-telescope/telescope.nvim',
|
||||
branch = '0.1.x',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
{
|
||||
'nvim-telescope/telescope-fnf-native.nvim',
|
||||
build = 'make',
|
||||
cond = function ()
|
||||
return vim.fn.executable('make') == 1
|
||||
end
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user