diff --git a/init.lua b/init.lua index 7e9ee387..f25917a0 100644 --- a/init.lua +++ b/init.lua @@ -809,6 +809,8 @@ require('lazy').setup({ javascript = { 'prettier' }, typescript = { 'prettier' }, typescriptreact = { 'prettier' }, + markdown = { 'markdownlint' }, + yaml = { 'prettier' }, }, }, }, diff --git a/lua/custom/plugins/colorscheme.lua b/lua/custom/plugins/colorscheme.lua index f454843b..5aacdcbf 100644 --- a/lua/custom/plugins/colorscheme.lua +++ b/lua/custom/plugins/colorscheme.lua @@ -5,11 +5,12 @@ return { config = function() vim.o.background = 'dark' -- or 'light' vim.cmd.colorscheme 'solarized' - vim.keymap.set('n', 'Scl', function() - vim.o.background = 'light' - end, { desc = '[S]et the [c]olorscheme background [l]ight' }) - vim.keymap.set('n', 'Scd', function() - vim.o.background = 'dark' - end, { desc = '[S]et the [c]olorscheme background [d]ark' }) + vim.keymap.set('n', 'tc', function() + if vim.o.background == 'light' then + vim.o.background = 'dark' + else + vim.o.background = 'light' + end + end, { desc = '[T]oggle the [c]olorscheme background' }) end, } diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 7cdfafbc..e386b73c 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -10,6 +10,37 @@ vim.keymap.set('n', '', '', { desc = 'Move focus to the right win vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) +local function copy_path(path_type) + local path_to_copy + local msg_suffix + + if path_type == 'full' then + path_to_copy = vim.fn.expand '%:p' + msg_suffix = 'full path' + elseif path_type == 'relative' then + path_to_copy = vim.fn.expand '%:.' + msg_suffix = 'relative path' + elseif path_type == 'filename' then + path_to_copy = vim.fn.expand '%:t' + msg_suffix = 'filename' + else + print 'Invalid path type specified for copy_path' + return + end + + vim.fn.setreg('+', path_to_copy) + print('Copied ' .. msg_suffix .. ' to clipboard') +end +vim.keymap.set('n', 'cp', function() + copy_path 'full' +end, { desc = 'Copy full file path' }) +vim.keymap.set('n', 'cr', function() + copy_path 'relative' +end, { desc = 'Copy relative file path' }) +vim.keymap.set('n', 'cf', function() + copy_path 'filename' +end, { desc = 'Copy filename' }) + require('guess-indent').setup {} return {}