Aded some keybinds and plugins
This commit is contained in:
parent
394cfa6376
commit
790032eb3b
12
init.lua
12
init.lua
|
@ -84,6 +84,9 @@ I hope you enjoy your Neovim journey,
|
|||
P.S. You can delete this when you're done too. It's your config now! :)
|
||||
--]]
|
||||
|
||||
-- Custom config.
|
||||
require 'custom.keybindings'
|
||||
|
||||
-- Set <space> as the leader key
|
||||
-- See `:help mapleader`
|
||||
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
|
||||
|
@ -197,10 +200,6 @@ vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right win
|
|||
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
|
||||
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
|
||||
|
||||
-- Custom Keybinds.
|
||||
vim.keymap.set('i', 'jk', '<Esc>', { desc = 'escape' })
|
||||
vim.keymap.set('i', 'kj', '<Esc>', { desc = 'escape' })
|
||||
|
||||
-- [[ Basic Autocommands ]]
|
||||
-- See `:help lua-guide-autocommands`
|
||||
|
||||
|
@ -918,7 +917,8 @@ require('lazy').setup({
|
|||
-- Manually trigger a completion from nvim-cmp.
|
||||
-- Generally you don't need this, because nvim-cmp will display
|
||||
-- completions whenever it has completion options available.
|
||||
['<C-Space>'] = cmp.mapping.complete {},
|
||||
-- ['<C-Space>'] = cmp.mapping.complete {},
|
||||
['<C-s>'] = cmp.mapping.complete {},
|
||||
|
||||
-- Think of <c-l> as moving to the right of your snippet expansion.
|
||||
-- So if you have a snippet that's like:
|
||||
|
@ -1065,7 +1065,7 @@ require('lazy').setup({
|
|||
-- This is the easiest way to modularize your config.
|
||||
--
|
||||
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
|
||||
-- { import = 'custom.plugins' },
|
||||
{ import = 'custom.plugins' },
|
||||
--
|
||||
-- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
|
||||
-- Or use telescope!
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
-- Custom Keybinds.
|
||||
|
||||
vim.keymap.set('i', 'jk', '<Esc>', { desc = 'escape' })
|
||||
vim.keymap.set('i', 'kj', '<Esc>', { desc = 'escape' })
|
||||
|
||||
-- Перемещение между буферами
|
||||
vim.keymap.set('n', '<Tab>', '<Cmd>BufferLineCycleNext<CR>')
|
||||
vim.keymap.set('n', '<S-Tab>', '<Cmd>BufferLineCyclePrev<CR>')
|
||||
|
||||
-- Закрыть буфер
|
||||
vim.keymap.set('n', '<leader>bd', '<Cmd>Bdelete!<CR>')
|
||||
|
||||
-- Переход к буферу по номеру (например, Alt+1, Alt+2...)
|
||||
for i = 1, 9 do
|
||||
vim.keymap.set('n', '<M-' .. i .. '>', '<Cmd>BufferLineGoToBuffer ' .. i .. '<CR>')
|
||||
end
|
|
@ -2,4 +2,68 @@
|
|||
-- I promise not to create any merge conflicts in this directory :)
|
||||
--
|
||||
-- See the kickstart.nvim README for more information
|
||||
return {}
|
||||
return {
|
||||
{
|
||||
'akinsho/bufferline.nvim',
|
||||
dependencies = 'nvim-tree/nvim-web-devicons',
|
||||
|
||||
event = 'VeryLazy',
|
||||
keys = {
|
||||
{ '<leader>bp', '<Cmd>BufferLineTogglePin<CR>', desc = 'Toggle Pin' },
|
||||
{ '<leader>bP', '<Cmd>BufferLineGroupClose ungrouped<CR>', desc = 'Delete Non-Pinned Buffers' },
|
||||
{ '<leader>br', '<Cmd>BufferLineCloseRight<CR>', desc = 'Delete Buffers to the Right' },
|
||||
{ '<leader>bl', '<Cmd>BufferLineCloseLeft<CR>', desc = 'Delete Buffers to the Left' },
|
||||
{ '<S-h>', '<cmd>BufferLineCyclePrev<cr>', desc = 'Prev Buffer' },
|
||||
{ '<S-l>', '<cmd>BufferLineCycleNext<cr>', desc = 'Next Buffer' },
|
||||
{ '[b', '<cmd>BufferLineCyclePrev<cr>', desc = 'Prev Buffer' },
|
||||
{ ']b', '<cmd>BufferLineCycleNext<cr>', desc = 'Next Buffer' },
|
||||
{ '[B', '<cmd>BufferLineMovePrev<cr>', desc = 'Move buffer prev' },
|
||||
{ ']B', '<cmd>BufferLineMoveNext<cr>', desc = 'Move buffer next' },
|
||||
},
|
||||
opts = {
|
||||
options = {
|
||||
-- stylua: ignore
|
||||
close_command = function(n) Snacks.bufdelete(n) end,
|
||||
-- stylua: ignore
|
||||
right_mouse_command = function(n) Snacks.bufdelete(n) end,
|
||||
diagnostics = 'nvim_lsp',
|
||||
always_show_bufferline = false,
|
||||
diagnostics_indicator = function(_, _, diag)
|
||||
local icons = LazyVim.config.icons.diagnostics
|
||||
local ret = (diag.error and icons.Error .. diag.error .. ' ' or '') .. (diag.warning and icons.Warn .. diag.warning or '')
|
||||
return vim.trim(ret)
|
||||
end,
|
||||
offsets = {
|
||||
{
|
||||
filetype = 'neo-tree',
|
||||
text = 'Neo-tree',
|
||||
highlight = 'Directory',
|
||||
text_align = 'left',
|
||||
},
|
||||
{
|
||||
filetype = 'snacks_layout_box',
|
||||
},
|
||||
},
|
||||
show_buffer_icons = true,
|
||||
color_icons = true,
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
require('bufferline').setup(opts)
|
||||
-- Fix bufferline when restoring a session
|
||||
vim.api.nvim_create_autocmd({ 'BufAdd', 'BufDelete' }, {
|
||||
callback = function()
|
||||
vim.schedule(function()
|
||||
pcall(nvim_bufferline)
|
||||
end)
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
'numToStr/Comment.nvim',
|
||||
opts = {
|
||||
-- add any options here
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -18,6 +18,12 @@ return {
|
|||
window = {
|
||||
mappings = {
|
||||
['\\'] = 'close_window',
|
||||
['<C-cr>'] = {
|
||||
'open',
|
||||
config = {
|
||||
open_command = 'tabnew', -- Альтернативный вариант параметра
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue