diff options
-rw-r--r-- | README.md | 33 | ||||
-rw-r--r-- | ftplugin/r.lua | 4 | ||||
l--------- | ftplugin/rmd.lua | 1 | ||||
-rw-r--r-- | ftplugin/svelte.lua | 4 | ||||
-rw-r--r-- | ftplugin/swift.lua | 4 | ||||
-rw-r--r-- | init.lua | 9 | ||||
-rw-r--r-- | lua/core/nvimtree.lua | 16 | ||||
-rw-r--r-- | lua/core/telescope.lua | 2 | ||||
-rw-r--r-- | lua/default-config.lua | 9 | ||||
-rw-r--r-- | lua/keymappings.lua | 109 | ||||
-rw-r--r-- | lua/lang/r.lua | 56 | ||||
-rw-r--r-- | lua/lang/svelte.lua | 35 | ||||
-rw-r--r-- | lua/lang/swift.lua | 52 | ||||
-rw-r--r-- | lua/lv-utils/init.lua | 82 | ||||
-rw-r--r-- | lua/plugin-loader.lua | 46 | ||||
-rw-r--r-- | lua/plugins.lua | 152 | ||||
-rw-r--r-- | lua/settings.lua | 6 | ||||
-rwxr-xr-x | utils/installer/install.sh | 21 | ||||
-rw-r--r-- | utils/installer/lv-config.example-no-ts.lua | 20 | ||||
-rw-r--r-- | utils/installer/lv-config.example.lua | 20 |
20 files changed, 501 insertions, 180 deletions
@@ -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, \ -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` - `~/.cache/nvim` - `~/.local/share/nvim/site/pack/packer` ```bash 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 @@ -66,7 +67,27 @@ O.completion.autocomplete = true O.default_options.relativenumber = true O.colorscheme = 'spacegray' 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 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') ``` +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 In order to update you should be aware of three things `Plugins`, `LunarVim` and `Neovim` diff --git a/ftplugin/r.lua b/ftplugin/r.lua new file mode 100644 index 00000000..6de40bda --- /dev/null +++ b/ftplugin/r.lua @@ -0,0 +1,4 @@ +require("lang.r").format() +require("lang.r").lint() +require("lang.r").lsp() +require("lang.r").dap() diff --git a/ftplugin/rmd.lua b/ftplugin/rmd.lua new file mode 120000 index 00000000..401cef17 --- /dev/null +++ b/ftplugin/rmd.lua @@ -0,0 +1 @@ +r.lua
\ No newline at end of file diff --git a/ftplugin/svelte.lua b/ftplugin/svelte.lua new file mode 100644 index 00000000..108a0fc3 --- /dev/null +++ b/ftplugin/svelte.lua @@ -0,0 +1,4 @@ +require("lang.svelte").format() +require("lang.svelte").lint() +require("lang.svelte").lsp() +require("lang.svelte").dap() diff --git a/ftplugin/swift.lua b/ftplugin/swift.lua new file mode 100644 index 00000000..64d87e1c --- /dev/null +++ b/ftplugin/swift.lua @@ -0,0 +1,4 @@ +require("lang.swift").format() +require("lang.swift").lint() +require("lang.swift").lsp() +require("lang.swift").dap() @@ -1,12 +1,17 @@ require "default-config" -require "keymappings" local status_ok, error = pcall(vim.cmd, "luafile " .. CONFIG_PATH .. "/lv-config.lua") if not status_ok then print "something is wrong with your lv-config" print(error) 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. + require "settings" require "lv-utils" diff --git a/lua/core/nvimtree.lua b/lua/core/nvimtree.lua index e3df9afb..7ecbe8c2 100644 --- a/lua/core/nvimtree.lua +++ b/lua/core/nvimtree.lua @@ -1,8 +1,4 @@ local M = {} -local status_ok, nvim_tree_config = pcall(require, "nvim-tree.config") -if not status_ok then - return -end -- M.config = function() O.plugin.nvimtree = { @@ -50,6 +46,10 @@ M.config = function() end -- 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 for opt, val in pairs(O.plugin.nvimtree) do @@ -65,12 +65,12 @@ M.setup = function() } end -- -local view_status_ok, view = pcall(require, "nvim-tree.view") -if not view_status_ok then - return -end -- M.toggle_tree = function() + local view_status_ok, view = pcall(require, "nvim-tree.view") + if not view_status_ok then + return + end if view.win_open() then require("nvim-tree").close() if package.loaded["bufferline.state"] then diff --git a/lua/core/telescope.lua b/lua/core/telescope.lua index 5a067d67..4456d65e 100644 --- a/lua/core/telescope.lua +++ b/lua/core/telescope.lua @@ -33,7 +33,7 @@ M.config = function() file_sorter = require("telescope.sorters").get_fzy_sorter, file_ignore_patterns = {}, generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter, - path_display = { "shorten" }, + path_display = { shorten = 5 }, winblend = 0, border = {}, borderchars = { "─", "│", "─", "│", "â•", "â•®", "╯", "â•°" }, diff --git a/lua/default-config.lua b/lua/default-config.lua index 408ba038..70c5f070 100644 --- a/lua/default-config.lua +++ b/lua/default-config.lua @@ -5,7 +5,9 @@ TERMINAL = vim.fn.expand "$TERMINAL" USER = vim.fn.expand "$USER" O = { - leader_key = "space", + keys = { + leader_key = "space", + }, colorscheme = "spacegray", line_wrap_cursor_movement = true, transparent_window = false, @@ -177,10 +179,13 @@ require("lang.kotlin").config() require("lang.lua").config() require("lang.php").config() require("lang.python").config() +require("lang.r").config() require("lang.ruby").config() require("lang.rust").config() -require("lang.scala").config() require("lang.sh").config() +require("lang.scala").config() +require("lang.svelte").config() +require("lang.swift").config() require("lang.terraform").config() require("lang.tex").config() require("lang.vim").config() diff --git a/lua/keymappings.lua b/lua/keymappings.lua index fed362aa..16c91b3e 100644 --- a/lua/keymappings.lua +++ b/lua/keymappings.lua @@ -1,42 +1,41 @@ -local function register_mappings(mappings, default_options) - 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 lv_utils = require "lv-utils" + +local opts = { + nnoremap = { noremap = true, silent = true }, + inoremap = { noremap = true, silent = true }, + vnoremap = { noremap = true, silent = true }, + xnoremap = { noremap = true, silent = true }, + generic = { silent = true }, +} -local mappings = { - i = { -- Insert mode +local default_keys = { + insert_mode = { -- I hate escape { "jk", "<ESC>" }, { "kj", "<ESC>" }, { "jj", "<ESC>" }, - -- Move current line / block with Alt-j/k ala vscode. { "<A-j>", "<Esc>:m .+1<CR>==gi" }, { "<A-k>", "<Esc>:m .-2<CR>==gi" }, - - -- Terminal window navigation - { "<C-h>", "<C-\\><C-N><C-w>h" }, - { "<C-j>", "<C-\\><C-N><C-w>j" }, - { "<C-k>", "<C-\\><C-N><C-w>k" }, - { "<C-l>", "<C-\\><C-N><C-w>l" }, + -- navigation + { "<A-Up>", "<C-\\><C-N><C-w>h" }, + { "<A-Down>", "<C-\\><C-N><C-w>j" }, + { "<A-Left>", "<C-\\><C-N><C-w>k" }, + { "<A-Right>", "<C-\\><C-N><C-w>l" }, }, - n = { -- Normal mode + + normal_mode = { -- Better window movement - { "<C-h>", "<C-w>h", { silent = true } }, - { "<C-j>", "<C-w>j", { silent = true } }, - { "<C-k>", "<C-w>k", { silent = true } }, - { "<C-l>", "<C-w>l", { silent = true } }, + { "<C-h>", "<C-w>h" }, + { "<C-j>", "<C-w>j" }, + { "<C-k>", "<C-w>k" }, + { "<C-l>", "<C-w>l" }, -- Resize with arrows - { "<C-Up>", ":resize -2<CR>", { silent = true } }, - { "<C-Down>", ":resize +2<CR>", { silent = true } }, - { "<C-Left>", ":vertical resize -2<CR>", { silent = true } }, - { "<C-Right>", ":vertical resize +2<CR>", { silent = true } }, + { "<C-Up>", ":resize -2<CR>" }, + { "<C-Down>", ":resize +2<CR>" }, + { "<C-Left>", ":vertical resize -2<CR>" }, + { "<C-Right>", ":vertical resize +2<CR>" }, -- Tab switch buffer -- { "<TAB>", ":bnext<CR>" }, @@ -49,17 +48,20 @@ local mappings = { -- QuickFix { "]q", ":cnext<CR>" }, { "[q", ":cprev<CR>" }, + { "<C-q>", ":call QuickFixToggle()<CR>" }, -- {'<C-TAB>', 'compe#complete()', {noremap = true, silent = true, expr = true}}, }, - t = { -- Terminal mode + + term_mode = { -- Terminal window navigation { "<C-h>", "<C-\\><C-N><C-w>h" }, { "<C-j>", "<C-\\><C-N><C-w>j" }, { "<C-k>", "<C-\\><C-N><C-w>k" }, { "<C-l>", "<C-\\><C-N><C-w>l" }, }, - v = { -- Visual/Select mode + + visual_mode = { -- Better indenting { "<", "<gv" }, { ">", ">gv" }, @@ -67,7 +69,8 @@ local mappings = { -- { "p", '"0p', { silent = true } }, -- { "P", '"0P', { silent = true } }, }, - x = { -- Visual mode + + visual_block_mode = { -- Move selected line / block of text in visual mode { "K", ":move '<-2<CR>gv-gv" }, { "J", ":move '>+1<CR>gv-gv" }, @@ -76,31 +79,37 @@ local mappings = { { "<A-j>", ":m '>+1<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 - mappings["n"][5][1] = "<A-Up>" - mappings["n"][6][1] = "<A-Down>" - mappings["n"][7][1] = "<A-Left>" - mappings["n"][8][1] = "<A-Right>" + -- TODO: fix this + default_keys.normal_mode[5][1] = "<A-Up>" + default_keys.normal_mode[6][1] = "<A-Down>" + default_keys.normal_mode[7][1] = "<A-Left>" + default_keys.normal_mode[8][1] = "<A-Right>" 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>")' -vim.cmd 'inoremap <expr> <c-k> ("\\<C-p>")' +local function get_user_keys(mode) + if O.keys[mode] == nil then + return default_keys[mode] + else + return O.keys[mode] + end +end --- vim.cmd('inoremap <expr> <TAB> (\"\\<C-n>\")') --- vim.cmd('inoremap <expr> <S-TAB> (\"\\<C-p>\")') +lv_utils.add_keymap_normal_mode(opts.nnoremap, get_user_keys "normal_mode") +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([[ --- map p <Plug>(miniyank-autoput) --- map P <Plug>(miniyank-autoPut) --- map <leader>n <Plug>(miniyank-cycle) --- map <leader>N <Plug>(miniyank-cycleback) --- ]]) +-- navigate tab completion with <c-j> and <c-k> +-- runs conditionally +vim.cmd 'inoremap <expr> <C-j> pumvisible() ? "\\<C-n>" : "\\<C-j>"' +vim.cmd 'inoremap <expr> <C-k> pumvisible() ? "\\<C-p>" : "\\<C-k>"' diff --git a/lua/lang/r.lua b/lua/lang/r.lua new file mode 100644 index 00000000..b05e6ee6 --- /dev/null +++ b/lua/lang/r.lua @@ -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 diff --git a/lua/lang/svelte.lua b/lua/lang/svelte.lua new file mode 100644 index 00000000..220c2c18 --- /dev/null +++ b/lua/lang/svelte.lua @@ -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 diff --git a/lua/lang/swift.lua b/lua/lang/swift.lua new file mode 100644 index 00000000..69254caa --- /dev/null +++ b/lua/lang/swift.lua @@ -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 diff --git a/lua/lv-utils/init.lua b/lua/lv-utils/init.lua index bc2b51b7..c88c106d 100644 --- a/lua/lv-utils/init.lua +++ b/lua/lv-utils/init.lua @@ -1,5 +1,61 @@ 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() vim.cmd "source ~/.config/nvim/lua/keymappings.lua" vim.cmd "source ~/.config/nvim/lv-config.lua" @@ -21,6 +77,32 @@ function lv_utils.check_lsp_client_active(name) return false 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 -- Create autocommand groups based on the passed definitions -- diff --git a/lua/plugin-loader.lua b/lua/plugin-loader.lua new file mode 100644 index 00000000..25a41111 --- /dev/null +++ b/lua/plugin-loader.lua @@ -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, +} diff --git a/lua/plugins.lua b/lua/plugins.lua index 2f1ad333..f880cc1f 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -1,101 +1,76 @@ -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, - }, -} - -return require("packer").startup(function(use) +return { -- 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) - use { "neovim/nvim-lspconfig" } - use { + { "neovim/nvim-lspconfig" }, + { "kabouzeid/nvim-lspinstall", event = "VimEnter", config = function() require("lspinstall").setup() end, - } + }, - use { "nvim-lua/popup.nvim" } - use { "nvim-lua/plenary.nvim" } - use { "tjdevries/astronauta.nvim" } + { "nvim-lua/popup.nvim" }, + { "nvim-lua/plenary.nvim" }, + { "tjdevries/astronauta.nvim" }, -- Telescope - use { + { "nvim-telescope/telescope.nvim", config = [[require('core.telescope').setup()]], - } + }, -- Autocomplete - use { + { "hrsh7th/nvim-compe", -- event = "InsertEnter", config = function() require("core.compe").setup() end, - } + }, -- Autopairs - use { + { "windwp/nvim-autopairs", -- event = "InsertEnter", config = function() require "core.autopairs" end, - } + }, -- Snippets - use { "hrsh7th/vim-vsnip", event = "InsertEnter" } - use { "rafamadriz/friendly-snippets", event = "InsertEnter" } + { "hrsh7th/vim-vsnip", event = "InsertEnter" }, + { "rafamadriz/friendly-snippets", event = "InsertEnter" }, -- Treesitter - use { + { "nvim-treesitter/nvim-treesitter", config = function() require("core.treesitter").setup() end, - } + }, -- Formatter.nvim - use { + { "mhartington/formatter.nvim", config = function() require "core.formatter" end, - } + }, -- Linter - use { + { "mfussenegger/nvim-lint", config = function() require("core.linter").setup() end, - } + }, -- NvimTree - use { + { "kyazdani42/nvim-tree.lua", -- event = "BufWinOpen", -- cmd = "NvimTreeToggle", @@ -103,28 +78,28 @@ return require("packer").startup(function(use) config = function() require("core.nvimtree").setup() end, - } + }, - use { + { "lewis6991/gitsigns.nvim", config = function() require("core.gitsigns").setup() end, event = "BufRead", - } + }, -- whichkey - use { + { "folke/which-key.nvim", config = function() require("core.which-key").setup() end, event = "BufWinEnter", - } + }, -- Comments - use { + { "terrortylor/nvim-comment", event = "BufRead", config = function() @@ -134,89 +109,89 @@ return require("packer").startup(function(use) end nvim_comment.setup() end, - } + }, -- vim-rooter - use { + { "airblade/vim-rooter", config = function() vim.g.rooter_silent_chdir = 1 end, - } + }, -- Icons - use { "kyazdani42/nvim-web-devicons" } + { "kyazdani42/nvim-web-devicons" }, -- Status Line and Bufferline - use { + { "glepnir/galaxyline.nvim", config = function() require "core.galaxyline" end, event = "BufWinEnter", disable = not O.plugin.galaxyline.active, - } + }, - use { + { "romgrk/barbar.nvim", config = function() require "core.bufferline" end, event = "BufWinEnter", - } + }, -- Debugging - use { + { "mfussenegger/nvim-dap", -- event = "BufWinEnter", config = function() require("core.dap").setup() end, disable = not O.plugin.dap.active, - } + }, -- Debugger management - use { + { "Pocco81/DAPInstall.nvim", -- event = "BufWinEnter", -- event = "BufRead", disable = not O.plugin.dap.active, - } + }, -- Builtins, these do not load by default -- Dashboard - use { + { "ChristianChiarulli/dashboard-nvim", event = "BufWinEnter", config = function() require("core.dashboard").setup() end, disable = not O.plugin.dashboard.active, - } + }, -- TODO: remove in favor of akinsho/nvim-toggleterm.lua -- Floating terminal - -- use { + -- { -- "numToStr/FTerm.nvim", -- event = "BufWinEnter", -- config = function() -- require("core.floatterm").setup() -- end, -- disable = not O.plugin.floatterm.active, - -- } + -- }, - use { + { "akinsho/nvim-toggleterm.lua", event = "BufWinEnter", config = function() require("core.terminal").setup() end, disable = not O.plugin.terminal.active, - } + }, -- Zen Mode - use { + { "folke/zen-mode.nvim", cmd = "ZenMode", event = "BufRead", @@ -224,28 +199,28 @@ return require("packer").startup(function(use) require("core.zen").setup() end, disable = not O.plugin.zen.active, - } + }, --------------------------------------------------------------------------------- -- LANGUAGE SPECIFIC GOES HERE - use { + { "lervag/vimtex", ft = "tex", - } + }, -- Rust tools -- TODO: use lazy loading maybe? - use { + { "simrat39/rust-tools.nvim", disable = not O.lang.rust.rust_tools.active, - } + }, -- Elixir - use { "elixir-editors/vim-elixir", ft = { "elixir", "eelixir", "euphoria3" } } + { "elixir-editors/vim-elixir", ft = { "elixir", "eelixir", "euphoria3" } }, -- Javascript / Typescript - use { + { "jose-elias-alvarez/nvim-lsp-ts-utils", ft = { "javascript", @@ -255,23 +230,18 @@ return require("packer").startup(function(use) "typescriptreact", "typescript.tsx", }, - } + }, -- Java - use { + { "mfussenegger/nvim-jdtls", -- ft = { "java" }, disable = not O.lang.java.java_tools.active, - } + }, -- Scala - use { + { "scalameta/nvim-metals", disable = not O.lang.scala.metals.active, - } - - -- Install user plugins - for _, plugin in pairs(O.user_plugins) do - packer.use(plugin) - end -end) + }, +} diff --git a/lua/settings.lua b/lua/settings.lua index 3ac94476..aa2bdd8d 100644 --- a/lua/settings.lua +++ b/lua/settings.lua @@ -28,12 +28,6 @@ end 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 vim.g["loaded_" .. plugin] = 1 end diff --git a/utils/installer/install.sh b/utils/installer/install.sh index 0473bbab..36178ae5 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -134,38 +134,30 @@ asktoinstallpip() { } installonmac() { - brew install ripgrep fzf ranger + brew install ripgrep fzf npm install -g tree-sitter-cli } -pipinstallueberzug() { - which pip3 >/dev/null && pip3 install ueberzug || echo "Not installing ueberzug pip not found" -} - 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 - pip3 install ueberzug pip3 install neovim-remote npm install -g tree-sitter-cli } installonarch() { - sudo pacman -S ripgrep fzf ranger - which yay >/dev/null && yay -S python-ueberzug-git || pipinstallueberzug + sudo pacman -S ripgrep fzf pip3 install neovim-remote npm install -g tree-sitter-cli } installonfedora() { sudo dnf groupinstall "X Software Development" - sudo dnf install -y fzf ripgrep ranger - pip3 install wheel ueberzug + sudo dnf install -y fzf ripgrep } installongentoo() { - sudo emerge -avn sys-apps/ripgrep app-shells/fzf app-misc/ranger dev-python/neovim-remote virtual/jpeg sys-libs/zlib - pipinstallueberzug + sudo emerge -avn sys-apps/ripgrep app-shells/fzf dev-python/neovim-remote virtual/jpeg sys-libs/zlib npm install -g tree-sitter-cli } @@ -217,7 +209,4 @@ else fi 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' diff --git a/utils/installer/lv-config.example-no-ts.lua b/utils/installer/lv-config.example-no-ts.lua index ab544a35..d52c61bc 100644 --- a/utils/installer/lv-config.example-no-ts.lua +++ b/utils/installer/lv-config.example-no-ts.lua @@ -16,7 +16,25 @@ O.completion.autocomplete = true O.colorscheme = "spacegray" O.default_options.wrap = true 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 -- After changing plugin config exit and reopen LunarVim, Run :PackerInstall :PackerCompile diff --git a/utils/installer/lv-config.example.lua b/utils/installer/lv-config.example.lua index 1ca556b2..0e1a4a26 100644 --- a/utils/installer/lv-config.example.lua +++ b/utils/installer/lv-config.example.lua @@ -16,7 +16,25 @@ O.completion.autocomplete = true O.colorscheme = "spacegray" O.default_options.wrap = true 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 -- After changing plugin config exit and reopen LunarVim, Run :PackerInstall :PackerCompile |