Always make :Build/:BuildDir available
Don't attached this functionality to only c/cpp filetypes.
This commit is contained in:
parent
0c1328ead4
commit
831ac41440
@ -1 +0,0 @@
|
|||||||
require('build').create_commands()
|
|
@ -1,4 +1,2 @@
|
|||||||
vim.opt.commentstring = '//%s'
|
vim.opt.commentstring = '//%s'
|
||||||
vim.opt.matchpairs:append('<:>')
|
vim.opt.matchpairs:append('<:>')
|
||||||
|
|
||||||
require('build').create_commands()
|
|
||||||
|
@ -151,22 +151,20 @@ function build.list_targets()
|
|||||||
return targets
|
return targets
|
||||||
end
|
end
|
||||||
|
|
||||||
function build.create_commands()
|
local buffer = vim.api.nvim_get_current_buf()
|
||||||
local buffer = vim.api.nvim_get_current_buf()
|
|
||||||
|
|
||||||
-- Create :BuildDir command
|
-- Create :BuildDir command
|
||||||
vim.api.nvim_buf_create_user_command(buffer, 'BuildDir', function(opts)
|
vim.api.nvim_buf_create_user_command(buffer, 'BuildDir', function(opts)
|
||||||
build.set_dir(opts.fargs[1])
|
build.set_dir(opts.fargs[1])
|
||||||
end, {
|
end, {
|
||||||
bang = true, nargs = '?', complete = build.list_dirs,
|
bang = true, nargs = '?', complete = build.list_dirs,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Create :Build command
|
-- Create :Build command
|
||||||
vim.api.nvim_buf_create_user_command(buffer, 'Build', function(opts)
|
vim.api.nvim_buf_create_user_command(buffer, 'Build', function(opts)
|
||||||
build.run(opts.fargs)
|
build.run(opts.fargs)
|
||||||
end, {
|
end, {
|
||||||
bang = true, nargs = '*', complete = build.list_targets,
|
bang = true, nargs = '*', complete = build.list_targets,
|
||||||
})
|
})
|
||||||
end
|
|
||||||
|
|
||||||
return build
|
return build
|
||||||
|
Loading…
x
Reference in New Issue
Block a user