moar keymaps and plugins
This commit is contained in:
parent
2e2df21633
commit
84c3b5ac7d
|
@ -1,5 +1,6 @@
|
|||
local lspconfig = require 'lspconfig'
|
||||
local lspsettings = require 'custom.plugins.configs.lspsettings'
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
|
||||
-- these are using the defaults
|
||||
local servers = {
|
||||
|
@ -16,7 +17,9 @@ local servers = {
|
|||
}
|
||||
|
||||
for _, lsp in ipairs(servers) do
|
||||
lspconfig[lsp].setup {}
|
||||
lspconfig[lsp].setup {
|
||||
capabilities = capabilities,
|
||||
}
|
||||
end
|
||||
|
||||
local server_with_settings = {
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
return {
|
||||
{
|
||||
'numToStr/Comment.nvim',
|
||||
keys = {
|
||||
{ 'gcc', mode = 'n', desc = 'Comment toggle current line' },
|
||||
{ 'gc', mode = { 'n', 'o' }, desc = 'Comment toggle linewise' },
|
||||
{ 'gc', mode = 'x', desc = 'Comment toggle linewise (visual)' },
|
||||
{ 'gbc', mode = 'n', desc = 'Comment toggle current block' },
|
||||
{ 'gb', mode = { 'n', 'o' }, desc = 'Comment toggle blockwise' },
|
||||
{ 'gb', mode = 'x', desc = 'Comment toggle blockwise (visual)' },
|
||||
},
|
||||
init = function()
|
||||
require('core.utils').load_mappings 'comment'
|
||||
end,
|
||||
config = function(_, opts)
|
||||
vim.keymap.set('n', '<leader>c', function()
|
||||
require('Comment.api').toggle.linewise.current()
|
||||
end, { desc = '[T]oggle [C]omment' })
|
||||
vim.keymap.set('v', '<leader>c', function()
|
||||
require('Comment.api').toggle.linewise.current()
|
||||
end, { desc = '[T]oggle [C]omment' })
|
||||
|
||||
require('Comment').setup(opts)
|
||||
end,
|
||||
},
|
||||
}
|
|
@ -1,75 +1,6 @@
|
|||
return {
|
||||
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
|
||||
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
|
||||
|
||||
-- NOTE: Plugins can also be added by using a table,
|
||||
-- with the first argument being the link and the following
|
||||
-- keys can be used to configure plugin behavior/loading/etc.
|
||||
--
|
||||
-- Use `opts = {}` to force a plugin to be loaded.
|
||||
--
|
||||
-- This is equivalent to:
|
||||
-- require('Comment').setup({})
|
||||
|
||||
-- "gc" to comment visual regions/lines
|
||||
{ 'numToStr/Comment.nvim', opts = {} },
|
||||
|
||||
-- Here is a more advanced example where we pass configuration
|
||||
-- options to `gitsigns.nvim`. This is equivalent to the following Lua:
|
||||
-- require('gitsigns').setup({ ... })
|
||||
--
|
||||
-- See `:help gitsigns` to understand what the configuration keys do
|
||||
{ -- Adds git related signs to the gutter, as well as utilities for managing changes
|
||||
'lewis6991/gitsigns.nvim',
|
||||
opts = {
|
||||
signs = {
|
||||
add = { text = '+' },
|
||||
change = { text = '~' },
|
||||
delete = { text = '_' },
|
||||
topdelete = { text = '‾' },
|
||||
changedelete = { text = '~' },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- NOTE: Plugins can also be configured to run Lua code when they are loaded.
|
||||
--
|
||||
-- This is often very useful to both group configuration, as well as handle
|
||||
-- lazy loading plugins that don't need to be loaded immediately at startup.
|
||||
--
|
||||
-- For example, in the following configuration, we use:
|
||||
-- event = 'VimEnter'
|
||||
--
|
||||
-- which loads which-key before all the UI elements are loaded. Events can be
|
||||
-- normal autocommands events (`:help autocmd-events`).
|
||||
--
|
||||
-- Then, because we use the `config` key, the configuration only runs
|
||||
-- after the plugin has been loaded:
|
||||
-- config = function() ... end
|
||||
|
||||
{ -- Useful plugin to show you pending keybinds.
|
||||
'folke/which-key.nvim',
|
||||
event = 'VimEnter', -- Sets the loading event to 'VimEnter'
|
||||
config = function() -- This is the function that runs, AFTER loading
|
||||
require('which-key').setup()
|
||||
|
||||
-- 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>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
|
||||
['<localleader>f'] = { name = '[F]ind', _ = 'which_key_ignore' },
|
||||
['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
|
||||
['<leader>t'] = { name = '[T]oggle', _ = 'which_key_ignore' },
|
||||
['<leader>h'] = { name = 'Git [H]unk', _ = 'which_key_ignore' },
|
||||
}
|
||||
-- visual mode
|
||||
require('which-key').register({
|
||||
['<leader>h'] = { 'Git [H]unk' },
|
||||
}, { mode = 'v' })
|
||||
end,
|
||||
},
|
||||
|
||||
-- NOTE: Plugins can specify dependencies.
|
||||
--
|
||||
-- The dependencies are proper plugin specifications as well - anything
|
||||
|
@ -79,10 +10,10 @@ return {
|
|||
|
||||
{ -- Fuzzy Finder (files, lsp, etc)
|
||||
'nvim-telescope/telescope.nvim',
|
||||
event = 'VimEnter',
|
||||
branch = '0.1.x',
|
||||
cmd = 'Telescope',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
{ -- If encountering errors, see telescope-fzf-native README for installation instructions
|
||||
'nvim-telescope/telescope-fzf-native.nvim',
|
||||
|
||||
|
@ -138,6 +69,19 @@ return {
|
|||
require('telescope.themes').get_dropdown(),
|
||||
},
|
||||
},
|
||||
defaults = {
|
||||
vimgrep_arguments = {
|
||||
'rg',
|
||||
'-L',
|
||||
'--color=never',
|
||||
'--no-heading',
|
||||
'--with-filename',
|
||||
'--line-number',
|
||||
'--column',
|
||||
'--smart-case',
|
||||
},
|
||||
prompt_prefix = ' ',
|
||||
},
|
||||
}
|
||||
|
||||
-- Enable Telescope extensions if they are installed
|
||||
|
@ -149,16 +93,20 @@ return {
|
|||
vim.keymap.set('n', '<localleader>fh', builtin.help_tags, { desc = '[F]ind [H]elp' })
|
||||
vim.keymap.set('n', '<localleader>fk', builtin.keymaps, { desc = '[F]ind [K]eymaps' })
|
||||
vim.keymap.set('n', '<localleader>ff', builtin.find_files, { desc = '[F]ind [F]iles' })
|
||||
vim.keymap.set('n', '<localleader>fs', builtin.builtin, { desc = '[F]ind [S]elect Telescope' })
|
||||
vim.keymap.set('n', '<localleader>fw', builtin.grep_string, { desc = '[F]ind current [W]ord' })
|
||||
vim.keymap.set('n', '<localleader>fg', builtin.live_grep, { desc = '[F]ind by [G]rep' })
|
||||
vim.keymap.set('n', '<localleader>ft', builtin.builtin, { desc = '[F]ind [T]elescope' })
|
||||
vim.keymap.set('n', '<localleader>fw', builtin.live_grep, { desc = '[F]ind a [W]ord interactively' })
|
||||
vim.keymap.set('n', '<localleader>fcw', builtin.grep_string, { desc = '[F]ind [C]urrent [W]ord' })
|
||||
vim.keymap.set('n', '<localleader>fd', builtin.diagnostics, { desc = '[F]ind [D]iagnostics' })
|
||||
vim.keymap.set('n', '<localleader>fr', builtin.resume, { desc = '[F]ind [R]esume' })
|
||||
vim.keymap.set('n', '<localleader>f.', builtin.oldfiles, { desc = '[F]ind Recent Files ("." for repeat)' })
|
||||
vim.keymap.set('n', '<localleader>fof.', builtin.oldfiles, { desc = '[F]ind [O]ld Files ("." for repeat)' })
|
||||
vim.keymap.set('n', '<localleader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
|
||||
vim.keymap.set('n', '<localleader>fb', builtin.buffers, { desc = '[F]ind existing [B]uffers' })
|
||||
vim.keymap.set('n', '<localleader>fm', builtin.marks, { desc = '[F]ind book[M]arks' })
|
||||
vim.keymap.set('n', '<localleader>fd', builtin.diagnostics, { desc = '[F]ind LSP [D]iagnostigs' })
|
||||
vim.keymap.set('n', '<localleader>fs', builtin.lsp_dynamic_workspace_symbols, { desc = '[F]ind LSP [S]ymbols' })
|
||||
|
||||
-- Slightly advanced example of overriding default behavior and theme
|
||||
vim.keymap.set('n', '<leader>/', function()
|
||||
vim.keymap.set('n', '<localleader>/', function()
|
||||
-- You can pass additional configuration to Telescope to change the theme, layout, etc.
|
||||
builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
||||
winblend = 10,
|
||||
|
@ -168,7 +116,7 @@ return {
|
|||
|
||||
-- It's also possible to pass additional configuration options.
|
||||
-- See `:help telescope.builtin.live_grep()` for information about particular keys
|
||||
vim.keymap.set('n', '<leader>s/', function()
|
||||
vim.keymap.set('n', '<localleader>f/', function()
|
||||
builtin.live_grep {
|
||||
grep_open_files = true,
|
||||
prompt_title = 'Live Grep in Open Files',
|
||||
|
@ -176,9 +124,9 @@ return {
|
|||
end, { desc = '[F]ind [/] in Open Files' })
|
||||
|
||||
-- Shortcut for searching your Neovim configuration files
|
||||
vim.keymap.set('n', '<leader>sn', function()
|
||||
vim.keymap.set('n', '<leader>fnf', function()
|
||||
builtin.find_files { cwd = vim.fn.stdpath 'config' }
|
||||
end, { desc = '[F]ind [N]eovim files' })
|
||||
end, { desc = '[F]ind [N]eovim [F]iles' })
|
||||
end,
|
||||
},
|
||||
|
||||
|
|
|
@ -2,7 +2,20 @@ return {
|
|||
{
|
||||
'neovim/nvim-lspconfig',
|
||||
config = function()
|
||||
require "custom.plugins.configs.lsp"
|
||||
require 'custom.plugins.configs.lsp'
|
||||
end,
|
||||
},
|
||||
-- See `:help gitsigns` to understand what the configuration keys do
|
||||
{ -- Adds git related signs to the gutter, as well as utilities for managing changes
|
||||
'lewis6991/gitsigns.nvim',
|
||||
opts = {
|
||||
signs = {
|
||||
add = { text = '+' },
|
||||
change = { text = '~' },
|
||||
delete = { text = '_' },
|
||||
topdelete = { text = '‾' },
|
||||
changedelete = { text = '~' },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
return {}
|
|
@ -1,5 +1,4 @@
|
|||
return {
|
||||
|
||||
{
|
||||
'nvim-tree/nvim-tree.lua',
|
||||
cmd = { 'NvimTreeToggle', 'NvimTreeFocus' },
|
||||
|
@ -32,7 +31,7 @@ return {
|
|||
},
|
||||
{
|
||||
'kdheepak/lazygit.nvim',
|
||||
keys = { '<leader>gg' },
|
||||
keys = { '<leader>gg', '<cmd> LazyGit <cr>', 'Open LazyGit' },
|
||||
cmd = 'LazyGit',
|
||||
-- optional for floating window border decoration
|
||||
dependencies = {
|
||||
|
@ -130,7 +129,28 @@ return {
|
|||
})
|
||||
end,
|
||||
},
|
||||
{ -- Useful plugin to show you pending keybinds.
|
||||
'folke/which-key.nvim',
|
||||
event = 'VimEnter', -- Sets the loading event to 'VimEnter'
|
||||
config = function() -- This is the function that runs, AFTER loading
|
||||
require('which-key').setup()
|
||||
|
||||
-- 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>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
|
||||
['<localleader>f'] = { name = '[F]ind', _ = 'which_key_ignore' },
|
||||
['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
|
||||
['<leader>t'] = { name = '[T]oggle', _ = 'which_key_ignore' },
|
||||
['<leader>h'] = { name = 'Git [H]unk', _ = 'which_key_ignore' },
|
||||
}
|
||||
-- visual mode
|
||||
require('which-key').register({
|
||||
['<leader>h'] = { 'Git [H]unk' },
|
||||
}, { mode = 'v' })
|
||||
end,
|
||||
},
|
||||
{
|
||||
'RRethy/vim-illuminate',
|
||||
lazy = false,
|
||||
|
@ -220,4 +240,66 @@ return {
|
|||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
'folke/trouble.nvim',
|
||||
cmd = 'Trouble',
|
||||
opts = { use_diagnostic_signs = true },
|
||||
-- stylua: ignore
|
||||
keys = {
|
||||
{ '<leader>rb', "<cmd>Trouble diagnostics toggle filter.buf=0<cr>", desc = 'Document Diagnostics (Trouble)' },
|
||||
{ '<leader>rr', '<cmd>Trouble diagnostics toggle<cr>', desc = 'Workspace Diagnostics (Trouble)' },
|
||||
{ '<leader>rq', "<cmd>Trouble qflist toggle<cr>", desc = 'Quickfix List (Trouble)' },
|
||||
{ '<leader>rl', "<cmd>Trouble loclist toggle<cr>", desc = 'Location List (Trouble)' },
|
||||
{ '<leader>rd', "<cmd>Trouble symbols<cr>", desc = 'LSP symbols (Trouble)' },
|
||||
{ '<leader>rt', "<cmd>Trouble todo<cr>", desc = 'Todos (Trouble)' },
|
||||
{
|
||||
'[q',
|
||||
function()
|
||||
if require('trouble').is_open() then
|
||||
require('trouble').previous({ skip_groups = true, jump = true })
|
||||
else
|
||||
vim.cmd.cprev()
|
||||
end
|
||||
end,
|
||||
desc = 'Previous trouble/quickfix item',
|
||||
},
|
||||
{
|
||||
']q',
|
||||
function()
|
||||
if require('trouble').is_open() then
|
||||
require('trouble').next({ skip_groups = true, jump = true })
|
||||
else
|
||||
vim.cmd.cnext()
|
||||
end
|
||||
end,
|
||||
desc = 'Next trouble/quickfix item',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
'akinsho/toggleterm.nvim',
|
||||
keys = {
|
||||
{ '<F12>', '<cmd>exe v:count1 "ToggleTerm direction=float"<cr>', desc = 'Toggle a big floating terminal' },
|
||||
{ '<A-i>', '<cmd>exe v:count1 "ToggleTerm direction=float"<cr>', desc = 'Toggle a big floating terminal' },
|
||||
{ '<A-t>', '<cmd>exe v:count1 "ToggleTerm direction=tab"<cr>', desc = 'Toggle a terminal in a new tab' },
|
||||
{ '<A-h>', '<cmd>exe v:count1 "ToggleTerm direction=horizontal"<cr>', desc = 'Toggle a horizontal terminal' },
|
||||
{ '<A-v>', '<cmd>exe v:count1 "ToggleTerm direction=vertical"<cr>', desc = 'Toggle a vertical terminal' },
|
||||
},
|
||||
cmd = 'ToggleTerm',
|
||||
opts = {
|
||||
size = function(term)
|
||||
if term.direction == 'horizontal' then
|
||||
return vim.o.lines * 0.35
|
||||
elseif term.direction == 'vertical' then
|
||||
return vim.o.columns * 0.35
|
||||
else
|
||||
return 20
|
||||
end
|
||||
end,
|
||||
open_mapping = false,
|
||||
float_opts = {
|
||||
border = 'curved',
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue