Merge branch 'rolling' of github.com:ChristianChiarulli/LunarVim into rolling

This commit is contained in:
christianchiarulli 2021-07-18 14:10:19 -04:00
commit b797c2398f
20 changed files with 501 additions and 180 deletions

View file

@ -34,13 +34,14 @@ LVBRANCH=rolling bash <(curl -s https://raw.githubusercontent.com/ChristianChiar
``` ```
If your installation is stuck on `Ok to remove? [y/N]`, it means there are some leftovers, \ If your installation is stuck on `Ok to remove? [y/N]`, it means there are some leftovers, \
you can run the script with `--overwrite` but be warned this will remove the following folder: you can run the script with `--overwrite` but be warned this will remove the following folders:
- `~/.config/nvim` - `~/.config/nvim`
- `~/.cache/nvim` - `~/.cache/nvim`
- `~/.local/share/nvim/site/pack/packer` - `~/.local/share/nvim/site/pack/packer`
```bash ```bash
curl -s https://raw.githubusercontent.com/ChristianChiarulli/lunarvim/rolling/utils/installer/install.sh | LVBRANCH=rolling bash -s -- --overwrite curl -s https://raw.githubusercontent.com/ChristianChiarulli/lunarvim/rolling/utils/installer/install.sh | LVBRANCH=rolling bash -s -- --overwrite
``` ```
then run nvim and wait for treesitter to finish the installation
## Installing LSP for your language ## Installing LSP for your language
@ -66,7 +67,27 @@ O.completion.autocomplete = true
O.default_options.relativenumber = true O.default_options.relativenumber = true
O.colorscheme = 'spacegray' O.colorscheme = 'spacegray'
O.default_options.timeoutlen = 100 O.default_options.timeoutlen = 100
O.leader_key = ' '
-- keymappings
O.keys.leader_key = "space"
-- overwrite the key-mappings provided by LunarVim for any mode, or leave it empty to keep them
O.keys.normal_mode = {
-- Page down/up
{'[d', '<PageUp>'},
{']d', '<PageDown>'},
-- Navigate buffers
{'<Tab>', ':bnext<CR>'},
{'<S-Tab>', ':bprevious<CR>'},
}
-- if you just want to augment the existing ones then use the utility function
require("lv-utils").add_keymap_insert_mode({ silent = true }, {
{ "<C-s>", ":w<cr>" },
{ "<C-c>", "<ESC>" }
})
-- you can also use the native vim way directly
vim.api.nvim_set_keymap("i", "<C-Space>", "compe#complete()", { noremap = true, silent = true, expr = true })
-- After changing plugin config it is recommended to run :PackerCompile -- After changing plugin config it is recommended to run :PackerCompile
O.plugin.dashboard.active = true O.plugin.dashboard.active = true
@ -131,6 +152,14 @@ O.lang.python.analysis.use_library_code_types = true
-- vim.cmd('source ' .. CONFIG_PATH .. '/lua/lv-user/init.vim') -- vim.cmd('source ' .. CONFIG_PATH .. '/lua/lv-user/init.vim')
``` ```
In case you want to see all the settings inside LunarVim, run the following:
```bash
cd ~/.config/nvim
nvim --headless +'lua require("lv-utils").generate_settings()' +qa && sort -o lv-settings.lua{,}
```
and then inspect `~/.config/nvim/lv-settings.lua` file
## Updating LunarVim ## Updating LunarVim
In order to update you should be aware of three things `Plugins`, `LunarVim` and `Neovim` In order to update you should be aware of three things `Plugins`, `LunarVim` and `Neovim`

4
ftplugin/r.lua Normal file
View file

@ -0,0 +1,4 @@
require("lang.r").format()
require("lang.r").lint()
require("lang.r").lsp()
require("lang.r").dap()

1
ftplugin/rmd.lua Symbolic link
View file

@ -0,0 +1 @@
r.lua

4
ftplugin/svelte.lua Normal file
View file

@ -0,0 +1,4 @@
require("lang.svelte").format()
require("lang.svelte").lint()
require("lang.svelte").lsp()
require("lang.svelte").dap()

4
ftplugin/swift.lua Normal file
View file

@ -0,0 +1,4 @@
require("lang.swift").format()
require("lang.swift").lint()
require("lang.swift").lsp()
require("lang.swift").dap()

View file

@ -1,12 +1,17 @@
require "default-config" require "default-config"
require "keymappings"
local status_ok, error = pcall(vim.cmd, "luafile " .. CONFIG_PATH .. "/lv-config.lua") local status_ok, error = pcall(vim.cmd, "luafile " .. CONFIG_PATH .. "/lv-config.lua")
if not status_ok then if not status_ok then
print "something is wrong with your lv-config" print "something is wrong with your lv-config"
print(error) print(error)
end end
require "plugins"
require "keymappings"
local plugins = require "plugins"
local plugin_loader = require("plugin-loader").init()
plugin_loader:load { plugins, O.user_plugins }
vim.g.colors_name = O.colorscheme -- Colorscheme must get called after plugins are loaded or it will break new installs. vim.g.colors_name = O.colorscheme -- Colorscheme must get called after plugins are loaded or it will break new installs.
require "settings" require "settings"
require "lv-utils" require "lv-utils"

View file

@ -1,8 +1,4 @@
local M = {} local M = {}
local status_ok, nvim_tree_config = pcall(require, "nvim-tree.config")
if not status_ok then
return
end
-- --
M.config = function() M.config = function()
O.plugin.nvimtree = { O.plugin.nvimtree = {
@ -50,6 +46,10 @@ M.config = function()
end end
-- --
M.setup = function() M.setup = function()
local status_ok, nvim_tree_config = pcall(require, "nvim-tree.config")
if not status_ok then
return
end
local g = vim.g local g = vim.g
for opt, val in pairs(O.plugin.nvimtree) do for opt, val in pairs(O.plugin.nvimtree) do
@ -65,12 +65,12 @@ M.setup = function()
} }
end end
-- --
--
M.toggle_tree = function()
local view_status_ok, view = pcall(require, "nvim-tree.view") local view_status_ok, view = pcall(require, "nvim-tree.view")
if not view_status_ok then if not view_status_ok then
return return
end end
--
M.toggle_tree = function()
if view.win_open() then if view.win_open() then
require("nvim-tree").close() require("nvim-tree").close()
if package.loaded["bufferline.state"] then if package.loaded["bufferline.state"] then

View file

@ -33,7 +33,7 @@ M.config = function()
file_sorter = require("telescope.sorters").get_fzy_sorter, file_sorter = require("telescope.sorters").get_fzy_sorter,
file_ignore_patterns = {}, file_ignore_patterns = {},
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter, generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
path_display = { "shorten" }, path_display = { shorten = 5 },
winblend = 0, winblend = 0,
border = {}, border = {},
borderchars = { "", "", "", "", "", "", "", "" }, borderchars = { "", "", "", "", "", "", "", "" },

View file

@ -5,7 +5,9 @@ TERMINAL = vim.fn.expand "$TERMINAL"
USER = vim.fn.expand "$USER" USER = vim.fn.expand "$USER"
O = { O = {
keys = {
leader_key = "space", leader_key = "space",
},
colorscheme = "spacegray", colorscheme = "spacegray",
line_wrap_cursor_movement = true, line_wrap_cursor_movement = true,
transparent_window = false, transparent_window = false,
@ -177,10 +179,13 @@ require("lang.kotlin").config()
require("lang.lua").config() require("lang.lua").config()
require("lang.php").config() require("lang.php").config()
require("lang.python").config() require("lang.python").config()
require("lang.r").config()
require("lang.ruby").config() require("lang.ruby").config()
require("lang.rust").config() require("lang.rust").config()
require("lang.scala").config()
require("lang.sh").config() require("lang.sh").config()
require("lang.scala").config()
require("lang.svelte").config()
require("lang.swift").config()
require("lang.terraform").config() require("lang.terraform").config()
require("lang.tex").config() require("lang.tex").config()
require("lang.vim").config() require("lang.vim").config()

View file

@ -1,42 +1,41 @@
local function register_mappings(mappings, default_options) local lv_utils = require "lv-utils"
for mode, mode_mappings in pairs(mappings) do
for _, mapping in pairs(mode_mappings) do
local options = #mapping == 3 and table.remove(mapping) or default_options
local prefix, cmd = unpack(mapping)
pcall(vim.api.nvim_set_keymap, mode, prefix, cmd, options)
end
end
end
local mappings = { local opts = {
i = { -- Insert mode nnoremap = { noremap = true, silent = true },
inoremap = { noremap = true, silent = true },
vnoremap = { noremap = true, silent = true },
xnoremap = { noremap = true, silent = true },
generic = { silent = true },
}
local default_keys = {
insert_mode = {
-- I hate escape -- I hate escape
{ "jk", "<ESC>" }, { "jk", "<ESC>" },
{ "kj", "<ESC>" }, { "kj", "<ESC>" },
{ "jj", "<ESC>" }, { "jj", "<ESC>" },
-- Move current line / block with Alt-j/k ala vscode. -- Move current line / block with Alt-j/k ala vscode.
{ "<A-j>", "<Esc>:m .+1<CR>==gi" }, { "<A-j>", "<Esc>:m .+1<CR>==gi" },
{ "<A-k>", "<Esc>:m .-2<CR>==gi" }, { "<A-k>", "<Esc>:m .-2<CR>==gi" },
-- navigation
-- Terminal window navigation { "<A-Up>", "<C-\\><C-N><C-w>h" },
{ "<C-h>", "<C-\\><C-N><C-w>h" }, { "<A-Down>", "<C-\\><C-N><C-w>j" },
{ "<C-j>", "<C-\\><C-N><C-w>j" }, { "<A-Left>", "<C-\\><C-N><C-w>k" },
{ "<C-k>", "<C-\\><C-N><C-w>k" }, { "<A-Right>", "<C-\\><C-N><C-w>l" },
{ "<C-l>", "<C-\\><C-N><C-w>l" },
}, },
n = { -- Normal mode
normal_mode = {
-- Better window movement -- Better window movement
{ "<C-h>", "<C-w>h", { silent = true } }, { "<C-h>", "<C-w>h" },
{ "<C-j>", "<C-w>j", { silent = true } }, { "<C-j>", "<C-w>j" },
{ "<C-k>", "<C-w>k", { silent = true } }, { "<C-k>", "<C-w>k" },
{ "<C-l>", "<C-w>l", { silent = true } }, { "<C-l>", "<C-w>l" },
-- Resize with arrows -- Resize with arrows
{ "<C-Up>", ":resize -2<CR>", { silent = true } }, { "<C-Up>", ":resize -2<CR>" },
{ "<C-Down>", ":resize +2<CR>", { silent = true } }, { "<C-Down>", ":resize +2<CR>" },
{ "<C-Left>", ":vertical resize -2<CR>", { silent = true } }, { "<C-Left>", ":vertical resize -2<CR>" },
{ "<C-Right>", ":vertical resize +2<CR>", { silent = true } }, { "<C-Right>", ":vertical resize +2<CR>" },
-- Tab switch buffer -- Tab switch buffer
-- { "<TAB>", ":bnext<CR>" }, -- { "<TAB>", ":bnext<CR>" },
@ -49,17 +48,20 @@ local mappings = {
-- QuickFix -- QuickFix
{ "]q", ":cnext<CR>" }, { "]q", ":cnext<CR>" },
{ "[q", ":cprev<CR>" }, { "[q", ":cprev<CR>" },
{ "<C-q>", ":call QuickFixToggle()<CR>" },
-- {'<C-TAB>', 'compe#complete()', {noremap = true, silent = true, expr = true}}, -- {'<C-TAB>', 'compe#complete()', {noremap = true, silent = true, expr = true}},
}, },
t = { -- Terminal mode
term_mode = {
-- Terminal window navigation -- Terminal window navigation
{ "<C-h>", "<C-\\><C-N><C-w>h" }, { "<C-h>", "<C-\\><C-N><C-w>h" },
{ "<C-j>", "<C-\\><C-N><C-w>j" }, { "<C-j>", "<C-\\><C-N><C-w>j" },
{ "<C-k>", "<C-\\><C-N><C-w>k" }, { "<C-k>", "<C-\\><C-N><C-w>k" },
{ "<C-l>", "<C-\\><C-N><C-w>l" }, { "<C-l>", "<C-\\><C-N><C-w>l" },
}, },
v = { -- Visual/Select mode
visual_mode = {
-- Better indenting -- Better indenting
{ "<", "<gv" }, { "<", "<gv" },
{ ">", ">gv" }, { ">", ">gv" },
@ -67,7 +69,8 @@ local mappings = {
-- { "p", '"0p', { silent = true } }, -- { "p", '"0p', { silent = true } },
-- { "P", '"0P', { silent = true } }, -- { "P", '"0P', { silent = true } },
}, },
x = { -- Visual mode
visual_block_mode = {
-- Move selected line / block of text in visual mode -- Move selected line / block of text in visual mode
{ "K", ":move '<-2<CR>gv-gv" }, { "K", ":move '<-2<CR>gv-gv" },
{ "J", ":move '>+1<CR>gv-gv" }, { "J", ":move '>+1<CR>gv-gv" },
@ -76,31 +79,37 @@ local mappings = {
{ "<A-j>", ":m '>+1<CR>gv-gv" }, { "<A-j>", ":m '>+1<CR>gv-gv" },
{ "<A-k>", ":m '<-2<CR>gv-gv" }, { "<A-k>", ":m '<-2<CR>gv-gv" },
}, },
[""] = {
-- Toggle the QuickFix window
{ "<C-q>", ":call QuickFixToggle()<CR>" },
},
} }
-- TODO: fix this
if vim.fn.has "mac" == 1 then if vim.fn.has "mac" == 1 then
mappings["n"][5][1] = "<A-Up>" -- TODO: fix this
mappings["n"][6][1] = "<A-Down>" default_keys.normal_mode[5][1] = "<A-Up>"
mappings["n"][7][1] = "<A-Left>" default_keys.normal_mode[6][1] = "<A-Down>"
mappings["n"][8][1] = "<A-Right>" default_keys.normal_mode[7][1] = "<A-Left>"
default_keys.normal_mode[8][1] = "<A-Right>"
end end
register_mappings(mappings, { silent = true, noremap = true }) if O.keys.leader_key == " " or O.keys.leader_key == "space" then
vim.g.mapleader = " "
else
vim.g.mapleader = O.keys.leader_key
end
vim.cmd 'inoremap <expr> <c-j> ("\\<C-n>")' local function get_user_keys(mode)
vim.cmd 'inoremap <expr> <c-k> ("\\<C-p>")' if O.keys[mode] == nil then
return default_keys[mode]
else
return O.keys[mode]
end
end
-- vim.cmd('inoremap <expr> <TAB> (\"\\<C-n>\")') lv_utils.add_keymap_normal_mode(opts.nnoremap, get_user_keys "normal_mode")
-- vim.cmd('inoremap <expr> <S-TAB> (\"\\<C-p>\")') lv_utils.add_keymap_insert_mode(opts.inoremap, get_user_keys "insert_mode")
lv_utils.add_keymap_visual_mode(opts.vnoremap, get_user_keys "visual_mode")
lv_utils.add_keymap_visual_block_mode(opts.xnoremap, get_user_keys "visual_block_mode")
lv_utils.add_keymap_term_mode(opts.generic, get_user_keys "visual_block_mode")
-- vim.cmd([[ -- navigate tab completion with <c-j> and <c-k>
-- map p <Plug>(miniyank-autoput) -- runs conditionally
-- map P <Plug>(miniyank-autoPut) vim.cmd 'inoremap <expr> <C-j> pumvisible() ? "\\<C-n>" : "\\<C-j>"'
-- map <leader>n <Plug>(miniyank-cycle) vim.cmd 'inoremap <expr> <C-k> pumvisible() ? "\\<C-p>" : "\\<C-k>"'
-- map <leader>N <Plug>(miniyank-cycleback)
-- ]])

56
lua/lang/r.lua Normal file
View file

@ -0,0 +1,56 @@
local M = {}
M.config = function()
-- R -e 'install.packages("formatR",repos = "http://cran.us.r-project.org")'
-- R -e 'install.packages("readr",repos = "http://cran.us.r-project.org")'
O.lang.r = {
formatter = {
exe = "R",
args = {
"--slave",
"--no-restore",
"--no-save",
'-e "formatR::tidy_source(text=readr::read_file(file(\\"stdin\\")), arrow=FALSE)"',
},
stdin = true,
},
}
end
M.format = function()
O.formatters.filetype["r"] = {
function()
return {
exe = O.lang.r.formatter.exe,
args = O.lang.r.formatter.args,
stdin = O.lang.r.formatter.stdin,
}
end,
}
O.formatters.filetype["rmd"] = O.formatters.filetype["r"]
require("formatter.config").set_defaults {
logging = false,
filetype = O.formatters.filetype,
}
end
M.lint = function()
-- TODO: implement linters (if applicable)
return "No linters configured!"
end
M.lsp = function()
if require("lv-utils").check_lsp_client_active "r_language_server" then
return
end
-- R -e 'install.packages("languageserver",repos = "http://cran.us.r-project.org")'
require("lspconfig").r_language_server.setup {}
end
M.dap = function()
-- TODO: implement dap
return "No DAP configured!"
end
return M

35
lua/lang/svelte.lua Normal file
View file

@ -0,0 +1,35 @@
local M = {}
M.config = function()
O.lang.svelte = {}
end
M.format = function()
-- TODO: implement formatter (if applicable)
return "No formatter configured!"
end
M.lint = function()
-- TODO: implement linters (if applicable)
return "No linters configured!"
end
M.lsp = function()
if require("lv-utils").check_lsp_client_active "svelte" then
return
end
require("lspconfig").svelte.setup {
cmd = { DATA_PATH .. "/lspinstall/svelte/node_modules/.bin/svelteserver", "--stdio" },
filetypes = { "svelte" },
root_dir = require("lspconfig.util").root_pattern("package.json", ".git"),
on_attach = require("lsp").common_on_attach,
}
end
M.dap = function()
-- TODO: implement dap
return "No DAP configured!"
end
return M

52
lua/lang/swift.lua Normal file
View file

@ -0,0 +1,52 @@
local M = {}
M.config = function()
O.lang.swift = {
formatter = {
exe = "swiftformat",
args = {},
stdin = true,
},
}
end
M.format = function()
-- TODO: implement formatter (if applicable)
return "No formatter configured!"
end
M.lint = function()
O.formatters.filetype["swift"] = {
function()
return {
exe = O.lang.swift.formatter.exe,
args = O.lang.swift.formatter.args,
stdin = O.lang.swift.formatter.stdin,
}
end,
}
require("formatter.config").set_defaults {
logging = false,
filetype = O.formatters.filetype,
}
end
M.lsp = function()
if require("lv-utils").check_lsp_client_active "sourcekit" then
return
end
require("lspconfig").sourcekit.setup {
cmd = { "xcrun", "sourcekit-lsp" },
on_attach = require("lsp").common_on_attach,
filetypes = { "swift" },
}
end
M.dap = function()
-- TODO: implement dap
return "No DAP configured!"
end
return M

View file

@ -1,5 +1,61 @@
local lv_utils = {} local lv_utils = {}
-- recursive Print (structure, limit, separator)
local function r_inspect_settings(structure, limit, separator)
limit = limit or 100 -- default item limit
separator = separator or "." -- indent string
if limit < 1 then
print "ERROR: Item limit reached."
return limit - 1
end
if structure == nil then
io.write("-- O", separator:sub(2), " = nil\n")
return limit - 1
end
local ts = type(structure)
if ts == "table" then
for k, v in pairs(structure) do
-- replace non alpha keys wih ["key"]
if tostring(k):match "[^%a_]" then
k = '["' .. tostring(k) .. '"]'
end
limit = r_inspect_settings(v, limit, separator .. "." .. tostring(k))
if limit < 0 then
break
end
end
return limit
end
if ts == "string" then
-- escape sequences
structure = string.format("%q", structure)
end
separator = separator:gsub("%.%[", "%[")
if type(structure) == "function" then
-- don't print functions
io.write("-- O", separator:sub(2), " = function ()\n")
else
io.write("O", separator:sub(2), " = ", tostring(structure), "\n")
end
return limit - 1
end
function lv_utils.generate_settings()
-- Opens a file in append mode
local file = io.open("lv-settings.lua", "w")
-- sets the default output file as test.lua
io.output(file)
-- write all `O` related settings to `lv-settings.lua` file
r_inspect_settings(O, 10000, ".")
-- closes the open file
io.close(file)
end
function lv_utils.reload_lv_config() function lv_utils.reload_lv_config()
vim.cmd "source ~/.config/nvim/lua/keymappings.lua" vim.cmd "source ~/.config/nvim/lua/keymappings.lua"
vim.cmd "source ~/.config/nvim/lv-config.lua" vim.cmd "source ~/.config/nvim/lv-config.lua"
@ -21,6 +77,32 @@ function lv_utils.check_lsp_client_active(name)
return false return false
end end
function lv_utils.add_keymap(mode, opts, keymaps)
for _, keymap in ipairs(keymaps) do
vim.api.nvim_set_keymap(mode, keymap[1], keymap[2], opts)
end
end
function lv_utils.add_keymap_normal_mode(opts, keymaps)
lv_utils.add_keymap("n", opts, keymaps)
end
function lv_utils.add_keymap_visual_mode(opts, keymaps)
lv_utils.add_keymap("v", opts, keymaps)
end
function lv_utils.add_keymap_visual_block_mode(opts, keymaps)
lv_utils.add_keymap("x", opts, keymaps)
end
function lv_utils.add_keymap_insert_mode(opts, keymaps)
lv_utils.add_keymap("i", opts, keymaps)
end
function lv_utils.add_keymap_term_mode(opts, keymaps)
lv_utils.add_keymap("t", opts, keymaps)
end
function lv_utils.define_augroups(definitions) -- {{{1 function lv_utils.define_augroups(definitions) -- {{{1
-- Create autocommand groups based on the passed definitions -- Create autocommand groups based on the passed definitions
-- --

46
lua/plugin-loader.lua Normal file
View file

@ -0,0 +1,46 @@
local plugin_loader = {}
function plugin_loader:init()
local execute = vim.api.nvim_command
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
execute("!git clone https://github.com/wbthomason/packer.nvim " .. install_path)
execute "packadd packer.nvim"
end
local packer_ok, packer = pcall(require, "packer")
if not packer_ok then
return
end
packer.init {
-- package_root = require("packer.util").join_paths(vim.fn.stdpath "data", "lvim", "pack"),
git = { clone_timeout = 300 },
display = {
open_fn = function()
return require("packer.util").float { border = "single" }
end,
},
}
self.packer = packer
return self
end
function plugin_loader:load(configurations)
return self.packer.startup(function(use)
for _, plugins in ipairs(configurations) do
for _, plugin in ipairs(plugins) do
use(plugin)
end
end
end)
end
return {
init = function()
return plugin_loader:init()
end,
}

View file

@ -1,101 +1,76 @@
local execute = vim.api.nvim_command return {
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
execute("!git clone https://github.com/wbthomason/packer.nvim " .. install_path)
execute "packadd packer.nvim"
end
local packer_ok, packer = pcall(require, "packer")
if not packer_ok then
return
end
packer.init {
-- package_root = require("packer.util").join_paths(vim.fn.stdpath "data", "lvim", "pack"),
git = { clone_timeout = 300 },
display = {
open_fn = function()
return require("packer.util").float { border = "single" }
end,
},
}
return require("packer").startup(function(use)
-- Packer can manage itself as an optional plugin -- Packer can manage itself as an optional plugin
use "wbthomason/packer.nvim" { "wbthomason/packer.nvim" },
-- TODO: refactor all of this (for now it works, but yes I know it could be wrapped in a simpler function) -- TODO: refactor all of this (for now it works, but yes I know it could be wrapped in a simpler function)
use { "neovim/nvim-lspconfig" } { "neovim/nvim-lspconfig" },
use { {
"kabouzeid/nvim-lspinstall", "kabouzeid/nvim-lspinstall",
event = "VimEnter", event = "VimEnter",
config = function() config = function()
require("lspinstall").setup() require("lspinstall").setup()
end, end,
} },
use { "nvim-lua/popup.nvim" } { "nvim-lua/popup.nvim" },
use { "nvim-lua/plenary.nvim" } { "nvim-lua/plenary.nvim" },
use { "tjdevries/astronauta.nvim" } { "tjdevries/astronauta.nvim" },
-- Telescope -- Telescope
use { {
"nvim-telescope/telescope.nvim", "nvim-telescope/telescope.nvim",
config = [[require('core.telescope').setup()]], config = [[require('core.telescope').setup()]],
} },
-- Autocomplete -- Autocomplete
use { {
"hrsh7th/nvim-compe", "hrsh7th/nvim-compe",
-- event = "InsertEnter", -- event = "InsertEnter",
config = function() config = function()
require("core.compe").setup() require("core.compe").setup()
end, end,
} },
-- Autopairs -- Autopairs
use { {
"windwp/nvim-autopairs", "windwp/nvim-autopairs",
-- event = "InsertEnter", -- event = "InsertEnter",
config = function() config = function()
require "core.autopairs" require "core.autopairs"
end, end,
} },
-- Snippets -- Snippets
use { "hrsh7th/vim-vsnip", event = "InsertEnter" } { "hrsh7th/vim-vsnip", event = "InsertEnter" },
use { "rafamadriz/friendly-snippets", event = "InsertEnter" } { "rafamadriz/friendly-snippets", event = "InsertEnter" },
-- Treesitter -- Treesitter
use { {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
config = function() config = function()
require("core.treesitter").setup() require("core.treesitter").setup()
end, end,
} },
-- Formatter.nvim -- Formatter.nvim
use { {
"mhartington/formatter.nvim", "mhartington/formatter.nvim",
config = function() config = function()
require "core.formatter" require "core.formatter"
end, end,
} },
-- Linter -- Linter
use { {
"mfussenegger/nvim-lint", "mfussenegger/nvim-lint",
config = function() config = function()
require("core.linter").setup() require("core.linter").setup()
end, end,
} },
-- NvimTree -- NvimTree
use { {
"kyazdani42/nvim-tree.lua", "kyazdani42/nvim-tree.lua",
-- event = "BufWinOpen", -- event = "BufWinOpen",
-- cmd = "NvimTreeToggle", -- cmd = "NvimTreeToggle",
@ -103,28 +78,28 @@ return require("packer").startup(function(use)
config = function() config = function()
require("core.nvimtree").setup() require("core.nvimtree").setup()
end, end,
} },
use { {
"lewis6991/gitsigns.nvim", "lewis6991/gitsigns.nvim",
config = function() config = function()
require("core.gitsigns").setup() require("core.gitsigns").setup()
end, end,
event = "BufRead", event = "BufRead",
} },
-- whichkey -- whichkey
use { {
"folke/which-key.nvim", "folke/which-key.nvim",
config = function() config = function()
require("core.which-key").setup() require("core.which-key").setup()
end, end,
event = "BufWinEnter", event = "BufWinEnter",
} },
-- Comments -- Comments
use { {
"terrortylor/nvim-comment", "terrortylor/nvim-comment",
event = "BufRead", event = "BufRead",
config = function() config = function()
@ -134,89 +109,89 @@ return require("packer").startup(function(use)
end end
nvim_comment.setup() nvim_comment.setup()
end, end,
} },
-- vim-rooter -- vim-rooter
use { {
"airblade/vim-rooter", "airblade/vim-rooter",
config = function() config = function()
vim.g.rooter_silent_chdir = 1 vim.g.rooter_silent_chdir = 1
end, end,
} },
-- Icons -- Icons
use { "kyazdani42/nvim-web-devicons" } { "kyazdani42/nvim-web-devicons" },
-- Status Line and Bufferline -- Status Line and Bufferline
use { {
"glepnir/galaxyline.nvim", "glepnir/galaxyline.nvim",
config = function() config = function()
require "core.galaxyline" require "core.galaxyline"
end, end,
event = "BufWinEnter", event = "BufWinEnter",
disable = not O.plugin.galaxyline.active, disable = not O.plugin.galaxyline.active,
} },
use { {
"romgrk/barbar.nvim", "romgrk/barbar.nvim",
config = function() config = function()
require "core.bufferline" require "core.bufferline"
end, end,
event = "BufWinEnter", event = "BufWinEnter",
} },
-- Debugging -- Debugging
use { {
"mfussenegger/nvim-dap", "mfussenegger/nvim-dap",
-- event = "BufWinEnter", -- event = "BufWinEnter",
config = function() config = function()
require("core.dap").setup() require("core.dap").setup()
end, end,
disable = not O.plugin.dap.active, disable = not O.plugin.dap.active,
} },
-- Debugger management -- Debugger management
use { {
"Pocco81/DAPInstall.nvim", "Pocco81/DAPInstall.nvim",
-- event = "BufWinEnter", -- event = "BufWinEnter",
-- event = "BufRead", -- event = "BufRead",
disable = not O.plugin.dap.active, disable = not O.plugin.dap.active,
} },
-- Builtins, these do not load by default -- Builtins, these do not load by default
-- Dashboard -- Dashboard
use { {
"ChristianChiarulli/dashboard-nvim", "ChristianChiarulli/dashboard-nvim",
event = "BufWinEnter", event = "BufWinEnter",
config = function() config = function()
require("core.dashboard").setup() require("core.dashboard").setup()
end, end,
disable = not O.plugin.dashboard.active, disable = not O.plugin.dashboard.active,
} },
-- TODO: remove in favor of akinsho/nvim-toggleterm.lua -- TODO: remove in favor of akinsho/nvim-toggleterm.lua
-- Floating terminal -- Floating terminal
-- use { -- {
-- "numToStr/FTerm.nvim", -- "numToStr/FTerm.nvim",
-- event = "BufWinEnter", -- event = "BufWinEnter",
-- config = function() -- config = function()
-- require("core.floatterm").setup() -- require("core.floatterm").setup()
-- end, -- end,
-- disable = not O.plugin.floatterm.active, -- disable = not O.plugin.floatterm.active,
-- } -- },
use { {
"akinsho/nvim-toggleterm.lua", "akinsho/nvim-toggleterm.lua",
event = "BufWinEnter", event = "BufWinEnter",
config = function() config = function()
require("core.terminal").setup() require("core.terminal").setup()
end, end,
disable = not O.plugin.terminal.active, disable = not O.plugin.terminal.active,
} },
-- Zen Mode -- Zen Mode
use { {
"folke/zen-mode.nvim", "folke/zen-mode.nvim",
cmd = "ZenMode", cmd = "ZenMode",
event = "BufRead", event = "BufRead",
@ -224,28 +199,28 @@ return require("packer").startup(function(use)
require("core.zen").setup() require("core.zen").setup()
end, end,
disable = not O.plugin.zen.active, disable = not O.plugin.zen.active,
} },
--------------------------------------------------------------------------------- ---------------------------------------------------------------------------------
-- LANGUAGE SPECIFIC GOES HERE -- LANGUAGE SPECIFIC GOES HERE
use { {
"lervag/vimtex", "lervag/vimtex",
ft = "tex", ft = "tex",
} },
-- Rust tools -- Rust tools
-- TODO: use lazy loading maybe? -- TODO: use lazy loading maybe?
use { {
"simrat39/rust-tools.nvim", "simrat39/rust-tools.nvim",
disable = not O.lang.rust.rust_tools.active, disable = not O.lang.rust.rust_tools.active,
} },
-- Elixir -- Elixir
use { "elixir-editors/vim-elixir", ft = { "elixir", "eelixir", "euphoria3" } } { "elixir-editors/vim-elixir", ft = { "elixir", "eelixir", "euphoria3" } },
-- Javascript / Typescript -- Javascript / Typescript
use { {
"jose-elias-alvarez/nvim-lsp-ts-utils", "jose-elias-alvarez/nvim-lsp-ts-utils",
ft = { ft = {
"javascript", "javascript",
@ -255,23 +230,18 @@ return require("packer").startup(function(use)
"typescriptreact", "typescriptreact",
"typescript.tsx", "typescript.tsx",
}, },
} },
-- Java -- Java
use { {
"mfussenegger/nvim-jdtls", "mfussenegger/nvim-jdtls",
-- ft = { "java" }, -- ft = { "java" },
disable = not O.lang.java.java_tools.active, disable = not O.lang.java.java_tools.active,
} },
-- Scala -- Scala
use { {
"scalameta/nvim-metals", "scalameta/nvim-metals",
disable = not O.lang.scala.metals.active, disable = not O.lang.scala.metals.active,
},
} }
-- Install user plugins
for _, plugin in pairs(O.user_plugins) do
packer.use(plugin)
end
end)

View file

@ -28,12 +28,6 @@ end
opt.shortmess:append "c" opt.shortmess:append "c"
if O.leader_key == " " or O.leader_key == "space" then
vim.g.mapleader = " "
else
vim.g.mapleader = O.leader_key
end
for _, plugin in pairs(O.disabled_built_ins) do for _, plugin in pairs(O.disabled_built_ins) do
vim.g["loaded_" .. plugin] = 1 vim.g["loaded_" .. plugin] = 1
end end

View file

@ -134,38 +134,30 @@ asktoinstallpip() {
} }
installonmac() { installonmac() {
brew install ripgrep fzf ranger brew install ripgrep fzf
npm install -g tree-sitter-cli npm install -g tree-sitter-cli
} }
pipinstallueberzug() {
which pip3 >/dev/null && pip3 install ueberzug || echo "Not installing ueberzug pip not found"
}
installonubuntu() { installonubuntu() {
sudo apt install ripgrep fzf ranger sudo apt install ripgrep fzf
sudo apt install libjpeg8-dev zlib1g-dev python-dev python3-dev libxtst-dev sudo apt install libjpeg8-dev zlib1g-dev python-dev python3-dev libxtst-dev
pip3 install ueberzug
pip3 install neovim-remote pip3 install neovim-remote
npm install -g tree-sitter-cli npm install -g tree-sitter-cli
} }
installonarch() { installonarch() {
sudo pacman -S ripgrep fzf ranger sudo pacman -S ripgrep fzf
which yay >/dev/null && yay -S python-ueberzug-git || pipinstallueberzug
pip3 install neovim-remote pip3 install neovim-remote
npm install -g tree-sitter-cli npm install -g tree-sitter-cli
} }
installonfedora() { installonfedora() {
sudo dnf groupinstall "X Software Development" sudo dnf groupinstall "X Software Development"
sudo dnf install -y fzf ripgrep ranger sudo dnf install -y fzf ripgrep
pip3 install wheel ueberzug
} }
installongentoo() { installongentoo() {
sudo emerge -avn sys-apps/ripgrep app-shells/fzf app-misc/ranger dev-python/neovim-remote virtual/jpeg sys-libs/zlib sudo emerge -avn sys-apps/ripgrep app-shells/fzf dev-python/neovim-remote virtual/jpeg sys-libs/zlib
pipinstallueberzug
npm install -g tree-sitter-cli npm install -g tree-sitter-cli
} }
@ -217,7 +209,4 @@ else
fi fi
echo "I recommend you also install and activate a font from here: https://github.com/ryanoasis/nerd-fonts" echo "I recommend you also install and activate a font from here: https://github.com/ryanoasis/nerd-fonts"
# echo "I also recommend you add 'set preview_images_method ueberzug' to ~/.config/ranger/rc.conf"
# echo 'export PATH=/home/$USER/.config/lunarvim/utils/bin:$PATH appending to zshrc/bashrc' # echo 'export PATH=/home/$USER/.config/lunarvim/utils/bin:$PATH appending to zshrc/bashrc'

View file

@ -16,7 +16,25 @@ O.completion.autocomplete = true
O.colorscheme = "spacegray" O.colorscheme = "spacegray"
O.default_options.wrap = true O.default_options.wrap = true
O.default_options.timeoutlen = 100 O.default_options.timeoutlen = 100
O.leader_key = " " -- keymappings
O.keys.leader_key = "space"
-- overwrite the key-mappings provided by LunarVim for any mode, or leave it empty to keep them
-- O.keys.normal_mode = {
-- Page down/up
-- {'[d', '<PageUp>'},
-- {']d', '<PageDown>'},
--
-- Navigate buffers
-- {'<Tab>', ':bnext<CR>'},
-- {'<S-Tab>', ':bprevious<CR>'},
-- }
-- if you just want to augment the existing ones then use the utility function
-- require("lv-utils").add_keymap_insert_mode({ silent = true }, {
-- { "<C-s>", ":w<cr>" },
-- { "<C-c>", "<ESC>" },
-- })
-- you can also use the native vim way directly
-- vim.api.nvim_set_keymap("i", "<C-Space>", "compe#complete()", { noremap = true, silent = true, expr = true })
-- TODO: User Config for predefined plugins -- TODO: User Config for predefined plugins
-- After changing plugin config exit and reopen LunarVim, Run :PackerInstall :PackerCompile -- After changing plugin config exit and reopen LunarVim, Run :PackerInstall :PackerCompile

View file

@ -16,7 +16,25 @@ O.completion.autocomplete = true
O.colorscheme = "spacegray" O.colorscheme = "spacegray"
O.default_options.wrap = true O.default_options.wrap = true
O.default_options.timeoutlen = 100 O.default_options.timeoutlen = 100
O.leader_key = " " -- keymappings
O.keys.leader_key = "space"
-- overwrite the key-mappings provided by LunarVim for any mode, or leave it empty to keep them
-- O.keys.normal_mode = {
-- Page down/up
-- {'[d', '<PageUp>'},
-- {']d', '<PageDown>'},
--
-- Navigate buffers
-- {'<Tab>', ':bnext<CR>'},
-- {'<S-Tab>', ':bprevious<CR>'},
-- }
-- if you just want to augment the existing ones then use the utility function
-- require("lv-utils").add_keymap_insert_mode({ silent = true }, {
-- { "<C-s>", ":w<cr>" },
-- { "<C-c>", "<ESC>" },
-- })
-- you can also use the native vim way directly
-- vim.api.nvim_set_keymap("i", "<C-Space>", "compe#complete()", { noremap = true, silent = true, expr = true })
-- TODO: User Config for predefined plugins -- TODO: User Config for predefined plugins
-- After changing plugin config exit and reopen LunarVim, Run :PackerInstall :PackerCompile -- After changing plugin config exit and reopen LunarVim, Run :PackerInstall :PackerCompile