mirror of
https://github.com/zoriya/dotfiles.git
synced 2026-06-08 12:42:02 +00:00
Adding config for the build tool
This commit is contained in:
@@ -3,13 +3,13 @@ local M = {}
|
||||
M.pattern = "*.sln"
|
||||
|
||||
M.list = function ()
|
||||
-- broken
|
||||
local projs = io.popen("dotnet sln list | tail -n +3")
|
||||
local ret = {}
|
||||
for line in projs:lines() do
|
||||
table.insert(ret, {
|
||||
name = line:match("([^/]+).csproj$"),
|
||||
file = line,
|
||||
icon = "",
|
||||
})
|
||||
end
|
||||
projs:close()
|
||||
|
||||
@@ -2,10 +2,18 @@ local has_icon, nwicon = pcall(require, 'nvim-web-devicons')
|
||||
|
||||
local M = {
|
||||
adapters = {},
|
||||
projects = {},
|
||||
config = {
|
||||
runner = "AsyncRun",
|
||||
},
|
||||
}
|
||||
|
||||
table.insert(M.adapters, require "build.adapters.dotnet")
|
||||
|
||||
M.setup = function (config)
|
||||
M.config = vim.tbl_deep_extend('keep', M.config, config)
|
||||
end
|
||||
|
||||
-- https://stackoverflow.com/questions/49907620/how-to-fuse-array-in-lua
|
||||
local function concatArray(a, b)
|
||||
local result = {unpack(a)}
|
||||
@@ -37,9 +45,20 @@ M.select_proj = function ()
|
||||
return icon .. " " .. proj.name
|
||||
end
|
||||
}, function (proj)
|
||||
|
||||
M.projects[vim.fn.getcwd()] = proj
|
||||
if M.config.on_select then
|
||||
M.config.on_select()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
M.get_project = function ()
|
||||
return M.projects[vim.fn.getcwd()]
|
||||
end
|
||||
|
||||
M.build = function ()
|
||||
vim.cmd(M.config.runner .. " " .. M.get_project().adapter.build())
|
||||
end
|
||||
|
||||
|
||||
return M
|
||||
|
||||
@@ -116,8 +116,8 @@ return packer.startup(function(use)
|
||||
|
||||
use { "lewis6991/gitsigns.nvim", requires = { 'nvim-lua/plenary.nvim' } }
|
||||
|
||||
|
||||
use "tpope/vim-dispatch"
|
||||
|
||||
use "skywind3000/asyncrun.vim"
|
||||
use "datamadsen/vim-compiler-plugin-for-dotnet"
|
||||
|
||||
if PACKER_BOOTSTRAP then
|
||||
|
||||
Reference in New Issue
Block a user