Merge branch 'dev' into StyLua-workflow

This commit is contained in:
Marc 2023-04-05 13:44:40 +03:00 committed by GitHub
commit 92e206ae85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 109 additions and 94 deletions

5
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,5 @@
repos:
- repo: https://github.com/JohnnyMorganz/StyLua
rev: v0.17.1
hooks:
- id: stylua-github

10
.stylua.toml Normal file
View File

@ -0,0 +1,10 @@
column_width = 120
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferSingle"
call_parentheses = "NoSingleTable"
collapse_simple_statement = "Never"
[sort_requires]
enabled = false

View File

@ -1,7 +1,7 @@
local M = {}
local defaults = {
position = "right", -- options: top, left, right, bottom
position = 'right', -- options: top, left, right, bottom
width = 80, -- width of window when position is left or right
height = 10, -- height of window when position is top or bottom
}

View File

@ -48,11 +48,11 @@ M.choice = function(handlers)
return function(buffer)
local picker = pickers.new(
{},
themes.get_dropdown({
prompt_title = "Runner",
finder = finders.new_table({
themes.get_dropdown {
prompt_title = 'Runner',
finder = finders.new_table {
results = vim.tbl_keys(handlers),
}),
},
sorter = sorters.get_generic_fuzzy_sorter(),
attach_mappings = function(prompt_bufnr)
actions.select_default:replace(function()
@ -62,7 +62,7 @@ M.choice = function(handlers)
end)
return true
end,
})
}
)
picker:find()
end

View File

@ -1,12 +1,12 @@
local helpers = require("runner.handlers.helpers")
local handlers = {
rust = require("runner.handlers.languages.rust"),
python = require("runner.handlers.languages.python"),
lua = helpers.command_handler("luafile %"),
javascript = require("runner.handlers.languages.nodejs"),
typescript = require("runner.handlers.languages.nodejs"),
vue = require("runner.handlers.languages.nodejs"),
rust = require('runner.handlers.languages.rust'),
python = require('runner.handlers.languages.python'),
lua = helpers.command_handler('luafile %'),
javascript = require('runner.handlers.languages.nodejs'),
typescript = require('runner.handlers.languages.nodejs'),
vue = require('runner.handlers.languages.nodejs'),
}
return handlers

View File

@ -1,5 +1,5 @@
local helpers = require("runner.handlers.helpers")
local utils = require("runner.handlers.utils")
local helpers = require('runner.handlers.helpers')
local utils = require('runner.handlers.utils')
return function(buffer)
utils.run_command(utils.script_path() .. "get-scripts.sh", function(output)
@ -14,7 +14,7 @@ return function(buffer)
end
local handlers = {
["Run current file"] = helpers.shell_handler("node " .. vim.fn.expand("%")),
['Run current file'] = helpers.shell_handler('node ' .. vim.fn.expand('%')),
}
for _, bin in pairs(bins) do

View File

@ -1,5 +1,5 @@
local helpers = require("runner.handlers.helpers")
local utils = require("runner.handlers.utils")
local helpers = require('runner.handlers.helpers')
local utils = require('runner.handlers.utils')
return function(buffer)
utils.run_command(utils.script_path() .. "get-bins.sh", function(output)

View File

@ -23,14 +23,14 @@ M.create_window = function()
return M._window
end
if config.options.position == "right" then
vim.cmd("botright " .. config.options.width .. " vsplit")
elseif config.options.position == "left" then
vim.cmd("topleft " .. config.options.width .. " vsplit")
elseif config.options.position == "bottom" then
vim.cmd("botright " .. config.options.height .. "split")
elseif config.options.position == "top" then
vim.cmd("topleft " .. config.options.height .. "split")
if config.options.position == 'right' then
vim.cmd('botright ' .. config.options.width .. ' vsplit')
elseif config.options.position == 'left' then
vim.cmd('topleft ' .. config.options.width .. ' vsplit')
elseif config.options.position == 'bottom' then
vim.cmd('botright ' .. config.options.height .. 'split')
elseif config.options.position == 'top' then
vim.cmd('topleft ' .. config.options.height .. 'split')
end
local window = vim.api.nvim_get_current_win()
@ -41,8 +41,8 @@ M.create_window = function()
wrap = true,
spell = false,
foldenable = false,
signcolumn = "no",
colorcolumn = "",
signcolumn = 'no',
colorcolumn = '',
cursorline = true,
}

View File

@ -20,7 +20,7 @@ M.run = function(bufnr)
else
buffer = bufnr
end
local filetype = vim.filetype.match({ buf = buffer })
local filetype = vim.filetype.match { buf = buffer }
local handler = M._handlers[filetype]