First of all, I'm not a programmer, but a musician. I just happen to (kind of) know how to use the terminal, and I use a music notation/engraving program called LilyPond that works in the terminal.
Now, I'm trying to setup the init.lua file in Neovim on Android with Termux.
My problem is, I'm trying to install some plugins with packer.nvim (as well as packer.nvim):
- packer
- nvim-lilypond-suite
- overseer
...and I don't seem to understand the instructions on the GitHub pages. So far I understand "Just write these lines of code there", so I assume I can place them as I feel like, as long as they're "in order" (take that as you will).
I somehow managed to get the plugins installed (or so I think), but I also needed to write the configuration of the plugins (like the syntax highlighting of LilyPond, etc.). I tried looking for how to set up the configuration of plugins, but I just got more confused so I tried what my brain could. And now Neovim gives me a bunch of errors and Packer commands don't seem to work anymore.
This is my current tree:
tree
├── init.lua
├── lua
│ └── plugins
│ ├── nvim-lilypond-suite.lua
│ ├── overseer.lua
│ └── packer.lua
└── plugin
└── packer_compiled.lua
3 directories, 5 files
This is my init.lua:
local ensure_packer = function()
local fn = vim.fn
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then
fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
vim.cmd [[packadd packer.nvim]]
return true
end
return false
end
local packer_bootstrap = ensure_packer()
return require('packer').startup(function(use)
use 'wbthomason/packer.nvim'
-- My plugins here
-- use 'foo1/bar1.nvim'
-- use 'foo2/bar2.nvim'
use {
'martineausimon/nvim-lilypond-suite',
requires = { 'MunifTanjim/nui.nvim' }
}
require('overseer').setup()
vim.api.nvim_create_autocmd('BufEnter', {
command = "syntax sync fromstart",
pattern = { '*.ly', '*.ily', '*.tex' }
})
local hi = vim.api.nvim_set_hl
hi(0, 'Keyword', { ctermfg = "yellow", bold = true })
hi(0, 'Tag', { ctermfg = "blue" })
hi(0, 'Label', { ctermfg = "lightYellow" })
hi(0, 'SpecialComment', { ctermfg = "lightCyan" })
hi(0, 'SpecialChar', { ctermfg = "lightMagenta", bold = true })
hi(0, 'PreCondit', { ctermfg = "cyan" })
vim.api.nvim_create_autocmd( 'QuickFixCmdPost', {
command = "cwindow",
pattern = "*"
})
local overseer = require('overseer')
overseer.register_template({
name = "lilypond",
builder = function(params)
return {
cmd = {"lilypond", vim.fn.expand("%:p:t")},
name = "lilypond",
cwd = "",
env = {},
components = {
"default",
},
metadata = {},
}
end,
desc = "Compile lilypond file",
tags = {overseer.TAG.BUILD},
params = {},
priority = 50,
condition = {
filetype = {"lilypond"},
},
})
use {'neoclide/coc.nvim', branch = 'release'}
require('lua/plugins/packer.lua')
require('lua/plugins/nvim-lilypond-suite.lua')
require('lua/plugins/overseer.lua')
-- Automatically set up your configuration after cloning packer.nvim
-- Put this at the end after all plugins
if packer_bootstrap then
require('packer').sync()
end
end)
This is my nvim-lilypond-suite.lua:
require('nvls').setup({
lilypond = {
mappings = {
player = "<F3>",
compile = "<F5>",
open_pdf = "<F6>",
switch_buffers = "<A-Space>",
insert_version = "<F4>",
hyphenation = "<F12>",
hyphenation_change_lang = "<F11>",
insert_hyphen = "<leader>ih",
add_hyphen = "<leader>ah",
del_next_hyphen = "<leader>dfh",
del_prev_hyphen = "<leader>dFh",
del_selected_hyphen = "<leader>dh"
},
options = {
pitches_language = "default",
output = "pdf",
main_file = "main.ly",
main_folder = "%:p:h",
hyphenation_language = "en_DEFAULT",
},
},
latex = {
mappings = {
compile = "<F5>",
open_pdf = "<F6>",
lilypond_syntax = "<F3>"
},
options = {
clean_logs = false
},
},
player = {
mappings = {
quit = "q",
play_pause = "p",
loop = "<A-l>",
backward = "h",
small_backward = "<S-h>",
forward = "l",
small_forward = "<S-l>",
decrease_speed = "j",
increase_speed = "k",
halve_speed = "<S-j>",
double_speed = "<S-k>"
},
options = {
row = "2%",
col = "99%",
width = "37",
height = "1",
border_style = "single",
winhighlight = "Normal:Normal,FloatBorder:Normal"
},
},
})
This is my overseer.lua:
require('packer').startup(function()
use {
'stevearc/overseer.nvim',
config = function() require('overseer').setup() end
}
end)
And this is my packer.lua:
local ensure_packer = function()
local fn = vim.fn
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then
fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
vim.cmd [[packadd packer.nvim]]
return true
end
return false
end
local packer_bootstrap = ensure_packer()
return require('packer').startup(function(use)
use 'wbthomason/packer.nvim'
-- My plugins here
-- use 'foo1/bar1.nvim'
-- use 'foo2/bar2.nvim'
use {
'martineausimon/nvim-lilypond-suite',
requires = { 'MunifTanjim/nui.nvim' }
}
-- Automatically set up your configuration after cloning packer.nvim
-- Put this at the end after all plugins
if packer_bootstrap then
require('packer').sync()
end
end)
Probably I just duplicated some things, but I'm just so tired to try to understand what I did and analyze the code.
Thank you for your time. Any help will be really appreciated!