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 M = {}
local defaults = { 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 width = 80, -- width of window when position is left or right
height = 10, -- height of window when position is top or bottom height = 10, -- height of window when position is top or bottom
} }

View File

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

View File

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

View File

@ -1,5 +1,5 @@
local helpers = require("runner.handlers.helpers") local helpers = require('runner.handlers.helpers')
local utils = require("runner.handlers.utils") local utils = require('runner.handlers.utils')
return function(buffer) return function(buffer)
utils.run_command(utils.script_path() .. "get-scripts.sh", function(output) utils.run_command(utils.script_path() .. "get-scripts.sh", function(output)
@ -14,7 +14,7 @@ return function(buffer)
end end
local handlers = { 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 for _, bin in pairs(bins) do

View File

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

View File

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

View File

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