Switched to lazy vim as packer stopped working.
Will need to clear the .local/shared/nvim/site directory to stop using the packer packages. I guess I made a build and run? that's neat.
This commit is contained in:
parent
4a09b836c1
commit
48eb0d8d60
|
@ -1 +1,2 @@
|
|||
[Pp]lugin/
|
||||
lazy-lock.json
|
||||
|
|
23
init.lua
23
init.lua
|
@ -1,6 +1,25 @@
|
|||
-- Only required if you have packer configured as `opt`
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable", -- latest stable release
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
require("lazy").setup({
|
||||
"morhetz/gruvbox",
|
||||
"neovim/nvim-lspconfig",
|
||||
{ "nvim-telescope/telescope.nvim", dependencies = {"nvim-lua/plenary.nvim"} },
|
||||
"windwp/nvim-autopairs",
|
||||
"sheerun/vim-polyglot",
|
||||
"habamax/vim-godot",
|
||||
})
|
||||
require('statusline')
|
||||
require('packer_init')
|
||||
--require('packer_init')
|
||||
require('keybindings')
|
||||
--vim.opt.guicursor = " "
|
||||
|
||||
|
|
|
@ -28,6 +28,25 @@ local function get_build_cmd()
|
|||
return ""
|
||||
end
|
||||
|
||||
local function get_buildnrun_cmd()
|
||||
for path, type in vim.fs.dir(vim.fn.getcwd(), nil)
|
||||
do
|
||||
if (path == "build.zig") then
|
||||
return "zig build run"
|
||||
end
|
||||
-- TODO(twig): build and run on other langauges
|
||||
--if (path == "build.bat" or path == "build.sh") then
|
||||
-- if (vim.loop.os_uname().sysname == "Windows_NT") then
|
||||
-- -- TODO(twig): if I move to llvm this should work, right now cl doesn't work because nvim spawns a command prompt that doesn't have vcvars in it (nor does it have my stuff)
|
||||
-- return "build.bat"
|
||||
-- else
|
||||
-- -- TODO(twig): this is untested!
|
||||
-- return "./build.sh"
|
||||
-- end
|
||||
--end
|
||||
end
|
||||
return ""
|
||||
end
|
||||
function save_all_and_build()
|
||||
if job_id then
|
||||
print("Job processing")
|
||||
|
@ -53,3 +72,30 @@ function save_all_and_build()
|
|||
job_id = vim.fn.termopen(build_cmd, {on_exit = job_exit})
|
||||
vim.api.nvim_buf_set_name(job_buffer, '[build]')
|
||||
end
|
||||
|
||||
function save_all_and_buildnrun()
|
||||
if job_id then
|
||||
print("Job processing")
|
||||
return
|
||||
end
|
||||
|
||||
local opts = {}
|
||||
vim.api.nvim_exec('wa', opts)
|
||||
|
||||
if not has_buffer() then
|
||||
job_buffer = vim.api.nvim_create_buf(true, true)
|
||||
end
|
||||
local job_window = vim.fn.bufwinnr(job_buffer)
|
||||
if job_window ~= -1 then
|
||||
vim.cmd(job_window .. ' wincmd w')
|
||||
else
|
||||
vim.cmd('buffer ' .. job_buffer)
|
||||
end
|
||||
vim.api.nvim_buf_set_option(job_buffer, 'filetype', 'build')
|
||||
vim.api.nvim_buf_set_option(job_buffer, 'modified', false)
|
||||
-- THis looks at files in the cwd and decides if there is something to build (build.zig for zig, build.bat/.sh for c++)
|
||||
local build_cmd = get_build_cmd()
|
||||
job_id = vim.fn.termopen(build_cmd, {on_exit = job_exit})
|
||||
vim.api.nvim_buf_set_name(job_buffer, '[build]')
|
||||
end
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ vim.keymap.set('n', '<leader>e', '<cmd>Ex<CR>', opts)
|
|||
vim.keymap.set('n', '<leader>ff', tbuiltin.find_files, opts)
|
||||
vim.keymap.set('n', '<leader>fb', '<cmd>Telescope buffers<cr>', opts)
|
||||
vim.keymap.set('n', '<leader>bb', save_all_and_build, opts)
|
||||
vim.keymap.set('n', '<leader>br', save_all_and_buildnrun, opts)
|
||||
-- TODO: get fancy and read the commentstring and user
|
||||
vim.keymap.set('i', '<A-t>', '// TODO(twig): ', opts)
|
||||
vim.keymap.set('i', '<A-y>', '// NOTE(twig): ', opts)
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
vim.cmd [[packadd packer.nvim]]
|
||||
|
||||
return require('packer').startup(function(use)
|
||||
-- Packer can manage itself
|
||||
use 'wbthomason/packer.nvim'
|
||||
-- themes
|
||||
--use 'sainnhe/everforest'
|
||||
--use 'sainnhe/sonokai'
|
||||
--use { 'tomasr/molokai' }
|
||||
use 'morhetz/gruvbox'
|
||||
-- Treesitter
|
||||
--use { 'nvim-treesitter/nvim-treesitter' }
|
||||
--use 'nvim-treesitter/nvim-treesitter-context'
|
||||
--use { 'nvim-treesitter/playground', requires = {{'nvim-treesitter/nvim-treesitter'}} }
|
||||
-- Utils
|
||||
use 'neovim/nvim-lspconfig'
|
||||
use { 'nvim-telescope/telescope.nvim', tag = '0.1.0', requires = {{'nvim-lua/plenary.nvim'}} }
|
||||
use { 'windwp/nvim-autopairs' }
|
||||
use 'sheerun/vim-polyglot'
|
||||
use 'habamax/vim-godot'
|
||||
end)
|
||||
--vim.cmd [[packadd packer.nvim]]
|
||||
--
|
||||
--return require('packer').startup(function(use)
|
||||
-- -- Packer can manage itself
|
||||
-- use 'wbthomason/packer.nvim'
|
||||
-- -- themes
|
||||
-- --use 'sainnhe/everforest'
|
||||
-- --use 'sainnhe/sonokai'
|
||||
-- --use { 'tomasr/molokai' }
|
||||
-- use 'morhetz/gruvbox'
|
||||
-- -- Treesitter
|
||||
-- --use { 'nvim-treesitter/nvim-treesitter' }
|
||||
-- --use 'nvim-treesitter/nvim-treesitter-context'
|
||||
-- --use { 'nvim-treesitter/playground', requires = {{'nvim-treesitter/nvim-treesitter'}} }
|
||||
-- -- Utils
|
||||
-- use 'neovim/nvim-lspconfig'
|
||||
-- use { 'nvim-telescope/telescope.nvim', tag = '0.1.0', requires = {{'nvim-lua/plenary.nvim'}} }
|
||||
-- use { 'windwp/nvim-autopairs' }
|
||||
-- use 'sheerun/vim-polyglot'
|
||||
-- use 'habamax/vim-godot'
|
||||
--end)
|
||||
|
|
Loading…
Reference in New Issue