aboutsummaryrefslogtreecommitdiffstats
path: root/lua/alpha/scratchs/sample.lua
diff options
context:
space:
mode:
authorAriel D'Alessandro <dalessandro.ariel@gmail.com>2022-12-11 11:00:04 +0100
committerAriel D'Alessandro <dalessandro.ariel@gmail.com>2022-12-11 11:00:28 +0100
commite96308e884375f3a876938f8c83600741f3aa6dd (patch)
tree552588c5d8cbe88cf28b924b6d1c3e74a282bbb3 /lua/alpha/scratchs/sample.lua
parent646b01b619fa36e15804c83a521aab1aec497fd6 (diff)
downloadnvim-conf-e96308e884375f3a876938f8c83600741f3aa6dd.tar.gz
nvim-conf-e96308e884375f3a876938f8c83600741f3aa6dd.zip
fix dressing, change lualine re-add null-ls
Diffstat (limited to 'lua/alpha/scratchs/sample.lua')
-rw-r--r--lua/alpha/scratchs/sample.lua22
1 files changed, 12 insertions, 10 deletions
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('<cword>')
+ 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 :<line1>,<line2>lua reverse_current_word()')
-for _, dir in ipairs(dirs) do
- P(vim.fs.basename(dir))
-end
+-- testing