From e96308e884375f3a876938f8c83600741f3aa6dd Mon Sep 17 00:00:00 2001 From: Ariel D'Alessandro Date: Sun, 11 Dec 2022 11:00:04 +0100 Subject: fix dressing, change lualine re-add null-ls --- lua/alpha/scratchs/sample.lua | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'lua/alpha/scratchs/sample.lua') diff --git a/lua/alpha/scratchs/sample.lua b/lua/alpha/scratchs/sample.lua index a2d783e..80b0b77 100644 --- a/lua/alpha/scratchs/sample.lua +++ b/lua/alpha/scratchs/sample.lua @@ -1,12 +1,14 @@ -local scandir = require("plenary.scandir") - - +function reverse_current_word() + local line = vim.fn.getline('.') + local current_word = vim.fn.expand('') + local start_index = vim.fn.col('.') - #current_word + 1 + local reversed_word = current_word:reverse() + + local reversed_line = line:sub(1, start_index -1)..reversed_word..line:sub(start_index+#current_word) + P(reversed_line) + vim.fn.setline('.', reversed_line) +end -local dirs = scandir.scan_dir( - { "/home/alpha/code/php" }, - { depth = 1, only_dirs = true } -) +vim.api.nvim_command('command! -range=% ReverseWord :,lua reverse_current_word()') -for _, dir in ipairs(dirs) do - P(vim.fs.basename(dir)) -end +-- testing -- cgit v1.2.3