mirror of
https://github.com/LunarVim/LunarVim.git
synced 2024-09-20 18:45:08 +02:00
Merge branch 'rolling'
This commit is contained in:
commit
e6ececed17
19 changed files with 547 additions and 278 deletions
4
.github/workflows/format.yaml
vendored
4
.github/workflows/format.yaml
vendored
|
@ -1,10 +1,8 @@
|
||||||
name: format
|
name: format
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
branches: "**"
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- "master"
|
|
||||||
- "rolling"
|
- "rolling"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
45
.github/workflows/install.yaml
vendored
45
.github/workflows/install.yaml
vendored
|
@ -1,7 +1,6 @@
|
||||||
name: install
|
name: install
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
branches: ["**"]
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- "master"
|
- "master"
|
||||||
|
@ -37,27 +36,27 @@ jobs:
|
||||||
# NOTE: make sure to adjust the timeout if you start adding a lot of tests
|
# NOTE: make sure to adjust the timeout if you start adding a lot of tests
|
||||||
timeout-minutes: 4
|
timeout-minutes: 4
|
||||||
run: make test
|
run: make test
|
||||||
# freebsd:
|
|
||||||
# runs-on: macos-latest
|
|
||||||
# if: github.event.pull_request.draft == false
|
|
||||||
# continue-on-error: true # we don't support freebsd yet
|
|
||||||
# name: "FreeBSD macos-latest"
|
|
||||||
# steps:
|
|
||||||
# - uses: actions/checkout@v2
|
|
||||||
|
|
||||||
# - name: Install dependencies for FreeBSD
|
windows:
|
||||||
# uses: vmactions/freebsd-vm@v0.1.5
|
name: "windows-latest"
|
||||||
# with:
|
runs-on: windows-latest
|
||||||
# prepare: pkg install -y curl neovim
|
if: github.event.pull_request.draft == false
|
||||||
# run: bash ./utils/installer/install.sh
|
continue-on-error: true # windows support is still experimental
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: pwsh
|
||||||
|
steps:
|
||||||
|
# it's not currently possbile to run tests on windows, see nvim-lua/plenary.nvim#255
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
# - name: Test LunarVim PackerCompile
|
- name: Install neovim binary
|
||||||
# uses: vmactions/freebsd-vm@v0.1.5
|
uses: rhysd/action-setup-vim@v1
|
||||||
# with:
|
with:
|
||||||
# run: if nvim --headless +PackerCompile -c ':qall' 2>&1|grep -q 'Error'; then false; fi
|
neovim: true
|
||||||
|
version: v0.6.1
|
||||||
# - name: Test LunarVim Health
|
|
||||||
# uses: vmactions/freebsd-vm@v0.1.5
|
|
||||||
# with:
|
|
||||||
# run: if nvim --headless +checkhealth -c ':qall' 2>&1|grep -q 'Error'; then false; fi
|
|
||||||
|
|
||||||
|
- name: Install LunarVim
|
||||||
|
timeout-minutes: 4
|
||||||
|
run: |
|
||||||
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
||||||
|
pwsh.exe -NoLogo -ExecutionPolicy Bypass -NonInteractive -Command "./utils/installer/install.ps1 --local"
|
||||||
|
|
4
.github/workflows/lint.yaml
vendored
4
.github/workflows/lint.yaml
vendored
|
@ -1,10 +1,8 @@
|
||||||
name: lint
|
name: lint
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
branches: "**"
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- "master"
|
|
||||||
- "rolling"
|
- "rolling"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
12
README.md
12
README.md
|
@ -28,12 +28,18 @@ You can find all the documentation for LunarVim at [lunarvim.org](https://www.lu
|
||||||
|
|
||||||
Make sure you have the release version of Neovim (0.6.1+).
|
Make sure you have the release version of Neovim (0.6.1+).
|
||||||
|
|
||||||
Linux:
|
### Linux:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bash <(curl -s https://raw.githubusercontent.com/lunarvim/lunarvim/master/utils/installer/install.sh)
|
bash <(curl -s https://raw.githubusercontent.com/lunarvim/lunarvim/master/utils/installer/install.sh)
|
||||||
```
|
```
|
||||||
|
|
||||||
Windows (Powershell):
|
To run the install script without any interaction you can pass the `-y` flag to automatically install all dependencies and have no prompts. This is particularly useful in automated installations.
|
||||||
|
|
||||||
|
The same way, you can use `--no-install-dependencies` to skip the dependency installation.
|
||||||
|
|
||||||
|
### Windows (Powershell):
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
Invoke-WebRequest https://raw.githubusercontent.com/LunarVim/LunarVim/master/utils/installer/install.ps1 -UseBasicParsing | Invoke-Expression
|
Invoke-WebRequest https://raw.githubusercontent.com/LunarVim/LunarVim/master/utils/installer/install.ps1 -UseBasicParsing | Invoke-Expression
|
||||||
```
|
```
|
||||||
|
@ -86,7 +92,7 @@ lvim.builtin.treesitter.ignore_install = { "haskell" }
|
||||||
-- Disable virtual text
|
-- Disable virtual text
|
||||||
lvim.lsp.diagnostics.virtual_text = false
|
lvim.lsp.diagnostics.virtual_text = false
|
||||||
|
|
||||||
-- Select which servers should be configured manually. Requires `:LvimCacheRest` to take effect.
|
-- Select which servers should be configured manually. Requires `:LvimCacheReset` to take effect.
|
||||||
-- See the full default list `:lua print(vim.inspect(lvim.lsp.override))`
|
-- See the full default list `:lua print(vim.inspect(lvim.lsp.override))`
|
||||||
vim.list_extend(lvim.lsp.override, { "pyright" })
|
vim.list_extend(lvim.lsp.override, { "pyright" })
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,8 @@ M.load_default_options = function()
|
||||||
}
|
}
|
||||||
|
|
||||||
--- SETTINGS ---
|
--- SETTINGS ---
|
||||||
vim.opt.shortmess:append "c"
|
vim.opt.shortmess:append "c" -- don't show redundant messages from ins-completion-menu
|
||||||
|
vim.opt.shortmess:append "I" -- don't show the default intro message
|
||||||
vim.opt.whichwrap:append "<,>,[,],h,l"
|
vim.opt.whichwrap:append "<,>,[,],h,l"
|
||||||
|
|
||||||
for k, v in pairs(default_options) do
|
for k, v in pairs(default_options) do
|
||||||
|
|
|
@ -9,11 +9,18 @@ function M.config()
|
||||||
disable_netrw = true,
|
disable_netrw = true,
|
||||||
hijack_netrw = true,
|
hijack_netrw = true,
|
||||||
open_on_setup = false,
|
open_on_setup = false,
|
||||||
|
ignore_buffer_on_setup = false,
|
||||||
ignore_ft_on_setup = {
|
ignore_ft_on_setup = {
|
||||||
"startify",
|
"startify",
|
||||||
"dashboard",
|
"dashboard",
|
||||||
"alpha",
|
"alpha",
|
||||||
},
|
},
|
||||||
|
auto_reload_on_write = true,
|
||||||
|
hijack_unnamed_buffer_when_opening = false,
|
||||||
|
hijack_directories = {
|
||||||
|
enable = true,
|
||||||
|
auto_open = true,
|
||||||
|
},
|
||||||
update_to_buf_dir = {
|
update_to_buf_dir = {
|
||||||
enable = true,
|
enable = true,
|
||||||
auto_open = true,
|
auto_open = true,
|
||||||
|
@ -67,17 +74,27 @@ function M.config()
|
||||||
cmd = "trash",
|
cmd = "trash",
|
||||||
require_confirm = true,
|
require_confirm = true,
|
||||||
},
|
},
|
||||||
|
actions = {
|
||||||
|
change_dir = {
|
||||||
|
global = false,
|
||||||
|
},
|
||||||
|
open_file = {
|
||||||
|
quit_on_open = false,
|
||||||
|
},
|
||||||
|
window_picker = {
|
||||||
|
enable = false,
|
||||||
|
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
|
||||||
|
exclude = {},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
show_icons = {
|
show_icons = {
|
||||||
git = 1,
|
git = 1,
|
||||||
folders = 1,
|
folders = 1,
|
||||||
files = 1,
|
files = 1,
|
||||||
folder_arrows = 1,
|
folder_arrows = 1,
|
||||||
tree_width = 30,
|
|
||||||
},
|
},
|
||||||
quit_on_open = 0,
|
|
||||||
git_hl = 1,
|
git_hl = 1,
|
||||||
disable_window_picker = 0,
|
|
||||||
root_folder_modifier = ":t",
|
root_folder_modifier = ":t",
|
||||||
icons = {
|
icons = {
|
||||||
default = "",
|
default = "",
|
||||||
|
@ -118,21 +135,25 @@ function M.setup()
|
||||||
if lvim.builtin.project.active then
|
if lvim.builtin.project.active then
|
||||||
lvim.builtin.nvimtree.respect_buf_cwd = 1
|
lvim.builtin.nvimtree.respect_buf_cwd = 1
|
||||||
lvim.builtin.nvimtree.setup.update_cwd = true
|
lvim.builtin.nvimtree.setup.update_cwd = true
|
||||||
lvim.builtin.nvimtree.setup.disable_netrw = false
|
lvim.builtin.nvimtree.setup.update_focused_file = { enable = true, update_cwd = true }
|
||||||
lvim.builtin.nvimtree.setup.hijack_netrw = false
|
end
|
||||||
vim.g.netrw_banner = false
|
|
||||||
|
local function telescope_find_files(_)
|
||||||
|
require("lvim.core.nvimtree").start_telescope "find_files"
|
||||||
|
end
|
||||||
|
local function telescope_live_grep(_)
|
||||||
|
require("lvim.core.nvimtree").start_telescope "live_grep"
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Add useful keymaps
|
-- Add useful keymaps
|
||||||
local tree_cb = nvim_tree_config.nvim_tree_callback
|
|
||||||
if #lvim.builtin.nvimtree.setup.view.mappings.list == 0 then
|
if #lvim.builtin.nvimtree.setup.view.mappings.list == 0 then
|
||||||
lvim.builtin.nvimtree.setup.view.mappings.list = {
|
lvim.builtin.nvimtree.setup.view.mappings.list = {
|
||||||
{ key = { "l", "<CR>", "o" }, cb = tree_cb "edit" },
|
{ key = { "l", "<CR>", "o" }, action = "edit", mode = "n" },
|
||||||
{ key = "h", cb = tree_cb "close_node" },
|
{ key = "h", action = "close_node" },
|
||||||
{ key = "v", cb = tree_cb "vsplit" },
|
{ key = "v", action = "vsplit" },
|
||||||
{ key = "C", cb = tree_cb "cd" },
|
{ key = "C", action = "cd" },
|
||||||
{ key = "gtf", cb = "<cmd>lua require'lvim.core.nvimtree'.start_telescope('find_files')<cr>" },
|
{ key = "gtf", action = "telescope_find_files", action_cb = telescope_find_files },
|
||||||
{ key = "gtg", cb = "<cmd>lua require'lvim.core.nvimtree'.start_telescope('live_grep')<cr>" },
|
{ key = "gtg", action = "telescope_live_grep", action_cb = telescope_live_grep },
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,15 @@ function M.config()
|
||||||
layout_config = {
|
layout_config = {
|
||||||
width = 0.75,
|
width = 0.75,
|
||||||
preview_cutoff = 120,
|
preview_cutoff = 120,
|
||||||
horizontal = { mirror = false },
|
horizontal = {
|
||||||
|
preview_width = function(_, cols, _)
|
||||||
|
if cols < 120 then
|
||||||
|
return math.floor(cols * 0.5)
|
||||||
|
end
|
||||||
|
return math.floor(cols * 0.6)
|
||||||
|
end,
|
||||||
|
mirror = false,
|
||||||
|
},
|
||||||
vertical = { mirror = false },
|
vertical = { mirror = false },
|
||||||
},
|
},
|
||||||
vimgrep_arguments = {
|
vimgrep_arguments = {
|
||||||
|
@ -91,11 +99,7 @@ function M.code_actions()
|
||||||
width = 80,
|
width = 80,
|
||||||
height = 12,
|
height = 12,
|
||||||
},
|
},
|
||||||
borderchars = {
|
borderchars = lvim.builtin.telescope.defaults.borderchars,
|
||||||
prompt = { "─", "│", " ", "│", "╭", "╮", "│", "│" },
|
|
||||||
results = { "─", "│", "─", "│", "├", "┤", "╯", "╰" },
|
|
||||||
preview = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
|
|
||||||
},
|
|
||||||
border = {},
|
border = {},
|
||||||
previewer = false,
|
previewer = false,
|
||||||
shorten_path = false,
|
shorten_path = false,
|
||||||
|
@ -149,7 +153,9 @@ function M.setup()
|
||||||
end
|
end
|
||||||
|
|
||||||
if lvim.builtin.telescope.extensions and lvim.builtin.telescope.extensions.fzf then
|
if lvim.builtin.telescope.extensions and lvim.builtin.telescope.extensions.fzf then
|
||||||
require("telescope").load_extension "fzf"
|
pcall(function()
|
||||||
|
require("telescope").load_extension "fzf"
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,9 @@ local copy_to_clipboard_action = function(prompt_bufnr)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.view_lunarvim_changelog()
|
function M.view_lunarvim_changelog()
|
||||||
local opts = themes.get_ivy { cwd = get_lvim_base_dir() }
|
local opts = themes.get_ivy {
|
||||||
|
cwd = get_lvim_base_dir(),
|
||||||
|
}
|
||||||
opts.entry_maker = make_entry.gen_from_git_commits(opts)
|
opts.entry_maker = make_entry.gen_from_git_commits(opts)
|
||||||
|
|
||||||
pickers.new(opts, {
|
pickers.new(opts, {
|
||||||
|
|
|
@ -78,6 +78,7 @@ return {
|
||||||
"graphql",
|
"graphql",
|
||||||
"jedi_language_server",
|
"jedi_language_server",
|
||||||
"ltex",
|
"ltex",
|
||||||
|
"ocamllsp",
|
||||||
"phpactor",
|
"phpactor",
|
||||||
"psalm",
|
"psalm",
|
||||||
"pylsp",
|
"pylsp",
|
||||||
|
|
|
@ -144,7 +144,10 @@ function M.setup()
|
||||||
require("lvim.lsp.templates").generate_templates()
|
require("lvim.lsp.templates").generate_templates()
|
||||||
end
|
end
|
||||||
|
|
||||||
bootstrap_nlsp { config_home = utils.join_paths(get_config_dir(), "lsp-settings") }
|
bootstrap_nlsp {
|
||||||
|
config_home = utils.join_paths(get_config_dir(), "lsp-settings"),
|
||||||
|
append_default_schemas = true,
|
||||||
|
}
|
||||||
|
|
||||||
require("lvim.lsp.null-ls").setup()
|
require("lvim.lsp.null-ls").setup()
|
||||||
|
|
||||||
|
|
|
@ -1,39 +1,39 @@
|
||||||
local commit = {
|
local commit = {
|
||||||
bufferline = "e97a404bd7449ecebab243c796c1016c98397fc0",
|
bufferline = "871495d9e2dbe3314a421fd2d5e46f47de7ee537",
|
||||||
cmp_buffer = "f83773e2f433a923997c5faad7ea689ec24d1785",
|
cmp_buffer = "d66c4c2d376e5be99db68d2362cd94d250987525",
|
||||||
cmp_luasnip = "d6f837f4e8fe48eeae288e638691b91b97d1737f",
|
cmp_luasnip = "d6f837f4e8fe48eeae288e638691b91b97d1737f",
|
||||||
cmp_nvim_lsp = "ebdfc204afb87f15ce3d3d3f5df0b8181443b5ba",
|
cmp_nvim_lsp = "ebdfc204afb87f15ce3d3d3f5df0b8181443b5ba",
|
||||||
cmp_path = "466b6b8270f7ba89abd59f402c73f63c7331ff6e",
|
cmp_path = "466b6b8270f7ba89abd59f402c73f63c7331ff6e",
|
||||||
comment = "18a8dc0bbdfc089d5f5a850e4640d8e75381c598",
|
comment = "00ed8f612b7bcbaf9df870781ed372ee8c00d6a8",
|
||||||
dapinstall = "24923c3819a450a772bb8f675926d530e829665f",
|
dapinstall = "24923c3819a450a772bb8f675926d530e829665f",
|
||||||
dashboard_nvim = "d82ddae95fd4dc4c3b7bbe87f09b1840fbf20ecb",
|
dashboard_nvim = "d82ddae95fd4dc4c3b7bbe87f09b1840fbf20ecb",
|
||||||
fixcursorhold = "1bfb32e7ba1344925ad815cb0d7f901dbc0ff7c1",
|
fixcursorhold = "1bfb32e7ba1344925ad815cb0d7f901dbc0ff7c1",
|
||||||
friendly_snippets = "2e575549910571ff5abb6b02178c69ad760a4e00",
|
friendly_snippets = "ad07b2844021b20797adda5b483265802559a693",
|
||||||
gitsigns = "1d1f043acf025f919b8dd12bb672569109c7f099",
|
gitsigns = "779f4eb59047ef7faa41e71d261d041edfabfb39",
|
||||||
lua_dev = "a0ee77789d9948adce64d98700cc90cecaef88d5",
|
lua_dev = "a0ee77789d9948adce64d98700cc90cecaef88d5",
|
||||||
lualine = "40849728b6c9b3389c7b54739f426f9899b53778",
|
lualine = "d2e0ac595b8e315b454f4384edb2eba7807a8401",
|
||||||
luasnip = "c1d07078dce0c9631e89a299e4b4a93334650a7b",
|
luasnip = "3d544b66c0ded7c01151559a83bd3ff9be6a40e8",
|
||||||
nlsp_settings = "80cb4d3051366afb019ddabe619b6eb967c82f63",
|
nlsp_settings = "61d95800be78ecea8e16297f36fef52c412d3602",
|
||||||
null_ls = "3059dc761b27c4c836f88879c460cd7a989caa47",
|
null_ls = "15d3aabc2b440293ecf6c85f25ca9fa645a468ae",
|
||||||
nvim_autopairs = "784398a8f184431fd4329f20b0e4f52e87707bbd",
|
nvim_autopairs = "d2cde7c5802b34d6391a8a3555a3b7b56482f2aa",
|
||||||
nvim_cmp = "13d64460cba64950aff41e230cc801225bd9a3e2",
|
nvim_cmp = "1001683bee3a52a7b7e07ba9d391472961739c7b",
|
||||||
nvim_dap = "9fcff6e02e1a549d47a2c559a4b833798537c0bc",
|
nvim_dap = "edb22a824e33f5244c98dbaa91f749f0d6390a94",
|
||||||
nvim_lsp_installer = "c95ffd31428da0abaffa2459c0231fa9971fcbaa",
|
nvim_lsp_installer = "6e6d75b7a446a13ec2bdaaf7934c071936ad3d8c",
|
||||||
nvim_lspconfig = "19a21d5a8681f721c584125a920d4cbeda1c80cc",
|
nvim_lspconfig = "cf2fc1d5149dc097e8c02c607f0f0c97c5099ae8",
|
||||||
nvim_notify = "8038d04d5371e49cf15728ae98cc6bff655b923b",
|
nvim_notify = "f81b48d298c0ff7479b66568d9cc1a4794c196d0",
|
||||||
nvim_tree = "2e1f82d8c0c57cbc2bfdc041a3aff26947559a1e",
|
nvim_tree = "ac858a28a2ca673bbca74af005442e58e015f19e",
|
||||||
nvim_treesitter = "2298a7584414af40a6a09cbe72a81175382992c7",
|
nvim_treesitter = "cada76c4901e2389c0f82ac11d0c9c61d5205e90",
|
||||||
nvim_ts_context_commentstring = "097df33c9ef5bbd3828105e4bee99965b758dc3f",
|
nvim_ts_context_commentstring = "097df33c9ef5bbd3828105e4bee99965b758dc3f",
|
||||||
nvim_web_devicons = "e3294f687626b40754bb40ac2d636d166098b2fb",
|
nvim_web_devicons = "4415d1aaa56f73b9c05795af84d625c610b05d3b",
|
||||||
packer = "963cb58c3dd15699c801baf3e64393c6795b62e9",
|
packer = "c576ab3f1488ee86d60fd340d01ade08dcabd256",
|
||||||
plenary = "66472128c3191b786966798fc956a689705ab1be",
|
plenary = "14dfb4071022b22e08384ee125a5607464b6d397",
|
||||||
popup = "b7404d35d5d3548a82149238289fa71f7f6de4ac",
|
popup = "b7404d35d5d3548a82149238289fa71f7f6de4ac",
|
||||||
project = "cef52b8da07648b750d7f1e8fb93f12cb9482988",
|
project = "cef52b8da07648b750d7f1e8fb93f12cb9482988",
|
||||||
schemastore = "c0c11c832fa812174cd196c723b97c493f528b5c",
|
schemastore = "120e95a9e3d60a7410adb1be102268091ed400fb",
|
||||||
structlog = "6f1403a192791ff1fa7ac845a73de9e860f781f1",
|
structlog = "6f1403a192791ff1fa7ac845a73de9e860f781f1",
|
||||||
telescope = "df0b35c8bc0944164828ccba8ea17941423c6725",
|
telescope = "b501d9ecb7d8181e2238620c919740025e8b2096",
|
||||||
telescope_fzf_native = "b8662b076175e75e6497c59f3e2799b879d7b954",
|
telescope_fzf_native = "8ec164b541327202e5e74f99bcc5fe5845720e18",
|
||||||
toggleterm = "f9845199f1d647890ca47f6185f7ac935991b442",
|
toggleterm = "e97d0c1046512e975a9f3fa95afe98f312752b1c",
|
||||||
which_key = "28d2bd129575b5e9ebddd88506601290bb2bb221",
|
which_key = "28d2bd129575b5e9ebddd88506601290bb2bb221",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
$env:XDG_DATA_HOME = ($env:XDG_DATA_HOME, "$env:APPDATA", 1 -ne $null)[0]
|
#Requires -Version 7.1
|
||||||
$env:XDG_CONFIG_HOME = ($env:XDG_CONFIG_HOME, "$env:LOCALAPPDATA", 1 -ne $null)[0]
|
$ErrorActionPreference = "Stop" # exit when command fails
|
||||||
$env:XDG_CACHE_HOME = ($env:XDG_CACHE_HOME, "$env:TEMP", 1 -ne $null)[0]
|
|
||||||
|
|
||||||
$env:LUNARVIM_RUNTIME_DIR = ($env:LUNARVIM_RUNTIME_DIR, "$env:XDG_DATA_HOME\lunarvim", 1 -ne $null)[0]
|
$env:XDG_DATA_HOME = $env:XDG_DATA_HOME ?? $env:APPDATA
|
||||||
$env:LUNARVIM_CONFIG_DIR = ($env:LUNARVIM_CONFIG_DIR, "$env:XDG_CONFIG_HOME\lvim", 1 -ne $null)[0]
|
$env:XDG_CONFIG_HOME = $env:XDG_CONFIG_HOME ?? $env:LOCALAPPDATA
|
||||||
$env:LUNARVIM_CACHE_DIR = ($env:LUNARVIM_CACHE_DIR, "$env:XDG_CACHE_HOME\lvim", 1 -ne $null)[0]
|
$env:XDG_CACHE_HOME = $env:XDG_CACHE_HOME ?? $env:TEMP
|
||||||
|
|
||||||
|
$env:LUNARVIM_RUNTIME_DIR = $env:LUNARVIM_RUNTIME_DIR ?? "$env:XDG_DATA_HOME\lunarvim"
|
||||||
|
$env:LUNARVIM_CONFIG_DIR = $env:LUNARVIM_CONFIG_DIR ?? "$env:XDG_CONFIG_HOME\lvim"
|
||||||
|
$env:LUNARVIM_CACHE_DIR = $env:LUNARVIM_CACHE_DIR ?? "$env:XDG_CACHE_HOME\lvim"
|
||||||
|
$env:LUNARVIM_BASE_DIR = $env:LUNARVIM_BASE_DIR ?? "$env:LUNARVIM_RUNTIME_DIR\lvim"
|
||||||
|
|
||||||
nvim -u "$env:LUNARVIM_RUNTIME_DIR\lvim\init.lua" @args
|
nvim -u "$env:LUNARVIM_RUNTIME_DIR\lvim\init.lua" @args
|
||||||
|
|
|
@ -84,7 +84,7 @@ lvim.builtin.treesitter.highlight.enabled = true
|
||||||
-- ---@usage disable automatic installation of servers
|
-- ---@usage disable automatic installation of servers
|
||||||
-- lvim.lsp.automatic_servers_installation = false
|
-- lvim.lsp.automatic_servers_installation = false
|
||||||
|
|
||||||
-- ---@usage Select which servers should be configured manually. Requires `:LvimCacheRest` to take effect.
|
-- ---@usage Select which servers should be configured manually. Requires `:LvimCacheReset` to take effect.
|
||||||
-- See the full default list `:lua print(vim.inspect(lvim.lsp.override))`
|
-- See the full default list `:lua print(vim.inspect(lvim.lsp.override))`
|
||||||
-- vim.list_extend(lvim.lsp.override, { "pyright" })
|
-- vim.list_extend(lvim.lsp.override, { "pyright" })
|
||||||
|
|
||||||
|
|
166
utils/installer/config_win.example.lua
Normal file
166
utils/installer/config_win.example.lua
Normal file
|
@ -0,0 +1,166 @@
|
||||||
|
--[[
|
||||||
|
THESE ARE EXAMPLE CONFIGS FEEL FREE TO CHANGE TO WHATEVER YOU WANT
|
||||||
|
`lvim` is the global options object
|
||||||
|
]]
|
||||||
|
|
||||||
|
-- Enable powershell as your default shell
|
||||||
|
vim.opt.shell = "pwsh.exe -NoLogo"
|
||||||
|
vim.opt.shellcmdflag =
|
||||||
|
"-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;"
|
||||||
|
vim.cmd [[
|
||||||
|
let &shellredir = '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode'
|
||||||
|
let &shellpipe = '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode'
|
||||||
|
set shellquote= shellxquote=
|
||||||
|
]]
|
||||||
|
|
||||||
|
-- Set a compatible clipboard manager
|
||||||
|
vim.g.clipboard = {
|
||||||
|
copy = {
|
||||||
|
["+"] = "win32yank.exe -i --crlf",
|
||||||
|
["*"] = "win32yank.exe -i --crlf",
|
||||||
|
},
|
||||||
|
paste = {
|
||||||
|
["+"] = "win32yank.exe -o --lf",
|
||||||
|
["*"] = "win32yank.exe -o --lf",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- general
|
||||||
|
lvim.log.level = "warn"
|
||||||
|
lvim.format_on_save = true
|
||||||
|
lvim.colorscheme = "onedarker"
|
||||||
|
|
||||||
|
-- keymappings [view all the defaults by pressing <leader>Lk]
|
||||||
|
lvim.leader = "space"
|
||||||
|
-- add your own keymapping
|
||||||
|
lvim.keys.normal_mode["<C-s>"] = ":w<cr>"
|
||||||
|
-- unmap a default keymapping
|
||||||
|
-- lvim.keys.normal_mode["<C-Up>"] = false
|
||||||
|
-- edit a default keymapping
|
||||||
|
-- lvim.keys.normal_mode["<C-q>"] = ":q<cr>"
|
||||||
|
|
||||||
|
-- Change Telescope navigation to use j and k for navigation and n and p for history in both input and normal mode.
|
||||||
|
-- we use protected-mode (pcall) just in case the plugin wasn't loaded yet.
|
||||||
|
-- local _, actions = pcall(require, "telescope.actions")
|
||||||
|
-- lvim.builtin.telescope.defaults.mappings = {
|
||||||
|
-- -- for input mode
|
||||||
|
-- i = {
|
||||||
|
-- ["<C-j>"] = actions.move_selection_next,
|
||||||
|
-- ["<C-k>"] = actions.move_selection_previous,
|
||||||
|
-- ["<C-n>"] = actions.cycle_history_next,
|
||||||
|
-- ["<C-p>"] = actions.cycle_history_prev,
|
||||||
|
-- },
|
||||||
|
-- -- for normal mode
|
||||||
|
-- n = {
|
||||||
|
-- ["<C-j>"] = actions.move_selection_next,
|
||||||
|
-- ["<C-k>"] = actions.move_selection_previous,
|
||||||
|
-- },
|
||||||
|
-- }
|
||||||
|
|
||||||
|
-- Use which-key to add extra bindings with the leader-key prefix
|
||||||
|
-- lvim.builtin.which_key.mappings["P"] = { "<cmd>Telescope projects<CR>", "Projects" }
|
||||||
|
-- lvim.builtin.which_key.mappings["t"] = {
|
||||||
|
-- name = "+Trouble",
|
||||||
|
-- r = { "<cmd>Trouble lsp_references<cr>", "References" },
|
||||||
|
-- f = { "<cmd>Trouble lsp_definitions<cr>", "Definitions" },
|
||||||
|
-- d = { "<cmd>Trouble lsp_document_diagnostics<cr>", "Diagnostics" },
|
||||||
|
-- q = { "<cmd>Trouble quickfix<cr>", "QuickFix" },
|
||||||
|
-- l = { "<cmd>Trouble loclist<cr>", "LocationList" },
|
||||||
|
-- w = { "<cmd>Trouble lsp_workspace_diagnostics<cr>", "Diagnostics" },
|
||||||
|
-- }
|
||||||
|
|
||||||
|
-- After changing plugin config exit and reopen LunarVim, Run :PackerInstall :PackerCompile
|
||||||
|
lvim.builtin.dashboard.active = true
|
||||||
|
lvim.builtin.notify.active = true
|
||||||
|
lvim.builtin.terminal.active = false
|
||||||
|
-- lvim.builtin.terminal.shell = "pwsh.exe -NoLogo"
|
||||||
|
|
||||||
|
-- nvim-tree has some performance issues on windows, see kyazdani42/nvim-tree.lua#549
|
||||||
|
lvim.builtin.nvimtree.setup.diagnostics.enable = false
|
||||||
|
lvim.builtin.nvimtree.setup.filters.custom = false
|
||||||
|
lvim.builtin.nvimtree.setup.git.enable = false
|
||||||
|
lvim.builtin.nvimtree.setup.update_cwd = false
|
||||||
|
lvim.builtin.nvimtree.setup.update_focused_file.update_cwd = false
|
||||||
|
lvim.builtin.nvimtree.setup.view.side = "left"
|
||||||
|
lvim.builtin.nvimtree.git_hl = false
|
||||||
|
lvim.builtin.nvimtree.show_icons.git = 0
|
||||||
|
|
||||||
|
-- if you don't want all the parsers change this to a table of the ones you want
|
||||||
|
lvim.builtin.treesitter.ensure_installed = {
|
||||||
|
"c",
|
||||||
|
"lua",
|
||||||
|
}
|
||||||
|
|
||||||
|
lvim.builtin.treesitter.ignore_install = { "haskell" }
|
||||||
|
lvim.builtin.treesitter.highlight.enabled = true
|
||||||
|
|
||||||
|
-- generic LSP settings
|
||||||
|
|
||||||
|
-- ---@usage disable automatic installation of servers
|
||||||
|
-- lvim.lsp.automatic_servers_installation = false
|
||||||
|
|
||||||
|
-- ---@usage Select which servers should be configured manually. Requires `:LvimCacheRest` to take effect.
|
||||||
|
-- See the full default list `:lua print(vim.inspect(lvim.lsp.override))`
|
||||||
|
-- vim.list_extend(lvim.lsp.override, { "pyright" })
|
||||||
|
|
||||||
|
-- ---@usage setup a server -- see: https://www.lunarvim.org/languages/#overriding-the-default-configuration
|
||||||
|
-- local opts = {} -- check the lspconfig documentation for a list of all possible options
|
||||||
|
-- require("lvim.lsp.manager").setup("pylsp", opts)
|
||||||
|
|
||||||
|
-- -- you can set a custom on_attach function that will be used for all the language servers
|
||||||
|
-- -- See <https://github.com/neovim/nvim-lspconfig#keybindings-and-completion>
|
||||||
|
-- lvim.lsp.on_attach_callback = function(client, bufnr)
|
||||||
|
-- local function buf_set_option(...)
|
||||||
|
-- vim.api.nvim_buf_set_option(bufnr, ...)
|
||||||
|
-- end
|
||||||
|
-- --Enable completion triggered by <c-x><c-o>
|
||||||
|
-- buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||||
|
-- end
|
||||||
|
|
||||||
|
-- -- set a formatter, this will override the language server formatting capabilities (if it exists)
|
||||||
|
-- local formatters = require "lvim.lsp.null-ls.formatters"
|
||||||
|
-- formatters.setup {
|
||||||
|
-- { command = "black", filetypes = { "python" } },
|
||||||
|
-- { command = "isort", filetypes = { "python" } },
|
||||||
|
-- {
|
||||||
|
-- -- each formatter accepts a list of options identical to https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md#Configuration
|
||||||
|
-- command = "prettier",
|
||||||
|
-- ---@usage arguments to pass to the formatter
|
||||||
|
-- -- these cannot contain whitespaces, options such as `--line-width 80` become either `{'--line-width', '80'}` or `{'--line-width=80'}`
|
||||||
|
-- extra_args = { "--print-with", "100" },
|
||||||
|
-- ---@usage specify which filetypes to enable. By default a providers will attach to all the filetypes it supports.
|
||||||
|
-- filetypes = { "typescript", "typescriptreact" },
|
||||||
|
-- },
|
||||||
|
-- }
|
||||||
|
|
||||||
|
-- -- set additional linters
|
||||||
|
-- local linters = require "lvim.lsp.null-ls.linters"
|
||||||
|
-- linters.setup {
|
||||||
|
-- { command = "flake8", filetypes = { "python" } },
|
||||||
|
-- {
|
||||||
|
-- -- each linter accepts a list of options identical to https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md#Configuration
|
||||||
|
-- command = "shellcheck",
|
||||||
|
-- ---@usage arguments to pass to the formatter
|
||||||
|
-- -- these cannot contain whitespaces, options such as `--line-width 80` become either `{'--line-width', '80'}` or `{'--line-width=80'}`
|
||||||
|
-- extra_args = { "--severity", "warning" },
|
||||||
|
-- },
|
||||||
|
-- {
|
||||||
|
-- command = "codespell",
|
||||||
|
-- ---@usage specify which filetypes to enable. By default a providers will attach to all the filetypes it supports.
|
||||||
|
-- filetypes = { "javascript", "python" },
|
||||||
|
-- },
|
||||||
|
-- }
|
||||||
|
|
||||||
|
-- Additional Plugins
|
||||||
|
-- lvim.plugins = {
|
||||||
|
-- {"folke/tokyonight.nvim"},
|
||||||
|
-- {
|
||||||
|
-- "folke/trouble.nvim",
|
||||||
|
-- cmd = "TroubleToggle",
|
||||||
|
-- },
|
||||||
|
-- }
|
||||||
|
|
||||||
|
-- Autocommands (https://neovim.io/doc/user/autocmd.html)
|
||||||
|
-- lvim.autocommands.custom_groups = {
|
||||||
|
-- { "BufWinEnter", "*.lua", "setlocal ts=8 sw=8" },
|
||||||
|
-- }
|
|
@ -2,112 +2,98 @@
|
||||||
$ErrorActionPreference = "Stop" # exit when command fails
|
$ErrorActionPreference = "Stop" # exit when command fails
|
||||||
|
|
||||||
# set script variables
|
# set script variables
|
||||||
$LV_BRANCH = ($LV_BRANCH, "rolling", 1 -ne $null)[0]
|
$LV_BRANCH = $LV_BRANCH ?? "rolling"
|
||||||
$LV_REMOTE = ($LV_REMOTE, "lunarvim/lunarvim.git", 1 -ne $null)[0]
|
$LV_REMOTE = $LV_REMOTE ?? "lunarvim/lunarvim.git"
|
||||||
$INSTALL_PREFIX = ($INSTALL_PREFIX, "$HOME\.local", 1 -ne $null)[0]
|
$INSTALL_PREFIX = $INSTALL_PREFIX ?? "$HOME\.local"
|
||||||
|
|
||||||
$env:XDG_DATA_HOME = ($env:XDG_DATA_HOME, "$env:APPDATA", 1 -ne $null)[0]
|
$env:XDG_DATA_HOME = $env:XDG_DATA_HOME ?? $env:APPDATA
|
||||||
$env:XDG_CONFIG_HOME = ($env:XDG_CONFIG_HOME, "$env:LOCALAPPDATA", 1 -ne $null)[0]
|
$env:XDG_CONFIG_HOME = $env:XDG_CONFIG_HOME ?? $env:LOCALAPPDATA
|
||||||
$env:XDG_CACHE_HOME = ($env:XDG_CACHE_HOME, "$env:TEMP", 1 -ne $null)[0]
|
$env:XDG_CACHE_HOME = $env:XDG_CACHE_HOME ?? $env:TEMP
|
||||||
$env:LUNARVIM_RUNTIME_DIR = ($env:LUNARVIM_RUNTIME_DIR, "$env:XDG_DATA_HOME\lunarvim", 1 -ne $null)[0]
|
|
||||||
$env:LUNARVIM_CONFIG_DIR = ($env:LUNARVIM_CONFIG_DIR, "$env:XDG_CONFIG_HOME\lvim", 1 -ne $null)[0]
|
|
||||||
$env:LUNARVIM_CACHE_DIR = ($env:LUNARVIM_CACHE_DIR, "$env:XDG_CACHE_HOME\lvim", 1 -ne $null)[0]
|
|
||||||
|
|
||||||
|
$env:LUNARVIM_RUNTIME_DIR = $env:LUNARVIM_RUNTIME_DIR ?? "$env:XDG_DATA_HOME\lunarvim"
|
||||||
|
$env:LUNARVIM_CONFIG_DIR = $env:LUNARVIM_CONFIG_DIR ?? "$env:XDG_CONFIG_HOME\lvim"
|
||||||
|
$env:LUNARVIM_CACHE_DIR = $env:LUNARVIM_CACHE_DIR ?? "$env:XDG_CACHE_HOME\lvim"
|
||||||
|
$env:LUNARVIM_BASE_DIR = $env:LUNARVIM_BASE_DIR ?? "$env:LUNARVIM_RUNTIME_DIR\lvim"
|
||||||
|
|
||||||
$__lvim_dirs = (
|
$__lvim_dirs = (
|
||||||
"$env:LUNARVIM_CONFIG_DIR",
|
$env:LUNARVIM_BASE_DIR,
|
||||||
"$env:LUNARVIM_RUNTIME_DIR",
|
$env:LUNARVIM_RUNTIME_DIR,
|
||||||
"$env:LUNARVIM_CACHE_DIR"
|
$env:LUNARVIM_CONFIG_DIR,
|
||||||
|
$env:LUNARVIM_CACHE_DIR
|
||||||
)
|
)
|
||||||
|
|
||||||
function main($cliargs) {
|
function __add_separator($div_width) {
|
||||||
Write-Output "
|
"-" * $div_width
|
||||||
|
Write-Output ""
|
||||||
88\ 88\
|
}
|
||||||
88 | \__|
|
|
||||||
88 |88\ 88\ 888888$\ 888888\ 888888\ 88\ 88\ 88\ 888888\8888\
|
|
||||||
88 |88 | 88 |88 __88\ \____88\ 88 __88\\88\ 88 |88 |88 _88 _88\
|
|
||||||
88 |88 | 88 |88 | 88 | 888888$ |88 | \__|\88\88 / 88 |88 / 88 / 88 |
|
|
||||||
88 |88 | 88 |88 | 88 |88 __88 |88 | \88$ / 88 |88 | 88 | 88 |
|
|
||||||
88 |\888888 |88 | 88 |\888888$ |88 | \$ / 88 |88 | 88 | 88 |
|
|
||||||
\__| \______/ \__| \__| \_______|\__| \_/ \__|\__| \__| \__|
|
|
||||||
|
|
||||||
"
|
|
||||||
|
|
||||||
|
function msg($text){
|
||||||
|
Write-Output $text
|
||||||
__add_separator "80"
|
__add_separator "80"
|
||||||
|
}
|
||||||
|
|
||||||
# skip this in a Github workflow
|
function main($cliargs) {
|
||||||
if ( $null -eq "$GITHUB_ACTIONS" ) {
|
|
||||||
install_packer
|
print_logo
|
||||||
setup_shim
|
|
||||||
|
verify_lvim_dirs
|
||||||
|
|
||||||
|
if ($cliargs.Contains("--overwrite")) {
|
||||||
|
Write-Output "!!Warning!! -> Removing all lunarvim related config because of the --overwrite flag"
|
||||||
|
$answer = Read-Host "Would you like to continue? [y]es or [n]o "
|
||||||
|
if ("$answer" -ne "y" -and "$answer" -ne "Y") {
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
uninstall_lvim
|
||||||
|
}
|
||||||
|
if ($cliargs.Contains("--local") -or $cliargs.Contains("--testing")) {
|
||||||
|
msg "Using local LunarVim installation"
|
||||||
|
local_install
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
__add_separator "80"
|
msg "Checking dependencies.."
|
||||||
|
|
||||||
check_system_deps
|
check_system_deps
|
||||||
|
|
||||||
Write-Output "Would you like to check lunarvim's NodeJS dependencies?"
|
$answer = Read-Host "Would you like to check lunarvim's NodeJS dependencies? [y]es or [n]o (default: no) "
|
||||||
$answer = Read-Host "[y]es or [n]o (default: no) "
|
|
||||||
if ("$answer" -eq "y" -or "$answer" -eq "Y") {
|
if ("$answer" -eq "y" -or "$answer" -eq "Y") {
|
||||||
install_nodejs_deps
|
install_nodejs_deps
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Output "Would you like to check lunarvim's Python dependencies?"
|
$answer = Read-Host "Would you like to check lunarvim's Python dependencies? [y]es or [n]o (default: no) "
|
||||||
$answer = Read-Host "[y]es or [n]o (default: no) "
|
|
||||||
if ("$answer" -eq "y" -or "$answer" -eq "Y") {
|
if ("$answer" -eq "y" -or "$answer" -eq "Y") {
|
||||||
install_python_deps
|
install_python_deps
|
||||||
}
|
}
|
||||||
|
|
||||||
__add_separator "80"
|
|
||||||
|
|
||||||
Write-Output "Backing up old LunarVim configuration"
|
if (Test-Path "$env:LUNARVIM_BASE_DIR\init.lua" ) {
|
||||||
backup_old_config
|
msg "Updating LunarVim"
|
||||||
|
validate_lunarvim_files
|
||||||
__add_separator "80"
|
|
||||||
|
|
||||||
verify_lvim_dirs
|
|
||||||
|
|
||||||
if (Test-Path "$env:LUNARVIM_RUNTIME_DIR\site\pack\packer\start\packer.nvim") {
|
|
||||||
Write-Output "Packer already installed"
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
install_packer
|
msg "Cloning Lunarvim"
|
||||||
}
|
clone_lvim
|
||||||
|
|
||||||
__add_separator "80"
|
|
||||||
|
|
||||||
if (Test-Path "$env:LUNARVIM_RUNTIME_DIR\lvim\init.lua" ) {
|
|
||||||
Write-Output "Updating LunarVim"
|
|
||||||
update_lvim
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if ($cliargs.Contains("--testing")) {
|
|
||||||
copy_local_lvim_repository
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
clone_lvim
|
|
||||||
}
|
|
||||||
setup_lvim
|
setup_lvim
|
||||||
}
|
}
|
||||||
|
|
||||||
__add_separator "80"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function print_missing_dep_msg($dep) {
|
function print_missing_dep_msg($dep) {
|
||||||
Write-Output "[ERROR]: Unable to find dependency [$dep]"
|
Write-Output "[ERROR]: Unable to find dependency [$dep]"
|
||||||
Write-Output "Please install it first and re-run the installer. Try: $RECOMMEND_INSTALL $dep"
|
Write-Output "Please install it first and re-run the installer."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$winget_package_matrix=@{"git" = "Git.Git"; "nvim" = "nvim.nvim"; "make" = "GnuWin32.Make"; "node" = "OpenJS.NodeJS"; "pip" = "Python.Python.3"}
|
||||||
|
$scoop_package_matrix=@{"git" = "git"; "nvim" = "neovim-nightly"; "make" = "make"; "node" = "nodejs"; "pip" = "python3"}
|
||||||
|
|
||||||
function install_system_package($dep) {
|
function install_system_package($dep) {
|
||||||
if (Get-Command -Name "winget" -ErrorAction SilentlyContinue) {
|
if (Get-Command -Name "winget" -ErrorAction SilentlyContinue) {
|
||||||
Write-Output "[INFO]: Attempting to install dependency [$dep] with winget"
|
Write-Output "Attempting to install dependency [$dep] with winget"
|
||||||
$install_cmd = "winget install --interactive"
|
$install_cmd = "winget install --interactive $winget_package_matrix[$dep]"
|
||||||
}
|
}
|
||||||
elseif (Get-Command -Name "scoop" -ErrorAction SilentlyContinue) {
|
elseif (Get-Command -Name "scoop" -ErrorAction SilentlyContinue) {
|
||||||
Write-Output "[INFO]: Attempting to install dependency [$dep] with scoop"
|
Write-Output "Attempting to install dependency [$dep] with scoop"
|
||||||
# TODO: check if it's fine to not run it with --global
|
# TODO: check if it's fine to not run it with --global
|
||||||
$install_cmd = "scoop install"
|
$install_cmd = "scoop install $scoop_package_matrix[$dep]"
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
print_missing_dep_msg "$dep"
|
print_missing_dep_msg "$dep"
|
||||||
|
@ -115,7 +101,7 @@ function install_system_package($dep) {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Invoke-Command $install_cmd $dep -ErrorAction Stop
|
Invoke-Command $install_cmd -ErrorAction Stop
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
print_missing_dep_msg "$dep"
|
print_missing_dep_msg "$dep"
|
||||||
|
@ -133,10 +119,9 @@ function check_system_dep($dep) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_system_deps() {
|
function check_system_deps() {
|
||||||
Write-Output "[INFO]: Checking dependencies.."
|
|
||||||
check_system_dep "git"
|
check_system_dep "git"
|
||||||
check_system_dep "nvim"
|
check_system_dep "nvim"
|
||||||
|
check_system_dep "make"
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_nodejs_deps() {
|
function install_nodejs_deps() {
|
||||||
|
@ -162,131 +147,144 @@ function install_python_deps() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function backup_old_config() {
|
function backup_old_config() {
|
||||||
foreach ($dir in $__lvim_dirs) {
|
$src = "$env:LUNARVIM_CONFIG_DIR"
|
||||||
# we create an empty folder for subsequent commands \
|
if (Test-Path $src) {
|
||||||
# that require an existing directory
|
New-Item "$src.old" -ItemType Directory -Force | Out-Null
|
||||||
if ( Test-Path "$dir") {
|
Copy-Item -Force -Recurse "$src\*" "$src.old\." | Out-Null
|
||||||
New-Item "$dir.bak" -ItemType Directory -Force
|
|
||||||
Copy-Item -Recurse "$dir\*" "$dir.bak\."
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
msg "Backup operation complete"
|
||||||
Write-Output "Backup operation complete"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function install_packer() {
|
function local_install() {
|
||||||
Invoke-Command -ErrorAction Stop -ScriptBlock { git clone --progress --depth 1 "https://github.com/wbthomason/packer.nvim" "$env:LUNARVIM_RUNTIME_DIR\site\pack\packer\start\packer.nvim" }
|
verify_lvim_dirs
|
||||||
}
|
$repoDir = git rev-parse --show-toplevel
|
||||||
|
$gitLocalCloneCmd = git clone --progress "$repoDir" "$env:LUNARVIM_BASE_DIR"
|
||||||
function copy_local_lvim_repository() {
|
Invoke-Command -ErrorAction Stop -ScriptBlock { $gitLocalCloneCmd; setup_lvim }
|
||||||
Write-Output "Copy local LunarVim configuration"
|
|
||||||
Copy-Item -Path "$((Get-Item $PWD).Parent.Parent.FullName)" -Destination "$env:LUNARVIM_RUNTIME_DIR/lvim" -Recurse
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function clone_lvim() {
|
function clone_lvim() {
|
||||||
Write-Output "Cloning LunarVim configuration"
|
|
||||||
try {
|
try {
|
||||||
Invoke-Command -ErrorAction Stop -ScriptBlock { git clone --progress --branch "$LV_BRANCH" --depth 1 "https://github.com/$LV_REMOTE" "$env:LUNARVIM_RUNTIME_DIR/lvim" }
|
$gitCloneCmd = git clone --progress --depth 1 --branch "$LV_BRANCH" `
|
||||||
|
"https://github.com/$LV_REMOTE" `
|
||||||
|
"$env:LUNARVIM_BASE_DIR"
|
||||||
|
Invoke-Command -ErrorAction Stop -ScriptBlock { $gitCloneCmd }
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
Write-Output "Failed to clone repository. Installation failed."
|
msg "Failed to clone repository. Installation failed."
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setup_shim() {
|
function setup_shim() {
|
||||||
if ((Test-Path "$INSTALL_PREFIX\bin") -eq $false) {
|
if ((Test-Path "$INSTALL_PREFIX\bin") -eq $false) {
|
||||||
New-Item "$INSTALL_PREFIX\bin" -ItemType Directory
|
New-Item "$INSTALL_PREFIX\bin" -ItemType Directory | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
|
Copy-Item -Force "$env:LUNARVIM_BASE_DIR\utils\bin\lvim.ps1" "$INSTALL_PREFIX\bin\lvim.ps1"
|
||||||
|
}
|
||||||
|
|
||||||
|
function uninstall_lvim() {
|
||||||
|
foreach ($dir in $__lvim_dirs) {
|
||||||
|
if (Test-Path "$dir") {
|
||||||
|
Remove-Item -Force -Recurse "$dir"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Copy-Item "$env:LUNARVIM_RUNTIME_DIR\lvim\utils\bin\lvim.ps1" -Destination "$INSTALL_PREFIX\bin\lvim.ps1" -Force
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function verify_lvim_dirs() {
|
function verify_lvim_dirs() {
|
||||||
if ($cliargs.Contains("--overwrite")) {
|
|
||||||
Write-Output "!!Warning!! -> Removing all lunarvim related config because of the --overwrite flag"
|
|
||||||
$answer = Read-Host "Would you like to continue? [y]es or [n]o "
|
|
||||||
if ("$answer" -ne "y" -and "$answer" -ne "Y") {
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($dir in $__lvim_dirs) {
|
|
||||||
if (Test-Path "$dir") {
|
|
||||||
Remove-Item -Force -Recurse "$dir"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($dir in $__lvim_dirs) {
|
foreach ($dir in $__lvim_dirs) {
|
||||||
if ((Test-Path "$dir") -eq $false) {
|
if ((Test-Path "$dir") -eq $false) {
|
||||||
New-Item "$dir" -ItemType Directory
|
New-Item "$dir" -ItemType Directory | Out-Null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
backup_old_config
|
||||||
}
|
}
|
||||||
|
|
||||||
function setup_lvim() {
|
|
||||||
Write-Output "Installing LunarVim shim"
|
|
||||||
|
|
||||||
|
function setup_lvim() {
|
||||||
|
msg "Installing LunarVim shim"
|
||||||
setup_shim
|
setup_shim
|
||||||
|
|
||||||
Write-Output "Preparing Packer setup"
|
msg "Installing sample configuration"
|
||||||
|
|
||||||
if (Test-Path "$env:LUNARVIM_CONFIG_DIR\config.lua") {
|
if (Test-Path "$env:LUNARVIM_CONFIG_DIR\config.lua") {
|
||||||
Remove-Item -Force "$env:LUNARVIM_CONFIG_DIR\config.lua"
|
Move-Item "$env:LUNARVIM_CONFIG_DIR\config.lua" "$env:LUNARVIM_CONFIG_DIR\config.lua.old"
|
||||||
}
|
}
|
||||||
|
|
||||||
Out-File -FilePath "$env:LUNARVIM_CONFIG_DIR\config.lua"
|
New-Item -ItemType File -Path "$env:LUNARVIM_CONFIG_DIR\config.lua" | Out-Null
|
||||||
|
|
||||||
Write-Output "Packer setup complete"
|
$exampleConfig = "$env:LUNARVIM_BASE_DIR\utils\installer\config_win.example.lua"
|
||||||
|
Copy-Item -Force "$exampleConfig" "$env:LUNARVIM_CONFIG_DIR\config.lua"
|
||||||
|
|
||||||
__add_separator "80"
|
# FIXME: this has never worked
|
||||||
|
# Invoke-Expression "$INSTALL_PREFIX\bin\lvim.ps1 --headless -c 'autocmd User PackerComplete quitall' -c 'PackerSync'"
|
||||||
|
|
||||||
Copy-Item "$env:LUNARVIM_RUNTIME_DIR\lvim\utils\installer\config.example.lua" "$env:LUNARVIM_CONFIG_DIR\config.lua"
|
Write-Host "Make sure to run `:PackerSync` at first launch" -ForegroundColor Green
|
||||||
|
|
||||||
$answer = Read-Host $(`
|
create_alias
|
||||||
"Would you like to create an alias inside your Powershell profile?`n" + `
|
|
||||||
"(This enables you to start lvim with the command 'lvim') [y]es or [n]o (default: no)" )
|
|
||||||
if ("$answer" -eq "y" -and "$answer" -eq "Y") {
|
|
||||||
create_alias
|
|
||||||
}
|
|
||||||
|
|
||||||
__add_separator "80"
|
msg "Thank you for installing LunarVim!!"
|
||||||
|
|
||||||
Write-Output "Thank you for installing LunarVim!!"
|
|
||||||
Write-Output "You can start it by running: $INSTALL_PREFIX\bin\lvim.ps1"
|
Write-Output "You can start it by running: $INSTALL_PREFIX\bin\lvim.ps1"
|
||||||
Write-Output "Do not forget to use a font with glyphs (icons) support [https://github.com/ryanoasis/nerd-fonts]"
|
Write-Output "Do not forget to use a font with glyphs (icons) support [https://github.com/ryanoasis/nerd-fonts]"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function update_lvim() {
|
function validate_lunarvim_files() {
|
||||||
|
Set-Alias lvim "$INSTALL_PREFIX\bin\lvim.ps1"
|
||||||
try {
|
try {
|
||||||
Invoke-Command git -C "$env:LUNARVIM_RUNTIME_DIR/lvim" status -uno
|
$verify_version_cmd='if v:errmsg != "" | cquit | else | quit | endif'
|
||||||
|
Invoke-Command -ScriptBlock { lvim --headless -c 'LvimUpdate' -c "$verify_version_cmd" } -ErrorAction SilentlyContinue
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
git -C "$env:LUNARVIM_RUNTIME_DIR/lvim" pull --ff-only --progress -or
|
Write-Output "Unable to guarantee data integrity while updating. Please run `:LvimUpdate` manually instead."
|
||||||
Write-Output "Unable to guarantee data integrity while updating. Please do that manually instead."
|
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
Write-Output "Your LunarVim installation is now up to date!"
|
Write-Output "Your LunarVim installation is now up to date!"
|
||||||
}
|
}
|
||||||
|
|
||||||
function __add_separator($div_width) {
|
function create_alias {
|
||||||
"-" * $div_width
|
try {
|
||||||
Write-Output ""
|
$answer = Read-Host $(`
|
||||||
|
"Would you like to create an alias inside your Powershell profile?`n" + `
|
||||||
|
"(This enables you to start lvim with the command 'lvim') [y]es or [n]o (default: no)" )
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
msg "Non-interactive mode detected. Skipping alias creation"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if ("$answer" -ne "y" -or "$answer" -ne "Y") {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
$lvim_bin="$INSTALL_PREFIX\bin\lvim.ps1"
|
||||||
|
$lvim_alias = Get-Alias lvim -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
|
if ($lvim_alias.Definition == $lvim_bin) {
|
||||||
|
Write-Output "Alias is already set and will not be reset."
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
Add-Content -Path $PROFILE -Value $("Set-Alias lvim $lvim_bin")
|
||||||
|
|
||||||
|
Write-Host 'To use the new alias in this window reload your profile with: `. $PROFILE`' -ForegroundColor Green
|
||||||
}
|
}
|
||||||
|
|
||||||
function create_alias {
|
function print_logo(){
|
||||||
if ($null -eq $(Get-Alias | Select-String "lvim")) {
|
Write-Output "
|
||||||
Add-Content -Path $PROFILE -Value $( -join @('Set-Alias lvim "', "$INSTALL_PREFIX", '\bin\lvim.ps1"'))
|
|
||||||
|
|
||||||
Write-Output ""
|
88\ 88\
|
||||||
Write-Host 'To use the new alias in this window reload your profile with ". $PROFILE".' -ForegroundColor Yellow
|
88 | \__|
|
||||||
|
88 |88\ 88\ 888888$\ 888888\ 888888\ 88\ 88\ 88\ 888888\8888\
|
||||||
|
88 |88 | 88 |88 __88\ \____88\ 88 __88\\88\ 88 |88 |88 _88 _88\
|
||||||
|
88 |88 | 88 |88 | 88 | 888888$ |88 | \__|\88\88 / 88 |88 / 88 / 88 |
|
||||||
|
88 |88 | 88 |88 | 88 |88 __88 |88 | \88$ / 88 |88 | 88 | 88 |
|
||||||
|
88 |\888888 |88 | 88 |\888888$ |88 | \$ / 88 |88 | 88 | 88 |
|
||||||
|
\__| \______/ \__| \__| \_______|\__| \_/ \__|\__| \__| \__|
|
||||||
|
|
||||||
}
|
"
|
||||||
else {
|
|
||||||
Write-Output "Alias is already set and will not be reset."
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
main "$args"
|
main "$args"
|
||||||
|
|
|
@ -25,6 +25,7 @@ readonly BASEDIR
|
||||||
declare ARGS_LOCAL=0
|
declare ARGS_LOCAL=0
|
||||||
declare ARGS_OVERWRITE=0
|
declare ARGS_OVERWRITE=0
|
||||||
declare ARGS_INSTALL_DEPENDENCIES=1
|
declare ARGS_INSTALL_DEPENDENCIES=1
|
||||||
|
declare INTERACTIVE_MODE=1
|
||||||
|
|
||||||
declare -a __lvim_dirs=(
|
declare -a __lvim_dirs=(
|
||||||
"$LUNARVIM_CONFIG_DIR"
|
"$LUNARVIM_CONFIG_DIR"
|
||||||
|
@ -45,10 +46,11 @@ function usage() {
|
||||||
echo "Usage: install.sh [<options>]"
|
echo "Usage: install.sh [<options>]"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Options:"
|
echo "Options:"
|
||||||
echo " -h, --help Print this help message"
|
echo " -h, --help Print this help message"
|
||||||
echo " -l, --local Install local copy of LunarVim"
|
echo " -l, --local Install local copy of LunarVim"
|
||||||
echo " --overwrite Overwrite previous LunarVim configuration (a backup is always performed first)"
|
echo " -y, --yes Disable confirmation prompts (answer yes to all questions)"
|
||||||
echo " --[no]-install-dependencies Whether to prompt to install external dependencies (will prompt by default)"
|
echo " --overwrite Overwrite previous LunarVim configuration (a backup is always performed first)"
|
||||||
|
echo " --[no]-install-dependencies Whether to automatically install external dependencies (will prompt by default)"
|
||||||
}
|
}
|
||||||
|
|
||||||
function parse_arguments() {
|
function parse_arguments() {
|
||||||
|
@ -60,6 +62,9 @@ function parse_arguments() {
|
||||||
--overwrite)
|
--overwrite)
|
||||||
ARGS_OVERWRITE=1
|
ARGS_OVERWRITE=1
|
||||||
;;
|
;;
|
||||||
|
-y | --yes)
|
||||||
|
INTERACTIVE_MODE=0
|
||||||
|
;;
|
||||||
--install-dependencies)
|
--install-dependencies)
|
||||||
ARGS_INSTALL_DEPENDENCIES=1
|
ARGS_INSTALL_DEPENDENCIES=1
|
||||||
;;
|
;;
|
||||||
|
@ -93,17 +98,23 @@ function main() {
|
||||||
check_system_deps
|
check_system_deps
|
||||||
|
|
||||||
if [ "$ARGS_INSTALL_DEPENDENCIES" -eq 1 ]; then
|
if [ "$ARGS_INSTALL_DEPENDENCIES" -eq 1 ]; then
|
||||||
msg "Would you like to install LunarVim's NodeJS dependencies?"
|
if [ "$INTERACTIVE_MODE" -eq 1 ]; then
|
||||||
read -p "[y]es or [n]o (default: no) : " -r answer
|
msg "Would you like to install LunarVim's NodeJS dependencies?"
|
||||||
[ "$answer" != "${answer#[Yy]}" ] && install_nodejs_deps
|
read -p "[y]es or [n]o (default: no) : " -r answer
|
||||||
|
[ "$answer" != "${answer#[Yy]}" ] && install_nodejs_deps
|
||||||
|
|
||||||
msg "Would you like to install LunarVim's Python dependencies?"
|
msg "Would you like to install LunarVim's Python dependencies?"
|
||||||
read -p "[y]es or [n]o (default: no) : " -r answer
|
read -p "[y]es or [n]o (default: no) : " -r answer
|
||||||
[ "$answer" != "${answer#[Yy]}" ] && install_python_deps
|
[ "$answer" != "${answer#[Yy]}" ] && install_python_deps
|
||||||
|
|
||||||
msg "Would you like to install LunarVim's Rust dependencies?"
|
msg "Would you like to install LunarVim's Rust dependencies?"
|
||||||
read -p "[y]es or [n]o (default: no) : " -r answer
|
read -p "[y]es or [n]o (default: no) : " -r answer
|
||||||
[ "$answer" != "${answer#[Yy]}" ] && install_rust_deps
|
[ "$answer" != "${answer#[Yy]}" ] && install_rust_deps
|
||||||
|
else
|
||||||
|
install_nodejs_deps
|
||||||
|
install_python_deps
|
||||||
|
install_rust_deps
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
backup_old_config
|
backup_old_config
|
||||||
|
@ -310,30 +321,29 @@ function verify_lvim_dirs() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function backup_old_config() {
|
function backup_old_config() {
|
||||||
for dir in "${__lvim_dirs[@]}"; do
|
local src="$LUNARVIM_CONFIG_DIR"
|
||||||
if [ ! -d "$dir" ]; then
|
if [ ! -d "$dir" ]; then
|
||||||
continue
|
return
|
||||||
fi
|
fi
|
||||||
mkdir -p "$dir.bak"
|
mkdir -p "$src.old"
|
||||||
touch "$dir/ignore"
|
touch "$src/ignore"
|
||||||
msg "Backing up old $dir to $dir.bak"
|
msg "Backing up old $src to $src.old"
|
||||||
if command -v rsync &>/dev/null; then
|
if command -v rsync &>/dev/null; then
|
||||||
rsync --archive -hh --stats --partial --copy-links --cvs-exclude "$dir"/ "$dir.bak"
|
rsync --archive -hh --stats --partial --copy-links --cvs-exclude "$src"/ "$src.old"
|
||||||
else
|
else
|
||||||
OS="$(uname -s)"
|
OS="$(uname -s)"
|
||||||
case "$OS" in
|
case "$OS" in
|
||||||
Linux | *BSD)
|
Linux | *BSD)
|
||||||
cp -r "$dir/"* "$dir.bak/."
|
cp -r "$src/"* "$src.old/."
|
||||||
;;
|
;;
|
||||||
Darwin)
|
Darwin)
|
||||||
cp -R "$dir/"* "$dir.bak/."
|
cp -R "$src/"* "$src.old/."
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "OS $OS is not currently supported."
|
echo "OS $OS is not currently supported."
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
done
|
|
||||||
msg "Backup operation complete"
|
msg "Backup operation complete"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1 +1,57 @@
|
||||||
Remove-Item -Path "$HOME/.local/share/lunarvim" -Recurse -Force
|
#Requires -Version 7.1
|
||||||
|
$ErrorActionPreference = "Stop" # exit when command fails
|
||||||
|
|
||||||
|
# set script variables
|
||||||
|
$LV_BRANCH = $LV_BRANCH ?? "rolling"
|
||||||
|
$LV_REMOTE = $LV_REMOTE ?? "lunarvim/lunarvim.git"
|
||||||
|
$INSTALL_PREFIX = $INSTALL_PREFIX ?? "$HOME\.local"
|
||||||
|
|
||||||
|
$env:XDG_DATA_HOME = $env:XDG_DATA_HOME ?? $env:APPDATA
|
||||||
|
$env:XDG_CONFIG_HOME = $env:XDG_CONFIG_HOME ?? $env:LOCALAPPDATA
|
||||||
|
$env:XDG_CACHE_HOME = $env:XDG_CACHE_HOME ?? $env:TEMP
|
||||||
|
|
||||||
|
$env:LUNARVIM_RUNTIME_DIR = $env:LUNARVIM_RUNTIME_DIR ?? "$env:XDG_DATA_HOME\lunarvim"
|
||||||
|
$env:LUNARVIM_CONFIG_DIR = $env:LUNARVIM_CONFIG_DIR ?? "$env:XDG_CONFIG_HOME\lvim"
|
||||||
|
$env:LUNARVIM_CACHE_DIR = $env:LUNARVIM_CACHE_DIR ?? "$env:XDG_CACHE_HOME\lvim"
|
||||||
|
$env:LUNARVIM_BASE_DIR = $env:LUNARVIM_BASE_DIR ?? "$env:LUNARVIM_RUNTIME_DIR\lvim"
|
||||||
|
|
||||||
|
$__lvim_dirs = (
|
||||||
|
$env:LUNARVIM_BASE_DIR,
|
||||||
|
$env:LUNARVIM_RUNTIME_DIR,
|
||||||
|
$env:LUNARVIM_CONFIG_DIR,
|
||||||
|
$env:LUNARVIM_CACHE_DIR
|
||||||
|
)
|
||||||
|
|
||||||
|
function main($cliargs) {
|
||||||
|
Write-Output "Removing LunarVim binary..."
|
||||||
|
remove_lvim_bin
|
||||||
|
Write-Output "Removing LunarVim directories..."
|
||||||
|
$force = $false
|
||||||
|
if ($cliargs.Contains("--remove-backups")) {
|
||||||
|
$force = $true
|
||||||
|
}
|
||||||
|
remove_lvim_dirs $force
|
||||||
|
Write-Output "Uninstalled LunarVim!"
|
||||||
|
}
|
||||||
|
|
||||||
|
function remove_lvim_bin(){
|
||||||
|
$lvim_bin="$INSTALL_PREFIX\bin\lvim"
|
||||||
|
if (Test-Path $lvim_bin) {
|
||||||
|
Remove-Item -Force $lvim_bin
|
||||||
|
}
|
||||||
|
if (Test-Path alias:lvim) {
|
||||||
|
Write-Warning "Please make sure to remove the 'lvim' alias from your `$PROFILE`: $PROFILE"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function remove_lvim_dirs($force) {
|
||||||
|
foreach ($dir in $__lvim_dirs) {
|
||||||
|
if (Test-Path $dir) {
|
||||||
|
Remove-Item -Force -Recurse $dir
|
||||||
|
}
|
||||||
|
if ($force -eq $true -and (Test-Path "$dir.bak" -or Test-Path "$dir.old")) {
|
||||||
|
Remove-Item -Force -Recurse "$dir.{bak,old}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ function remove_lvim_dirs() {
|
||||||
for dir in "${__lvim_dirs[@]}"; do
|
for dir in "${__lvim_dirs[@]}"; do
|
||||||
rm -rf "$dir"
|
rm -rf "$dir"
|
||||||
if [ "$ARGS_REMOVE_BACKUPS" -eq 1 ]; then
|
if [ "$ARGS_REMOVE_BACKUPS" -eq 1 ]; then
|
||||||
rm -rf "$dir.bak"
|
rm -rf "$dir.{bak,old}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue