diff --git a/.github/workflows/pre-deploy-mintlify.yml b/.github/workflows/pre-deploy-mintlify.yml new file mode 100644 index 0000000..7378b2c --- /dev/null +++ b/.github/workflows/pre-deploy-mintlify.yml @@ -0,0 +1,29 @@ +name: "Pre-deploy Mintlify" + +on: + push: + branches: + - main + +jobs: + release: + name: Change email + runs-on: ubuntu-latest + steps: + - name: πŸ— Checkout files + uses: actions/checkout@v3 + + - name: πŸ”§ Configure Git + run: | + git config --global user.name "Marcos Oliveira" + git config --global user.email "vmarcosp.pereira@gmail.com" + git filter-branch --commit-filter ' + if [ "$GIT_AUTHOR_EMAIL" != "vmarcosp.pereira@gmail.com" ]; + then + GIT_AUTHOR_NAME="Marcos Oliveira"; + GIT_AUTHOR_EMAIL="vmarcosp.pereira@gmail.com"; + git commit-tree "$@"; + else + git commit-tree "$@"; + fi' HEAD + git push origin ${GITHUB_REF##*/} -f diff --git a/README.md b/README.md new file mode 100644 index 0000000..745062a --- /dev/null +++ b/README.md @@ -0,0 +1,34 @@ +# Mintlify Starter Kit + +Click on `Use this template` to copy the Mintlify starter kit. The starter kit contains examples including + +- Guide pages +- Navigation +- Customizations +- API Reference pages +- Use of popular components + +### πŸ‘©β€πŸ’» Development + +Install the [Mintlify CLI](https://www.npmjs.com/package/mintlify) to preview the documentation changes locally. To install, use the following command + +``` +npm i -g mintlify +``` + +Run the following command at the root of your documentation (where mint.json is) + +``` +mintlify dev +``` + +### 😎 Publishing Changes + +Changes will be deployed to production automatically after pushing to the default branch. + +You can also preview changes using PRs, which generates a preview link of the docs. + +#### Troubleshooting + +- Mintlify dev isn't running - Run `mintlify install` it'll re-install dependencies. +- Page loads as a 404 - Make sure you are running in a folder with `mint.json` diff --git a/_snippets/snippet-example.mdx b/_snippets/snippet-example.mdx new file mode 100644 index 0000000..78d18e1 --- /dev/null +++ b/_snippets/snippet-example.mdx @@ -0,0 +1,3 @@ +## My Snippet + +Beautiful docs that convert users. Get started on Mintlify at mintlify.com. diff --git a/api-reference/authentication.mdx b/api-reference/authentication.mdx new file mode 100644 index 0000000..4578f69 --- /dev/null +++ b/api-reference/authentication.mdx @@ -0,0 +1,22 @@ +--- +title: "Authentication" +description: "Example overview page before API endpoints" +--- + +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas et eros iaculis tortor dapibus cursus. Curabitur quis sapien nec tortor dictum gravida. + +```bash +'Authorization': 'Token ' +``` + +## API Tokens + +Nullam convallis mauris at nunc consectetur, ac imperdiet leo rutrum. Maecenas cursus purus a pellentesque blandit. Pellentesque vitae lacinia libero, non mollis metus. + +Nam id ullamcorper urna, at rutrum enim. [Maecenas vulputate](/introduction) vehicula libero, vitae sodales augue pretium nec. Quisque a magna tempor, semper risus vel, fermentum nunc. Pellentesque fermentum interdum ex, eu convallis massa blandit sed. Aliquam bibendum ipsum vel laoreet auctor. + +### Permissions + +Etiam lobortis ut odio ut fermentum. Nunc odio velit, sollicitudin at consectetur id, tristique eget turpis. Aliquam at risus vitae dolor sodales venenatis. In hac habitasse platea dictumst. + +Aenean consequat diam eget mollis fermentum. [Quisque eu malesuada](/introduction) felis, non dignissim libero. diff --git a/api-reference/endpoint/create.mdx b/api-reference/endpoint/create.mdx new file mode 100644 index 0000000..7e7f86b --- /dev/null +++ b/api-reference/endpoint/create.mdx @@ -0,0 +1,84 @@ +--- +title: "Create User" +api: "POST https://api.mintlify.com/api/user" +description: "This endpoint creates a new user" +--- + +### Body + + + This is the current user group token you have for the user group that you want + to rotate. + + +### Response + + + Indicates whether the call was successful. 1 if successful, 0 if not. + + + + +The contents of the user group + + + + + This is the internal ID for this user group. You don't need to record this + information, since you will not need to use it. + + + + This is the user group token (userGroupToken or USER_GROUP_TOKEN) that will be + used to identify which user group is viewing the dashboard. You should save + this on your end to use when rendering an embedded dashboard. + + + + This is the name of the user group provided in the request body. + + + + This is the user_group_id provided in the request body. + + + + This is the environment tag of the user group. Possible values are 'Customer' + and 'Testing'. User group id's must be unique to each environment, so you can + not create multiple user groups with with same id. If you have a production + customer and a test user group with the same id, you will be required to label + one as 'Customer' and another as 'Testing' + + + + + + + + +```bash Example Request +curl --location --request POST 'https://api.mintlify.com/api/user' \ +--header 'Content-Type: application/json' \ +--header 'Authorization: Token ' \ +--data-raw '{ + "current_token": "" +}' +``` + + + + + +```json Response +{ + "success": 1, + "user_group": { + "team_id": 3, + "token": "", + "name": "Example 1", + "provided_id": "example_1" + } +} +``` + + diff --git a/api-reference/endpoint/delete.mdx b/api-reference/endpoint/delete.mdx new file mode 100644 index 0000000..cb0eb8b --- /dev/null +++ b/api-reference/endpoint/delete.mdx @@ -0,0 +1,47 @@ +--- +title: "Delete User" +api: "DELETE https://api.mintlify.com/api/user" +description: "This endpoint deletes an existing user." +--- + +### Body + + + The data source ID provided in the data tab may be used to identify the data + source for the user group + + + + This is the current user group token you have for the user group you want to + delete + + +### Response + + + Indicates whether the call was successful. 1 if successful, 0 if not. + + + + +```bash Example Request +curl --location --request DELETE 'https://api.mintlify.com/api/user' \ +--header 'Content-Type: application/json' \ +--header 'Authorization: Token ' \ +--data-raw '{ + "user_group_id": "example_1" + "current_token": "abcdef" +}' +``` + + + + + +```json Response +{ + "success": 1 +} +``` + + diff --git a/api-reference/endpoint/get.mdx b/api-reference/endpoint/get.mdx new file mode 100644 index 0000000..ce95f65 --- /dev/null +++ b/api-reference/endpoint/get.mdx @@ -0,0 +1,101 @@ +--- +title: "Get User" +api: "GET https://api.mintlify.com/api/user" +description: "This endpoint gets or creates a new user." +--- + +### Body + + + This is the name of the user group. + + + + This is the ID you use to identify this user group in your database. + + + + This is a JSON mapping of schema id to either the data source that this user group should be + associated with or id of the datasource you provided when creating it. + + + + This is a JSON object for properties assigned to this user group. These will be accessible through + variables in the dashboards and SQL editor + + +### Response + + + Indicates whether the call was successful. 1 if successful, 0 if not. + + + + Indicates whether a new user group was created. + + + + +The contents of the user group + + + + + This is the internal ID for this user group. You don't need to record this information, since + you will not need to use it. + + + + This is the user group token (userGroupToken or USER_GROUP_TOKEN) that will be used to identify + which user group is viewing the dashboard. You should save this on your end to use when rendering + an embedded dashboard. + + + + This is the name of the user group provided in the request body. + + + + This is the user_group_id provided in the request body. + + + + This is the properties object if it was provided in the request body + + + + + + + + +```bash Example Request +curl --location --request GET 'https://api.mintlify.com/api/user' \ +--header 'Content-Type: application/json' \ +--header 'Authorization: Token ' \ +--data-raw '{ + "user_group_id": "example_1", + "name": "Example 1", + "mapping": {"40": "213", "134": "386"}, + "properties": {"filterValue": "value"} +}' +``` + + + + + +```json Response +{ + "success": 1, + "new_user_group": true, + "user_group": { + "team_id": 3, + "token": "", + "name": "Example 1", + "provided_id": "example_1" + } +} +``` + + diff --git a/api-reference/endpoint/update.mdx b/api-reference/endpoint/update.mdx new file mode 100644 index 0000000..4304987 --- /dev/null +++ b/api-reference/endpoint/update.mdx @@ -0,0 +1,101 @@ +--- +title: "Update User" +api: "PUT https://api.mintlify.com/api/user" +description: "This endpoint updates an existing user." +--- + +### Body + + + This is the name of the user group. + + + + This is the ID you use to identify this user group in your database. + + + + This is a JSON mapping of schema id to either the data source that this user + group should be associated with or id of the datasource you provided when + creating it. + + + + This is a JSON object for properties assigned to this user group. These will + be accessible through variables in the dashboards and SQL editor + + +### Response + + + Indicates whether the call was successful. 1 if successful, 0 if not. + + + + +The contents of the user group + + + + + Indicates whether a new user group was created. + + + + This is the user group token (userGroupToken or USER_GROUP_TOKEN) that will be + used to identify which user group is viewing the dashboard. You should save + this on your end to use when rendering an embedded dashboard. + + + + This is the name of the user group provided in the request body. + + + + This is the user_group_id provided in the request body. + + + + This is the properties object if it was provided in the request body + + + + This is the environment tag of the user group. Possible values are 'Customer' + and 'Testing' + + + + + + + + +```bash Example Request +curl --location --request PUT 'https://api.mintlify.com/api/user' \ +--header 'Content-Type: application/json' \ +--header 'Authorization: Token ' \ +--data-raw '{ + "user_group_id": "example_1", + "name": "Example 1", + "mapping": {"40": "213", "134": "386"}, + "properties": {"filterValue": "value"} +}' +``` + + + + + +```json Response +{ + "success": 1, + "user_group": { + "team_id": 113, + "token": "", + "name": "ok", + "provided_id": "6" + } +} +``` + + diff --git a/codemod/codemod.toml b/codemod/codemod.toml new file mode 100644 index 0000000..2bb53e0 --- /dev/null +++ b/codemod/codemod.toml @@ -0,0 +1,41 @@ +[snippet-better-vim-lua] +match=''' + +''' +rewrite=''' +```lua better-vim.lua +:[content] +``` +''' + +[tips] +match=''' + +''' + +rewrite=''' + +:[text] + +''' + +[imports] +match="import :[rest];" +rewrite="" + +[brs] +match="
" +rewrite="" + + +[kbd-component] +match=":[key1] + :[key2]" +rewrite="`:[key1] + :[key2]`" diff --git a/customization/flags.mdx b/customization/flags.mdx new file mode 100644 index 0000000..b324eb9 --- /dev/null +++ b/customization/flags.mdx @@ -0,0 +1,28 @@ +The `flags` option is used to toggle features on the config. Let's see an example of how to use the flags option to disable the Better Vim tabs feature: +Open your Better Vim config and add the `flags` option: + +```lua better-vim.lua +return { + flags = { + disable_tabs = true + } +} +``` + +Reopen your **neovim** and you'll notice that there are no tabs on the top. + +## Available flags +### `disable_tabs` +Disable the tabs feature. + - Options: `true` and `false` + - Default: `false` + +### `format_on_save` +Auto format the code on save if the LSP has this feature. + - Options: `true` and `false` + - Default: `false` + +### `disable_auto_theme_loading` +Disable theme auto loading. Use this flag if you want to setup your theme manually without setting `colorscheme` and loading themes automatically. + - Options: `true` and `false` + - Default: `false` diff --git a/customization/how-it-works.mdx b/customization/how-it-works.mdx new file mode 100644 index 0000000..1f03891 --- /dev/null +++ b/customization/how-it-works.mdx @@ -0,0 +1,168 @@ +--- +title: How it works +--- +When you install BetterVim, we create some folders on your environment: + +### `~/.config/nvim` +Where your neovim config lives. Don't touch these files if you want to receive Better Vim updates. + +### `~/.config/better-vim` +This folder contains your customizations. You'll see two files that you can use to create customizations and overrides: +- `better-vim.lua` - You'll use this lua file to pass options to Better Vim like the theme name/flavour and your custom mappings. +- `.bettervimrc` - Do not touch this file. It contains your license key from Gumroad that we use to install the updates for Better Vim. + +# The `better-vim.lua` file + +This documentation provides an overview of the `better-vim.lua` file, which serves +as the entry point for configuring Better Vim. + +The `better-vim.lua` file is located in `~/.config/better-vim/better-vim.lua`. +This file acts as the main configuration file for Better Vim and allows you to +organize your configuration files and plugins within the `~/.config/better-vim/` +directory. + +Check the [**File Structure**](#file-structure) session to learn more. + +## Configuration Options + +The `better-vim.lua` file provides various configuration options to customize your +Vim environment. Below are the defaults for all possible entries to `better-vim.lua` file: + +```lua +return { + plugins = {}, + unload_plugins = {}, + lsps = {}, + formatters = {}, + treesitter = {}, + gitsigns = {}, + noice = {}, + theme = { + name = "catppuccin", + catppuccin_flavour = "mocha", + ayucolor = "dark", + nightfox = {}, + rose_pine = { + dark_variant = "main", + }, + }, + flags = { + disable_auto_theme_loading = false, + disable_tabs = false, + format_on_save = false, + }, + hooks = {}, + mappings = { + leader = " ", + tabs = nil, + custom = {}, + by_mode = { + n = {}, + i = {}, + v = {}, + x = {}, + }, + }, + lualine = { + options = {}, + sections = {}, + }, + telescope = {}, + nvim_tree = {}, + whichkey = {}, +} +``` + +Throughout this documentation you will find all the necessary information to know +what each of this entries means. + +You can explore and modify them according to your preferences and needs. + +## File Structure + +The file structure for Better Vim configuration follows the organization within +the `~/.config/better-vim/` directory. + +You can break your configuration in small modules to organize them better. + +For example, if you have a configuration file called `plugins.lua`, it should be +placed inside the `~/.config/better-vim/` directory. + +You can import modules and configuration files using the `better-vim` namespace. +To import a module, use the following syntax: + +```lua plugins.lua +require "better-vim.module_name" +``` + +Replace `module_name` with the name of the module or configuration file you want +to import. + +In the above example, if you want to put all your plugins inside +the file `plugins.lua`, just create this file inside `~/.config/better-vim/` directory +and import it in `better-vim.lua`: + +```lua better-vim.lua +local plugins = require "better-vim.plugins" + +return { + plugins = plugins, +} +``` + +## Better Vim Utils + +We expose some functions that you can use to improve your customizations. + +To use those functions, just import the `better-vim-utils` module and use them: + +```lua better-vim.lua +local utils = require "better-vim-utils" +``` + +### Exposed functions + +#### `load_theme` + +This function will be used to load a custom theme only after all other plugins are already loaded. +It will ensure your theme will have all the correct functionalities expected by your plugins. + +The function expects your theme configuration table as argument and returns this table with +some additional properties (`lazy = false` and `priority = 1000`), to load the theme only when all other plugins are ready. + +Here is an example of using this function to load [**poimandres**](https://github.com/olivercederborg/poimandres.nvim) theme: + +```lua better-vim.lua +return { + plugins = { + utils.load_theme { + "olivercederborg/poimandres.nvim", + config = function() + require "poimandres".setup {} + vim.cmd [[ colorscheme poimandres ]] + end, + } + } +} +``` + +#### `statusline.get_file_name` + +This function will be used with `lualine` plugin. + +It will show ` Explorer` text when `NvimTree` buffer is in focus, and the +_filename_ when you have a file opened and the file buffer is in focus: + +Usage example: + +```lua better-vim.lua +local utils = require "better-vim-utils" + +return { + lualine = { + sections = { + c = { utils.statusline.get_file_name }, + }, + } +} +``` diff --git a/customization/installing-lsps.mdx b/customization/installing-lsps.mdx new file mode 100644 index 0000000..8c8c123 --- /dev/null +++ b/customization/installing-lsps.mdx @@ -0,0 +1,124 @@ +--- +title: Installing LSPs +description: Learn how to configure BetterVim for various any programming language. +--- + +## Installing New Language Servers (LSPs) with Mason + +Better Vim provides seamless integration with various Language Servers (LSPs) +through the use of Mason. Mason simplifies the setup and configuration of LSPs +within Better Vim, allowing you to enhance your coding experience with specific +language features and intelligent code suggestions. + +To install a new LSP using Mason, follow these steps: + +- Open the `better-vim.lua` file located in your Better Vim configuration directory. +- Locate the `lsps` entry within the configuration file. If it doesn't exist, +you can create it as an empty table using the following format: + +```lua better-vim.lua +return { + lsps = {}, + } +``` + +- Inside the `lsps` table, add a new entry for the desired language server. +The key should be a unique identifier for the LSP, and the value should be an +empty table. This table is used to configure the specific settings and `on_attach` +function for the LSP through lspconfig. For example, to install the `prismals` +language server, your configuration would look like this: + +```lua better-vim.lua +return { + lsps = { + prismals = {}, -- Configuration settings for "prismals" LSP + }, + } +``` + + +You can find all available LSPs using the command `:Mason` and doing a `Ctrl + F` +to find the language server you want to install. + + +- Customize the configuration settings for the LSP within its respective table. +You can refer to the documentation of the specific LSP or lspconfig for the +available options and their meanings. + +To add settings or customize the `on_attach` function, see the example below: + +```lua better-vim.lua +return { + lsps = { + tsserver = { + settings = { + -- tsserver settings live here. If you don't have settings, you don't need + -- to add this section. + }, + on_attach = function(client, bufnr) + require "twoslash-queries".on_attach(client, bufnr) + end, + }, + } +} +``` + +- Save the `better-vim.lua` file. + +- Restart Better Vim or reload the configuration to apply the changes. + +Congratulations! You have successfully installed a new Language Server using Mason. +Better Vim will now utilize the features provided by the LSP to enhance your +coding workflow. + +## Installing New Formatters with null-ls + +null-ls is a plugin integrated with Better Vim that enables you to format your code +using various formatters. By leveraging null-ls, you can maintain consistent code +formatting and adhere to coding style guidelines across different programming languages. + +To install a new formatter using null-ls, follow these steps: + +- Open the `better-vim.lua` file located in your Better Vim configuration directory. + +- Locate the `formatters` entry within the configuration file. If it doesn't +exist, you can create it as an empty table using the following format: + + +```lua better-vim.lua +return { + formatters = {}, + } +``` + +- Inside the `formatters` table, add a new entry for the desired formatter. +The key should be a unique identifier for the formatter, and the value should be +an empty table. This table is passed to the `with` method when configuring formatting sources +for null-ls. For example, to install the `blade_formatter` formatter, your +configuration would look like this: + +```lua better-vim.lua +return { + formatters = { + blade_formatter = {} -- Configuration for "blade_formatter" formatter + } + } +``` + + +You can find all formatters for null-ls following this page +on the documetation. Just put the name of the formatter, you don't need the part `null_ls.builtins.formatting` + + +- Customize the configuration settings for the formatter within its respective table. +The available options and their meanings may vary depending on the formatter you +are using. Refer to the documentation of the specific formatter for more information on the +available options. + +- Save the `better-vim.lua` file. + +- Restart Better Vim or reload the configuration to apply the changes. + +Congratulations! You have successfully installed a new formatter using null-ls. +Better Vim will now utilize the formatter to format your code according to the +specified configuration, helping you maintain consistent and well-formatted code. diff --git a/customization/installing-plugins.mdx b/customization/installing-plugins.mdx new file mode 100644 index 0000000..e772fc6 --- /dev/null +++ b/customization/installing-plugins.mdx @@ -0,0 +1,93 @@ +You can add more neovim plugins to your Better Vim setup using [lazy.nvim](https://github.com/folke/lazy.nvim) which is the default plugin manager for Better Vim. +This guide shows you how to install any vim/neovim plugin using the plugin manager and the Better Vim modules. + +## 1. Adding the plugin +The first step to install a plugin to your Better Vim config is add it to the plugins list. `lazy.nvim` uses Github to install and +manage plugins. For example, if we want to install the [todo-comments](https://github.com/folke/todo-comments.nvim) plugin we can change the entry `plugins` in `better-vim.lua`: + +```lua better-vim.lua +return { + plugins = { + "folke/todo-comments.nvim", + }, +} +``` + +You don't need to pass the entire url of the repository, instead, we just pass the `username/repository` to the plugin manager. +Usually, the installation instructions of the plugin show how to install the plugin using **lazy.nvim** and other package managers. If `lazy.nvim` is not present, the installation via `Packer` is pretty simmilar, with some differences that you can see [here](https://github.com/folke/lazy.nvim#-migration-guide). + +If the plugin has some dependencies, you can use the `dependencies` entry in the plugin `table`: + +```lua better-vim.lua +return { + plugins = { + "nvim-lua/plenary.nvim", + { "folke/todo-comments.nvim", dependencies = "nvim-lua/plenary.nvim" }, + }, +} +``` + +## 2. Setting up the plugin +Some plugins (like todo-comments) requires a setup or an initial config to work. You can do this using the entry `config` in the plugin `table`: + +```lua better-vim.lua +return { + plugins = { + "nvim-lua/plenary.nvim", + { + "folke/todo-comments.nvim", + dependencies = "nvim-lua/plenary.nvim", + config = function() + require("todo-comments").setup {} + end, + }, + }, +} +``` + +Using the `.setup` method is a common way to configure plugins in Vim from `Lua`. If `.setup` is the only function you need to call to setup your plugin, and/or pass some properties to it, instead of creating a new function, requiring the plugin and calling the `.setup` method, you can just use the entry `opts` instead: + +```lua better-vim.lua +return { + plugins = { + "nvim-lua/plenary.nvim", + { + "folke/todo-comments.nvim", + dependencies = "nvim-lua/plenary.nvim", + opts = {}, + }, + }, +} +``` + + +Sometimes you need to execute raw Vim commands to setup the plugin.
You can use vim.cmd [[ VIM_COMMAND_HERE ]] to run Vim commands inside of a .lua file. +
+ +After all that, reopen your neovim and plugins will be installed asynchronously. + +You can see all of them using the command `:Lazy` πŸŽ‰ + + +To see every possible option, check out the lazy.nvim documentation page. + + +# Updating plugins + +To update all your plugins, just run: + +```lua +:Lazy sync +``` + +Or open the `:Lazy` interface and press `Shift + S`. + +# Uninstalling plugins + +If you want to uninstall any plugin, remove the plugin from the `plugins` entry in `better-vim.lua`, reopen neovim and run this command inside Neovim: + +```lua +:Lazy sync +``` + +After a new reopen, the plugin will be uninstalled. To cleanup removed plugins, you can type `:Lazy` to open Lazy interface, then press `Shift + X`, or just type `:Lazy clean`. diff --git a/customization/override-defaults.mdx b/customization/override-defaults.mdx new file mode 100644 index 0000000..3a0f636 --- /dev/null +++ b/customization/override-defaults.mdx @@ -0,0 +1,82 @@ +Better Vim provides the flexibility to override the default configurations or add +new ones by utilizing the `hooks.before_setup` and `hooks.after_setup` functions. +These functions allow you to modify various aspects of Better Vim's behavior +before and after the setup process. + +## `hooks.before_setup` + +The `hooks.before_setup` function is called before the Better Vim setup process +begins. It serves as a hook where you can make modifications or override default +configurations. Here's an example of how to use `hooks.before_setup`: + +```lua better-vim.lua +return { + hooks = { + before_setup = function() + -- Do something before Better Vim starts its setup process + end, + }, +} +``` + +The `hooks.before_setup` function is not that useful, but it is there if you need it. + +## `hooks.after_setup` + +The `hooks.after_setup` function is called after the Better Vim setup process has +completed. It provides an opportunity to further customize or extend Better Vim's +functionality. Here's an example of how to use `hooks.after_setup`: + +```lua better-vim.lua +return { + hooks = { + after_setup = function() + -- Perform additional configuration or add new functionality here + end, + }, +} +``` + +Within the `hooks.after_setup` function, you can add additional configurations, +keybindings, or any other customization that you desire. + +This allows you to enhance the default Better Vim setup with your own preferences +or extend it with additional features. + +## Examples + +Let's take a look at a few examples to illustrate how you can utilize `hooks` to +override defaults or add new configurations: + +### 2. Add custom keybinding + +```lua better-vim.lua +return { + hooks = { + after_setup = function() + vim.api.nvim_set_keymap('n', 'l', ':set number!', { silent = true }) + end, + }, +} +``` + +This example adds a custom keybinding using `vim.api.nvim_set_keymap` within +`hooks.after_setup`. The keybinding toggles line numbers when `l` is +pressed in normal mode. + +### 3. Load additional configuration file +```lua better-vim.lua +return { + hooks = { + after_setup = function() + require "better-vim.my_custom_config" + end, + }, +} +``` + +In this example, an additional configuration file named `my_custom_config.lua` +is loaded using `require` within `hooks.after_setup`. + +This allows you to separate your custom configurations into separate files for +better organization and load them only after all the Better Vim setup is done. diff --git a/customization/plugins.mdx b/customization/plugins.mdx new file mode 100644 index 0000000..b4d288c --- /dev/null +++ b/customization/plugins.mdx @@ -0,0 +1,192 @@ +## Lualine sections + +You can override the lualine default options by passing a new configurations table to the `better-vim.lua` module. +To customize the layout, use the `lualine.sections` field. Let's see how to add a branch section to the statusline: + +```lua better-vim.lua +return { + lualine = { + sections = { c = { "branch" } }, + }, +} +``` + +The lualine structure has 6 sections: `| a, b, c ------- x, y, z |` + +You can use [this example](https://github.com/nvim-lualine/lualine.nvim#default-configuration) to explore the available options to customize the sections. + +## Lualine plugin options + +To customize the Lualine plugin options, you can use the `lualine.options` field. Let's see how to change the statusline theme from `auto` (default) to `dracula`: + +```lua better-vim.lua +return { + lualine = { + options = { theme = "dracula" }, + }, +} +``` + +πŸ“’ Please, check out [lualine's official +documentation](https://github.com/nvim-lualine/lualine.nvim#default-configuration) +to see more plugin options. + +## Nvimtree options (File explorer) + +You can override the nvimtree options using the `better-vim.lua` module. Let's +see how to change the default filters to show all dotfiles on the file explorer: + +```lua better-vim.lua +return { + nvim_tree = { + filters = { + dotfiles = false + }, + }, +} +``` + +πŸ“’ Please, check out [nvimtree's official +documentation](https://github.com/nvim-tree/nvim-tree.lua) to see more plugin +options. + +## Whichkey options (mappings autocomplete plugin) + +You can override any whichkey plugin option by providing custom options on the `better-vim.lua` module. Let's see an example: + +```lua better-vim.lua +return { + whichkey = { + spelling = { + enabled = false, + } + } +} +``` + + +πŸ“’ Please, check out [whichkey's official documentation](https://github.com/folke/which-key.nvim) to see more plugin options. + + +The whichkey options just works to override the plugin options, if you want to create your own custom mappings using whichkey and better-vim.lua, check out the mappings documentation. + + +## Telescope options (File finder) + +You can override any telescope plugin option by providing custom options on the `better-vim.lua` module. Let's see an example: + +```lua better-vim.lua +return { + telescope = { + view = { + width = 40 + } + } +} +``` + + +πŸ“’ Please, check out [telescope's official documentation](https://github.com/nvim-telescope/telescope.nvim) +to see more plugin options. + +## Treesitter + +The goal of [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter) +is both to provide a simple and easy way to use the interface for tree-sitter in +Neovim and to provide some basic functionality such as highlighting based on it. + + +Better Vim does not have any treesitter plugin installed by default. + +You can install them using the entry `treesitter` in `better-vim.lua` file. + + + +This entry accepts two types of data: +- A string `"all"` that will install all available treesitter plugins; +- A table of strings containing only the languages you want to highlight with treesitter. + +Using the first option, the first time you open Neovim after the configuration, +you will see your CPU working as crazy. Don't worry: treesitter will install the +plugins using all available cores on your CPU, but just on the first time. + +After this long installation, you will be fine πŸ˜… + +Here is how to use this option: + +```lua better-vim.lua +return { + treesitter = "all", +} +``` + + +If you prefer, only install some hand picked plugins: + +```lua better-vim.lua +return { + treesitter = { "javascript", "typescript", "lua", "rust" }, +} +``` + +πŸ“’ Please, check out [treesitter's official documentation](https://github.com/nvim-treesitter/nvim-treesitter#supported-languages) +to see a list of all supported languages. + +## GitSigns + +This plugin adds some signs based on `git status` of the project. You can configure +the plugin from the entry `gitsigns` in `better-vim.lua` file: + +```lua better-vim.lua +return { + gitsigns = { + numhl = true, + }, +} +```` + +πŸ“’ Please, check out [gitsigns' official documentation](https://github.com/lewis6991/gitsigns.nvim) +to see more plugin options. + +## Noice + +This plugin improves the UI for Neovim. You can configure the plugin from the entry +`noice` in `better-vim.lua` file: + +```lua better-vim.lua +return { + noice = { + presets = { + command_palette = false, + }, + }, +} +``` +πŸ“’ Please, check out [noice's official documentation](https://github.com/folke/noice.nvim) +to see more plugin options. + + + + + +# Unload plugins + +Didn't like some internal Better Vim plugin or want to remove in order to install +a different one? You can use the option `unload_plugins` to remove some unessencial +plugin from Better Vim: + +```lua better-vim.lua +return { + unload_plugins = { "noice" }, +} +``` + + +With this code, the `noice.nvim` plugin will be unload. + +## List of plugins that can be unloaded + +Here is the list of plugins you can unload from Better Vim: + +- [noice](https://github.com/folke/noice.nvim) +- [snippets](https://github.com/L3MON4D3/LuaSnip) diff --git a/customization/theme.mdx b/customization/theme.mdx new file mode 100644 index 0000000..f33133c --- /dev/null +++ b/customization/theme.mdx @@ -0,0 +1,150 @@ +# Themes + +Better Vim comes with 9 hand-picked themes: + +- [Dracula](https://github.com/dracula/vim) +- [Catppuccin](https://github.com/catppuccin/nvim) +- [Ayu](https://github.com/ayu-theme/ayu-vim) +- [Palenight](https://github.com/drewtempelmeyer/palenight.vim) +- [Tokyo Night](https://github.com/folke/tokyonight.nvim) +- [Nord](https://github.com/arcticicestudio/nord) +- [One Dark Pro](https://github.com/olimorris/onedarkpro.nvim) +- [RosΓ© Pine](https://github.com/rose-pine/neovim) +- [Nightfox](https://github.com/EdenEast/nightfox.nvim) + +## Changing the theme + +The default theme is **Catppuccin**. If you want to change the theme, just change the `theme.name` on the Better Vim config: + +```lua better-vim.lua +return { + theme = { + name = "dracula" + } +} +``` +### Available themes: + +- `catppuccin` +- `dracula` +- `ayu` (and its variants, check [here](https://github.com/ayu-theme/ayu-colors)) +- `palenight` +- `tokyonight` +- `nord` +- `onedarkpro` +- `rose-pine` +- `nightfox` (and its variants, check [here](https://github.com/EdenEast/nightfox.nvim#nightfox-1)) + +## Changing the flavour + +Some themes like **Catppuccin** or **Ayu** have theme flavours. These flavours can be changed using the flavour key for the respective theme. For example, +if you're using Catppuccin and want to change the flavour from the default flavour `frappe` to `latte` you can do this by changing your config to something like: + +```lua better-vim.lua +return { + theme = { + name = "catppuccin", + // Add this line + catppuccin_flavour = "latte" + } +} +``` + +Or, if you're using **Ayu**, you can change the theme flavour doing something like: + +```lua better-vim.lua +return { + theme = { + name = "ayu", + ayucolor = "light" + } +} +``` + +It's important to notice that each theme has its own flavour key. For example: The flavour key for Catppuccin is catppuccin_flavour, but for Ayu is ayucolor. You can see all flavours and flavour keys below. + + +## Available flavours + +Each theme has **its own flavour key**. Here is the complete list of flavours grouped by theme: + +- For `catppuccin` + + - Flavour key: `catppuccin_flavour` + - Flavours: `frappe`, `latte`, `mocha` and `macchiato` + +- For `ayu` + + - Flavour key: `ayu_color` + - Flavours: `dark` and `light` + +- For `rose-pine` + - You can use the field `rose_pine` to pass options: + +```lua better-vim.lua +return { + theme = { + name = "rose-pine", + rose_pine = { variant_dark = "moon" }, + }, + } +``` + +- For `nightfox` + - You can use the field `nightfox` to pass options: + +```lua better-vim.lua +return { + theme = { + name = "nightfox", + nightfox = { + options = { + colorblind = { enable = true }, + }, + }, + }, + } +``` +- For all other themes, just change `theme.name`. + +## Installing custom themes + +You can install custom themes using [lazy.nvim](https://github.com/folke/lazy.nvim) which is the default plugin manager for Better Vim. +Let's see how to install the [Gruvbox](https://github.com/) theme: + +### 1. Adding it the to the plugins list + +Better vim allows you to install custom plugins using the `plugins` entry in `better-vim.lua` file. A neovim/vim theme is also considered a vim plugin. +You can install the Gruvbox by adding this following code to the `plugins` entry in `better-vim.lua` file: + + +
+
+ +Reopen your Neovim and you'll see that `lazy.nvim` is installing the theme automatically. + +### 2. Setting up the theme + +Now, open your Better Vim config and change the `theme.name` to `gruvbox`: + +```lua better-vim.lua +return { + plugins = { + "morhetz/gruvbox", + }, + theme = { + name = "gruvbox", + } +} +``` +
+
+Now, reopen your **neovim** and tada πŸŽ‰ you should see the new theme applied to your setup. diff --git a/favicon.png b/favicon.png new file mode 100644 index 0000000..6deb37e Binary files /dev/null and b/favicon.png differ diff --git a/features.mdx b/features.mdx new file mode 100644 index 0000000..61f1c6a --- /dev/null +++ b/features.mdx @@ -0,0 +1,25 @@ +--- +title: "Features" +--- + +Better Vim comes with lots of slick defaults and an outstanding UI. Here is a detailed list of our features: + +- Tabs πŸ“‚ +- Nice defaults that everyone agrees with 🧠 +- File explorer πŸ—ƒοΈ - Try with `ctrl + p` +- Beautiful and minimalist status line ✨ +- File finder πŸ”Ž - We're using [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) which it's not just a file finder, you can use it for git integrations, searching, etc. +- Mouse support πŸ–±οΈ - By default, the mouse support is enabled. Sometimes you don't need the "hacker way". +- Intuitive shortcuts like `ctrl + s` , `ctrl + p` and `ctrl + f`. Check out the complete [list of mappings](/mappings/general) to see more. +- 9 hand-picked themes 🎨 +- Improved code highlight via TreeSitter πŸ’ƒ +- First-class support for JavaScript and TypeScript 🟨 🟦 +- Auto formatting on save for projects using Prettier and/or EsLint πŸ€– +- Emmet support out of the box πŸ“¦ +- Easy way to install new plugins with [lazy.nvim](https://github.com/folke/lazy.nvim) πŸ”Œ +- Extensible plugin to install LSPs via [mason.nvim](https://github.com/williamboman/mason.nvim) and formatters via [null-ls](https://github.com/jose-elias-alvarez/null-ls.nvim) βš™οΈ +- Custom overrides using lua πŸ› οΈ +- Custom and beautiful dashboard πŸ“ +- Shortcuts completion πŸ“™ - To try, Press leader and wait a few seconds. +- Zen Mode 🧘 - Just type `:ZenMode` and relax ✨ +- Custom + Common snippets for JavaScript, TypeScript, CSS, HTML, and more. diff --git a/general/credits.mdx b/general/credits.mdx new file mode 100644 index 0000000..14edf43 --- /dev/null +++ b/general/credits.mdx @@ -0,0 +1,57 @@ +--- +title: Credits and plugins list +--- + +Thanks to these plugins, obviously, because without them, this project would not exist. + +- [editorconfig/editorconfig-vim](https://github.com/editorconfig/editorconfig-vim) +- [tpope/vim-sleuth](https://github.com/tpope/vim-sleuth) +- [nvim-lua/plenary.nvim](https://github.com/nvim-lua/plenary.nvim) +- [kyazdani42/nvim-web-devicons](https://github.com/kyazdani42/nvim-web-devicons) +- [kyazdani42/nvim-tree.lua](https://github.com/kyazdani42/nvim-tree.lua) +- [nvim-telescope/telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) +- [nvim-telescope/telescope-fzf-native.nvim](https://github.com/nvim-telescope/telescope-fzf-native.nvim) +- [nvim-lualine/lualine.nvim](https://github.com/nvim-lualine/lualine.nvim) +- [catppuccin/nvim](https://github.com/catppuccin/nvim) +- [Mofiqul/dracula.nvim](https://github.com/Mofiqul/dracula.nvim) +- [ayu-theme/ayu-vim](https://github.com/ayu-theme/ayu-vim) +- [drewtempelmeyer/palenight.vim](https://github.com/drewtempelmeyer/palenight.vim) +- [folke/tokyonight.nvim](https://github.com/folke/tokyonight.nvim) +- [arcticicestudio/nord-vim](https://github.com/arcticicestudio/nord-vim) +- [olimorris/onedarkpro.nvim](https://github.com/olimorris/onedarkpro.nvim) +- [rose-pine/neovim](https://github.com/rose-pine/neovim) +- [EdenEast/nightfox.nvim](https://github.com/EdenEast/nightfox.nvim) +- [mattn/emmet-vim](https://github.com/mattn/emmet-vim) +- [akinsho/bufferline.nvim](https://github.com/akinsho/bufferline.nvim) +- [numToStr/Comment.nvim](https://github.com/numToStr/Comment.nvim) +- [folke/which-key.nvim](https://github.com/folke/which-key.nvim) +- [SirVer/ultisnips](https://github.com/SirVer/ultisnips) +- [honza/vim-snippets](https://github.com/honza/vim-snippets) +- [glepnir/dashboard-nvim](https://github.com/glepnir/dashboard-nvim) +- [norcalli/nvim-colorizer.lua](https://github.com/norcalli/nvim-colorizer.lua) +- [tpope/vim-sensible](https://github.com/tpope/vim-sensible) +- [tpope/vim-surround](https://github.com/tpope/vim-surround) +- [andymass/vim-matchup](https://github.com/andymass/vim-matchup) +- [windwp/nvim-autopairs](https://github.com/windwp/nvim-autopairs) +- [yuttie/comfortable-motion.vim](https://github.com/yuttie/comfortable-motion.vim) +- [folke/todo-comments.nvim](https://github.com/folke/todo-comments.nvim) +- [nvim-treesitter/nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter) +- [nvim-treesitter/nvim-treesitter-textobjects](https://github.com/nvim-treesitter/nvim-treesitter-textobjects) +- [JoosepAlviste/nvim-ts-context-commentstring](https://github.com/JoosepAlviste/nvim-ts-context-commentstring) +- [lukas-reineke/indent-blankline.nvim](https://github.com/lukas-reineke/indent-blankline.nvim) +- [maxmellon/vim-jsx-pretty](https://github.com/maxmellon/vim-jsx-pretty) +- [jparise/vim-graphql](https://github.com/jparise/vim-graphql) +- [folke/zen-mode](https://github.com/folke/zen-mode) +- [stevearc/dressing.nvim](https://github.com/stevearc/dressing.nvim) +- [neovim/nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) +- [williamboman/mason.nvim](https://github.com/williamboman/mason.nvim) +- [williamboman/mason-lspconfig.nvim](https://github.com/williamboman/mason-lspconfig.nvim) +- [j-hui/fidget.nvim](https://github.com/j-hui/fidget.nvim) +- [folke/neodev.nvim](https://github.com/folke/neodev.nvim) +- [hrsh7th/nvim-cmp](https://github.com/hrsh7th/nvim-cmp) +- [hrsh7th/cmp-nvim-lsp](https://github.com/hrsh7th/cmp-nvim-lsp) +- [L3MON4D3/LuaSnip](https://github.com/L3MON4D3/LuaSnip) +- [rafamadriz/friendly-snippets](https://github.com/rafamadriz/friendly-snippets) +- [saadparwaiz1/cmp_luasnip](https://github.com/saadparwaiz1/cmp_luasnip) +- [lewis6991/gitsigns.nvim](https://github.com/lewis6991/gitsigns.nvim) +- [moll/vim-bbye](https://github.com/moll/vim-bbye) diff --git a/general/learning-resources.mdx b/general/learning-resources.mdx new file mode 100644 index 0000000..83eb11c --- /dev/null +++ b/general/learning-resources.mdx @@ -0,0 +1,5 @@ +If you're a newcomer, check out this learning resources: +- [Vim Adventures](https://vim-adventures.com/) +- [Learn Vim](https://github.com/iggredible/Learn-Vim) +- [Open Vim](https://www.openvim.com/) +- [Vim Be Good](https://github.com/ThePrimeagen/vim-be-good) diff --git a/how-to-guides.mdx b/how-to-guides.mdx new file mode 100644 index 0000000..64682f0 --- /dev/null +++ b/how-to-guides.mdx @@ -0,0 +1,25 @@ +--- +title: How-to guides +description: A list of common customizations, tutorials and guides for mastering Better Vim. +--- + +## Setting custom icons +If you want to set custom icons for elements like tabs, file explorer, file finder, etc, just add this following config to the entry `hooks.after_setup` in `better-vim.lua` file: + +```lua better-vim.lua +return { + hooks = { + after_setup = function() + require("nvim-web-devicons").set_icon { + res = { + icon = "ﬦ", + color = "#e6484f", + name = "ReScript" + } + } + end, + }, +} +``` + +Since we're using **nvim-web-devicons** as our icons plugin, you can see more about custom icons on its [official documentation](https://github.com/nvim-tree/nvim-web-devicons). diff --git a/images/logo.png b/images/logo.png new file mode 100644 index 0000000..3495368 Binary files /dev/null and b/images/logo.png differ diff --git a/images/logo.svg b/images/logo.svg new file mode 100644 index 0000000..83dc3d8 --- /dev/null +++ b/images/logo.svg @@ -0,0 +1,4 @@ + + + + diff --git a/images/overview/testing-your-setup-2.png b/images/overview/testing-your-setup-2.png new file mode 100644 index 0000000..3148250 Binary files /dev/null and b/images/overview/testing-your-setup-2.png differ diff --git a/installation.mdx b/installation.mdx new file mode 100644 index 0000000..f2a4fff --- /dev/null +++ b/installation.mdx @@ -0,0 +1,39 @@ +--- +title: Installation +description: 'Learn how to get started with BetterVim.' +--- +# Pre-requisites +## For MacOS + - Nodejs + - Git + - Brew + - unzip + +## For Linux (Ubuntu, Arch, Fedora and WSL2) + - Nodejs + - Git + - unzip + +## Semi-optional requisites + - A powerline font like [NERD Fonts](https://www.nerdfonts.com/font-downloads). We're using **SpaceMono Nerd Font** in our screenshots. A powerline font is **required** for a better experience, since we're using a font-based icons in the file explorer, file finder, etc. + - If you want to achieve the same beautiful results of our screenshots, we recommend you to use a terminal emulator that support custom themes, like [Iterm2](https://iterm2.com/) (MacOS only) or [WezTerm](https://github.com/wez/wezterm) (Linux and MacOS). Since you're using Better Vim with our default themes (or even with custom themes) you'll probably want to use the same theme in neovim and in the terminal emulator. + +## Installing Better Vim +To install Better Vim, you need a terminal or a terminal emulator like [Iterm2](https://iterm2.com/) or [WezTerm](https://github.com/wez/wezterm). Open your terminal and run the following command: + +```shell +curl -L https://bettervim.com/install/YOUR_LICENSE | bash +``` + + +Don't forget to replace the value of YOUR_LICENSE with your Better Vim license generated by Gumroad. To get your license key, go to your Gumroad account and check Better Vim product page. + + +This command will install neovim, its peer dependencies and everything needed for your Better Vim setup. + +## Testing your setup +Open your terminal in a project and type nvim. You'll see a screen like that: + +![Better Vim File Finder Screenshot](/images/overview/testing-your-setup-2.png) + +If you can see the screen above, you're ready to go πŸš€ diff --git a/introduction.mdx b/introduction.mdx new file mode 100644 index 0000000..4e8e03a --- /dev/null +++ b/introduction.mdx @@ -0,0 +1,56 @@ +--- +title: Introduction +description: 'This documentation is going to help you get started and get a deeper understanding on how Better Vim works.' +--- + +## First steps + + + + Setup your BetterVim with one command. + + + Learn how you can keep your editor up to date. + + + +## Make it yours + + + + Understanding how BetterVim customization works. + + + How to install, update and remove custom plugins. + + + How to add support for other programming languages. + + + Customizing, installing and configuring themes. + + diff --git a/mappings/custom-mappings.mdx b/mappings/custom-mappings.mdx new file mode 100644 index 0000000..f1575c3 --- /dev/null +++ b/mappings/custom-mappings.mdx @@ -0,0 +1,88 @@ +### Changing the default leader key +Better Vim uses the `Space` key as the default leader. If you want to change it, you can use the `better-vim.lua` file. +To change your leader from `Space` to `,` you can update your `better-vim.lua` to something like: + +```lua better-vim.lua +return { + mappings = { + leader = ",", + }, +} +``` +### Creating your own mappings +There are two ways to create your own custom mappings: +- Using the [whichkey.nvim](https://github.com/folke/which-key.nvim) plugin + the Better Vim modules; +- Using `lua` and `hooks.after_setup` hook in `better-vim.lua`. + +### Creating mappings with whichkey +To create your own mappings using the whichkey plugin you'll use the `better-vim.lua` module. Let's see how to create a mapping to open the file explorer using `ctrl + b`: +```lua better-vim.lua +return { + mappings = { + custom = { + [""] = { + "NvimTreeToggle", + "Open file explorer", + }, + }, + }, +} +``` +We can split the mapping creation into 3 parts: +- 1. On the line `4` we define the combination of keys that we want to use +- 2. On the line `5` we set the command that we want to execute +- 3. And on the line `6` we set a description for this mapping + +πŸ“’ Since we're using whichkey.nvim to create custom mappings, you may want to check its [official documentation](https://github.com/folke/which-key.nvim/blob/main/doc/which-key.nvim.txt) before creating your own mappings. + +### Creating mappings by mode + +You can also create your own mappings **by mode**. This is important if you have +the same shortcuts, but want different commands for different modes: + +```lua better-vim.lua +return { + mappings = { + by_mode = { + i = {}, -- use these tables to create your mapings + v = {}, -- β”™ + }, + }, +} +``` + +You can use `i` (for `insert` mode), `n` (for `normal` mode), `v` (for `visual` +and `select` modes) or `x` (for only `visual` mode). The options are the same as +used in `mappings.custom`. + +### Creating mappings for tabs + +You can create custom mappings to change tabs. The default mapping is `alt/option` + **tab number**. +To customize it, just pass a function to the `tabs` key inside `mappings` table. +The function receives the `tab` number. That way you just concatenate the tab number with your custom keys: + +``` lua better-vim.lua +return { + mappings = { + tabs = function(tab) + return "h" .. tab + end, + } +} +``` + +The example above will create the mappings: + +``` +h1 -> first tab +h2 -> second tab +... +h20 -> twentyth tab +``` + +Now, you can use `h1` to go to tab 1, instead of `alt` + `1`. + +### Creating mappings with lua + +To create custom mappings using `lua` you can use the `hooks.after_setup` entry in `better-vim.lua` file, following this [tutorial](https://neovim.io/doc/user/lua-guide.html#lua-guide-mappings) +from the Neovim official documentation. diff --git a/mappings/file-explorer.mdx b/mappings/file-explorer.mdx new file mode 100644 index 0000000..30f6d1e --- /dev/null +++ b/mappings/file-explorer.mdx @@ -0,0 +1,15 @@ +- `h`, `j`, `k` or `l` : Navigate between folders and files +- `backspace` : Close the current folder +- `enter` : Open selected file or open the selected folder +- `ctrl + v` : Split the selected file +- `ctrl + n` : Open file explorer +- `a` : Create a new file (also create the parent folders if needed) +- `d` (+ confirmation with y/n) : Delete a file +- `r` : Rename a file (or move a file/folder) +- `f` : Filter files and folders + +πŸ“’ We're using [nvim.tree](https://github.com/nvim-tree/nvim-tree.lua) as our file explorer, check out the complete list of [default mappings](https://github.com/nvim-tree/nvim-tree.lua/blob/master/doc/nvim-tree-lua.txt#L1204). + + + Make sure that your cursor is on the file explorer window. + diff --git a/mappings/file-finder.mdx b/mappings/file-finder.mdx new file mode 100644 index 0000000..529417f --- /dev/null +++ b/mappings/file-finder.mdx @@ -0,0 +1,6 @@ +- `ctrl + p` : Find files +- `ctrl + o` : Show opened files +- `ctrl + f` : Search in files +- `leader + /` : Fuzzy find in current buffer + +πŸ“’ We're using [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) as our file finder, check out its official documentation to see more. diff --git a/mappings/general.mdx b/mappings/general.mdx new file mode 100644 index 0000000..cf6b3eb --- /dev/null +++ b/mappings/general.mdx @@ -0,0 +1,35 @@ +Better Vim comes with lots of slick defaults. Here is a complete list of common mappings that you may need: + +- `ctrl + s` : Save file +- `leader + eb` : Open your neovim config file (`better-vim.lua`) +- `leader + ev` : Open Better Vim default config file +- `leader + sv` : Reload the neovim config +- `leader + cl` : Clear searching highlights +- `ctrl + /` : Toggle comment line (in normal mode) or block (in visual mode) +- `ctrl + n` : Toggle File Explorer +- `leader + p` : Paste over a selection without losing the last copied text +- `leader + o` : Go to older cursor position +- `leader + i` : Go to newer cursor position +- `leader + q` : When `nvim-tree` is opened, it closes the buffer without closing the window + +## Only available in Visual Mode + +- `shift + j` : Move selected text one line down +- `shift + k` : Move selected text one line up + +**Tip:** You can use `shift + v` to select the whole line and enter Visual Mode at the same time. + +## Navigation + +- `ctrl + h`, `j`, `k` or `l` : Navigate + between buffers + +## Tabs + +- `alt/option` + tab number (e.g `1`) : Navigate to a specific tab + + + If you're using iTerm2 the mapping above will not work due some limitations with the iTerm2 built in mappings. + + +To customize mappings for tabs, check the [custom mappings](/mappings/custom-mappings#creating-mappings-for-tabs) documentation page. diff --git a/mappings/lsp.mdx b/mappings/lsp.mdx new file mode 100644 index 0000000..9ab6d73 --- /dev/null +++ b/mappings/lsp.mdx @@ -0,0 +1,23 @@ +--- +title: Autocomplete and LSP +description: Mappings related to go to definition, show documentation, type definitions and more. +--- + +Here is the complete list for the LSP (language server protocol). + +- `leader + cd` : Show documentation +- `leader + cs` : Show signature documentation +- `leader + gd` : Go to definition +- `leader + gD` : Go to declaration +- `leader + rn` : Rename a symbol +- `leader + cy` : Type definition +- `leader + ci` : Show implementation +- `leader + cr` : Show references +- `leader + dp` : Go to the previous LSP diagnostic +- `leader + dn` : Go to the next LSP diagnostic +- `leader + dl` : Show the LSP diagnostics list +- `leader + dm` : Show floating diagnostic message +- `leader + ca` : Show code actions +- `leader + ll` : Run the code lens action on the line +- `leader + ds` : Show a list of all symbols found in the document +- `leader + ws` : Show a list of all symbols found in the workspace diff --git a/mint.json b/mint.json new file mode 100644 index 0000000..65a187e --- /dev/null +++ b/mint.json @@ -0,0 +1,86 @@ +{ + "$schema": "https://mintlify.com/schema.json", + "name": "BetterVim | Your ultimate Neovim distribution", + "logo": { + "dark": "/images/logo.svg", + "light": "/images/logo.svg" + }, + "favicon": "/favicon.png", + "colors": { + "primary": "#07E4A2", + "light": "#fafafa", + "dark": "#000", + "background": { + "light": "#fafafa", + "dark": "#0f1117" + } + }, + "topbarLinks": [], + "topbarCtaButton": { + "name": "Get Started", + "url": "overview/introduction" + }, + "anchors": [ + { + "name": "Get your license", + "icon": "bolt", + "url": "https://bettervim.com" + }, + { + "name": "FAQ", + "icon": "question", + "url": "https://bettervim.com/#faq" + } + ], + "navigation": [ + { + "group": "Overview", + "pages": [ + "introduction", + "installation", + "updating", + "uninstalling", + "features", + "how-to-guides", + "troubleshooting" + ] + }, + { + "group": "Customization", + "pages": [ + "customization/how-it-works", + "customization/installing-plugins", + "customization/installing-lsps", + "customization/theme", + "customization/flags", + "customization/override-defaults", + "customization/plugins" + ] + }, + { + "group": "Mappings", + "pages": [ + "mappings/general", + "mappings/lsp", + "mappings/file-explorer", + "mappings/file-finder", + "mappings/custom-mappings" + ] + }, + { + "group": "General", + "pages": [ + "general/credits", + "general/learning-resources" + ] + } + ], + "footerSocials": { + "twitter": "https://twitter.com/mintlify", + "github": "https://github.com/mintlify", + "linkedin": "https://www.linkedin.com/company/mintsearch" + }, + "modeToggle": { + "default": "dark" + } +} diff --git a/troubleshooting.mdx b/troubleshooting.mdx new file mode 100644 index 0000000..ef116b5 --- /dev/null +++ b/troubleshooting.mdx @@ -0,0 +1,57 @@ +--- +title: Troubleshooting +description: Answers / Solutions for common problems when using Better Vim. +--- + +### I can't see folders like .github or dotfiles + +By default we hide any dotfile like `.github` or `.husky` and files ignored by your `.gitignore`. If you want to show +these files/folders, you have two options: + +- With your cursor on the file explorer, press shift + u and/or shift + i to show dotfiles/ignored files. +- Or, you can also change the default filters for the file explorer. Please check out the customization section of the file explorer [here](/customization/plugins#nvimtree-options-(file-explorer)). + +### Icons are not working + +You need to install a powerline font like [NERD Fonts](https://www.nerdfonts.com/font-downloads) and set it up that font in your terminal. We're using **SpaceMono Nerd Font** in our screenshots. A powerline font is required for a better experience, since we're using a font-based icons in the file explorer, file finder, etc. + +### How to change the default leader + +Check this [guide](/mappings/custom-mappings#changing-the-default-leader-key). + +### How to create custom mappings + +Check this [guide](/mappings/custom-mappings#creating-your-own-mappings). + +### I don't have the .bettervimrc + +To create the `.bettervimrc` file on your setup, run the following comand: + +```bash +curl -L https://bettervim.com/bettervimrc/YOUR_LICENSE | bash +``` +Don't forget to replace YOUR_LICENSE with your license key provided by Gumroad. + +### I'm seeing weird error messages + +If you already had a previous installation of Neovim, and after installed Better Vim +you are seeing some weird error messages, you should clean up your system, +removing everything that was automatically created by Neovim or its dependencies. + +Follow the steps below: + +- First, [uninstall Better Vim](/uninstalling) +- Delete all Neovim related directories: + +```bash +rm -rf ~/.config/nvim +rm -rf ~/.cache/nvim +rm -rf ~/.local/nvim +rm -rf ~/.local/share/nvim +rm -rf ~/.local/state/nvim +``` + +- Now you can [install Better Vim](/installation) again. + +If you keep seeing weird errors, feel free to drop us a message at [bettervim@gmail.com](bettervim@gmail.com) +and we'll try to help you. diff --git a/uninstalling.mdx b/uninstalling.mdx new file mode 100644 index 0000000..f1977b7 --- /dev/null +++ b/uninstalling.mdx @@ -0,0 +1,7 @@ +If you want to uninstall Better Vim, run this command on your terminal: + +```bash +curl -L https://bettervim.com/uninstall | bash +``` + +If you already had a neovim configuration before installing Better Vim, a backup was created, and we'll recover it after run the uninstalling script. diff --git a/unstalling.mdx b/unstalling.mdx new file mode 100644 index 0000000..e69de29 diff --git a/updating.mdx b/updating.mdx new file mode 100644 index 0000000..a086af4 --- /dev/null +++ b/updating.mdx @@ -0,0 +1,9 @@ +The process of updating your Better Vim takes just one command: + +```bash +curl -L https://bettervim.com/update/latest | bash +``` + + +When you install Better Vim, we create a .bettervimrc file on the ~/.config/better-vim/ directory. This file stores your license key, that is used by the update script. +