better buffer shortcuts

pull/1710/head
Daniel B Sherry 4 months ago
parent a5207c9491
commit e0e949f2e6

@ -7,8 +7,8 @@ require 'user.keymaps'
require 'user.plugins' require 'user.plugins'
require 'user.colorscheme' require 'user.colorscheme'
require 'user.cmp' require 'user.cmp'
require 'user.lsp'
require 'user.telescope' require 'user.telescope'
require 'user.lsp'
require 'user.treesitter' require 'user.treesitter'
require 'user.autopairs' require 'user.autopairs'
require 'user.nvim-tree' require 'user.nvim-tree'

@ -0,0 +1,13 @@
-- [[ Basic Autocommands ]]
-- See `:help lua-guide-autocommands`
-- Highlight when yanking (copying) text
-- Try it with `yap` in normal mode
-- See `:help vim.highlight.on_yank()`
--
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,
})

@ -33,7 +33,7 @@ bufferline.setup {
-- end, -- end,
max_name_length = 30, max_name_length = 30,
max_prefix_length = 30, -- prefix used when a buffer is de-duplicated max_prefix_length = 30, -- prefix used when a buffer is de-duplicated
tab_size = 21, tab_size = 16,
diagnostics = false, -- | "nvim_lsp" | "coc", diagnostics = false, -- | "nvim_lsp" | "coc",
diagnostics_update_in_insert = false, diagnostics_update_in_insert = false,
-- diagnostics_indicator = function(count, level, diagnostics_dict, context) -- diagnostics_indicator = function(count, level, diagnostics_dict, context)
@ -73,7 +73,7 @@ bufferline.setup {
}, },
highlights = { highlights = {
fill = { fill = {
guifg = { attribute = "fg", highlight = "#ff0000" }, guifg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" }, guibg = { attribute = "bg", highlight = "TabLine" },
}, },
background = { background = {

@ -35,12 +35,17 @@ keymap('n', '<C-Right>', ':vertical resize +2<CR>', opts)
-- Navigate buffers -- Navigate buffers
keymap('n', '<S-l>', ':bnext<CR>', opts) keymap('n', '<S-l>', ':bnext<CR>', opts)
keymap("n", "<leader>n", ":bnext<CR>", opts)
keymap('n', '<S-h>', ':bprevious<CR>', opts) keymap('n', '<S-h>', ':bprevious<CR>', opts)
keymap("n", "<leader>p", ":bprev<CR>", opts)
-- Insert -- -- Insert --
-- Press jk fast to enter -- Press fast to exit
keymap('i', 'jk', '<ESC>', opts) keymap('i', 'jk', '<ESC>', opts)
-- Jump to beginning of line
keymap('n', '<leader>h', '^', opts)
-- Visual -- -- Visual --
-- Stay in indent mode -- Stay in indent mode
keymap('v', '<', '<gv', opts) keymap('v', '<', '<gv', opts)
@ -49,7 +54,9 @@ keymap('v', '>', '>gv', opts)
-- Move text up and down -- Move text up and down
keymap('v', '<A-j>', ':m .+1<CR>==', opts) keymap('v', '<A-j>', ':m .+1<CR>==', opts)
keymap('v', '<A-k>', ':m .-2<CR>==', opts) keymap('v', '<A-k>', ':m .-2<CR>==', opts)
keymap('v', 'p', '"_dP', opts) -- paste over currently selected text without yanking it
keymap('v', 'p', '"_dp', opts)
keymap('v', 'P', '"_dP', opts)
-- Visual Block -- -- Visual Block --
-- Move text up and down -- Move text up and down
@ -83,7 +90,6 @@ vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' }
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' }) vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
-- Slightly advanced example of overriding default behavior and theme
vim.keymap.set('n', '<leader>/', function() vim.keymap.set('n', '<leader>/', function()
-- You can pass additional configuration to Telescope to change the theme, layout, etc. -- You can pass additional configuration to Telescope to change the theme, layout, etc.
builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
@ -108,4 +114,19 @@ end, { desc = '[S]earch [N]eovim files' })
-- Nvimtree -- Nvimtree
keymap("n", "<leader>e", ":NvimTreeToggle<cr>", opts) keymap("n", "<leader>e", ":NvimTreeToggle<cr>", opts)
keymap("n", "<leader>f", ":Format<cr>", opts) -- keymap("n", "<leader>f", ":Format<cr>", opts)
keymap("n", "<leader>w", ":w<cr>", opts)
keymap("n", "<leader>q", ":q<cr>", opts)
keymap("n", "<leader>d", ":bdelete<cr>", opts)
keymap("n", "<C-d>", "<C-d>zz", opts)
keymap("n", "<C-u>", "<C-u>zz", opts)
-- Move line on the screen rather than by line in the file
vim.keymap.set("n", "j", "gj", opts)
vim.keymap.set("n", "k", "gk", opts)
-- Select all
vim.keymap.set("n", "<C-a>", "ggVG", opts)
vim.keymap.set("n", "YY", "va{Vy", opts)

@ -4,6 +4,6 @@ if not status_ok then
end end
require "user.lsp.mason" require "user.lsp.mason"
require("user.lsp.handlers").setup() -- require("user.lsp.handlers").setup()
require "user.lsp.null-ls" require "user.lsp.null-ls"

@ -23,10 +23,10 @@ local settings = {
} }
require("mason").setup(settings) require("mason").setup(settings)
require("mason-lspconfig").setup({ -- require("mason-lspconfig").setup({
ensure_installed = servers, -- ensure_installed = servers,
automatic_installation = true, -- automatic_installation = true,
}) -- })
local lspconfig_status_ok, lspconfig = pcall(require, "lspconfig") local lspconfig_status_ok, lspconfig = pcall(require, "lspconfig")
if not lspconfig_status_ok then if not lspconfig_status_ok then

@ -5,7 +5,7 @@ local options = {
completeopt = { 'menuone', 'noselect' }, -- mostly just for cmp completeopt = { 'menuone', 'noselect' }, -- mostly just for cmp
conceallevel = 0, -- so that `` is visible in markdown files conceallevel = 0, -- so that `` is visible in markdown files
fileencoding = 'utf-8', -- the encoding written to a file fileencoding = 'utf-8', -- the encoding written to a file
hlsearch = true, -- highlight all matches on previous search pattern hlsearch = false, -- highlight all matches on previous search pattern
ignorecase = true, -- ignore case in search patterns ignorecase = true, -- ignore case in search patterns
mouse = 'a', -- allow the mouse to be used in neovim mouse = 'a', -- allow the mouse to be used in neovim
pumheight = 10, -- pop up menu height pumheight = 10, -- pop up menu height
@ -26,7 +26,7 @@ local options = {
tabstop = 2, -- insert 2 spaces for a tab tabstop = 2, -- insert 2 spaces for a tab
cursorline = true, -- highlight the current line cursorline = true, -- highlight the current line
number = true, -- set numbered lines number = true, -- set numbered lines
relativenumber = false, -- set relative numbered lines relativenumber = true, -- set relative numbered lines
numberwidth = 4, -- set number column width to 2 {default 4} numberwidth = 4, -- set number column width to 2 {default 4}
signcolumn = 'yes', -- always show the sign column, otherwise it would shift the text each time signcolumn = 'yes', -- always show the sign column, otherwise it would shift the text each time
wrap = false, -- display lines as one long line wrap = false, -- display lines as one long line

@ -53,7 +53,6 @@ return packer.startup(function(use)
use "lunarvim/darkplus.nvim" use "lunarvim/darkplus.nvim"
use "akinsho/bufferline.nvim" use "akinsho/bufferline.nvim"
use "moll/vim-bbye" use "moll/vim-bbye"
-- cmp plugins -- cmp plugins
use "hrsh7th/nvim-cmp" -- The completion plugin use "hrsh7th/nvim-cmp" -- The completion plugin
use "hrsh7th/cmp-buffer" -- buffer completions use "hrsh7th/cmp-buffer" -- buffer completions

@ -0,0 +1,5 @@
x = [1, 2, 3]
for item in x:
print(item)
# print(type(mydict))
Loading…
Cancel
Save