Merge branch 'master' into hotfix
This commit is contained in:
commit
be342366ec
|
@ -0,0 +1,8 @@
|
||||||
|
***************************************************************************
|
||||||
|
**NOTE**
|
||||||
|
Please verify that the `base repository` above has the intended destination!
|
||||||
|
Github by default opens Pull Requests against the parent of a forked repository.
|
||||||
|
If this is your personal fork and you didn't intend to open a PR for contribution
|
||||||
|
to the original project then adjust the `base repository` accordingly.
|
||||||
|
**************************************************************************
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
# Check Lua Formatting
|
||||||
|
name: Check Lua Formatting
|
||||||
|
on: pull_request_target
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
stylua-check:
|
||||||
|
if: github.repository == 'nvim-lua/kickstart.nvim'
|
||||||
|
name: Stylua Check
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
|
- name: Stylua Check
|
||||||
|
uses: JohnnyMorganz/stylua-action@v3
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
version: latest
|
||||||
|
args: --check .
|
||||||
|
|
|
@ -2,3 +2,6 @@ tags
|
||||||
test.sh
|
test.sh
|
||||||
.luarc.json
|
.luarc.json
|
||||||
nvim
|
nvim
|
||||||
|
|
||||||
|
spell/
|
||||||
|
lazy-lock.json
|
||||||
|
|
114
README.md
114
README.md
|
@ -1,21 +1,73 @@
|
||||||
# Mike's NVIM from kickstart.nvim
|
# kickstart.nvim
|
||||||
|
|
||||||
Requirements:
|
## Introduction
|
||||||
* Make sure to review the readmes of the plugins if you are experiencing errors. In particular:
|
|
||||||
* [ripgrep](https://github.com/BurntSushi/ripgrep#installation) is required for multiple [telescope](https://github.com/nvim-telescope/telescope.nvim#suggested-dependencies) pickers.
|
A starting point for Neovim that is:
|
||||||
|
|
||||||
|
* Small
|
||||||
|
* Single-file
|
||||||
|
* Completely Documented
|
||||||
|
|
||||||
|
**NOT** a Neovim distribution, but instead a starting point for your configuration.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
### Install Neovim
|
||||||
|
|
||||||
|
Kickstart.nvim targets *only* the latest
|
||||||
|
['stable'](https://github.com/neovim/neovim/releases/tag/stable) and latest
|
||||||
|
['nightly'](https://github.com/neovim/neovim/releases/tag/nightly) of Neovim.
|
||||||
|
If you are experiencing issues, please make sure you have the latest versions.
|
||||||
|
|
||||||
|
### Install External Dependencies
|
||||||
|
|
||||||
|
External Requirements:
|
||||||
|
- Basic utils: `git`, `make`, `unzip`, C Compiler (`gcc`)
|
||||||
|
- [ripgrep](https://github.com/BurntSushi/ripgrep#installation)
|
||||||
|
- Clipboard tool (xclip/xsel/win32yank or other depending on platform)
|
||||||
|
- A [Nerd Font](https://www.nerdfonts.com/): optional, provides various icons
|
||||||
|
- if you have it set `vim.g.have_nerd_font` in `init.lua` to true
|
||||||
|
- Language Setup:
|
||||||
|
- If want to write Typescript, you need `npm`
|
||||||
|
- If want to write Golang, you will need `go`
|
||||||
|
- etc.
|
||||||
|
|
||||||
|
> **NOTE**
|
||||||
|
> See [Install Recipes](#Install-Recipes) for additional Windows and Linux specific notes
|
||||||
|
> and quick install snippets
|
||||||
|
|
||||||
|
### Install Kickstart
|
||||||
|
|
||||||
|
> **NOTE**
|
||||||
|
> [Backup](#FAQ) your previous configuration (if any exists)
|
||||||
|
|
||||||
Neovim's configurations are located under the following paths, depending on your OS:
|
Neovim's configurations are located under the following paths, depending on your OS:
|
||||||
|
|
||||||
| OS | PATH |
|
| OS | PATH |
|
||||||
| :- | :--- |
|
| :- | :--- |
|
||||||
| Linux | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` |
|
| Linux, MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` |
|
||||||
| MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` |
|
| Windows (cmd)| `%localappdata%\nvim\` |
|
||||||
| Windows (cmd)| `%userprofile%\AppData\Local\nvim\` |
|
| Windows (powershell)| `$env:LOCALAPPDATA\nvim\` |
|
||||||
| Windows (powershell)| `$env:USERPROFILE\AppData\Local\nvim\` |
|
|
||||||
|
|
||||||
Clone kickstart.nvim:
|
#### Recommended Step
|
||||||
|
|
||||||
|
[Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) this repo
|
||||||
|
so that you have your own copy that you can modify, then install by cloning the
|
||||||
|
fork to your machine using one of the commands below, depending on your OS.
|
||||||
|
|
||||||
|
> **NOTE**
|
||||||
|
> Your fork's url will be something like this:
|
||||||
|
> `https://github.com/<your_github_username>/kickstart.nvim.git`
|
||||||
|
|
||||||
|
#### Clone kickstart.nvim
|
||||||
|
> **NOTE**
|
||||||
|
> If following the recommended step above (i.e., forking the repo), replace
|
||||||
|
> `nvim-lua` with `<your_github_username>` in the commands below
|
||||||
|
|
||||||
|
<details><summary> Linux and Mac </summary>
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
|
||||||
# on Linux and Mac
|
# on Linux and Mac
|
||||||
git clone git@github.com:mmroczka/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim
|
git clone git@github.com:mmroczka/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim
|
||||||
```
|
```
|
||||||
|
@ -28,47 +80,15 @@ Start Neovim
|
||||||
nvim
|
nvim
|
||||||
```
|
```
|
||||||
|
|
||||||
### Configuration And Extension
|
That's it! Lazy will install all the plugins you have. Use `:Lazy` to view
|
||||||
|
current plugin status. Hit `q` to close the window.
|
||||||
|
|
||||||
* Inside of your copy, feel free to modify any file you like! It's your copy!
|
Read through the `init.lua` file in your configuration folder for more
|
||||||
* Feel free to change any of the default options in `init.lua` to better suit your needs.
|
information about extending and exploring Neovim. That also includes
|
||||||
* For adding plugins, there are 3 primary options:
|
examples of adding popularly requested plugins.
|
||||||
* Add new configuration in `lua/custom/plugins/*` files, which will be auto sourced using `lazy.nvim` (uncomment the line importing the `custom/plugins` directory in the `init.lua` file to enable this)
|
|
||||||
* Modify `init.lua` with additional plugins.
|
|
||||||
* Include the `lua/kickstart/plugins/*` files in your configuration.
|
|
||||||
|
|
||||||
You can also merge updates/changes from the repo back into your fork, to keep up-to-date with any changes for the default configuration.
|
|
||||||
|
|
||||||
#### Example: Adding an autopairs plugin
|
|
||||||
|
|
||||||
In the file: `lua/custom/plugins/autopairs.lua`, add:
|
|
||||||
|
|
||||||
```lua
|
|
||||||
-- File: lua/custom/plugins/autopairs.lua
|
|
||||||
|
|
||||||
return {
|
|
||||||
"windwp/nvim-autopairs",
|
|
||||||
-- Optional dependency
|
|
||||||
dependencies = { 'hrsh7th/nvim-cmp' },
|
|
||||||
config = function()
|
|
||||||
require("nvim-autopairs").setup {}
|
|
||||||
-- If you want to automatically add `(` after selecting a function or method
|
|
||||||
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
|
|
||||||
local cmp = require('cmp')
|
|
||||||
cmp.event:on(
|
|
||||||
'confirm_done',
|
|
||||||
cmp_autopairs.on_confirm_done()
|
|
||||||
)
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
This will automatically install [windwp/nvim-autopairs](https://github.com/windwp/nvim-autopairs) and enable it on startup. For more information, see documentation for [lazy.nvim](https://github.com/folke/lazy.nvim).
|
### Getting Started
|
||||||
|
|
||||||
#### Example: Adding a file tree plugin
|
|
||||||
|
|
||||||
In the file: `lua/custom/plugins/filetree.lua`, add:
|
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
-- Unless you are still migrating, remove the deprecated commands from v1.x
|
-- Unless you are still migrating, remove the deprecated commands from v1.x
|
||||||
|
|
90
init.lua
90
init.lua
|
@ -1,6 +1,93 @@
|
||||||
|
--[[
|
||||||
|
|
||||||
|
=====================================================================
|
||||||
|
==================== READ THIS BEFORE CONTINUING ====================
|
||||||
|
=====================================================================
|
||||||
|
======== .-----. ========
|
||||||
|
======== .----------------------. | === | ========
|
||||||
|
======== |.-""""""""""""""""""-.| |-----| ========
|
||||||
|
======== || || | === | ========
|
||||||
|
======== || KICKSTART.NVIM || |-----| ========
|
||||||
|
======== || || | === | ========
|
||||||
|
======== || || |-----| ========
|
||||||
|
======== ||:Tutor || |:::::| ========
|
||||||
|
======== |'-..................-'| |____o| ========
|
||||||
|
======== `"")----------------(""` ___________ ========
|
||||||
|
======== /::::::::::| |::::::::::\ \ no mouse \ ========
|
||||||
|
======== /:::========| |==hjkl==:::\ \ required \ ========
|
||||||
|
======== '""""""""""""' '""""""""""""' '""""""""""' ========
|
||||||
|
======== ========
|
||||||
|
=====================================================================
|
||||||
|
=====================================================================
|
||||||
|
|
||||||
|
What is Kickstart?
|
||||||
|
|
||||||
|
Kickstart.nvim is *not* a distribution.
|
||||||
|
|
||||||
|
Kickstart.nvim is a starting point for your own configuration.
|
||||||
|
The goal is that you can read every line of code, top-to-bottom, understand
|
||||||
|
what your configuration is doing, and modify it to suit your needs.
|
||||||
|
|
||||||
|
Once you've done that, you can start exploring, configuring and tinkering to
|
||||||
|
make Neovim your own! That might mean leaving Kickstart just the way it is for a while
|
||||||
|
or immediately breaking it into modular pieces. It's up to you!
|
||||||
|
|
||||||
|
If you don't know anything about Lua, I recommend taking some time to read through
|
||||||
|
a guide. One possible example which will only take 10-15 minutes:
|
||||||
|
- https://learnxinyminutes.com/docs/lua/
|
||||||
|
|
||||||
|
After understanding a bit more about Lua, you can use `:help lua-guide` as a
|
||||||
|
reference for how Neovim integrates Lua.
|
||||||
|
- :help lua-guide
|
||||||
|
- (or HTML version): https://neovim.io/doc/user/lua-guide.html
|
||||||
|
|
||||||
|
Kickstart Guide:
|
||||||
|
|
||||||
|
TODO: The very first thing you should do is to run the command `:Tutor` in Neovim.
|
||||||
|
|
||||||
|
If you don't know what this means, type the following:
|
||||||
|
- <escape key>
|
||||||
|
- :
|
||||||
|
- Tutor
|
||||||
|
- <enter key>
|
||||||
|
|
||||||
|
(If you already know the Neovim basics, you can skip this step.)
|
||||||
|
|
||||||
|
Once you've completed that, you can continue working through **AND READING** the rest
|
||||||
|
of the kickstart init.lua.
|
||||||
|
|
||||||
|
Next, run AND READ `:help`.
|
||||||
|
This will open up a help window with some basic information
|
||||||
|
about reading, navigating and searching the builtin help documentation.
|
||||||
|
|
||||||
|
This should be the first place you go to look when you're stuck or confused
|
||||||
|
with something. It's one of my favorite Neovim features.
|
||||||
|
|
||||||
|
MOST IMPORTANTLY, we provide a keymap "<space>sh" to [s]earch the [h]elp documentation,
|
||||||
|
which is very useful when you're not exactly sure of what you're looking for.
|
||||||
|
|
||||||
|
I have left several `:help X` comments throughout the init.lua
|
||||||
|
These are hints about where to find more information about the relevant settings,
|
||||||
|
plugins or Neovim features used in Kickstart.
|
||||||
|
|
||||||
|
NOTE: Look for lines like this
|
||||||
|
|
||||||
|
Throughout the file. These are for you, the reader, to help you understand what is happening.
|
||||||
|
Feel free to delete them once you know what you're doing, but they should serve as a guide
|
||||||
|
for when you are first encountering a few different constructs in your Neovim config.
|
||||||
|
|
||||||
|
If you experience any errors while trying to install kickstart, run `:checkhealth` for more info.
|
||||||
|
|
||||||
|
I hope you enjoy your Neovim journey,
|
||||||
|
- TJ
|
||||||
|
|
||||||
|
P.S. You can delete this when you're done too. It's your config now! :)
|
||||||
|
--]]
|
||||||
|
|
||||||
|
|
||||||
-- Set <space> as the leader key
|
-- Set <space> as the leader key
|
||||||
-- See `:help mapleader`
|
-- See `:help mapleader`
|
||||||
-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used)
|
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
|
||||||
vim.g.mapleader = ' '
|
vim.g.mapleader = ' '
|
||||||
vim.g.maplocalleader = ' '
|
vim.g.maplocalleader = ' '
|
||||||
|
|
||||||
|
@ -33,6 +120,5 @@ require('custom.lsp-setup')
|
||||||
require('custom.cmp-setup')
|
require('custom.cmp-setup')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- The line beneath this is called `modeline`. See `:help modeline`
|
-- The line beneath this is called `modeline`. See `:help modeline`
|
||||||
-- vim: ts=2 sts=2 sw=2 et
|
-- vim: ts=2 sts=2 sw=2 et
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
--[[
|
||||||
|
--
|
||||||
|
-- This file is not required for your own configuration,
|
||||||
|
-- but helps people determine if their system is setup correctly.
|
||||||
|
--
|
||||||
|
--]]
|
||||||
|
|
||||||
|
local check_version = function()
|
||||||
|
local verstr = tostring(vim.version())
|
||||||
|
if not vim.version.ge then
|
||||||
|
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if vim.version.ge(vim.version(), '0.10-dev') then
|
||||||
|
vim.health.ok(string.format("Neovim version is: '%s'", verstr))
|
||||||
|
else
|
||||||
|
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local check_external_reqs = function()
|
||||||
|
-- Basic utils: `git`, `make`, `unzip`
|
||||||
|
for _, exe in ipairs { 'git', 'make', 'unzip', 'rg' } do
|
||||||
|
local is_executable = vim.fn.executable(exe) == 1
|
||||||
|
if is_executable then
|
||||||
|
vim.health.ok(string.format("Found executable: '%s'", exe))
|
||||||
|
else
|
||||||
|
vim.health.warn(string.format("Could not find executable: '%s'", exe))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
check = function()
|
||||||
|
vim.health.start 'kickstart.nvim'
|
||||||
|
|
||||||
|
vim.health.info [[NOTE: Not every warning is a 'must-fix' in `:checkhealth`
|
||||||
|
|
||||||
|
Fix only warnings for plugins and languages you intend to use.
|
||||||
|
Mason will give warnings for languages that are not installed.
|
||||||
|
You do not need to install, unless you want to use those languages!]]
|
||||||
|
|
||||||
|
local uv = vim.uv or vim.loop
|
||||||
|
vim.health.info('System Information: ' .. vim.inspect(uv.os_uname()))
|
||||||
|
|
||||||
|
check_version()
|
||||||
|
check_external_reqs()
|
||||||
|
end,
|
||||||
|
}
|
|
@ -1,74 +0,0 @@
|
||||||
-- autoformat.lua
|
|
||||||
--
|
|
||||||
-- Use your language server to automatically format your code on save.
|
|
||||||
-- Adds additional commands as well to manage the behavior
|
|
||||||
|
|
||||||
return {
|
|
||||||
'neovim/nvim-lspconfig',
|
|
||||||
config = function()
|
|
||||||
-- Switch for controlling whether you want autoformatting.
|
|
||||||
-- Use :KickstartFormatToggle to toggle autoformatting on or off
|
|
||||||
local format_is_enabled = true
|
|
||||||
vim.api.nvim_create_user_command('KickstartFormatToggle', function()
|
|
||||||
format_is_enabled = not format_is_enabled
|
|
||||||
print('Setting autoformatting to: ' .. tostring(format_is_enabled))
|
|
||||||
end, {})
|
|
||||||
|
|
||||||
-- Create an augroup that is used for managing our formatting autocmds.
|
|
||||||
-- We need one augroup per client to make sure that multiple clients
|
|
||||||
-- can attach to the same buffer without interfering with each other.
|
|
||||||
local _augroups = {}
|
|
||||||
local get_augroup = function(client)
|
|
||||||
if not _augroups[client.id] then
|
|
||||||
local group_name = 'kickstart-lsp-format-' .. client.name
|
|
||||||
local id = vim.api.nvim_create_augroup(group_name, { clear = true })
|
|
||||||
_augroups[client.id] = id
|
|
||||||
end
|
|
||||||
|
|
||||||
return _augroups[client.id]
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Whenever an LSP attaches to a buffer, we will run this function.
|
|
||||||
--
|
|
||||||
-- See `:help LspAttach` for more information about this autocmd event.
|
|
||||||
vim.api.nvim_create_autocmd('LspAttach', {
|
|
||||||
group = vim.api.nvim_create_augroup('kickstart-lsp-attach-format', { clear = true }),
|
|
||||||
-- This is where we attach the autoformatting for reasonable clients
|
|
||||||
callback = function(args)
|
|
||||||
local client_id = args.data.client_id
|
|
||||||
local client = vim.lsp.get_client_by_id(client_id)
|
|
||||||
local bufnr = args.buf
|
|
||||||
|
|
||||||
-- Only attach to clients that support document formatting
|
|
||||||
if not client.server_capabilities.documentFormattingProvider then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Tsserver usually works poorly. Sorry you work with bad languages
|
|
||||||
-- You can remove this line if you know what you're doing :)
|
|
||||||
if client.name == 'tsserver' then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Create an autocmd that will run *before* we save the buffer.
|
|
||||||
-- Run the formatting command for the LSP that has just attached.
|
|
||||||
vim.api.nvim_create_autocmd('BufWritePre', {
|
|
||||||
group = get_augroup(client),
|
|
||||||
buffer = bufnr,
|
|
||||||
callback = function()
|
|
||||||
if not format_is_enabled then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.lsp.buf.format {
|
|
||||||
async = false,
|
|
||||||
filter = function(c)
|
|
||||||
return c.id == client.id
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
}
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
-- autopairs
|
||||||
|
-- https://github.com/windwp/nvim-autopairs
|
||||||
|
|
||||||
|
return {
|
||||||
|
'windwp/nvim-autopairs',
|
||||||
|
event = 'InsertEnter',
|
||||||
|
-- Optional dependency
|
||||||
|
dependencies = { 'hrsh7th/nvim-cmp' },
|
||||||
|
config = function()
|
||||||
|
require('nvim-autopairs').setup {}
|
||||||
|
-- If you want to automatically add `(` after selecting a function or method
|
||||||
|
local cmp_autopairs = require 'nvim-autopairs.completion.cmp'
|
||||||
|
local cmp = require 'cmp'
|
||||||
|
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
|
||||||
|
end,
|
||||||
|
}
|
|
@ -14,6 +14,9 @@ return {
|
||||||
-- Creates a beautiful debugger UI
|
-- Creates a beautiful debugger UI
|
||||||
'rcarriga/nvim-dap-ui',
|
'rcarriga/nvim-dap-ui',
|
||||||
|
|
||||||
|
-- Required dependency for nvim-dap-ui
|
||||||
|
'nvim-neotest/nvim-nio',
|
||||||
|
|
||||||
-- Installs the debug adapters for you
|
-- Installs the debug adapters for you
|
||||||
'williamboman/mason.nvim',
|
'williamboman/mason.nvim',
|
||||||
'jay-babu/mason-nvim-dap.nvim',
|
'jay-babu/mason-nvim-dap.nvim',
|
||||||
|
@ -21,6 +24,28 @@ return {
|
||||||
-- Add your own debuggers here
|
-- Add your own debuggers here
|
||||||
'leoluz/nvim-dap-go',
|
'leoluz/nvim-dap-go',
|
||||||
},
|
},
|
||||||
|
keys = function(_, keys)
|
||||||
|
local dap = require 'dap'
|
||||||
|
local dapui = require 'dapui'
|
||||||
|
return {
|
||||||
|
-- Basic debugging keymaps, feel free to change to your liking!
|
||||||
|
{ '<F5>', dap.continue, desc = 'Debug: Start/Continue' },
|
||||||
|
{ '<F1>', dap.step_into, desc = 'Debug: Step Into' },
|
||||||
|
{ '<F2>', dap.step_over, desc = 'Debug: Step Over' },
|
||||||
|
{ '<F3>', dap.step_out, desc = 'Debug: Step Out' },
|
||||||
|
{ '<leader>b', dap.toggle_breakpoint, desc = 'Debug: Toggle Breakpoint' },
|
||||||
|
{
|
||||||
|
'<leader>B',
|
||||||
|
function()
|
||||||
|
dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ')
|
||||||
|
end,
|
||||||
|
desc = 'Debug: Set Breakpoint',
|
||||||
|
},
|
||||||
|
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
|
||||||
|
{ '<F7>', dapui.toggle, desc = 'Debug: See last session result.' },
|
||||||
|
unpack(keys),
|
||||||
|
}
|
||||||
|
end,
|
||||||
config = function()
|
config = function()
|
||||||
local dap = require 'dap'
|
local dap = require 'dap'
|
||||||
local dapui = require 'dapui'
|
local dapui = require 'dapui'
|
||||||
|
@ -28,7 +53,7 @@ return {
|
||||||
require('mason-nvim-dap').setup {
|
require('mason-nvim-dap').setup {
|
||||||
-- Makes a best effort to setup the various debuggers with
|
-- Makes a best effort to setup the various debuggers with
|
||||||
-- reasonable debug configurations
|
-- reasonable debug configurations
|
||||||
automatic_setup = true,
|
automatic_installation = true,
|
||||||
|
|
||||||
-- You can provide additional configuration to the handlers,
|
-- You can provide additional configuration to the handlers,
|
||||||
-- see mason-nvim-dap README for more information
|
-- see mason-nvim-dap README for more information
|
||||||
|
@ -42,16 +67,6 @@ return {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Basic debugging keymaps, feel free to change to your liking!
|
|
||||||
vim.keymap.set('n', '<F5>', dap.continue, { desc = 'Debug: Start/Continue' })
|
|
||||||
vim.keymap.set('n', '<F1>', dap.step_into, { desc = 'Debug: Step Into' })
|
|
||||||
vim.keymap.set('n', '<F2>', dap.step_over, { desc = 'Debug: Step Over' })
|
|
||||||
vim.keymap.set('n', '<F3>', dap.step_out, { desc = 'Debug: Step Out' })
|
|
||||||
vim.keymap.set('n', '<leader>b', dap.toggle_breakpoint, { desc = 'Debug: Toggle Breakpoint' })
|
|
||||||
vim.keymap.set('n', '<leader>B', function()
|
|
||||||
dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ')
|
|
||||||
end, { desc = 'Debug: Set Breakpoint' })
|
|
||||||
|
|
||||||
-- Dap UI setup
|
-- Dap UI setup
|
||||||
-- For more information, see |:help nvim-dap-ui|
|
-- For more information, see |:help nvim-dap-ui|
|
||||||
dapui.setup {
|
dapui.setup {
|
||||||
|
@ -74,14 +89,17 @@ return {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
|
|
||||||
vim.keymap.set('n', '<F7>', dapui.toggle, { desc = 'Debug: See last session result.' })
|
|
||||||
|
|
||||||
dap.listeners.after.event_initialized['dapui_config'] = dapui.open
|
dap.listeners.after.event_initialized['dapui_config'] = dapui.open
|
||||||
dap.listeners.before.event_terminated['dapui_config'] = dapui.close
|
dap.listeners.before.event_terminated['dapui_config'] = dapui.close
|
||||||
dap.listeners.before.event_exited['dapui_config'] = dapui.close
|
dap.listeners.before.event_exited['dapui_config'] = dapui.close
|
||||||
|
|
||||||
-- Install golang specific config
|
-- Install golang specific config
|
||||||
require('dap-go').setup()
|
require('dap-go').setup {
|
||||||
|
delve = {
|
||||||
|
-- On Windows delve must be run attached or it crashes.
|
||||||
|
-- See https://github.com/leoluz/nvim-dap-go/blob/main/README.md#configuring
|
||||||
|
detached = vim.fn.has 'win32' == 0,
|
||||||
|
},
|
||||||
|
}
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
-- Adds git related signs to the gutter, as well as utilities for managing changes
|
||||||
|
-- NOTE: gitsigns is already included in init.lua but contains only the base
|
||||||
|
-- config. This will add also the recommended keymaps.
|
||||||
|
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
'lewis6991/gitsigns.nvim',
|
||||||
|
opts = {
|
||||||
|
on_attach = function(bufnr)
|
||||||
|
local gitsigns = require 'gitsigns'
|
||||||
|
|
||||||
|
local function map(mode, l, r, opts)
|
||||||
|
opts = opts or {}
|
||||||
|
opts.buffer = bufnr
|
||||||
|
vim.keymap.set(mode, l, r, opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Navigation
|
||||||
|
map('n', ']c', function()
|
||||||
|
if vim.wo.diff then
|
||||||
|
vim.cmd.normal { ']c', bang = true }
|
||||||
|
else
|
||||||
|
gitsigns.nav_hunk 'next'
|
||||||
|
end
|
||||||
|
end, { desc = 'Jump to next git [c]hange' })
|
||||||
|
|
||||||
|
map('n', '[c', function()
|
||||||
|
if vim.wo.diff then
|
||||||
|
vim.cmd.normal { '[c', bang = true }
|
||||||
|
else
|
||||||
|
gitsigns.nav_hunk 'prev'
|
||||||
|
end
|
||||||
|
end, { desc = 'Jump to previous git [c]hange' })
|
||||||
|
|
||||||
|
-- Actions
|
||||||
|
-- visual mode
|
||||||
|
map('v', '<leader>hs', function()
|
||||||
|
gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
||||||
|
end, { desc = 'stage git hunk' })
|
||||||
|
map('v', '<leader>hr', function()
|
||||||
|
gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
||||||
|
end, { desc = 'reset git hunk' })
|
||||||
|
-- normal mode
|
||||||
|
map('n', '<leader>hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' })
|
||||||
|
map('n', '<leader>hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' })
|
||||||
|
map('n', '<leader>hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' })
|
||||||
|
map('n', '<leader>hu', gitsigns.undo_stage_hunk, { desc = 'git [u]ndo stage hunk' })
|
||||||
|
map('n', '<leader>hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' })
|
||||||
|
map('n', '<leader>hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' })
|
||||||
|
map('n', '<leader>hb', gitsigns.blame_line, { desc = 'git [b]lame line' })
|
||||||
|
map('n', '<leader>hd', gitsigns.diffthis, { desc = 'git [d]iff against index' })
|
||||||
|
map('n', '<leader>hD', function()
|
||||||
|
gitsigns.diffthis '@'
|
||||||
|
end, { desc = 'git [D]iff against last commit' })
|
||||||
|
-- Toggles
|
||||||
|
map('n', '<leader>tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' })
|
||||||
|
map('n', '<leader>tD', gitsigns.toggle_deleted, { desc = '[T]oggle git show [D]eleted' })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
return {
|
||||||
|
{ -- Add indentation guides even on blank lines
|
||||||
|
'lukas-reineke/indent-blankline.nvim',
|
||||||
|
-- Enable `lukas-reineke/indent-blankline.nvim`
|
||||||
|
-- See `:help ibl`
|
||||||
|
main = 'ibl',
|
||||||
|
opts = {},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
return {
|
||||||
|
|
||||||
|
{ -- Linting
|
||||||
|
'mfussenegger/nvim-lint',
|
||||||
|
event = { 'BufReadPre', 'BufNewFile' },
|
||||||
|
config = function()
|
||||||
|
local lint = require 'lint'
|
||||||
|
lint.linters_by_ft = {
|
||||||
|
markdown = { 'markdownlint' },
|
||||||
|
}
|
||||||
|
|
||||||
|
-- To allow other plugins to add linters to require('lint').linters_by_ft,
|
||||||
|
-- instead set linters_by_ft like this:
|
||||||
|
-- lint.linters_by_ft = lint.linters_by_ft or {}
|
||||||
|
-- lint.linters_by_ft['markdown'] = { 'markdownlint' }
|
||||||
|
--
|
||||||
|
-- However, note that this will enable a set of default linters,
|
||||||
|
-- which will cause errors unless these tools are available:
|
||||||
|
-- {
|
||||||
|
-- clojure = { "clj-kondo" },
|
||||||
|
-- dockerfile = { "hadolint" },
|
||||||
|
-- inko = { "inko" },
|
||||||
|
-- janet = { "janet" },
|
||||||
|
-- json = { "jsonlint" },
|
||||||
|
-- markdown = { "vale" },
|
||||||
|
-- rst = { "vale" },
|
||||||
|
-- ruby = { "ruby" },
|
||||||
|
-- terraform = { "tflint" },
|
||||||
|
-- text = { "vale" }
|
||||||
|
-- }
|
||||||
|
--
|
||||||
|
-- You can disable the default linters by setting their filetypes to nil:
|
||||||
|
-- lint.linters_by_ft['clojure'] = nil
|
||||||
|
-- lint.linters_by_ft['dockerfile'] = nil
|
||||||
|
-- lint.linters_by_ft['inko'] = nil
|
||||||
|
-- lint.linters_by_ft['janet'] = nil
|
||||||
|
-- lint.linters_by_ft['json'] = nil
|
||||||
|
-- lint.linters_by_ft['markdown'] = nil
|
||||||
|
-- lint.linters_by_ft['rst'] = nil
|
||||||
|
-- lint.linters_by_ft['ruby'] = nil
|
||||||
|
-- lint.linters_by_ft['terraform'] = nil
|
||||||
|
-- lint.linters_by_ft['text'] = nil
|
||||||
|
|
||||||
|
-- Create autocommand which carries out the actual linting
|
||||||
|
-- on the specified events.
|
||||||
|
local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true })
|
||||||
|
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
|
||||||
|
group = lint_augroup,
|
||||||
|
callback = function()
|
||||||
|
lint.try_lint()
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
-- Neo-tree is a Neovim plugin to browse the file system
|
||||||
|
-- https://github.com/nvim-neo-tree/neo-tree.nvim
|
||||||
|
|
||||||
|
return {
|
||||||
|
'nvim-neo-tree/neo-tree.nvim',
|
||||||
|
version = '*',
|
||||||
|
dependencies = {
|
||||||
|
'nvim-lua/plenary.nvim',
|
||||||
|
'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
|
||||||
|
'MunifTanjim/nui.nvim',
|
||||||
|
},
|
||||||
|
cmd = 'Neotree',
|
||||||
|
keys = {
|
||||||
|
{ '\\', ':Neotree reveal<CR>', desc = 'NeoTree reveal' },
|
||||||
|
},
|
||||||
|
opts = {
|
||||||
|
filesystem = {
|
||||||
|
window = {
|
||||||
|
mappings = {
|
||||||
|
['\\'] = 'close_window',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
Loading…
Reference in New Issue