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) -- Package manager (Self update)
use 'wbthomason/packer.nvim' use 'wbthomason/packer.nvim'
-- General Editing -- 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 { use {
'Konfekt/vim-sentence-chopper', -- 'gw' to split using sentences 'Konfekt/vim-sentence-chopper', -- 'gw' to split using sentences
config = function() vim.g.latexindent = false end, -- "gw" should not use latexindent config = function() vim.g.latexindent = false end, -- "gw" should not use latexindent
} }
use 'beauwilliams/focus.nvim' -- Automatically resize based on focused window
-- Appearance -- Appearance
use { use {
'cormacrelf/dark-notify', -- Automatic theme switching 'cormacrelf/dark-notify', -- Automatic theme switching
requires = { requires = {
'hoob3rt/lualine.nvim', -- Status line 'hoob3rt/lualine.nvim', -- Status line
@ -33,7 +37,11 @@ require('packer').startup(function()
'folke/which-key.nvim', -- Show key mappings 'folke/which-key.nvim', -- Show key mappings
config = function() require('plugins.keymap') end, config = function() require('plugins.keymap') end,
} }
-- -- Language configuration use {
"beauwilliams/focus.nvim",
config = function() require("focus").setup() end,
}
-- Language configuration
use { use {
'neovim/nvim-lspconfig', -- Configuration of LSP 'neovim/nvim-lspconfig', -- Configuration of LSP
requires = { requires = {
@ -49,9 +57,14 @@ require('packer').startup(function()
require('lang.python') require('lang.python')
require('lang.rust') require('lang.rust')
require('lang.tex') require('lang.tex')
require('lang.yaml')
require('lang.zinc') require('lang.zinc')
end, end,
} }
use {
'pianocomposer321/yabs.nvim', -- Build System
config = require('lang.build').conf_yabs,
}
-- Auto-completion -- Auto-completion
use { use {
'hrsh7th/nvim-cmp', '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,21 +2,25 @@
local conf_cmp = function() local conf_cmp = function()
local cmp = require('cmp') local cmp = require('cmp')
cmp.setup({ cmp.setup({
snippet = { snippet = {
expand = function(args) expand = function(args)
vim.fn["vsnip#anonymous"](args.body) vim.fn["vsnip#anonymous"](args.body)
end, end,
}, },
mapping = { mapping = {
['<C-y>'] = cmp.mapping.confirm({ select = true }), ['<C-d>'] = cmp.mapping.scroll_docs(-4),
}, ['<C-f>'] = cmp.mapping.scroll_docs(4),
sources = { ['<C-Space>'] = cmp.mapping.complete(),
{ name = 'buffer' }, ['<C-e>'] = cmp.mapping.close(),
{ name = 'crates' }, ['<CR>'] = cmp.mapping.confirm({ select = true }),
{ name = 'nvim_lua' }, },
{ name = 'nvim_lsp' }, sources = {
{ name = 'path' }, { name = 'buffer' },
} { name = 'crates' },
{ name = 'nvim_lua' },
{ name = 'nvim_lsp' },
{ name = 'path' },
}
}) })
end end

View File

@ -43,6 +43,8 @@ local mappings = {
-- Project -- Project
p = { p = {
f = { "<cmd>lua require('telescope.builtin').find_files()<cr>", "Search Project" }, 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 -- Window

View File

@ -1,17 +1,6 @@
-- Telescope -- Telescope
local conf_telescope = function() function conf_telescope()
require('telescope').setup { 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,
}
}
end end
return { conf_telescope = conf_telescope } return { conf_telescope = conf_telescope }