setting up

This commit is contained in:
BearDad 2024-11-20 18:45:09 +01:00
parent c4aabd2da3
commit 271f3fbc2f
3 changed files with 80 additions and 4 deletions

View File

@ -981,6 +981,7 @@ require('lazy').setup({
--
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
{ import = 'custom.plugins' },
--
-- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
-- Or use telescope!
@ -1103,9 +1104,6 @@ vim.g.vimtex_view_method = ''
vim.g.vimtex_compiler_method = 'latexmk'
vim.opt.guicursor = 'a:block'
vim.keymap.set('v', 'J', ":m '>+1<CR>gv=gv", { desc = 'Move down' })
vim.keymap.set('v', 'K', ":m '<-2<CR>gv=gv", { desc = 'Move up' })
vim.keymap.set('n', '<leader>n', '<cmd>NerdIcons<cr>', { desc = 'Open NerdIcons' })
vim.keymap.set({ 'n', 'v' }, '<C-p>', '"*p', { desc = 'Paste from selection clipboard' })
vim.keymap.set({ 'n', 'v' }, 'p', '"+p', { desc = 'Paste from system clipboard' })
@ -1131,3 +1129,47 @@ vim.keymap.set({ 'n' }, '<leader>o', function()
print 'No file found. Make sure the buffer is saved.'
end
end, { desc = 'Open file ' })
-- NOTE: THESE ARE FROM https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
vim.keymap.set({ 'n', 'x' }, 'j', "v:count == 0 ? 'gj' : 'j'", { desc = 'Down', expr = true, silent = true })
vim.keymap.set({ 'n', 'x' }, '<Down>', "v:count == 0 ? 'gj' : 'j'", { desc = 'Down', expr = true, silent = true })
vim.keymap.set({ 'n', 'x' }, 'k', "v:count == 0 ? 'gk' : 'k'", { desc = 'Up', expr = true, silent = true })
vim.keymap.set({ 'n', 'x' }, '<Up>', "v:count == 0 ? 'gk' : 'k'", { desc = 'Up', expr = true, silent = true })
-- to window using the <ctrl> hjkl keys
vim.keymap.set('n', '<C-h>', '<C-w>h', { desc = 'Go to Left Window', remap = true })
vim.keymap.set('n', '<C-j>', '<C-w>j', { desc = 'Go to Lower Window', remap = true })
vim.keymap.set('n', '<C-k>', '<C-w>k', { desc = 'Go to Upper Window', remap = true })
vim.keymap.set('n', '<C-l>', '<C-w>l', { desc = 'Go to Right Window', remap = true })
vim.keymap.set('n', '<A-j>', "<cmd>execute 'move .+' . v:count1<cr>==", { desc = 'Move Down' })
vim.keymap.set('n', '<A-k>', "<cmd>execute 'move .-' . (v:count1 + 1)<cr>==", { desc = 'Move Up' })
vim.keymap.set('i', '<A-j>', '<esc><cmd>m .+1<cr>==gi', { desc = 'Move Down' })
vim.keymap.set('i', '<A-k>', '<esc><cmd>m .-2<cr>==gi', { desc = 'Move Up' })
vim.keymap.set('v', '<A-j>', ":<C-u>execute \"'<,'>move '>+\" . v:count1<cr>gv=gv", { desc = 'Move Down' })
vim.keymap.set('v', '<A-k>', ":<C-u>execute \"'<,'>move '<-\" . (v:count1 + 1)<cr>gv=gv", { desc = 'Move Up' })
-- better indenting
vim.keymap.set('v', '<', '<gv')
vim.keymap.set('v', '>', '>gv')
-- commenting
vim.keymap.set('n', 'gco', 'o<esc>Vcx<esc><cmd>normal gcc<cr>fxa<bs>', { desc = 'Add Comment Below' })
vim.keymap.set('n', 'gcO', 'O<esc>Vcx<esc><cmd>normal gcc<cr>fxa<bs>', { desc = 'Add Comment Above' })
-- windows
vim.keymap.set('n', '<leader>w', '<c-w>', { desc = 'Windows', remap = true })
vim.keymap.set('n', '<leader>-', '<C-W>s', { desc = 'Split Window Below', remap = true })
vim.keymap.set('n', '<leader>|', '<C-W>v', { desc = 'Split Window Right', remap = true })
vim.keymap.set('n', '<leader>wd', '<C-W>c', { desc = 'Delete Window', remap = true })
-- native snippets
if vim.fn.has 'nvim-0.11' == 0 then
vim.keymap.set('s', '<Tab>', function()
return vim.snippet.active { direction = 1 } and '<cmd>lua vim.snippet.jump(1)<cr>' or '<Tab>'
end, { expr = true, desc = 'Jump Next' })
vim.keymap.set({ 'i', 's' }, '<S-Tab>', function()
return vim.snippet.active { direction = -1 } and '<cmd>lua vim.snippet.jump(-1)<cr>' or '<S-Tab>'
end, { expr = true, desc = 'Jump Previous' })
end

View File

@ -0,0 +1,34 @@
return {
vim.g.vimtex_view_method == '',
vim.g.vimtex_compiler_method == 'latexmk',
vim.opt.guicursor == 'a:block',
vim.keymap.set('v', 'J', ":m '>+1<CR>gv=gv", { desc = 'Move down' }),
vim.keymap.set('v', 'K', ":m '<-2<CR>gv=gv", { desc = 'Move up' }),
vim.keymap.set('n', '<leader>n', '<cmd>NerdIcons<cr>', { desc = 'Open NerdIcons' }),
vim.keymap.set({ 'n', 'v' }, '<C-p>', '"*p', { desc = 'Paste from selection clipboard' }),
vim.keymap.set({ 'n', 'v' }, 'p', '"+p', { desc = 'Paste from system clipboard' }),
vim.keymap.set({ 'v', 'n' }, '<leader>t', '<cmd>TSBufToggle highlight<cr>', { desc = 'Toggle Tree-sitter highlighting' }),
vim.keymap.set('n', '<leader>z', ":!zathura <C-r>=expand('%:r')<cr>.pdf &<cr>", { desc = 'Open PDF' }),
vim.keymap.set({ 'n' }, '<leader>p', function()
local file_name = vim.fn.expand '%:t'
if file_name ~= '' then
-- Open Explorer in the current directory and select the file
vim.fn.system { 'explorer.exe', '/select,', file_name }
else
print 'No file name found. Save the buffer first.'
end
end, { desc = 'Open file location in Explorer' }),
vim.keymap.set({ 'n' }, '<leader>o', function()
local file_name = vim.fn.expand '%:t'
if file_name ~= '' then
-- Open Explorer in the current directory and select the file
vim.fn.system { 'explorer.exe', file_name }
else
print 'No file found. Make sure the buffer is saved.'
end
end, { desc = 'Open file ' }),
}

View File

@ -5,7 +5,7 @@ return {
---@type snacks.Config
opts = {
bigfile = { enabled = true },
dashboard = { enabled = true },
dashboard = { enabled = false },
notifier = {
enabled = true,
timeout = 3000,