Przeglądaj źródła

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

christianchiarulli 3 lat temu
rodzic
commit
a77e36483b

+ 15 - 106
README.md

@@ -20,79 +20,37 @@
 
 </div>
 
-## Install In One Command!
+## Documentation
 
-Make sure you have the newest version of Neovim (0.5).
+You can find all of the documentation for Lunarvim at [lunarvim.org](https://www.lunarvim.org)
 
-``` bash
-bash <(curl -s https://raw.githubusercontent.com/lunarvim/lunarvim/master/utils/installer/install.sh)
-```
-
-### Customizing the installation
-
-The following options are supported by setting environment variables:
-- `"$LV_REMOTE"`            Select a different LunarVim remote [default: 'lunarvim/lunarvim.git']
-- `"$LV_BRANCH"`            Select LunarVim's branch [default: 'rolling']
-- `"$INSTALL_PREFIX"`       Select LunarVim's install prefix [default: `'$HOME/.local'`]
-- `"$LUNARVIM_RUNTIME_DIR"` Select LunarVim's runtime directory [default: `'$HOME/.local/share/lunarvim'`]
-- `"$LUNARVIM_CONFIG_DIR"`  Select LunarVim's configuration directory [default: `'$HOME/.config/lvim'`]
+## Install In One Command!
 
-Putting it all together
+Make sure you have the release version of Neovim (0.5).
 
 ``` bash
-curl -LSs https://raw.githubusercontent.com/lunarvim/lunarvim/rolling/utils/installer/install.sh -O install.sh
-INSTALL_PREFIX=/tmp/t1 LUNARVIM_CONFIG_DIR=/tmp/t2 LUNARVIM_RUNTIME_DIR=/tmp/t3 bash ./install.sh
-```
-
-### BREAKING CHANGE on rolling and master branches
-* The latest changes to LunarVim require you to [remove it completely](https://github.com/lunarvim/LunarVim/wiki/Uninstalling-LunarVim) before upgrading
-* Going forward LunarVim will no longer reside in the nvim configuration folder.  LunarVim has been moved to `~/.local/share/lunarvim`.  
-* To launch Lunarvim use the new `lvim` command.  `nvim` will only launch standard neovim.  
-* Your personal configuration file (`config.lua`) can now be found in `~/.config/lvim`.  You can initialize this folder as a git repository to track changes to your configuration files.
-* If you want to keep launching LunarVim with the `nvim` command, add an alias entry to your shell's config file:  `alias nvim=lvim`.  To temporarily revert to the default `nvim` prefix it with a backslash `\nvim`.
-* Many options formerly available in `config.lua` have been renamed.  For details [look here](https://github.com/lunarvim/LunarVim/wiki/Breaking-changes-in-rolling)
-
-### Debugging LunarVim's configuration
-* To turn on debugging add these settings `lvim.log.level = debug` and use `<leader>Ll` to see the options of viewing the logfiles
-* You can also use install [lnav](https://github.com/tstack/lnav) and use it in a floating terminal. Make sure to set `lvim.builtin.terminal.active = true`.
-
-### Fixing installation problems
-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 folders:
-- `~/.cache/nvim`
-- `~/.config/nvim`                        #Removed only on Master Branch
-- `~/.local/share/nvim/site/pack/packer`  #Removed only on Master Branch
-- `~/.local/share/lunarvim`               #Removed only on Rolling Branch
-- `~/.config/lvim`                        #Removed only on Rolling Branch
-```bash
-curl -s https://raw.githubusercontent.com/lunarvim/lunarvim/rolling/utils/installer/install.sh | LVBRANCH=rolling bash -s -- --overwrite
+bash <(curl -s https://raw.githubusercontent.com/lunarvim/lunarvim/master/utils/installer/install.sh)
 ```
-then run nvim and wait for treesitter to finish the installation
 
+## Install Language support
 
-## Installing LSP for your language
+- Enter `:LspInstall` followed by `<TAB>` to see your options for LSP
 
-Just enter `:LspInstall` followed by `<TAB>` to see your options
+- Enter `:TSInstall` followed by `<TAB>` to see your options for syntax highlighting
 
 **NOTE** I recommend installing `lua` for autocomplete in `config.lua`
 
-For the julia language server look [here](https://github.com/lunarvim/LunarVim/wiki/Enabling-a-language-server#julia-support)
-
 ## Configuration file
 
-To activate other plugins and language features use the `lv-config.lua` file provided in the `nvim` folder (`~/.config/nvim/lv-config.lua`) in the master branch or (`~/.config/lvim/config.lua`) on rolling
+To install plugins configure LunarVim use the `config.lua` located here: `~/.config/lvim/config.lua`
 
 Example:
 
 ```lua
 -- general
 lvim.format_on_save = true
-lvim.lint_on_save = true
 lvim.colorscheme = "onedarker"
 
-lvim.builtin.compe.autocomplete = true
-
--- keymappings [view all the defaults by pressing <leader>Lk]
 lvim.leader = "space"
 -- add your own keymapping
 lvim.keys.normal_mode["<C-s>"] = ":w<cr>"
@@ -105,25 +63,16 @@ lvim.keys.normal_mode["<C-s>"] = ":w<cr>"
 
 -- 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>", "Diagnosticss" },
---   q = { "<cmd>Trouble quickfix<cr>", "QuickFix" },
---   l = { "<cmd>Trouble loclist<cr>", "LocationList" },
---   w = { "<cmd>Trouble lsp_workspace_diagnostics<cr>", "Diagnosticss" },
--- }
-
--- After changing plugin config exit and reopen LunarVim, Run :PackerInstall :PackerCompile
+
+-- Configure builtin plugins
 lvim.builtin.dashboard.active = true
 lvim.builtin.terminal.active = true
 
--- if you don't want all the parsers change this to a table of the ones you want
+-- Treesitter parsers change this to a table of the languages you want i.e. {"java", "python", javascript}
 lvim.builtin.treesitter.ensure_installed = "maintained"
 lvim.builtin.treesitter.ignore_install = { "haskell" }
-lvim.builtin.treesitter.highlight.enabled = true
 
+-- Disable virtual text
 lvim.lsp.diagnostics.virtual_text = false
 
 -- set a formatter if you want to override the default lsp one (if it exists)
@@ -151,23 +100,8 @@ lvim.plugins = {
         event = "InsertEnter"
     }
 }
-
--- Autocommands (https://neovim.io/doc/user/autocmd.html)
--- lvim.autocommands.custom_groups = {
---   { "BufWinEnter", "*.lua", "setlocal ts=8 sw=8" },
--- }
-
-
 ```
 
-In case you want to see all the settings inside LunarVim, run the following:
-
-```bash
-cd /tmp
-lvim --headless +'lua require("utils").generate_settings()' +qa && sort -o lv-settings.lua{,}
-```
-and then inspect `/tmp/lv-settings.lua` file
-
 ## Updating LunarVim
 
 In order to update you should be aware of three things `Plugins`, `LunarVim` and `Neovim`
@@ -185,37 +119,12 @@ cd ~/.local/share/lunarvim/lvim && git pull
 :PackerSync
 ```
 
-To update Neovim use your package manager or [compile from source](https://github.com/lunarvim/LunarVim/wiki/Installation#get-the-latest-version-of-neovim)
-
-## Project Goals
-
-1. Provide basic functionalities required from an IDE
-    - LSP
-    - Formatting/Linting
-    - Debugging
-    - Treesitter
-    - Colorschemes
-2. Be as fast and lean as possible 
-    - Lazy loading
-    - Not a single extra plugin
-    - User configurable lang/feature enable/disable
-3. Provide a [simple and easy](https://github.com/LunarVim/LunarVimCommunity) way for users to share their own configuration or use others. 
-4. Hot reload of configurations
-    - Hot install of lsp/treesitter/formatter required upon opening a filetype for the first time
-5. Provide a stable & maintainable error free configuration layer over neovim 
-    - With the help of the community behind it
-    - Github workflow testing
-    - Freezing plugin versions
-6. Provide detailed documentation
-    - Video series on how to configure LunarVim as an IDE for each lang
-7. Valhalla
-
 ## Resources
 
-- [YouTube](https://www.youtube.com/channel/UCS97tchJDq17Qms3cux8wcA)
-
 - [Documentation](https://www.lunarvim.org)
 
+- [YouTube](https://www.youtube.com/channel/UCS97tchJDq17Qms3cux8wcA)
+
 - [Discord](https://discord.gg/Xb9B4Ny)
 
 - [Twitter](https://twitter.com/chrisatmachine)

+ 3 - 0
ftdetect/bicep.lua

@@ -0,0 +1,3 @@
+vim.cmd [[
+ au BufRead,BufNewFile *.bicep set filetype=bicep
+]]

+ 1 - 0
ftplugin/bicep.lua

@@ -0,0 +1 @@
+require("lsp").setup "bicep"

+ 6 - 6
init.lua

@@ -3,16 +3,16 @@ local home_dir = vim.loop.os_homedir()
 
 vim.opt.rtp:append(home_dir .. "/.local/share/lunarvim/lvim")
 
-vim.opt.rtp:remove(home_dir .. "/.config/nvim")
-vim.opt.rtp:remove(home_dir .. "/.config/nvim/after")
-vim.opt.rtp:append(home_dir .. "/.config/lvim")
-vim.opt.rtp:append(home_dir .. "/.config/lvim/after")
-
 vim.opt.rtp:remove(home_dir .. "/.local/share/nvim/site")
 vim.opt.rtp:remove(home_dir .. "/.local/share/nvim/site/after")
-vim.opt.rtp:append(home_dir .. "/.local/share/lunarvim/site")
+vim.opt.rtp:prepend(home_dir .. "/.local/share/lunarvim/site")
 vim.opt.rtp:append(home_dir .. "/.local/share/lunarvim/site/after")
 
+vim.opt.rtp:remove(home_dir .. "/.config/nvim")
+vim.opt.rtp:remove(home_dir .. "/.config/nvim/after")
+vim.opt.rtp:prepend(home_dir .. "/.config/lvim")
+vim.opt.rtp:append(home_dir .. "/.config/lvim/after")
+
 -- TODO: we need something like this: vim.opt.packpath = vim.opt.rtp
 vim.cmd [[let &packpath = &runtimepath]]
 -- }}}

+ 35 - 0
lua/config/defaults.lua

@@ -134,6 +134,20 @@ lvim.lang = {
       },
     },
   },
+  bicep = {
+    formatters = {},
+    linters = {},
+    lsp = {
+      provider = "bicep",
+      setup = {
+        cmd = {
+          "dotnet",
+          DATA_PATH .. "/lspinstall/bicep/Bicep.LangServer.dll",
+        },
+        filetypes = { "bicep" },
+      },
+    },
+  },
   c = {
     formatters = {
       -- {
@@ -1077,6 +1091,27 @@ lvim.lang = {
         cmd = {
           DATA_PATH .. "/lspinstall/vue/node_modules/.bin/vls",
         },
+        root_dir = function(fname)
+          local util = require "lspconfig/util"
+          return util.root_pattern "package.json"(fname) or util.root_pattern "vue.config.js"(fname) or vim.fn.getcwd()
+        end,
+        init_options = {
+          config = {
+            vetur = {
+              completion = {
+                autoImport = true,
+                tagCasing = "kebab",
+                useScaffoldSnippets = true,
+              },
+              useWorkspaceDependencies = true,
+              validation = {
+                script = true,
+                style = true,
+                template = true,
+              },
+            },
+          },
+        },
       },
     },
   },

+ 9 - 8
lua/core/which-key.lua

@@ -72,25 +72,26 @@ M.config = function()
       ["h"] = { "<cmd>nohlsearch<CR>", "No Highlight" },
       b = {
         name = "Buffers",
-        j = { "<cmd>BufferPick<cr>", "jump to buffer" },
-        f = { "<cmd>Telescope buffers<cr>", "Find buffer" },
-        w = { "<cmd>BufferWipeout<cr>", "wipeout buffer" },
+        j = { "<cmd>BufferPick<cr>", "Jump" },
+        f = { "<cmd>Telescope buffers<cr>", "Find" },
+        b = { "<cmd>b#<cr>", "Previous" },
+        w = { "<cmd>BufferWipeout<cr>", "Wipeout" },
         e = {
           "<cmd>BufferCloseAllButCurrent<cr>",
-          "close all but current buffer",
+          "Close all but current",
         },
-        h = { "<cmd>BufferCloseBuffersLeft<cr>", "close all buffers to the left" },
+        h = { "<cmd>BufferCloseBuffersLeft<cr>", "Close all to the left" },
         l = {
           "<cmd>BufferCloseBuffersRight<cr>",
-          "close all BufferLines to the right",
+          "Close all to the right",
         },
         D = {
           "<cmd>BufferOrderByDirectory<cr>",
-          "sort BufferLines automatically by directory",
+          "Sort by directory",
         },
         L = {
           "<cmd>BufferOrderByLanguage<cr>",
-          "sort BufferLines automatically by language",
+          "Sort by language",
         },
       },
       p = {

+ 3 - 3
lua/lsp/null-ls/formatters.lua

@@ -45,15 +45,15 @@ function M.list_configured(formatter_configs)
     local formatter = null_ls.builtins.formatting[fmt_config.exe]
 
     if not formatter then
-      Log:error("Not a valid formatter:", fmt_config.exe)
+      Log:error("Not a valid formatter: " .. fmt_config.exe)
       errors[fmt_config.exe] = {} -- Add data here when necessary
     else
       local formatter_cmd = services.find_command(formatter._opts.command)
       if not formatter_cmd then
-        Log:warn("Not found:", formatter._opts.command)
+        Log:warn("Not found: " .. formatter._opts.command)
         errors[fmt_config.exe] = {} -- Add data here when necessary
       else
-        Log:debug("Using formatter:", formatter_cmd)
+        Log:debug("Using formatter: " .. formatter_cmd)
         formatters[fmt_config.exe] = formatter.with { command = formatter_cmd, extra_args = fmt_config.args }
       end
     end

+ 3 - 3
lua/lsp/null-ls/linters.lua

@@ -45,15 +45,15 @@ function M.list_configured(linter_configs)
     local linter = null_ls.builtins.diagnostics[lnt_config.exe]
 
     if not linter then
-      Log:error("Not a valid linter:", lnt_config.exe)
+      Log:error("Not a valid linter: " .. lnt_config.exe)
       errors[lnt_config.exe] = {} -- Add data here when necessary
     else
       local linter_cmd = services.find_command(linter._opts.command)
       if not linter_cmd then
-        Log:warn("Not found:", linter._opts.command)
+        Log:warn("Not found: " .. linter._opts.command)
         errors[lnt_config.exe] = {} -- Add data here when necessary
       else
-        Log:debug("Using linter:", linter_cmd)
+        Log:debug("Using linter: " .. linter_cmd)
         linters[lnt_config.exe] = linter.with { command = linter_cmd, extra_args = lnt_config.args }
       end
     end

+ 13 - 1
utils/installer/install.sh

@@ -210,11 +210,23 @@ function backup_old_config() {
     # we create an empty folder for subsequent commands \
     # that require an existing directory
     mkdir -p "$dir" "$dir.bak"
+    touch "$dir/ignore"
     if command -v rsync &>/dev/null; then
       rsync --archive -hh --partial --progress --cvs-exclude \
         --modify-window=1 "$dir"/ "$dir.bak"
     else
-      cp -R "$dir/"* "$dir.bak/."
+      OS="$(uname -s)"
+      case "$OS" in
+        Linux)
+          cp -r "$dir/"* "$dir.bak/."
+          ;;
+        Darwin)
+          cp -R "$dir/"* "$dir.bak/."
+          ;;
+        *)
+          echo "OS $OS is not currently supported."
+          ;;
+      esac
     fi
   done
   echo "Backup operation complete"

+ 1 - 1
utils/vscode_config/settings.json

@@ -362,7 +362,7 @@
         },
         {
           "key": "P",
-          "name": "Push",
+          "name": "Pull",
           "type": "command",
           "command": "git.pull"
         },