1
0

Update NeoVIM configuration with build system

This commit is contained in:
Jip J. Dekker 2021-10-16 16:21:06 +11:00
parent 2a29b0e559
commit ac171b055b
No known key found for this signature in database
GPG Key ID: 517DF4A00618C9C3
6 changed files with 101 additions and 34 deletions

View File

@ -10,14 +10,18 @@ require('packer').startup(function()
-- Package manager (Self update)
use 'wbthomason/packer.nvim'
-- General Editing
use 'b3nj5m1n/kommentary' -- 'gc' to comment visual regions/lines
use {
'numToStr/Comment.nvim', -- 'gc' to comment visual regions/lines
config = function()
require('Comment').setup()
end
}
use {
'Konfekt/vim-sentence-chopper', -- 'gw' to split using sentences
config = function() vim.g.latexindent = false end, -- "gw" should not use latexindent
}
use 'beauwilliams/focus.nvim' -- Automatically resize based on focused window
-- Appearance
use {
use {
'cormacrelf/dark-notify', -- Automatic theme switching
requires = {
'hoob3rt/lualine.nvim', -- Status line
@ -33,7 +37,11 @@ require('packer').startup(function()
'folke/which-key.nvim', -- Show key mappings
config = function() require('plugins.keymap') end,
}
-- -- Language configuration
use {
"beauwilliams/focus.nvim",
config = function() require("focus").setup() end,
}
-- Language configuration
use {
'neovim/nvim-lspconfig', -- Configuration of LSP
requires = {
@ -49,9 +57,14 @@ require('packer').startup(function()
require('lang.python')
require('lang.rust')
require('lang.tex')
require('lang.yaml')
require('lang.zinc')
end,
}
use {
'pianocomposer321/yabs.nvim', -- Build System
config = require('lang.build').conf_yabs,
}
-- Auto-completion
use {
'hrsh7th/nvim-cmp',

View File

@ -0,0 +1,58 @@
-- YABS
function conf_yabs()
local c_tasks = {
default_task = "build",
tasks = {
build = {
command = "cmake --build build --config Debug",
output = "quickfix",
},
build_rel = {
command = "cmake --build build --config Release",
output = "quickfix",
},
clean = {
command = "cmake --build build --target clean",
output = "quickfix",
},
}
}
require("yabs"):setup {
languages = {
cpp = c_tasks,
c = c_tasks,
rust = {
default_task = "build",
tasks = {
build = {
command = "cargo build -q",
output = "quickfix",
},
build_rel = {
command = "cargo build -q --release",
output = "quickfix",
},
clean = {
command = "cargo clean",
output = "quickfix",
},
run = {
command = "cargo run",
output = "quickfix",
},
}
},
},
-- Default tasks
tasks = {},
opts = {
output_types = {
quickfix = {
open_on_run = "always"
}
}
},
}
end
return { conf_yabs = conf_yabs }

View File

@ -0,0 +1 @@
vim.cmd('autocmd Filetype yaml setlocal tabstop=2 shiftwidth=2 expandtab')

View File

@ -2,22 +2,26 @@
local conf_cmp = function()
local cmp = require('cmp')
cmp.setup({
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},
mapping = {
['<C-y>'] = cmp.mapping.confirm({ select = true }),
},
sources = {
{ name = 'buffer' },
{ name = 'crates' },
{ name = 'nvim_lua' },
{ name = 'nvim_lsp' },
{ name = 'path' },
}
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},
mapping = {
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.close(),
['<CR>'] = cmp.mapping.confirm({ select = true }),
},
sources = {
{ name = 'buffer' },
{ name = 'crates' },
{ name = 'nvim_lua' },
{ name = 'nvim_lsp' },
{ name = 'path' },
}
})
end
return { conf_cmp = conf_cmp }
return { conf_cmp = conf_cmp }

View File

@ -43,6 +43,8 @@ local mappings = {
-- Project
p = {
f = { "<cmd>lua require('telescope.builtin').find_files()<cr>", "Search Project" },
b = { "<cmd>lua require('yabs'):run_default_task()<cr>", "Build Project" },
t = { "<cmd>lua require('telescope').extensions.yabs.tasks()<cr>", "Search Project" },
},
-- Window

View File

@ -1,17 +1,6 @@
-- Telescope
local conf_telescope = function()
require('telescope').setup {
defaults = {
mappings = {
i = {
["<C-u>"] = false,
["<C-d>"] = false,
},
},
generic_sorter = require'telescope.sorters'.get_fzy_sorter,
file_sorter = require'telescope.sorters'.get_fzy_sorter,
}
}
function conf_telescope()
require("telescope").setup {}
end
return { conf_telescope = conf_telescope }
return { conf_telescope = conf_telescope }