Lisp support and so on
This commit is contained in:
parent
e145f9f06d
commit
e9fe358191
4 changed files with 65 additions and 0 deletions
|
|
@ -38,4 +38,16 @@ vim.api.nvim_create_user_command('CDToGitRoot', function()
|
|||
end
|
||||
end, { desc = 'Change directory to the current Git repository root' })
|
||||
|
||||
vim.api.nvim_create_user_command('WordCount', function()
|
||||
local buf = vim.api.nvim_get_current_buf()
|
||||
local lines = vim.api.nvim_buf_get_lines(buf, 0, -1, false)
|
||||
local words = 0
|
||||
for _, line in ipairs(lines) do
|
||||
for _ in line:gmatch '%S+' do
|
||||
words = words + 1
|
||||
end
|
||||
end
|
||||
print('Word count: ' .. words)
|
||||
end, { desc = 'Count words in current buffer' })
|
||||
|
||||
-- vim: ts=2 sts=2 sw=2 et
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue