wrapped some stuff in do-end blocks
This commit is contained in:
@@ -243,7 +243,8 @@ local function packer_startup(use)
|
||||
}
|
||||
end
|
||||
|
||||
local function file_exists(name)
|
||||
do
|
||||
local function file_exists(name)
|
||||
local f = io.open(name,"r")
|
||||
|
||||
if f~=nil then
|
||||
@@ -252,14 +253,14 @@ local function file_exists(name)
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Opens a default .snippets file for the filetype you are currently editing in a horizontal split pane.
|
||||
-- If the .snippets file does not exist, it will be created.
|
||||
-- This requires the snippets folder to exist in the config folder.
|
||||
-- If the folder does not exist, the command will print out a helpful error message showing what the path
|
||||
-- should look like.
|
||||
vim.api.nvim_create_user_command(
|
||||
-- Opens a default .snippets file for the filetype you are currently editing in a horizontal split pane.
|
||||
-- If the .snippets file does not exist, it will be created.
|
||||
-- This requires the snippets folder to exist in the config folder.
|
||||
-- If the folder does not exist, the command will print out a helpful error message showing what the path
|
||||
-- should look like.
|
||||
vim.api.nvim_create_user_command(
|
||||
'S',
|
||||
function ()
|
||||
---@type string
|
||||
@@ -280,34 +281,38 @@ vim.api.nvim_create_user_command(
|
||||
vim.api.nvim_command(('SnippyEdit %s'):format(snippets_path))
|
||||
end,
|
||||
{ nargs = 0 }
|
||||
)
|
||||
)
|
||||
end
|
||||
|
||||
local tab_whitespace = ''
|
||||
for _ = 1, tab_width do
|
||||
-- local function split_line()
|
||||
-- local line = vim.api.nvim_get_current_line()
|
||||
-- local items = vim.split(line, ", *")
|
||||
-- local indent = string.match(line, "^%s*")
|
||||
|
||||
-- local formatted_items = {items[1] .. ','}
|
||||
-- for i = 2, #items -1 do
|
||||
-- table.insert(formatted_items, indent .. tab_whitespace .. items[i] .. ',')
|
||||
-- end
|
||||
-- table.insert(formatted_items, indent .. tab_whitespace .. items[#items] )
|
||||
|
||||
-- local row, _ = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
-- vim.api.nvim_buf_set_lines(0, row-1, row, false, formatted_items)
|
||||
-- end
|
||||
|
||||
local split_line
|
||||
do
|
||||
local tab_whitespace = ''
|
||||
for _ = 1, tab_width do
|
||||
tab_whitespace = tab_whitespace .. ' '
|
||||
end
|
||||
|
||||
local function split_line()
|
||||
local line = vim.api.nvim_get_current_line()
|
||||
local items = vim.split(line, ", *")
|
||||
local indent = string.match(line, "^%s*")
|
||||
|
||||
local formatted_items = {items[1] .. ','}
|
||||
for i = 2, #items -1 do
|
||||
table.insert(formatted_items, indent .. tab_whitespace .. items[i] .. ',')
|
||||
end
|
||||
table.insert(formatted_items, indent .. tab_whitespace .. items[#items] )
|
||||
|
||||
local row, _ = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
vim.api.nvim_buf_set_lines(0, row-1, row, false, formatted_items)
|
||||
end
|
||||
|
||||
local BRACKETS = {
|
||||
local BRACKETS = {
|
||||
['{'] ='}',
|
||||
['['] = ']',
|
||||
['('] = ')'
|
||||
}
|
||||
local function split_line()
|
||||
}
|
||||
|
||||
split_line = function()
|
||||
local line = vim.api.nvim_get_current_line()
|
||||
local leading_whitespace = string.match(line, "^%s*")
|
||||
local leading_indented_whitespace = leading_whitespace .. tab_whitespace
|
||||
@@ -333,6 +338,7 @@ local function split_line()
|
||||
end
|
||||
::continue::
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user