diff options
Diffstat (limited to 'Common/nvim')
-rwxr-xr-x | Common/nvim/lua/helper_functions.lua | 20 | ||||
-rwxr-xr-x | Common/nvim/lua/plugins.lua | 9 |
2 files changed, 29 insertions, 0 deletions
diff --git a/Common/nvim/lua/helper_functions.lua b/Common/nvim/lua/helper_functions.lua index cac6c00..715c2a7 100755 --- a/Common/nvim/lua/helper_functions.lua +++ b/Common/nvim/lua/helper_functions.lua @@ -21,6 +21,26 @@ function ToggleListChars() vim.opt.listchars = list_chars_enabled and list_chars_when_enabled or 'eol:$' end +-- Command to join lines in buffer as list +function JoinLines(args, quotes) + r = args.args + o = "" + for k, v in pairs(vim.fn.getreg(r, 1, 1)) do + if k > 1 then o = o .. ", " end + if quotes ~= nil then o = o .. quotes end + o = o .. v:match( "^%s*(.-)%s*$" ) -- Strip leading and trailing + if quotes ~= nil then o = o .. quotes end + end + vim.fn.setreg(r, o) +end +function JoinLinesSQ(args) JoinLines(args, "'") end +function JoinLinesDQ(args) JoinLines(args, '"') end +function JoinLinesBT(args) JoinLines(args, "`") end +vim.api.nvim_create_user_command('JoinLines', JoinLines, {bang=false, desc='Joins all lines in a register', nargs='?'}) +vim.api.nvim_create_user_command('JoinLinesSQ', JoinLinesSQ, {bang=false, desc='Joins all lines in a register', nargs='?'}) +vim.api.nvim_create_user_command('JoinLinesDQ', JoinLinesDQ, {bang=false, desc='Joins all lines in a register', nargs='?'}) +vim.api.nvim_create_user_command('JoinLinesBT', JoinLinesBT, {bang=false, desc='Joins all lines in a register', nargs='?'}) + -- Close buffer without closing window --[[ vim.cmd [[ diff --git a/Common/nvim/lua/plugins.lua b/Common/nvim/lua/plugins.lua index 555dad3..3077560 100755 --- a/Common/nvim/lua/plugins.lua +++ b/Common/nvim/lua/plugins.lua @@ -16,6 +16,8 @@ vim.cmd([[ return require('packer').startup(function(use) -- Packer itself :) use 'wbthomason/packer.nvim' + -- targets (extends vim's targets, allowing things like multiline select inside backticks) + use 'wellle/targets.vim'; -- GitSigns use { @@ -160,6 +162,13 @@ return require('packer').startup(function(use) use 'mfussenegger/nvim-jdtls' + -- Goyo :) + use { + 'junegunn/goyo.vim' + } + use { 'smithbm2316/centerpad.nvim' } + + -- packer.nvim -- Automatically set up your configuration after cloning packer.nvim -- Put this at the end after all plugins if packer_bootstrap then |