Updated Home (markdown)

rebuilt 2021-07-04 14:22:11 +02:00
parent 2ecd45650a
commit ab24650a05

123
Home.md

@ -237,106 +237,97 @@ will help you easily access many of the default keybindings. Whichkey
defines keymappings in this file: defines keymappings in this file:
\~/.config/nvim/lua/lv-which-key/init.lua . \~/.config/nvim/lua/lv-which-key/init.lua .
The speed the Whichkey window opens is determined by the 'timeoutlen' setting. The speed the Whichkey window opens is determined by the 'timeoutlen' setting. 'timeoutlen' also defines the timeout length for any key combination. Change this value in ~/.config/nvim/lua/settings.lua. Or add an entry
'timeoutlen' also defines the timeout length for any key combination.
Change this value in ~/.config/nvim/lua/settings.lua. Or add an entry
for it in your personal configuration file ~/.config/nvim/lv-config.lua so it for it in your personal configuration file ~/.config/nvim/lv-config.lua so it
won't be changed the next time you update LunarVim. won't be changed the next time you update LunarVim.
``` ```
-- ~/.config/nvim/lv-config.lua
O.timeoutlen = 400 -- Timeout value in milliseconds O.timeoutlen = 400 -- Timeout value in milliseconds
``` ```
## Other key bindings ## Other key bindings
Other key bindings can be found in \~/.config/nvim/lua/keymappings.lua. Other key bindings can be found in \~/.config/nvim/lua/keymappings.lua. This file is for the set of keybindings that aren't mapped to the Leader key.
This file is for the set of keybindings that aren't mapped to the Leader key.
If you already have a set of keybindings you prefer, the best place to put these bindings If you already have a set of keybindings you prefer, the best place to put these bindingsis the ~/.config/nvim/lv-config.lua file. This way, they won't be overwritten when you updateLunarVim.
is the ~/.config/nvim/lv-config.lua file. This way, they won't be overwritten when you update
LunarVim.
If you mappings are in vimscript you can translate your old bindings to lua If you mappings are in vimscript you can translate your old bindings to lua by following the lua guide available
by following the lua guide available
[here](https://github.com/nanotee/nvim-lua-guide) [here](https://github.com/nanotee/nvim-lua-guide)
Or if you prefer to keep your mappings in vimscript, wrap them in the vim.cmd function Or if you prefer to keep your mappings in vimscript, wrap them in the vim.cmd function
``` ```
-- ~/.config/nvim/lv-config.lua
vim.cmd([[ vim.cmd([[
PLACE_YOUR_VIMSCRIPT_HERE PLACE_YOUR_VIMSCRIPT_HERE
]]) ]])
``` ```
## Important Configuration files ## Configuration files in the order they are loaded
| Path | Description | | Path | Description |
|-------------------------------------|----------------------------| |-------------------------------------|----------------------------|
| \~/.config/nvim/lv-settings.lua | The main settings file | | \~/.config/nvim/lua/default-config.lua | This is where the global variable 'O' is defined. |
| \~/.config/nvim/lua/keymappings.lua | Key bindings | | \~/.config/nvim/lv-config.lua | Your personal settings file |
| \~/.config/nvim/lua/plugins.lua | Add or remove plugins here | | \~/.config/nvim/settings.lua | Sane defaults for neovim. This file sets neovim editor related configurations like wrapping line and tab spacing, etc |
| \~/.config/nvim/lua/plugins.lua | Plugins are defined here |
| \~/.config/nvim/lua/lv-utils | LunarVim utility functions |
| \~/.config/nvim/lua/keymappings.lua | Key bindings that don't contain the leader key |
| \~/.config/nvim/lua/lv-which-key.lua | Key bindings that start with the leader key |
# Install your own plugins # Install your own plugins
The steps for configuring your own plugin are: Most plugins are disabled by default. If you wish to enable a plugin, turn it on by setting the plugin to 'active' and installing it with packer.
1. Add the plugin to `plugins.lua`
2. If the plugin requires configuration, create a configuration file for it
3. If you created a configuration, require the file in `init.lua`
4. Use Packer to download and install the plugin
Please note that every plugin will require different configuration steps. For example, to enable hop add the following line to your personal configuration file
Follow the instructions provided by the README of plugin you're interested in. If
those instructions are written in lua, copy and paste the code they provide.
If the instructions are written in vimscript, either translate the code to
lua or wrap the vimscript in this lua function:
```lua ```
vim.cmd([[ -- ~/.config/nvim/lv-config.lua
YOUR_VIMSCRIPT_GOES_HERE O.plugin.hop.active = true
]])
``` ```
## An example installation of the colorizer plugin The following is a list of available plugins. Some plugins may require you to set your own keybindings. Check the readme for each plugin to learn exactly what configuration options are available. This list will grow as we add more plugins. Check default-config.lua or plugins.lua to see if others have been added.
'use' is a function provided by the Packer plugin. In the example below,
we tell Packer to optionally load the plugin. This means the plugin will not
start unless some other function manually loads it.
The 'require_plugin' function is part of LunarVim. It loads the plugin.
``` lua
# ~/.config/nvim/lua/plugins.lua
use {"norcalli/nvim-colorizer.lua", opt = true}
require_plugin("nvim-colorizer.lua")
``` ```
hop
dial
dashboard
matchup
colorizer
numb
zen
ts_playground
indent_line
ts_context_commentstring
symbol_outline
debug
bqf
trouble
floatterm
spectre
lsp_rooter
markdown_preview
codi
telescope_fzy
sanegx
snap
ranger
todo_comments
lsp_colors
git_blame
gist
gitlinker
lazygit
octo
lush
diffview
bracey
telescope_project
dap_install
From the [ README ](https://github.com/norcalli/nvim-colorizer.lua) we find out [ Colorizer ](https://github.com/norcalli/nvim-colorizer.lua) is written and configured in lua.
Colorizer provides a setup function which must be called for the plugin to work correctly. So we create a folder 'lv-colorizer' and
a file 'init.lua'. And populate the file with the configuration mentioned in the
[ README ](https://github.com/norcalli/nvim-colorizer.lua)
``` lua
# ~/.config/nvim/lua/lv-colorizer/init.lua
require'colorizer'.setup()
``` ```
We created the lua/lv-colorizer/init.lua file. Creating this file means that we've created a module. Now we need to make sure this module
gets loaded when we start neovim. 'require' is a lua function that loads
a module.
``` lua
# ~/.config/nvim/init.lua
require('lv-colorizer')
```
``` lua
:PackerCompile
:PackerInstall
```
The example above loads the plugin when neovim starts. If you want to take advantage of Packer's built-in lazy loading, do not use the 'require_plugin' function. Instead, define the loading strategy in Packer's 'use' method. For a more in-depth explantion, read the [Packer docs](https://github.com/wbthomason/packer.nvim)
## Finding plugins ## Finding plugins
If you want to find other plugins that take advantage of neovims latest If you want to find other plugins that take advantage of neovims latest
@ -628,7 +619,7 @@ To switch color schemes on the fly, type the following command:
``` ```
To change the color scheme permanently, modify To change the color scheme permanently, modify
\~/.config/nvim/lv-settings.lua \~/.config/nvim/lv-config.lua
``` lua ``` lua
O.colorscheme = 'lunar' O.colorscheme = 'lunar'