Skip to content

Commit 47425cf

Browse files
Add minimal_init to scripts folder. Closes nvim-orgmode#325.
1 parent 2cd3ae6 commit 47425cf

File tree

2 files changed

+56
-1
lines changed

2 files changed

+56
-1
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ body:
3636
required: true
3737
attributes:
3838
label: Minimal init.lua
39-
description: Please provide minimal init.lua to reproduce the issue. You can find the template here https://gist.github.com/kristijanhusak/a0cb5f4eb2bad3e732a1d18d311ebe2f. Once set up, you can run it with `nvim -u minimal_init.lua`.
39+
description: Please provide minimal init.lua to reproduce the issue. You can find the template here https://github.com/nvim-orgmode/orgmode/blob/master/scripts/minimal_init.lua. Once set up, you can run it with `nvim -u minimal_init.lua`.
4040
- type: textarea
4141
attributes:
4242
label: Screenshots and recordings

scripts/minimal_init.lua

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
vim.cmd([[set runtimepath=$VIMRUNTIME]])
2+
vim.cmd([[set packpath=/tmp/nvim/site]])
3+
4+
local package_root = '/tmp/nvim/site/pack'
5+
local install_path = package_root .. '/packer/start/packer.nvim'
6+
7+
local function load_plugins()
8+
require('packer').startup({
9+
{
10+
'wbthomason/packer.nvim',
11+
{ 'nvim-treesitter/nvim-treesitter' },
12+
{ 'kristijanhusak/orgmode.nvim', branch = 'master' },
13+
},
14+
config = {
15+
package_root = package_root,
16+
compile_path = install_path .. '/plugin/packer_compiled.lua',
17+
},
18+
})
19+
end
20+
21+
_G.load_config = function()
22+
require('orgmode').setup_ts_grammar()
23+
require('nvim-treesitter.configs').setup({
24+
highlight = {
25+
enable = true,
26+
additional_vim_regex_highlighting = { 'org' },
27+
},
28+
})
29+
30+
vim.cmd([[packadd nvim-treesitter]])
31+
vim.cmd([[runtime plugin/nvim-treesitter.lua]])
32+
vim.cmd([[TSUpdateSync org]])
33+
34+
-- Close packer after install
35+
if vim.bo.filetype == 'packer' then
36+
vim.api.nvim_win_close(0, true)
37+
end
38+
39+
require('orgmode').setup()
40+
41+
-- Reload current file if it's org file to reload tree-sitter
42+
if vim.bo.filetype == 'org' then
43+
vim.cmd([[edit!]])
44+
end
45+
end
46+
47+
if vim.fn.isdirectory(install_path) == 0 then
48+
vim.fn.system({ 'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path })
49+
load_plugins()
50+
require('packer').sync()
51+
vim.cmd([[autocmd User PackerCompileDone ++once lua load_config()]])
52+
else
53+
load_plugins()
54+
load_config()
55+
end

0 commit comments

Comments
 (0)