Merge branch 'master' of https://github.com/nvim-lua/kickstart.nvim into HEAD
This commit is contained in:
commit
45e2a64680
|
@ -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.
|
||||||
|
**************************************************************************
|
||||||
|
|
|
@ -2,3 +2,6 @@ tags
|
||||||
test.sh
|
test.sh
|
||||||
.luarc.json
|
.luarc.json
|
||||||
nvim
|
nvim
|
||||||
|
|
||||||
|
spell/
|
||||||
|
lazy-lock.json
|
||||||
|
|
234
README.md
234
README.md
|
@ -1,7 +1,233 @@
|
||||||
# Tazoeur's kickstart.nvim
|
# kickstart.nvim
|
||||||
|
|
||||||
### Introduction
|
## Introduction
|
||||||
|
|
||||||
This is my fork of the magnificent kickstart.nvim repository.
|
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 you want to write Typescript, you need `npm`
|
||||||
|
- If you 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:
|
||||||
|
|
||||||
|
| OS | PATH |
|
||||||
|
| :- | :--- |
|
||||||
|
| Linux, MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` |
|
||||||
|
| Windows (cmd)| `%localappdata%\nvim\` |
|
||||||
|
| Windows (powershell)| `$env:LOCALAPPDATA\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`
|
||||||
|
|
||||||
|
You likely want to remove `lazy-lock.json` from your fork's `.gitignore` file
|
||||||
|
too - it's ignored in the kickstart repo to make maintenance easier, but it's
|
||||||
|
[recommmended to track it in version control](https://lazy.folke.io/usage/lockfile).
|
||||||
|
|
||||||
|
#### 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
|
||||||
|
git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details><summary> Windows </summary>
|
||||||
|
|
||||||
|
If you're using `cmd.exe`:
|
||||||
|
|
||||||
|
```
|
||||||
|
git clone https://github.com/nvim-lua/kickstart.nvim.git "%localappdata%\nvim"
|
||||||
|
```
|
||||||
|
|
||||||
|
If you're using `powershell.exe`
|
||||||
|
|
||||||
|
```
|
||||||
|
git clone https://github.com/nvim-lua/kickstart.nvim.git "${env:LOCALAPPDATA}\nvim"
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
### Post Installation
|
||||||
|
|
||||||
|
Start Neovim
|
||||||
|
|
||||||
|
```sh
|
||||||
|
nvim
|
||||||
|
```
|
||||||
|
|
||||||
|
That's it! Lazy will install all the plugins you have. Use `:Lazy` to view
|
||||||
|
current plugin status. Hit `q` to close the window.
|
||||||
|
|
||||||
|
Read through the `init.lua` file in your configuration folder for more
|
||||||
|
information about extending and exploring Neovim. That also includes
|
||||||
|
examples of adding popularly requested plugins.
|
||||||
|
|
||||||
|
|
||||||
|
### Getting Started
|
||||||
|
|
||||||
|
[The Only Video You Need to Get Started with Neovim](https://youtu.be/m8C0Cq9Uv9o)
|
||||||
|
|
||||||
|
### FAQ
|
||||||
|
|
||||||
|
* What should I do if I already have a pre-existing neovim configuration?
|
||||||
|
* You should back it up and then delete all associated files.
|
||||||
|
* This includes your existing init.lua and the neovim files in `~/.local`
|
||||||
|
which can be deleted with `rm -rf ~/.local/share/nvim/`
|
||||||
|
* Can I keep my existing configuration in parallel to kickstart?
|
||||||
|
* Yes! You can use [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME)`=nvim-NAME`
|
||||||
|
to maintain multiple configurations. For example, you can install the kickstart
|
||||||
|
configuration in `~/.config/nvim-kickstart` and create an alias:
|
||||||
|
```
|
||||||
|
alias nvim-kickstart='NVIM_APPNAME="nvim-kickstart" nvim'
|
||||||
|
```
|
||||||
|
When you run Neovim using `nvim-kickstart` alias it will use the alternative
|
||||||
|
config directory and the matching local directory
|
||||||
|
`~/.local/share/nvim-kickstart`. You can apply this approach to any Neovim
|
||||||
|
distribution that you would like to try out.
|
||||||
|
* What if I want to "uninstall" this configuration:
|
||||||
|
* See [lazy.nvim uninstall](https://lazy.folke.io/usage#-uninstalling) information
|
||||||
|
* Why is the kickstart `init.lua` a single file? Wouldn't it make sense to split it into multiple files?
|
||||||
|
* The main purpose of kickstart is to serve as a teaching tool and a reference
|
||||||
|
configuration that someone can easily use to `git clone` as a basis for their own.
|
||||||
|
As you progress in learning Neovim and Lua, you might consider splitting `init.lua`
|
||||||
|
into smaller parts. A fork of kickstart that does this while maintaining the
|
||||||
|
same functionality is available here:
|
||||||
|
* [kickstart-modular.nvim](https://github.com/dam9000/kickstart-modular.nvim)
|
||||||
|
* Discussions on this topic can be found here:
|
||||||
|
* [Restructure the configuration](https://github.com/nvim-lua/kickstart.nvim/issues/218)
|
||||||
|
* [Reorganize init.lua into a multi-file setup](https://github.com/nvim-lua/kickstart.nvim/pull/473)
|
||||||
|
|
||||||
|
### Install Recipes
|
||||||
|
|
||||||
|
Below you can find OS specific install instructions for Neovim and dependencies.
|
||||||
|
|
||||||
|
After installing all the dependencies continue with the [Install Kickstart](#Install-Kickstart) step.
|
||||||
|
|
||||||
|
#### Windows Installation
|
||||||
|
|
||||||
|
<details><summary>Windows with Microsoft C++ Build Tools and CMake</summary>
|
||||||
|
Installation may require installing build tools and updating the run command for `telescope-fzf-native`
|
||||||
|
|
||||||
|
See `telescope-fzf-native` documentation for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation)
|
||||||
|
|
||||||
|
This requires:
|
||||||
|
|
||||||
|
- Install CMake and the Microsoft C++ Build Tools on Windows
|
||||||
|
|
||||||
|
```lua
|
||||||
|
{'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' }
|
||||||
|
```
|
||||||
|
</details>
|
||||||
|
<details><summary>Windows with gcc/make using chocolatey</summary>
|
||||||
|
Alternatively, one can install gcc and make which don't require changing the config,
|
||||||
|
the easiest way is to use choco:
|
||||||
|
|
||||||
|
1. install [chocolatey](https://chocolatey.org/install)
|
||||||
|
either follow the instructions on the page or use winget,
|
||||||
|
run in cmd as **admin**:
|
||||||
|
```
|
||||||
|
winget install --accept-source-agreements chocolatey.chocolatey
|
||||||
|
```
|
||||||
|
|
||||||
|
2. install all requirements using choco, exit previous cmd and
|
||||||
|
open a new one so that choco path is set, and run in cmd as **admin**:
|
||||||
|
```
|
||||||
|
choco install -y neovim git ripgrep wget fd unzip gzip mingw make
|
||||||
|
```
|
||||||
|
</details>
|
||||||
|
<details><summary>WSL (Windows Subsystem for Linux)</summary>
|
||||||
|
|
||||||
|
```
|
||||||
|
wsl --install
|
||||||
|
wsl
|
||||||
|
sudo add-apt-repository ppa:neovim-ppa/unstable -y
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install make gcc ripgrep unzip git xclip neovim
|
||||||
|
```
|
||||||
|
</details>
|
||||||
|
|
||||||
|
#### Linux Install
|
||||||
|
<details><summary>Ubuntu Install Steps</summary>
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo add-apt-repository ppa:neovim-ppa/unstable -y
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install make gcc ripgrep unzip git xclip neovim
|
||||||
|
```
|
||||||
|
</details>
|
||||||
|
<details><summary>Debian Install Steps</summary>
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install make gcc ripgrep unzip git xclip curl
|
||||||
|
|
||||||
|
# Now we install nvim
|
||||||
|
curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz
|
||||||
|
sudo rm -rf /opt/nvim-linux64
|
||||||
|
sudo mkdir -p /opt/nvim-linux64
|
||||||
|
sudo chmod a+rX /opt/nvim-linux64
|
||||||
|
sudo tar -C /opt -xzf nvim-linux64.tar.gz
|
||||||
|
|
||||||
|
# make it available in /usr/local/bin, distro installs to /usr/bin
|
||||||
|
sudo ln -sf /opt/nvim-linux64/bin/nvim /usr/local/bin/
|
||||||
|
```
|
||||||
|
</details>
|
||||||
|
<details><summary>Fedora Install Steps</summary>
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo dnf install -y gcc make git ripgrep fd-find unzip neovim
|
||||||
|
```
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details><summary>Arch Install Steps</summary>
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo pacman -S --noconfirm --needed gcc make git ripgrep fd unzip neovim
|
||||||
|
```
|
||||||
|
</details>
|
||||||
|
|
||||||
I am not expecting someone else to fool around here. Not that I care, but I just mean that it's not designed for anyone else but me.
|
|
||||||
|
|
785
init.lua
785
init.lua
|
@ -1,740 +1,97 @@
|
||||||
-- todo:
|
--[[
|
||||||
--nnoremap gx <CMD>execute '!xdg-open ' .. shellescape(expand('<cfile>'), v:true)<CR>
|
|
||||||
-- Set <space> as the leader key
|
|
||||||
-- See `:help mapleader`
|
|
||||||
-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used)
|
|
||||||
vim.g.mapleader = ' '
|
|
||||||
vim.g.maplocalleader = ' '
|
|
||||||
|
|
||||||
vim.g.loaded_netrw = 1
|
=====================================================================
|
||||||
vim.g.loaded_netrwPlugin = 1
|
=====================================================================
|
||||||
-- [[ Install `lazy.nvim` plugin manager ]]
|
=====================================================================
|
||||||
-- https://github.com/folke/lazy.nvim
|
======== .-----. ========
|
||||||
-- `:help lazy.nvim.txt` for more info
|
======== .----------------------. | === | ========
|
||||||
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
======== |.-""""""""""""""""""-.| |-----| ========
|
||||||
if not vim.loop.fs_stat(lazypath) then
|
======== || || | === | ========
|
||||||
vim.fn.system {
|
======== || KICKSTART.NVIM || |-----| ========
|
||||||
'git',
|
======== || || | === | ========
|
||||||
'clone',
|
======== || || |-----| ========
|
||||||
'--filter=blob:none',
|
======== ||:Tutor || |:::::| ========
|
||||||
'https://github.com/folke/lazy.nvim.git',
|
======== |'-..................-'| |____o| ========
|
||||||
'--branch=stable', -- latest stable release
|
======== `"")----------------(""` ___________ ========
|
||||||
lazypath,
|
======== /::::::::::| |::::::::::\ \ no mouse \ ========
|
||||||
}
|
======== /:::========| |==hjkl==:::\ \ required \ ========
|
||||||
end
|
======== '""""""""""""' '""""""""""""' '""""""""""' ========
|
||||||
vim.opt.rtp:prepend(lazypath)
|
======== ========
|
||||||
|
=====================================================================
|
||||||
|
=====================================================================
|
||||||
|
|
||||||
-- [[ Configure plugins ]]
|
I hope you enjoy your Neovim journey,
|
||||||
-- NOTE: Here is where you install your plugins.
|
- TJ
|
||||||
-- You can configure plugins using the `config` key.
|
|
||||||
--
|
|
||||||
-- You can also configure plugins after the setup call,
|
|
||||||
-- as they will be available in your neovim runtime.
|
|
||||||
require('lazy').setup({
|
|
||||||
-- NOTE: First, some plugins that don't require any configuration
|
|
||||||
|
|
||||||
-- Git related plugins
|
--]]
|
||||||
'tpope/vim-fugitive',
|
|
||||||
'tpope/vim-rhubarb',
|
|
||||||
|
|
||||||
-- Detect tabstop and shiftwidth automatically
|
require 'custom.options'
|
||||||
'tpope/vim-sleuth',
|
require 'custom.keymaps'
|
||||||
|
|
||||||
-- NOTE: This is where your plugins related to LSP can be installed.
|
-- [[ Basic Autocommands ]]
|
||||||
-- The configuration is done below. Search for lspconfig to find it below.
|
-- See `:help lua-guide-autocommands`
|
||||||
{
|
|
||||||
-- LSP Configuration & Plugins
|
|
||||||
'neovim/nvim-lspconfig',
|
|
||||||
dependencies = {
|
|
||||||
-- Automatically install LSPs to stdpath for neovim
|
|
||||||
{ 'williamboman/mason.nvim', config = true },
|
|
||||||
'williamboman/mason-lspconfig.nvim',
|
|
||||||
|
|
||||||
-- Useful status updates for LSP
|
-- Highlight when yanking (copying) text
|
||||||
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
|
-- Try it with `yap` in normal mode
|
||||||
{ 'j-hui/fidget.nvim', opts = {} },
|
-- See `:help vim.highlight.on_yank()`
|
||||||
|
|
||||||
-- Additional lua configuration, makes nvim stuff amazing!
|
|
||||||
'folke/neodev.nvim',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"jay-babu/mason-null-ls.nvim",
|
|
||||||
event = { "BufReadPre", "BufNewFile" },
|
|
||||||
dependencies = {
|
|
||||||
"williamboman/mason.nvim",
|
|
||||||
"nvimtools/none-ls.nvim",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"nvim-tree/nvim-tree.lua",
|
|
||||||
version = "*",
|
|
||||||
lazy = false,
|
|
||||||
dependencies = {
|
|
||||||
"nvim-tree/nvim-web-devicons",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
-- Autocompletion
|
|
||||||
'hrsh7th/nvim-cmp',
|
|
||||||
dependencies = {
|
|
||||||
-- Snippet Engine & its associated nvim-cmp source
|
|
||||||
{
|
|
||||||
'L3MON4D3/LuaSnip',
|
|
||||||
build = (function()
|
|
||||||
-- Build Step is needed for regex support in snippets
|
|
||||||
return 'make install_jsregexp'
|
|
||||||
end)(),
|
|
||||||
},
|
|
||||||
'saadparwaiz1/cmp_luasnip',
|
|
||||||
|
|
||||||
-- Adds LSP completion capabilities
|
|
||||||
'hrsh7th/cmp-nvim-lsp',
|
|
||||||
'hrsh7th/cmp-path',
|
|
||||||
'hrsh7th/cmp-buffer',
|
|
||||||
|
|
||||||
-- Adds a number of user-friendly snippets
|
|
||||||
'rafamadriz/friendly-snippets',
|
|
||||||
|
|
||||||
-- Adds nice formatting to the completions
|
|
||||||
'onsails/lspkind-nvim',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Useful plugin to show you pending keybinds.
|
|
||||||
{ 'folke/which-key.nvim', opts = {} },
|
|
||||||
{
|
|
||||||
-- Adds git related signs to the gutter, as well as utilities for managing changes
|
|
||||||
'lewis6991/gitsigns.nvim',
|
|
||||||
opts = {
|
|
||||||
-- See `:help gitsigns.txt`
|
|
||||||
signs = {
|
|
||||||
add = { text = '+' },
|
|
||||||
change = { text = '~' },
|
|
||||||
delete = { text = '_' },
|
|
||||||
topdelete = { text = '‾' },
|
|
||||||
changedelete = { text = '~' },
|
|
||||||
},
|
|
||||||
on_attach = function(bufnr)
|
|
||||||
local gs = package.loaded.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', 'v' }, ']c', function()
|
|
||||||
if vim.wo.diff then
|
|
||||||
return ']c'
|
|
||||||
end
|
|
||||||
vim.schedule(function()
|
|
||||||
gs.next_hunk()
|
|
||||||
end)
|
|
||||||
return '<Ignore>'
|
|
||||||
end, { expr = true, desc = 'Jump to next hunk' })
|
|
||||||
|
|
||||||
map({ 'n', 'v' }, '[c', function()
|
|
||||||
if vim.wo.diff then
|
|
||||||
return '[c'
|
|
||||||
end
|
|
||||||
vim.schedule(function()
|
|
||||||
gs.prev_hunk()
|
|
||||||
end)
|
|
||||||
return '<Ignore>'
|
|
||||||
end, { expr = true, desc = 'Jump to previous hunk' })
|
|
||||||
|
|
||||||
-- Actions
|
|
||||||
-- visual mode
|
|
||||||
map('v', '<leader>hs', function()
|
|
||||||
gs.stage_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
|
||||||
end, { desc = 'stage git hunk' })
|
|
||||||
map('v', '<leader>hr', function()
|
|
||||||
gs.reset_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
|
||||||
end, { desc = 'reset git hunk' })
|
|
||||||
-- normal mode
|
|
||||||
map('n', '<leader>hs', gs.stage_hunk, { desc = 'git stage hunk' })
|
|
||||||
map('n', '<leader>hr', gs.reset_hunk, { desc = 'git reset hunk' })
|
|
||||||
map('n', '<leader>hS', gs.stage_buffer, { desc = 'git Stage buffer' })
|
|
||||||
map('n', '<leader>hu', gs.undo_stage_hunk, { desc = 'undo stage hunk' })
|
|
||||||
map('n', '<leader>hR', gs.reset_buffer, { desc = 'git Reset buffer' })
|
|
||||||
map('n', '<leader>hp', gs.preview_hunk, { desc = 'preview git hunk' })
|
|
||||||
map('n', '<leader>hb', function()
|
|
||||||
gs.blame_line { full = false }
|
|
||||||
end, { desc = 'git blame line' })
|
|
||||||
map('n', '<leader>hd', gs.diffthis, { desc = 'git diff against index' })
|
|
||||||
map('n', '<leader>hD', function()
|
|
||||||
gs.diffthis '~'
|
|
||||||
end, { desc = 'git diff against last commit' })
|
|
||||||
|
|
||||||
-- Toggles
|
|
||||||
map('n', '<leader>tb', gs.toggle_current_line_blame, { desc = '[T]oggle git [B]lame line' })
|
|
||||||
map('n', '<leader>td', gs.toggle_deleted, { desc = '[T]oggle git [S]how deleted' })
|
|
||||||
|
|
||||||
-- Text object
|
|
||||||
map({ 'o', 'x' }, 'ih', ':<C-U>Gitsigns select_hunk<CR>', { desc = 'select git hunk' })
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
-- Theme
|
|
||||||
"rose-pine/neovim",
|
|
||||||
name = "rose-pine",
|
|
||||||
config = function()
|
|
||||||
require("rose-pine").setup({
|
|
||||||
dim_inactive_windows = true,
|
|
||||||
extend_background_behind_borders = true,
|
|
||||||
enable = {
|
|
||||||
terminal = true,
|
|
||||||
legacy_highlights = true,
|
|
||||||
migrations = true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Pocco81/auto-save.nvim",
|
|
||||||
config = function()
|
|
||||||
require("auto-save").setup {
|
|
||||||
trigger_events = { "FocusLost" }
|
|
||||||
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
-- Set lualine as statusline
|
|
||||||
'nvim-lualine/lualine.nvim',
|
|
||||||
-- See `:help lualine.txt`
|
|
||||||
opts = {
|
|
||||||
options = {
|
|
||||||
icons_enabled = false,
|
|
||||||
theme = 'auto',
|
|
||||||
component_separators = '|',
|
|
||||||
section_separators = '',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
-- Add indentation guides even on blank lines
|
|
||||||
'lukas-reineke/indent-blankline.nvim',
|
|
||||||
-- Enable `lukas-reineke/indent-blankline.nvim`
|
|
||||||
-- See `:help ibl`
|
|
||||||
main = 'ibl',
|
|
||||||
opts = {},
|
|
||||||
},
|
|
||||||
|
|
||||||
-- "gc" to comment visual regions/lines
|
|
||||||
{ 'numToStr/Comment.nvim', opts = {} },
|
|
||||||
|
|
||||||
-- Fuzzy Finder (files, lsp, etc)
|
|
||||||
{
|
|
||||||
'nvim-telescope/telescope.nvim',
|
|
||||||
branch = '0.1.x',
|
|
||||||
dependencies = {
|
|
||||||
'nvim-lua/plenary.nvim',
|
|
||||||
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
|
|
||||||
-- Only load if `make` is available. Make sure you have the system
|
|
||||||
-- requirements installed.
|
|
||||||
{
|
|
||||||
'nvim-telescope/telescope-fzf-native.nvim',
|
|
||||||
-- NOTE: If you are having trouble with this installation,
|
|
||||||
-- refer to the README for telescope-fzf-native for more instructions.
|
|
||||||
build = 'make',
|
|
||||||
cond = function()
|
|
||||||
return vim.fn.executable 'make' == 1
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
-- Highlight, edit, and navigate code
|
|
||||||
'nvim-treesitter/nvim-treesitter',
|
|
||||||
dependencies = {
|
|
||||||
'nvim-treesitter/nvim-treesitter-textobjects',
|
|
||||||
},
|
|
||||||
build = ':TSUpdate',
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
"danymat/neogen",
|
|
||||||
dependencies = "nvim-treesitter/nvim-treesitter",
|
|
||||||
config = true,
|
|
||||||
-- Comment next line if you want to follow unstable versions
|
|
||||||
version = "*"
|
|
||||||
},
|
|
||||||
|
|
||||||
-- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart
|
|
||||||
-- These are some example plugins that I've included in the kickstart repository.
|
|
||||||
-- Uncomment any of the lines below to enable them.
|
|
||||||
require 'kickstart.plugins.autoformat',
|
|
||||||
require 'kickstart.plugins.debug',
|
|
||||||
|
|
||||||
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
|
|
||||||
-- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping
|
|
||||||
-- up-to-date with whatever is in the kickstart repo.
|
|
||||||
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
|
|
||||||
--
|
|
||||||
-- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins
|
|
||||||
-- { import = 'custom.plugins' },
|
|
||||||
}, {})
|
|
||||||
|
|
||||||
-- [[ Setting options ]]
|
|
||||||
-- See `:help vim.o`
|
|
||||||
-- NOTE: You can change these options as you wish!
|
|
||||||
|
|
||||||
-- Set highlight on search
|
|
||||||
vim.o.hlsearch = false
|
|
||||||
|
|
||||||
-- Make line numbers default
|
|
||||||
vim.wo.number = true
|
|
||||||
|
|
||||||
-- Enable mouse mode
|
|
||||||
vim.o.mouse = 'a'
|
|
||||||
|
|
||||||
-- Sync clipboard between OS and Neovim.
|
|
||||||
-- Remove this option if you want your OS clipboard to remain independent.
|
|
||||||
-- See `:help 'clipboard'`
|
|
||||||
vim.o.clipboard = 'unnamedplus'
|
|
||||||
|
|
||||||
-- Enable break indent
|
|
||||||
vim.o.breakindent = true
|
|
||||||
|
|
||||||
-- Save undo history
|
|
||||||
vim.o.undofile = true
|
|
||||||
|
|
||||||
-- Case-insensitive searching UNLESS \C or capital in search
|
|
||||||
vim.o.ignorecase = true
|
|
||||||
vim.o.smartcase = true
|
|
||||||
|
|
||||||
-- Keep signcolumn on by default
|
|
||||||
vim.wo.signcolumn = 'yes'
|
|
||||||
|
|
||||||
-- Decrease update time
|
|
||||||
vim.o.updatetime = 250
|
|
||||||
vim.o.timeoutlen = 300
|
|
||||||
|
|
||||||
-- Set completeopt to have a better completion experience
|
|
||||||
vim.o.completeopt = 'menuone,noselect,preview'
|
|
||||||
|
|
||||||
-- NOTE: You should make sure your terminal supports this
|
|
||||||
vim.o.termguicolors = true
|
|
||||||
|
|
||||||
-- Create new window below instead of above
|
|
||||||
vim.o.splitbelow = true
|
|
||||||
|
|
||||||
-- Setup the spell checker
|
|
||||||
vim.opt.spelllang = 'en_us'
|
|
||||||
vim.opt.spell = true
|
|
||||||
|
|
||||||
|
|
||||||
-- [[ Basic Keymaps ]]
|
|
||||||
|
|
||||||
-- Keymaps for better default experience
|
|
||||||
-- See `:help vim.keymap.set()`
|
|
||||||
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
|
|
||||||
|
|
||||||
-- Center the cursor when going up or down
|
|
||||||
vim.api.nvim_set_keymap('n', '<C-u>', '<C-u>zz', { noremap = true, silent = true })
|
|
||||||
vim.api.nvim_set_keymap('n', '<C-d>', '<C-d>zz', { noremap = true, silent = true })
|
|
||||||
vim.api.nvim_set_keymap('n', 'n', 'nzzzv', { noremap = true, silent = true })
|
|
||||||
vim.api.nvim_set_keymap('n', 'N', 'Nzzzv', { noremap = true, silent = true })
|
|
||||||
|
|
||||||
-- Toggle between absolute and relative line numbers
|
|
||||||
vim.keymap.set('n', '<leader>tl', ":set number! relativenumber!<cr>", { desc = "[T]oggle [L]ine numbers display" })
|
|
||||||
-- Remap for dealing with word wrap
|
|
||||||
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
|
||||||
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
|
||||||
|
|
||||||
-- Diagnostic keymaps
|
|
||||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' })
|
|
||||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' })
|
|
||||||
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' })
|
|
||||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' })
|
|
||||||
|
|
||||||
-- [[ Highlight on yank ]]
|
|
||||||
-- See `:help vim.highlight.on_yank()`
|
|
||||||
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
|
|
||||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||||
|
desc = 'Highlight when yanking (copying) text',
|
||||||
|
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.highlight.on_yank()
|
vim.highlight.on_yank()
|
||||||
end,
|
end,
|
||||||
group = highlight_group,
|
|
||||||
pattern = '*',
|
pattern = '*',
|
||||||
})
|
})
|
||||||
|
|
||||||
-- [[ Configure Telescope ]]
|
-- [[ Install `lazy.nvim` plugin manager ]]
|
||||||
-- See `:help telescope` and `:help telescope.setup()`
|
-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
|
||||||
require('telescope').setup {
|
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
||||||
pickers = { find_files = { hidden = true } },
|
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||||
defaults = {
|
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
|
||||||
mappings = {
|
local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
|
||||||
i = {
|
|
||||||
['<C-u>'] = false,
|
|
||||||
['<C-d>'] = false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Enable telescope fzf native, if installed
|
|
||||||
pcall(require('telescope').load_extension, 'fzf')
|
|
||||||
|
|
||||||
-- Telescope live_grep in git root
|
|
||||||
-- Function to find the git root directory based on the current buffer's path
|
|
||||||
local function find_git_root()
|
|
||||||
-- Use the current buffer's path as the starting point for the git search
|
|
||||||
local current_file = vim.api.nvim_buf_get_name(0)
|
|
||||||
local current_dir
|
|
||||||
local cwd = vim.fn.getcwd()
|
|
||||||
-- If the buffer is not associated with a file, return nil
|
|
||||||
if current_file == '' then
|
|
||||||
current_dir = cwd
|
|
||||||
else
|
|
||||||
-- Extract the directory from the current file's path
|
|
||||||
current_dir = vim.fn.fnamemodify(current_file, ':h')
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Find the Git root directory from the current file's path
|
|
||||||
local git_root = vim.fn.systemlist('git -C ' .. vim.fn.escape(current_dir, ' ') .. ' rev-parse --show-toplevel')[1]
|
|
||||||
if vim.v.shell_error ~= 0 then
|
if vim.v.shell_error ~= 0 then
|
||||||
print 'Not a git repository. Searching on current working directory'
|
error('Error cloning lazy.nvim:\n' .. out)
|
||||||
return cwd
|
|
||||||
end
|
|
||||||
return git_root
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Custom live_grep function to search in git root
|
|
||||||
local function live_grep_git_root()
|
|
||||||
local git_root = find_git_root()
|
|
||||||
if git_root then
|
|
||||||
require('telescope.builtin').live_grep {
|
|
||||||
search_dirs = { git_root },
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
vim.api.nvim_create_user_command('LiveGrepGitRoot', live_grep_git_root, {})
|
-- [[ Configure and install plugins ]]
|
||||||
|
|
||||||
-- See `:help telescope.builtin`
|
|
||||||
vim.keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' })
|
|
||||||
vim.keymap.set('n', '<leader><space>', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' })
|
|
||||||
vim.keymap.set('n', '<leader>/', function()
|
|
||||||
-- You can pass additional configuration to telescope to change theme, layout, etc.
|
|
||||||
require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
|
||||||
winblend = 10,
|
|
||||||
previewer = false,
|
|
||||||
})
|
|
||||||
end, { desc = '[/] Fuzzily search in current buffer' })
|
|
||||||
|
|
||||||
local function telescope_live_grep_open_files()
|
|
||||||
require('telescope.builtin').live_grep {
|
|
||||||
grep_open_files = true,
|
|
||||||
prompt_title = 'Live Grep in Open Files',
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.keymap.set('n', '<leader>s/', telescope_live_grep_open_files, { desc = '[S]earch [/] in Open Files' })
|
|
||||||
vim.keymap.set('n', '<leader>ss', require('telescope.builtin').builtin, { desc = '[S]earch [S]elect Telescope' })
|
|
||||||
vim.keymap.set('n', '<leader>gf', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' })
|
|
||||||
vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' })
|
|
||||||
vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' })
|
|
||||||
vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
|
|
||||||
vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
|
|
||||||
vim.keymap.set('n', '<leader>sG', ':LiveGrepGitRoot<cr>', { desc = '[S]earch by [G]rep on Git Root' })
|
|
||||||
vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
|
|
||||||
vim.keymap.set('n', '<leader>sr', require('telescope.builtin').resume, { desc = '[S]earch [R]esume' })
|
|
||||||
|
|
||||||
-- [[ Configure Treesitter ]]
|
|
||||||
-- See `:help nvim-treesitter`
|
|
||||||
-- Defer Treesitter setup after first render to improve startup time of 'nvim {filename}'
|
|
||||||
vim.defer_fn(function()
|
|
||||||
require('nvim-treesitter.configs').setup {
|
|
||||||
-- Add languages to be installed here that you want installed for treesitter
|
|
||||||
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim',
|
|
||||||
'bash' },
|
|
||||||
|
|
||||||
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
|
|
||||||
auto_install = false,
|
|
||||||
-- Install languages synchronously (only applied to `ensure_installed`)
|
|
||||||
sync_install = false,
|
|
||||||
-- List of parsers to ignore installing
|
|
||||||
ignore_install = {},
|
|
||||||
-- You can specify additional Treesitter modules here: -- For example: -- playground = {--enable = true,-- },
|
|
||||||
modules = {},
|
|
||||||
highlight = { enable = true },
|
|
||||||
indent = { enable = true },
|
|
||||||
incremental_selection = {
|
|
||||||
enable = true,
|
|
||||||
keymaps = {
|
|
||||||
init_selection = '<c-space>',
|
|
||||||
node_incremental = '<c-space>',
|
|
||||||
scope_incremental = '<c-s>',
|
|
||||||
node_decremental = '<M-space>',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
textobjects = {
|
|
||||||
select = {
|
|
||||||
enable = true,
|
|
||||||
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
|
|
||||||
keymaps = {
|
|
||||||
-- You can use the capture groups defined in textobjects.scm
|
|
||||||
['aa'] = '@parameter.outer',
|
|
||||||
['ia'] = '@parameter.inner',
|
|
||||||
['af'] = '@function.outer',
|
|
||||||
['if'] = '@function.inner',
|
|
||||||
['ac'] = '@class.outer',
|
|
||||||
['ic'] = '@class.inner',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
move = {
|
|
||||||
enable = true,
|
|
||||||
set_jumps = true, -- whether to set jumps in the jumplist
|
|
||||||
goto_next_start = {
|
|
||||||
[']m'] = '@function.outer',
|
|
||||||
[']]'] = '@class.outer',
|
|
||||||
},
|
|
||||||
goto_next_end = {
|
|
||||||
[']M'] = '@function.outer',
|
|
||||||
[']['] = '@class.outer',
|
|
||||||
},
|
|
||||||
goto_previous_start = {
|
|
||||||
['[m'] = '@function.outer',
|
|
||||||
['[['] = '@class.outer',
|
|
||||||
},
|
|
||||||
goto_previous_end = {
|
|
||||||
['[M'] = '@function.outer',
|
|
||||||
['[]'] = '@class.outer',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
swap = {
|
|
||||||
enable = true,
|
|
||||||
swap_next = {
|
|
||||||
['<leader>a'] = '@parameter.inner',
|
|
||||||
},
|
|
||||||
swap_previous = {
|
|
||||||
['<leader>A'] = '@parameter.inner',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
end, 0)
|
|
||||||
|
|
||||||
-- [[ Configure LSP ]]
|
|
||||||
-- This function gets run when an LSP connects to a particular buffer.
|
|
||||||
local on_attach = function(_, bufnr)
|
|
||||||
-- NOTE: Remember that lua is a real programming language, and as such it is possible
|
|
||||||
-- to define small helper and utility functions so you don't have to repeat yourself
|
|
||||||
-- many times.
|
|
||||||
--
|
|
||||||
-- In this case, we create a function that lets us more easily define mappings specific
|
|
||||||
-- for LSP related items. It sets the mode, buffer and description for us each time.
|
|
||||||
local nmap = function(keys, func, desc)
|
|
||||||
if desc then
|
|
||||||
desc = 'LSP: ' .. desc
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc })
|
|
||||||
end
|
|
||||||
|
|
||||||
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
|
|
||||||
nmap('<leader>ca', function()
|
|
||||||
vim.lsp.buf.code_action { context = { only = { 'quickfix', 'refactor', 'source' } } }
|
|
||||||
end, '[C]ode [A]ction')
|
|
||||||
|
|
||||||
nmap('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
|
|
||||||
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
|
||||||
nmap('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
|
|
||||||
nmap('<leader>D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition')
|
|
||||||
nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
|
|
||||||
nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
|
||||||
|
|
||||||
-- See `:help K` for why this keymap
|
|
||||||
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
|
|
||||||
nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
|
|
||||||
|
|
||||||
-- Lesser used LSP functionality
|
|
||||||
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
|
||||||
nmap('<leader>wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder')
|
|
||||||
nmap('<leader>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
|
|
||||||
nmap('<leader>wl', function()
|
|
||||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
|
||||||
end, '[W]orkspace [L]ist Folders')
|
|
||||||
|
|
||||||
-- Create a command `:Format` local to the LSP buffer
|
|
||||||
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
|
|
||||||
vim.lsp.buf.format()
|
|
||||||
end, { desc = 'Format current buffer with LSP' })
|
|
||||||
nmap('<leader>cf', vim.lsp.buf.format, '[C]ode [F]ormat')
|
|
||||||
end
|
|
||||||
|
|
||||||
-- document existing key chains
|
|
||||||
require('which-key').register {
|
|
||||||
['<leader>c'] = { name = '[C]ode', _ = 'which_key_ignore' },
|
|
||||||
['<leader>d'] = { name = '[D]ocument', _ = 'which_key_ignore' },
|
|
||||||
['<leader>g'] = { name = '[G]it', _ = 'which_key_ignore' },
|
|
||||||
['<leader>h'] = { name = 'Git [H]unk', _ = 'which_key_ignore' },
|
|
||||||
['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
|
|
||||||
['<leader>s'] = { name = '[S]earch', _ = 'which_key_ignore' },
|
|
||||||
['<leader>t'] = { name = '[T]oggle', _ = 'which_key_ignore' },
|
|
||||||
['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
|
|
||||||
}
|
|
||||||
-- register which-key VISUAL mode
|
|
||||||
-- required for visual <leader>hs (hunk stage) to work
|
|
||||||
require('which-key').register({
|
|
||||||
['<leader>'] = { name = 'VISUAL <leader>' },
|
|
||||||
['<leader>h'] = { 'Git [H]unk' },
|
|
||||||
}, { mode = 'v' })
|
|
||||||
|
|
||||||
-- mason-lspconfig requires that these setup functions are called in this order
|
|
||||||
-- before setting up the servers.
|
|
||||||
require('mason').setup()
|
|
||||||
require('mason-lspconfig').setup()
|
|
||||||
|
|
||||||
-- Enable the following language servers
|
|
||||||
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
|
|
||||||
--
|
--
|
||||||
-- Add any additional override configuration in the following tables. They will be passed to
|
-- To check the current status of your plugins, run
|
||||||
-- the `settings` field of the server config. You must look up that documentation yourself.
|
-- :Lazy
|
||||||
--
|
--
|
||||||
-- If you want to override the default filetypes that your language server will attach to you can
|
-- To update plugins you can run
|
||||||
-- define the property 'filetypes' to the map in question.
|
-- :Lazy update
|
||||||
local servers = {
|
--
|
||||||
-- clangd = {},
|
require('lazy').setup({
|
||||||
-- gopls = {},
|
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
|
||||||
ruff_lsp = {},
|
|
||||||
rust_analyzer = {},
|
|
||||||
-- tsserver = {},
|
|
||||||
-- html = { filetypes = { 'html', 'twig', 'hbs'} },
|
|
||||||
|
|
||||||
lua_ls = {
|
-- Highlight todo, notes, etc in comments
|
||||||
Lua = {
|
{ 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } },
|
||||||
workspace = { checkThirdParty = false },
|
|
||||||
telemetry = { enable = false },
|
{ import = 'kickstart.plugins' },
|
||||||
-- NOTE: toggle below to ignore Lua_LS's noisy `missing-fields` warnings
|
{ import = 'custom.plugins' },
|
||||||
-- diagnostics = { disable = { 'missing-fields' } },
|
}, {
|
||||||
|
ui = {
|
||||||
|
-- If you are using a Nerd Font: set icons to an empty table which will use the
|
||||||
|
-- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table
|
||||||
|
icons = vim.g.have_nerd_font and {} or {
|
||||||
|
cmd = '⌘',
|
||||||
|
config = '🛠',
|
||||||
|
event = '📅',
|
||||||
|
ft = '📂',
|
||||||
|
init = '⚙',
|
||||||
|
keys = '🗝',
|
||||||
|
plugin = '🔌',
|
||||||
|
runtime = '💻',
|
||||||
|
require = '🌙',
|
||||||
|
source = '📄',
|
||||||
|
start = '🚀',
|
||||||
|
task = '📌',
|
||||||
|
lazy = '💤 ',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
|
||||||
|
|
||||||
-- Setup neovim lua configuration
|
|
||||||
require('neodev').setup()
|
|
||||||
|
|
||||||
-- nvim-cmp supports additional completion capabilities, so broadcast that to servers
|
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
|
||||||
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
|
|
||||||
|
|
||||||
-- Ensure the servers above are installed
|
|
||||||
local mason_lspconfig = require 'mason-lspconfig'
|
|
||||||
|
|
||||||
mason_lspconfig.setup {
|
|
||||||
ensure_installed = vim.tbl_keys(servers),
|
|
||||||
}
|
|
||||||
|
|
||||||
mason_lspconfig.setup_handlers {
|
|
||||||
function(server_name)
|
|
||||||
require('lspconfig')[server_name].setup {
|
|
||||||
capabilities = capabilities,
|
|
||||||
on_attach = on_attach,
|
|
||||||
settings = servers[server_name],
|
|
||||||
filetypes = (servers[server_name] or {}).filetypes,
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
||||||
-- setup nvim tree
|
|
||||||
require("nvim-tree").setup()
|
|
||||||
|
|
||||||
|
|
||||||
-- setup docstring generation
|
|
||||||
require('neogen').setup({
|
|
||||||
enabled = true,
|
|
||||||
snippet_engine = 'luasnip',
|
|
||||||
languages = {
|
|
||||||
python = {
|
|
||||||
template = { annotation_convention = 'numpydoc' },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
local neomap = function(keys, func, desc)
|
|
||||||
if desc then
|
|
||||||
desc = 'DOC: [N]eogen ' .. desc
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.keymap.set('n', keys, func, { noremap = true, silent = true, desc = desc })
|
|
||||||
end
|
|
||||||
|
|
||||||
neomap("<leader>nf", ":lua require('neogen').generate()<CR>", "[f]unction")
|
|
||||||
neomap("<leader>nF", ":lua require('neogen').generate({type='file'})<CR>", "[F]ile")
|
|
||||||
neomap("<leader>nc", ":lua require('neogen').generate({type='class'})<CR>", "[c]lass")
|
|
||||||
neomap("<leader>nt", ":lua require('neogen').generate({type='type'})<CR>", "[t]ype")
|
|
||||||
|
|
||||||
-- [[ Configure nvim-cmp ]]
|
|
||||||
-- See `:help cmp`
|
|
||||||
local cmp = require 'cmp'
|
|
||||||
local luasnip = require 'luasnip'
|
|
||||||
local lspkind = require 'lspkind'
|
|
||||||
require('luasnip.loaders.from_vscode').lazy_load()
|
|
||||||
luasnip.config.setup {}
|
|
||||||
|
|
||||||
cmp.setup {
|
|
||||||
snippet = {
|
|
||||||
expand = function(args)
|
|
||||||
luasnip.lsp_expand(args.body)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
completion = {
|
|
||||||
completeopt = 'menuone,noinsert,preview',
|
|
||||||
},
|
|
||||||
mapping = cmp.mapping.preset.insert {
|
|
||||||
['<C-n>'] = cmp.mapping.select_next_item(),
|
|
||||||
['<C-p>'] = cmp.mapping.select_prev_item(),
|
|
||||||
['<C-e>'] = cmp.mapping.close(),
|
|
||||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
|
||||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
|
||||||
['<C-Space>'] = cmp.mapping.complete {},
|
|
||||||
['<C-y>'] = cmp.mapping.confirm {
|
|
||||||
behavior = cmp.ConfirmBehavior.Insert,
|
|
||||||
select = true,
|
|
||||||
},
|
|
||||||
['<Tab>'] = cmp.mapping(function(fallback)
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_next_item()
|
|
||||||
elseif luasnip.expand_or_locally_jumpable() then
|
|
||||||
luasnip.expand_or_jump()
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end, { 'i', 's' }),
|
|
||||||
['<S-Tab>'] = cmp.mapping(function(fallback)
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_prev_item()
|
|
||||||
elseif luasnip.locally_jumpable(-1) then
|
|
||||||
luasnip.jump(-1)
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end, { 'i', 's' }),
|
|
||||||
},
|
|
||||||
sources = {
|
|
||||||
{ name = 'nvim_lsp' },
|
|
||||||
{ name = 'luasnip' },
|
|
||||||
{ name = 'path' },
|
|
||||||
{ name = 'buffer', keyword_length = 5, max_item_count = 5 },
|
|
||||||
},
|
|
||||||
formatting = {
|
|
||||||
format = lspkind.cmp_format {
|
|
||||||
with_text = true,
|
|
||||||
menu = { buffer = "[buf]", nvim_lsp = "[LSP]", nvim_lua = "[api]", path = "[path]", luasnip = "[snip]" },
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
vim.cmd.colorscheme "rose-pine"
|
|
||||||
-- 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
|
||||||
|
|
|
@ -1,40 +1,44 @@
|
||||||
{
|
{
|
||||||
"Comment.nvim": { "branch": "master", "commit": "e51f2b142d88bb666dcaa77d93a07f4b419aca70" },
|
"LuaSnip": { "branch": "master", "commit": "e808bee352d1a6fcf902ca1a71cee76e60e24071" },
|
||||||
"LuaSnip": { "branch": "master", "commit": "1f4ad8bb72bdeb60975e98652636b991a9b7475d" },
|
|
||||||
"auto-save.nvim": { "branch": "main", "commit": "979b6c82f60cfa80f4cf437d77446d0ded0addf0" },
|
|
||||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||||
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
|
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
|
||||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||||
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
|
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
|
||||||
"fidget.nvim": { "branch": "main", "commit": "785efc604f6ffe3c3fdd2ea86262804d48863ee1" },
|
"conform.nvim": { "branch": "master", "commit": "1a99fdc1d3aa9ccdf3021e67982a679a8c5c740c" },
|
||||||
"friendly-snippets": { "branch": "main", "commit": "43727c2ff84240e55d4069ec3e6158d74cb534b6" },
|
"fidget.nvim": { "branch": "main", "commit": "d855eed8a06531a7e8fd0684889b2943f373c469" },
|
||||||
"gitsigns.nvim": { "branch": "main", "commit": "bb808fc7376ed7bac0fbe8f47b83d4bf01738167" },
|
"friendly-snippets": { "branch": "main", "commit": "00ba9dd3df89509f95437b8d595553707c46d5ea" },
|
||||||
"indent-blankline.nvim": { "branch": "master", "commit": "29be0919b91fb59eca9e90690d76014233392bef" },
|
"gitsigns.nvim": { "branch": "main", "commit": "863903631e676b33e8be2acb17512fdc1b80b4fb" },
|
||||||
"lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" },
|
"indent-blankline.nvim": { "branch": "master", "commit": "18603eb949eba08300799f64027af11ef922283f" },
|
||||||
"lspkind-nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" },
|
"lazy.nvim": { "branch": "main", "commit": "460e1cd8f24e364d54543a4b0e83f6f4ec1f65fb" },
|
||||||
"lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" },
|
"lazydev.nvim": { "branch": "main", "commit": "491452cf1ca6f029e90ad0d0368848fac717c6d2" },
|
||||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "3d9e06ca604185ea5675d3c2ffd4284e0c2c7ffc" },
|
"lspkind-nvim": { "branch": "master", "commit": "59c3f419af48a2ffb2320cea85e44e5a95f71664" },
|
||||||
"mason-null-ls.nvim": { "branch": "main", "commit": "ae0c5fa57468ac65617f1bf821ba0c3a1e251f0c" },
|
"luarocks.nvim": { "branch": "main", "commit": "1db9093915eb16ba2473cfb8d343ace5ee04130a" },
|
||||||
"mason-nvim-dap.nvim": { "branch": "main", "commit": "5b4db7c0d6873436b42bcda0ba7cd4efa9206745" },
|
"luvit-meta": { "branch": "main", "commit": "ce76f6f6cdc9201523a5875a4471dcfe0186eb60" },
|
||||||
"mason.nvim": { "branch": "main", "commit": "41e75af1f578e55ba050c863587cffde3556ffa6" },
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "25c11854aa25558ee6c03432edfa0df0217324be" },
|
||||||
"neodev.nvim": { "branch": "main", "commit": "da1562e1e3df0e994ddc52cb4ba22376a5d7f2fc" },
|
"mason-nvim-dap.nvim": { "branch": "main", "commit": "8b9363d83b5d779813cdd2819b8308651cec2a09" },
|
||||||
"neogen": { "branch": "main", "commit": "cb1f384df804c1bf729332c4f728253fe17962d4" },
|
"mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" },
|
||||||
"none-ls.nvim": { "branch": "main", "commit": "2d4d4f765da684c92cca714bfd7a395ff6b08333" },
|
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
|
||||||
"nvim-cmp": { "branch": "main", "commit": "0b751f6beef40fd47375eaf53d3057e0bfa317e4" },
|
"mini.nvim": { "branch": "main", "commit": "73af55e44865f2ede67a772b0972a5d34dcedd0e" },
|
||||||
"nvim-dap": { "branch": "master", "commit": "debd7c2f80eaf20c5f5df25db8d8c1b9b18f4421" },
|
"neo-tree.nvim": { "branch": "main", "commit": "a77af2e764c5ed4038d27d1c463fa49cd4794e07" },
|
||||||
"nvim-dap-python": { "branch": "master", "commit": "66560f0ebddf96604f7037e1efad3ba6942761e6" },
|
"nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" },
|
||||||
"nvim-dap-ui": { "branch": "master", "commit": "34160a7ce6072ef332f350ae1d4a6a501daf0159" },
|
"null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" },
|
||||||
"nvim-lspconfig": { "branch": "master", "commit": "553c4e0e667167640c5398573f6f3a488ff8047a" },
|
"nvim-autopairs": { "branch": "master", "commit": "f158dcb865c36f72c92358f87787dab2c272eaf3" },
|
||||||
"nvim-tree.lua": { "branch": "master", "commit": "d35a8d5ec6358ada4b058431b367b32360737466" },
|
"nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" },
|
||||||
"nvim-treesitter": { "branch": "master", "commit": "2a5f6c9eb733a5a847bb1890f620658547033515" },
|
"nvim-dap": { "branch": "master", "commit": "90616ae6ae40053103dc66872886fc26b94c70c8" },
|
||||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "dbcd9388e3b119a87c785e10a00d62876077d23d" },
|
"nvim-dap-python": { "branch": "master", "commit": "db72bf6ab9f75fe841e8e11e772ee7fef6f484f1" },
|
||||||
"nvim-web-devicons": { "branch": "master", "commit": "cdbcca210cf3655aa9b31ebf2422763ecd85ee5c" },
|
"nvim-dap-ui": { "branch": "master", "commit": "1c351e4e417d4691da12948b6ecf966936a56d28" },
|
||||||
"plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" },
|
"nvim-lint": { "branch": "master", "commit": "968a35d54b3a4c1ce66609cf80b14d4ae44fe77f" },
|
||||||
"rose-pine": { "branch": "main", "commit": "c52167563e6aa44b5fa6fe007faa2bcac71050f0" },
|
"nvim-lspconfig": { "branch": "master", "commit": "a9bc587e9ae0cbcb3e90a2e9342f86b3b78c4408" },
|
||||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" },
|
"nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" },
|
||||||
"telescope.nvim": { "branch": "0.1.x", "commit": "7011eaae0ac1afe036e30c95cf80200b8dc3f21a" },
|
"nvim-treesitter": { "branch": "master", "commit": "f027762845fa35ff27fe0487c86537a74a480a0c" },
|
||||||
"vim-fugitive": { "branch": "master", "commit": "46eaf8918b347906789df296143117774e827616" },
|
"nvim-web-devicons": { "branch": "master", "commit": "26220156aafb198b2de6a4cf80c1b120a3768da0" },
|
||||||
"vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" },
|
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
|
||||||
"vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" },
|
"rose-pine": { "branch": "main", "commit": "8b1fd252255a7f2c41b4192a787ab62660b29f72" },
|
||||||
"which-key.nvim": { "branch": "main", "commit": "ce741eb559c924d72e3a67d2189ad3771a231414" }
|
"telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" },
|
||||||
|
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
|
||||||
|
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
|
||||||
|
"todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" },
|
||||||
|
"vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" },
|
||||||
|
"vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" },
|
||||||
|
"which-key.nvim": { "branch": "main", "commit": "fb070344402cfc662299d9914f5546d840a22126" }
|
||||||
}
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
-- [[ Basic Keymaps ]]
|
||||||
|
-- See `:help vim.keymap.set()`
|
||||||
|
|
||||||
|
-- Clear highlights on search when pressing <Esc> in normal mode
|
||||||
|
-- See `:help hlsearch`
|
||||||
|
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
||||||
|
|
||||||
|
-- Diagnostic keymaps
|
||||||
|
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
|
||||||
|
|
||||||
|
-- Exit terminal mode in the builtin terminal
|
||||||
|
-- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping
|
||||||
|
-- or just use <C-\><C-n> to exit terminal mode
|
||||||
|
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
|
||||||
|
|
||||||
|
-- Disable arrow keys in normal mode
|
||||||
|
vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
|
||||||
|
vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
|
||||||
|
vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
|
||||||
|
vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
|
||||||
|
|
||||||
|
-- Keybinds to make split navigation easier.
|
||||||
|
-- Use CTRL+<hjkl> to switch between windows
|
||||||
|
--
|
||||||
|
-- See `:help wincmd` for a list of all window commands
|
||||||
|
vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' })
|
||||||
|
vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' })
|
||||||
|
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
|
||||||
|
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
|
|
@ -0,0 +1,70 @@
|
||||||
|
-- [[ Setting options ]]
|
||||||
|
-- See `:help vim.opt`
|
||||||
|
-- For more options, you can see `:help option-list`
|
||||||
|
|
||||||
|
-- Set <space> as the leader key
|
||||||
|
-- See `:help mapleader`
|
||||||
|
vim.g.mapleader = ' '
|
||||||
|
vim.g.maplocalleader = ' '
|
||||||
|
|
||||||
|
vim.g.loaded_netrw = 1
|
||||||
|
vim.g.loaded_netrwPlugin = 1
|
||||||
|
|
||||||
|
-- Set to true if you have a Nerd Font installed and selected in the terminal
|
||||||
|
vim.g.have_nerd_font = true
|
||||||
|
-- Make line numbers default
|
||||||
|
-- vim.opt.number = true -- Make line number default
|
||||||
|
vim.opt.relativenumber = true -- Make relative line number default
|
||||||
|
|
||||||
|
-- Enable mouse mode, can be useful for resizing splits for example!
|
||||||
|
vim.opt.mouse = 'a'
|
||||||
|
|
||||||
|
-- Don't show the mode, since it's already in the status line
|
||||||
|
vim.opt.showmode = false
|
||||||
|
|
||||||
|
-- Sync clipboard between OS and Neovim.
|
||||||
|
-- Schedule the setting after `UiEnter` because it can increase startup-time.
|
||||||
|
-- Remove this option if you want your OS clipboard to remain independent.
|
||||||
|
-- See `:help 'clipboard'`
|
||||||
|
vim.schedule(function()
|
||||||
|
vim.opt.clipboard = 'unnamedplus'
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- Enable break indent
|
||||||
|
vim.opt.breakindent = true
|
||||||
|
|
||||||
|
-- Save undo history
|
||||||
|
vim.opt.undofile = true
|
||||||
|
|
||||||
|
-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
|
||||||
|
vim.opt.ignorecase = true
|
||||||
|
vim.opt.smartcase = true
|
||||||
|
|
||||||
|
-- Keep signcolumn on by default
|
||||||
|
vim.opt.signcolumn = 'yes'
|
||||||
|
|
||||||
|
-- Decrease update time
|
||||||
|
vim.opt.updatetime = 250
|
||||||
|
|
||||||
|
-- Decrease mapped sequence wait time
|
||||||
|
-- Displays which-key popup sooner
|
||||||
|
vim.opt.timeoutlen = 300
|
||||||
|
|
||||||
|
-- Configure how new splits should be opened
|
||||||
|
vim.opt.splitright = true
|
||||||
|
vim.opt.splitbelow = true
|
||||||
|
|
||||||
|
-- Sets how neovim will display certain whitespace characters in the editor.
|
||||||
|
-- See `:help 'list'`
|
||||||
|
-- and `:help 'listchars'`
|
||||||
|
vim.opt.list = true
|
||||||
|
vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' }
|
||||||
|
|
||||||
|
-- Preview substitutions live, as you type!
|
||||||
|
vim.opt.inccommand = 'split'
|
||||||
|
|
||||||
|
-- Show which line your cursor is on
|
||||||
|
vim.opt.cursorline = true
|
||||||
|
|
||||||
|
-- Minimal number of screen lines to keep above and below the cursor.
|
||||||
|
vim.opt.scrolloff = 10
|
|
@ -0,0 +1,119 @@
|
||||||
|
-- Autocompletion
|
||||||
|
return {
|
||||||
|
'hrsh7th/nvim-cmp',
|
||||||
|
event = 'InsertEnter',
|
||||||
|
dependencies = {
|
||||||
|
-- Snippet Engine & its associated nvim-cmp source
|
||||||
|
{
|
||||||
|
'L3MON4D3/LuaSnip',
|
||||||
|
event = 'VeryLazy',
|
||||||
|
build = (function()
|
||||||
|
-- Build Step is needed for regex support in snippets.
|
||||||
|
-- This step is not supported in many windows environments.
|
||||||
|
-- Remove the below condition to re-enable on windows.
|
||||||
|
if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
return 'make install_jsregexp'
|
||||||
|
end)(),
|
||||||
|
dependencies = {
|
||||||
|
-- `friendly-snippets` contains a variety of premade snippets.
|
||||||
|
-- See the README about individual language/framework/plugin snippets:
|
||||||
|
-- https://github.com/rafamadriz/friendly-snippets
|
||||||
|
{
|
||||||
|
'rafamadriz/friendly-snippets',
|
||||||
|
config = function()
|
||||||
|
require('luasnip.loaders.from_vscode').lazy_load()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
'onsails/lspkind-nvim',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'saadparwaiz1/cmp_luasnip',
|
||||||
|
|
||||||
|
-- Adds other completaion capabilities.
|
||||||
|
-- nvim-cmp does not ship with all sources by default. They are split
|
||||||
|
-- into multiple repos for maintenance purposes.
|
||||||
|
'hrsh7th/cmp-nvim-lsp',
|
||||||
|
'hrsh7th/cmp-path',
|
||||||
|
'hrsh7th/cmp-buffer',
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
-- See `:help cmp`
|
||||||
|
local cmp = require 'cmp'
|
||||||
|
local luasnip = require 'luasnip'
|
||||||
|
luasnip.config.setup {}
|
||||||
|
|
||||||
|
cmp.setup {
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
luasnip.lsp_expand(args.body)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
completion = { completeopt = 'menu,menuone,noinsert' },
|
||||||
|
|
||||||
|
-- For an understanding of why these mappings were
|
||||||
|
-- chosen, you will need to read `:help ins-completion`
|
||||||
|
--
|
||||||
|
-- No, but seriously. Please read `:help ins-completion`, it is really good!
|
||||||
|
mapping = cmp.mapping.preset.insert {
|
||||||
|
-- Select the [n]ext item
|
||||||
|
['<C-n>'] = cmp.mapping.select_next_item(),
|
||||||
|
-- Select the [p]revious item
|
||||||
|
['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||||
|
|
||||||
|
-- Scroll the documentation window [b]ack / [f]orward
|
||||||
|
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||||
|
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||||
|
|
||||||
|
-- Accept ([y]es) the completion.
|
||||||
|
-- This will auto-import if your LSP supports it.
|
||||||
|
-- This will expand snippets if the LSP sent a snippet.
|
||||||
|
['<C-y>'] = cmp.mapping.confirm { select = true },
|
||||||
|
|
||||||
|
-- If you prefer more traditional completion keymaps,
|
||||||
|
-- you can uncomment the following lines
|
||||||
|
--['<CR>'] = cmp.mapping.confirm { select = true },
|
||||||
|
--['<Tab>'] = cmp.mapping.select_next_item(),
|
||||||
|
--['<S-Tab>'] = cmp.mapping.select_prev_item(),
|
||||||
|
|
||||||
|
-- Manually trigger a completion from nvim-cmp.
|
||||||
|
-- Generally you don't need this, because nvim-cmp will display
|
||||||
|
-- completions whenever it has completion options available.
|
||||||
|
['<C-Space>'] = cmp.mapping.complete {},
|
||||||
|
|
||||||
|
-- Think of <c-l> as moving to the right of your snippet expansion.
|
||||||
|
-- So if you have a snippet that's like:
|
||||||
|
-- function $name($args)
|
||||||
|
-- $body
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
-- <c-l> will move you to the right of each of the expansion locations.
|
||||||
|
-- <c-h> is similar, except moving you backwards.
|
||||||
|
['<C-l>'] = cmp.mapping(function()
|
||||||
|
if luasnip.expand_or_locally_jumpable() then
|
||||||
|
luasnip.expand_or_jump()
|
||||||
|
end
|
||||||
|
end, { 'i', 's' }),
|
||||||
|
['<C-h>'] = cmp.mapping(function()
|
||||||
|
if luasnip.locally_jumpable(-1) then
|
||||||
|
luasnip.jump(-1)
|
||||||
|
end
|
||||||
|
end, { 'i', 's' }),
|
||||||
|
|
||||||
|
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
|
||||||
|
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
|
||||||
|
},
|
||||||
|
sources = {
|
||||||
|
{
|
||||||
|
name = 'lazydev',
|
||||||
|
-- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
|
||||||
|
group_index = 0,
|
||||||
|
},
|
||||||
|
{ name = 'nvim_lsp' },
|
||||||
|
{ name = 'luasnip' },
|
||||||
|
{ name = 'path' },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
-- Autoformat
|
||||||
|
return {
|
||||||
|
'stevearc/conform.nvim',
|
||||||
|
event = { 'BufWritePre' },
|
||||||
|
cmd = { 'ConformInfo' },
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
'<leader>f',
|
||||||
|
function()
|
||||||
|
require('conform').format { async = true, lsp_format = 'fallback' }
|
||||||
|
end,
|
||||||
|
mode = '',
|
||||||
|
desc = '[F]ormat buffer',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
opts = {
|
||||||
|
notify_on_error = false,
|
||||||
|
format_on_save = function(bufnr)
|
||||||
|
-- Disable "format_on_save lsp_fallback" for languages that don't
|
||||||
|
-- have a well standardized coding style. You can add additional
|
||||||
|
-- languages here or re-enable it for the disabled ones.
|
||||||
|
local disable_filetypes = { c = true, cpp = true }
|
||||||
|
local lsp_format_opt
|
||||||
|
if disable_filetypes[vim.bo[bufnr].filetype] then
|
||||||
|
lsp_format_opt = 'never'
|
||||||
|
else
|
||||||
|
lsp_format_opt = 'fallback'
|
||||||
|
end
|
||||||
|
return {
|
||||||
|
timeout_ms = 500,
|
||||||
|
lsp_format = lsp_format_opt,
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
formatters_by_ft = {
|
||||||
|
lua = { 'stylua' },
|
||||||
|
-- Conform can also run multiple formatters sequentially
|
||||||
|
python = { 'ruff' },
|
||||||
|
toml = { 'taplo' },
|
||||||
|
--
|
||||||
|
-- You can use 'stop_after_first' to run the first available formatter from the list
|
||||||
|
-- javascript = { "prettierd", "prettier", stop_after_first = true },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,64 @@
|
||||||
|
-- https://github.com/RRethy/vim-illuminate
|
||||||
|
-- Neovim plugin for automatically highlighting other uses of the word under the cursor using either LSP, Tree-sitter, or regex matching.
|
||||||
|
|
||||||
|
return {
|
||||||
|
'RRethy/vim-illuminate',
|
||||||
|
config = function()
|
||||||
|
require('illuminate').configure {
|
||||||
|
-- providers: provider used to get references in the buffer, ordered by priority
|
||||||
|
providers = {
|
||||||
|
'lsp',
|
||||||
|
'treesitter',
|
||||||
|
'regex',
|
||||||
|
},
|
||||||
|
-- delay: delay in milliseconds
|
||||||
|
delay = 100,
|
||||||
|
-- filetype_overrides: filetype specific overrides.
|
||||||
|
-- The keys are strings to represent the filetype while the values are tables that
|
||||||
|
-- supports the same keys passed to .configure except for filetypes_denylist and filetypes_allowlist
|
||||||
|
filetype_overrides = {},
|
||||||
|
-- filetypes_denylist: filetypes to not illuminate, this overrides filetypes_allowlist
|
||||||
|
filetypes_denylist = {
|
||||||
|
'dirbuf',
|
||||||
|
'dirvish',
|
||||||
|
'fugitive',
|
||||||
|
},
|
||||||
|
-- filetypes_allowlist: filetypes to illuminate, this is overridden by filetypes_denylist
|
||||||
|
-- You must set filetypes_denylist = {} to override the defaults to allow filetypes_allowlist to take effect
|
||||||
|
filetypes_allowlist = {},
|
||||||
|
-- modes_denylist: modes to not illuminate, this overrides modes_allowlist
|
||||||
|
-- See `:help mode()` for possible values
|
||||||
|
modes_denylist = {},
|
||||||
|
-- modes_allowlist: modes to illuminate, this is overridden by modes_denylist
|
||||||
|
-- See `:help mode()` for possible values
|
||||||
|
modes_allowlist = {},
|
||||||
|
-- providers_regex_syntax_denylist: syntax to not illuminate, this overrides providers_regex_syntax_allowlist
|
||||||
|
-- Only applies to the 'regex' provider
|
||||||
|
-- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name')
|
||||||
|
providers_regex_syntax_denylist = {},
|
||||||
|
-- providers_regex_syntax_allowlist: syntax to illuminate, this is overridden by providers_regex_syntax_denylist
|
||||||
|
-- Only applies to the 'regex' provider
|
||||||
|
-- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name')
|
||||||
|
providers_regex_syntax_allowlist = {},
|
||||||
|
-- under_cursor: whether or not to illuminate under the cursor
|
||||||
|
under_cursor = true,
|
||||||
|
-- large_file_cutoff: number of lines at which to use large_file_config
|
||||||
|
-- The `under_cursor` option is disabled when this cutoff is hit
|
||||||
|
large_file_cutoff = nil,
|
||||||
|
-- large_file_config: config to use for large files (based on large_file_cutoff).
|
||||||
|
-- Supports the same keys passed to .configure
|
||||||
|
-- If nil, vim-illuminate will be disabled for large files.
|
||||||
|
large_file_overrides = nil,
|
||||||
|
-- min_count_to_highlight: minimum number of matches required to perform highlighting
|
||||||
|
min_count_to_highlight = 2,
|
||||||
|
-- should_enable: a callback that overrides all other settings to
|
||||||
|
-- enable/disable illumination. This will be called a lot so don't do
|
||||||
|
-- anything expensive in it.
|
||||||
|
should_enable = function(bufnr)
|
||||||
|
return true
|
||||||
|
end,
|
||||||
|
-- case_insensitive_regex: sets regex case sensitivity
|
||||||
|
case_insensitive_regex = false,
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
}
|
|
@ -1,5 +0,0 @@
|
||||||
-- You can add your own plugins here or in other files in this directory!
|
|
||||||
-- I promise not to create any merge conflicts in this directory :)
|
|
||||||
--
|
|
||||||
-- See the kickstart.nvim README for more information
|
|
||||||
return {}
|
|
|
@ -0,0 +1,272 @@
|
||||||
|
-- LSP Plugins
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
'vhyrro/luarocks.nvim',
|
||||||
|
priority = 900, -- Very high priority is required, luarocks.nvim should run as the first plugin in your config.
|
||||||
|
config = true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
-- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
|
||||||
|
-- used for completion, annotations and signatures of Neovim apis
|
||||||
|
'folke/lazydev.nvim',
|
||||||
|
ft = 'lua',
|
||||||
|
opts = {
|
||||||
|
library = {
|
||||||
|
-- Load luvit types when the `vim.uv` word is found
|
||||||
|
{ path = 'luvit-meta/library', words = { 'vim%.uv' } },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ 'Bilal2453/luvit-meta', lazy = true },
|
||||||
|
{
|
||||||
|
-- Main LSP Configuration
|
||||||
|
'neovim/nvim-lspconfig',
|
||||||
|
dependencies = {
|
||||||
|
-- Automatically install LSPs and related tools to stdpath for Neovim
|
||||||
|
{ 'williamboman/mason.nvim', config = true }, -- NOTE: Must be loaded before dependants
|
||||||
|
'williamboman/mason-lspconfig.nvim',
|
||||||
|
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
||||||
|
|
||||||
|
-- Useful status updates for LSP.
|
||||||
|
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
|
||||||
|
{ 'j-hui/fidget.nvim', opts = {} },
|
||||||
|
|
||||||
|
-- Allows extra capabilities provided by nvim-cmp
|
||||||
|
'hrsh7th/cmp-nvim-lsp',
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
-- Brief aside: **What is LSP?**
|
||||||
|
--
|
||||||
|
-- LSP is an initialism you've probably heard, but might not understand what it is.
|
||||||
|
--
|
||||||
|
-- LSP stands for Language Server Protocol. It's a protocol that helps editors
|
||||||
|
-- and language tooling communicate in a standardized fashion.
|
||||||
|
--
|
||||||
|
-- In general, you have a "server" which is some tool built to understand a particular
|
||||||
|
-- language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc.). These Language Servers
|
||||||
|
-- (sometimes called LSP servers, but that's kind of like ATM Machine) are standalone
|
||||||
|
-- processes that communicate with some "client" - in this case, Neovim!
|
||||||
|
--
|
||||||
|
-- LSP provides Neovim with features like:
|
||||||
|
-- - Go to definition
|
||||||
|
-- - Find references
|
||||||
|
-- - Autocompletion
|
||||||
|
-- - Symbol Search
|
||||||
|
-- - and more!
|
||||||
|
--
|
||||||
|
-- Thus, Language Servers are external tools that must be installed separately from
|
||||||
|
-- Neovim. This is where `mason` and related plugins come into play.
|
||||||
|
--
|
||||||
|
-- If you're wondering about lsp vs treesitter, you can check out the wonderfully
|
||||||
|
-- and elegantly composed help section, `:help lsp-vs-treesitter`
|
||||||
|
|
||||||
|
-- This function gets run when an LSP attaches to a particular buffer.
|
||||||
|
-- That is to say, every time a new file is opened that is associated with
|
||||||
|
-- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this
|
||||||
|
-- function will be executed to configure the current buffer
|
||||||
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
|
group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }),
|
||||||
|
callback = function(event)
|
||||||
|
-- NOTE: Remember that Lua is a real programming language, and as such it is possible
|
||||||
|
-- to define small helper and utility functions so you don't have to repeat yourself.
|
||||||
|
--
|
||||||
|
-- In this case, we create a function that lets us more easily define mappings specific
|
||||||
|
-- for LSP related items. It sets the mode, buffer and description for us each time.
|
||||||
|
local map = function(keys, func, desc, mode)
|
||||||
|
mode = mode or 'n'
|
||||||
|
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Jump to the definition of the word under your cursor.
|
||||||
|
-- This is where a variable was first declared, or where a function is defined, etc.
|
||||||
|
-- To jump back, press <C-t>.
|
||||||
|
map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
|
||||||
|
|
||||||
|
-- Find references for the word under your cursor.
|
||||||
|
map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
||||||
|
|
||||||
|
-- Jump to the implementation of the word under your cursor.
|
||||||
|
-- Useful when your language has ways of declaring types without an actual implementation.
|
||||||
|
map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
|
||||||
|
|
||||||
|
-- Jump to the type of the word under your cursor.
|
||||||
|
-- Useful when you're not sure what type a variable is and you want to see
|
||||||
|
-- the definition of its *type*, not where it was *defined*.
|
||||||
|
map('<leader>D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition')
|
||||||
|
|
||||||
|
-- Fuzzy find all the symbols in your current document.
|
||||||
|
-- Symbols are things like variables, functions, types, etc.
|
||||||
|
map('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
|
||||||
|
|
||||||
|
-- Fuzzy find all the symbols in your current workspace.
|
||||||
|
-- Similar to document symbols, except searches over your entire project.
|
||||||
|
map('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
||||||
|
|
||||||
|
-- Rename the variable under your cursor.
|
||||||
|
-- Most Language Servers support renaming across files, etc.
|
||||||
|
map('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
|
||||||
|
|
||||||
|
-- Execute a code action, usually your cursor needs to be on top of an error
|
||||||
|
-- or a suggestion from your LSP for this to activate.
|
||||||
|
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' })
|
||||||
|
|
||||||
|
-- WARN: This is not Goto Definition, this is Goto Declaration.
|
||||||
|
-- For example, in C this would take you to the header.
|
||||||
|
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
||||||
|
|
||||||
|
-- The following two autocommands are used to highlight references of the
|
||||||
|
-- word under your cursor when your cursor rests there for a little while.
|
||||||
|
-- See `:help CursorHold` for information about when this is executed
|
||||||
|
--
|
||||||
|
-- When you move your cursor, the highlights will be cleared (the second autocommand).
|
||||||
|
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
||||||
|
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then
|
||||||
|
local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false })
|
||||||
|
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
|
||||||
|
buffer = event.buf,
|
||||||
|
group = highlight_augroup,
|
||||||
|
callback = vim.lsp.buf.document_highlight,
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
|
||||||
|
buffer = event.buf,
|
||||||
|
group = highlight_augroup,
|
||||||
|
callback = vim.lsp.buf.clear_references,
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd('LspDetach', {
|
||||||
|
group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }),
|
||||||
|
callback = function(event2)
|
||||||
|
vim.lsp.buf.clear_references()
|
||||||
|
vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf }
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- The following code creates a keymap to toggle inlay hints in your
|
||||||
|
-- code, if the language server you are using supports them
|
||||||
|
--
|
||||||
|
-- This may be unwanted, since they displace some of your code
|
||||||
|
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then
|
||||||
|
map('<leader>th', function()
|
||||||
|
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
|
||||||
|
end, '[T]oggle Inlay [H]ints')
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- LSP servers and clients are able to communicate to each other what features they support.
|
||||||
|
-- By default, Neovim doesn't support everything that is in the LSP specification.
|
||||||
|
-- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities.
|
||||||
|
-- So, we create new capabilities with nvim cmp, and then broadcast that to the servers.
|
||||||
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
|
capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities())
|
||||||
|
|
||||||
|
-- Enable the following language servers
|
||||||
|
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
|
||||||
|
--
|
||||||
|
-- Add any additional override configuration in the following tables. Available keys are:
|
||||||
|
-- - cmd (table): Override the default command used to start the server
|
||||||
|
-- - filetypes (table): Override the default list of associated filetypes for the server
|
||||||
|
-- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features.
|
||||||
|
-- - settings (table): Override the default settings passed when initializing the server.
|
||||||
|
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
|
||||||
|
local servers = {
|
||||||
|
-- clangd = {},
|
||||||
|
-- gopls = {},
|
||||||
|
vale = {},
|
||||||
|
taplo = {
|
||||||
|
filetypes = { 'toml' },
|
||||||
|
root_dir = require('lspconfig.util').root_pattern('*.toml', '.git'),
|
||||||
|
},
|
||||||
|
pyright = {
|
||||||
|
settings = {
|
||||||
|
pyright = {
|
||||||
|
disableOrganizeImports = true, -- Using ruff
|
||||||
|
},
|
||||||
|
python = {
|
||||||
|
analysis = {
|
||||||
|
ignore = { '*' }, -- Using ruff
|
||||||
|
typeCheckingMode = 'off', -- Using mypy
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
filetypes = { 'python' },
|
||||||
|
},
|
||||||
|
mypy = {},
|
||||||
|
ruff = {},
|
||||||
|
-- rust_analyzer = {},
|
||||||
|
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
|
||||||
|
--
|
||||||
|
-- Some languages (like typescript) have entire language plugins that can be useful:
|
||||||
|
-- https://github.com/pmizio/typescript-tools.nvim
|
||||||
|
--
|
||||||
|
-- But for many setups, the LSP (`ts_ls`) will work just fine
|
||||||
|
-- ts_ls = {},
|
||||||
|
--
|
||||||
|
-- ruff_lsp = {
|
||||||
|
-- filetypes = { 'python' },
|
||||||
|
-- },
|
||||||
|
|
||||||
|
lua_ls = {
|
||||||
|
-- cmd = {...},
|
||||||
|
-- filetypes = { ...},
|
||||||
|
-- capabilities = {},
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
diagnostics = { globals = { 'vim' } },
|
||||||
|
completion = {
|
||||||
|
callSnippet = 'Replace',
|
||||||
|
},
|
||||||
|
-- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings:
|
||||||
|
-- diagnostics = { disable = { 'missing-fields' } },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Ensure the servers and tools above are installed
|
||||||
|
-- To check the current status of installed tools and/or manually install
|
||||||
|
-- other tools, you can run
|
||||||
|
-- :Mason
|
||||||
|
--
|
||||||
|
-- You can press `g?` for help in this menu.
|
||||||
|
require('mason').setup()
|
||||||
|
|
||||||
|
-- You can add other tools here that you want Mason to install
|
||||||
|
-- for you, so that they are available from within Neovim.
|
||||||
|
local ensure_installed = vim.tbl_keys(servers or {})
|
||||||
|
vim.list_extend(ensure_installed, {
|
||||||
|
'stylua', -- Used to format Lua code
|
||||||
|
})
|
||||||
|
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
|
||||||
|
|
||||||
|
require('mason-lspconfig').setup {
|
||||||
|
handlers = {
|
||||||
|
function(server_name)
|
||||||
|
local server = servers[server_name] or {}
|
||||||
|
-- This handles overriding only values explicitly passed
|
||||||
|
-- by the server configuration above. Useful when disabling
|
||||||
|
-- certain features of an LSP (for example, turning off formatting for ts_ls)
|
||||||
|
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
|
||||||
|
require('lspconfig')[server_name].setup(server)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
'jose-elias-alvarez/null-ls.nvim',
|
||||||
|
ft = { 'python' },
|
||||||
|
opts = function()
|
||||||
|
local null_ls = require 'null-ls'
|
||||||
|
return {
|
||||||
|
sources = {
|
||||||
|
null_ls.builtins.diagnostics.ruff,
|
||||||
|
null_ls.builtins.diagnostics.mypy,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
-- Collection of various small independent plugins/modules
|
||||||
|
-- https://github.com/echasnovski/mini.nvim
|
||||||
|
return {
|
||||||
|
'echasnovski/mini.nvim',
|
||||||
|
config = function()
|
||||||
|
-- Better Around/Inside textobjects
|
||||||
|
--
|
||||||
|
-- Examples:
|
||||||
|
-- - va) - [V]isually select [A]round [)]paren
|
||||||
|
-- - yinq - [Y]ank [I]nside [N]ext [Q]uote
|
||||||
|
-- - ci' - [C]hange [I]nside [']quote
|
||||||
|
require('mini.ai').setup { n_lines = 500 }
|
||||||
|
|
||||||
|
-- Add/delete/replace surroundings (brackets, quotes, etc.)
|
||||||
|
--
|
||||||
|
-- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren
|
||||||
|
-- - sd' - [S]urround [D]elete [']quotes
|
||||||
|
-- - sr)' - [S]urround [R]eplace [)] [']
|
||||||
|
require('mini.surround').setup()
|
||||||
|
|
||||||
|
-- Simple and easy statusline.
|
||||||
|
-- You could remove this setup call if you don't like it,
|
||||||
|
-- and try some other statusline plugin
|
||||||
|
local statusline = require 'mini.statusline'
|
||||||
|
-- set use_icons to true if you have a Nerd Font
|
||||||
|
statusline.setup { use_icons = vim.g.have_nerd_font }
|
||||||
|
|
||||||
|
-- You can configure sections in the statusline by overriding their
|
||||||
|
-- default behavior. For example, here we set the section for
|
||||||
|
-- cursor location to LINE:COLUMN
|
||||||
|
---@diagnostic disable-next-line: duplicate-set-field
|
||||||
|
statusline.section_location = function()
|
||||||
|
return '%2l:%-2v'
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
return {
|
||||||
|
'rose-pine/neovim',
|
||||||
|
name = 'rose-pine',
|
||||||
|
priority = 1000, -- Make sure to load this before all the other start plugins,
|
||||||
|
init = function()
|
||||||
|
-- Load the colorscheme here.
|
||||||
|
-- Like many other themes, this one has different styles, and you could load
|
||||||
|
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
|
||||||
|
vim.cmd.colorscheme 'rose-pine'
|
||||||
|
end,
|
||||||
|
config = function()
|
||||||
|
require('rose-pine').setup {
|
||||||
|
enable = {
|
||||||
|
terminal = true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
}
|
|
@ -0,0 +1,109 @@
|
||||||
|
-- Gaze deeply into unknown regions using the power of the moon
|
||||||
|
--
|
||||||
|
-- Fuzzy Finder (files, lsp, etc)
|
||||||
|
--
|
||||||
|
-- https://github.com/nvim-telescope/telescope.nvim
|
||||||
|
return {
|
||||||
|
'nvim-telescope/telescope.nvim',
|
||||||
|
event = 'VimEnter',
|
||||||
|
branch = '0.1.x',
|
||||||
|
dependencies = {
|
||||||
|
'nvim-lua/plenary.nvim',
|
||||||
|
{ -- If encountering errors, see telescope-fzf-native README for installation instructions
|
||||||
|
'nvim-telescope/telescope-fzf-native.nvim',
|
||||||
|
|
||||||
|
-- `build` is used to run some command when the plugin is installed/updated.
|
||||||
|
-- This is only run then, not every time Neovim starts up.
|
||||||
|
build = 'make',
|
||||||
|
|
||||||
|
-- `cond` is a condition used to determine whether this plugin should be
|
||||||
|
-- installed and loaded.
|
||||||
|
cond = function()
|
||||||
|
return vim.fn.executable 'make' == 1
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{ 'nvim-telescope/telescope-ui-select.nvim' },
|
||||||
|
|
||||||
|
-- Useful for getting pretty icons, but requires a Nerd Font.
|
||||||
|
{ 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
-- Telescope is a fuzzy finder that comes with a lot of different things that
|
||||||
|
-- it can fuzzy find! It's more than just a "file finder", it can search
|
||||||
|
-- many different aspects of Neovim, your workspace, LSP, and more!
|
||||||
|
--
|
||||||
|
-- The easiest way to use Telescope, is to start by doing something like:
|
||||||
|
-- :Telescope help_tags
|
||||||
|
--
|
||||||
|
-- After running this command, a window will open up and you're able to
|
||||||
|
-- type in the prompt window. You'll see a list of `help_tags` options and
|
||||||
|
-- a corresponding preview of the help.
|
||||||
|
--
|
||||||
|
-- Two important keymaps to use while in Telescope are:
|
||||||
|
-- - Insert mode: <c-/>
|
||||||
|
-- - Normal mode: ?
|
||||||
|
--
|
||||||
|
-- This opens a window that shows you all of the keymaps for the current
|
||||||
|
-- Telescope picker. This is really useful to discover what Telescope can
|
||||||
|
-- do as well as how to actually do it!
|
||||||
|
|
||||||
|
-- [[ Configure Telescope ]]
|
||||||
|
-- See `:help telescope` and `:help telescope.setup()`
|
||||||
|
require('telescope').setup {
|
||||||
|
-- You can put your default mappings / updates / etc. in here
|
||||||
|
-- All the info you're looking for is in `:help telescope.setup()`
|
||||||
|
--
|
||||||
|
-- defaults = {
|
||||||
|
-- mappings = {
|
||||||
|
-- i = { ['<c-enter>'] = 'to_fuzzy_refine' },
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- pickers = {}
|
||||||
|
extensions = {
|
||||||
|
['ui-select'] = {
|
||||||
|
require('telescope.themes').get_dropdown(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Enable Telescope extensions if they are installed
|
||||||
|
pcall(require('telescope').load_extension, 'fzf')
|
||||||
|
pcall(require('telescope').load_extension, 'ui-select')
|
||||||
|
|
||||||
|
-- See `:help telescope.builtin`
|
||||||
|
local builtin = require 'telescope.builtin'
|
||||||
|
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
|
||||||
|
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
|
||||||
|
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
|
||||||
|
vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
|
||||||
|
vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
|
||||||
|
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
|
||||||
|
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
|
||||||
|
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
|
||||||
|
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
|
||||||
|
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
|
||||||
|
|
||||||
|
-- Slightly advanced example of overriding default behavior and theme
|
||||||
|
vim.keymap.set('n', '<leader>/', function()
|
||||||
|
-- You can pass additional configuration to Telescope to change the theme, layout, etc.
|
||||||
|
builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
||||||
|
winblend = 10,
|
||||||
|
previewer = false,
|
||||||
|
})
|
||||||
|
end, { desc = '[/] Fuzzily search in current buffer' })
|
||||||
|
|
||||||
|
-- It's also possible to pass additional configuration options.
|
||||||
|
-- See `:help telescope.builtin.live_grep()` for information about particular keys
|
||||||
|
vim.keymap.set('n', '<leader>s/', function()
|
||||||
|
builtin.live_grep {
|
||||||
|
grep_open_files = true,
|
||||||
|
prompt_title = 'Live Grep in Open Files',
|
||||||
|
}
|
||||||
|
end, { desc = '[S]earch [/] in Open Files' })
|
||||||
|
|
||||||
|
-- Shortcut for searching your Neovim configuration files
|
||||||
|
vim.keymap.set('n', '<leader>sn', function()
|
||||||
|
builtin.find_files { cwd = vim.fn.stdpath 'config' }
|
||||||
|
end, { desc = '[S]earch [N]eovim files' })
|
||||||
|
end,
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
-- Highlight, edit, and navigate code
|
||||||
|
return {
|
||||||
|
'nvim-treesitter/nvim-treesitter',
|
||||||
|
build = ':TSUpdate',
|
||||||
|
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
|
||||||
|
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
|
||||||
|
opts = {
|
||||||
|
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc', 'python' },
|
||||||
|
-- Autoinstall languages that are not installed
|
||||||
|
auto_install = true,
|
||||||
|
highlight = {
|
||||||
|
enable = true,
|
||||||
|
-- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules.
|
||||||
|
-- If you are experiencing weird indenting issues, add the language to
|
||||||
|
-- the list of additional_vim_regex_highlighting and disabled languages for indent.
|
||||||
|
additional_vim_regex_highlighting = { 'ruby' },
|
||||||
|
},
|
||||||
|
indent = { enable = true, disable = { 'ruby' } },
|
||||||
|
},
|
||||||
|
-- There are additional nvim-treesitter modules that you can use to interact
|
||||||
|
-- with nvim-treesitter. You should go explore a few and see what interests you:
|
||||||
|
--
|
||||||
|
-- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod`
|
||||||
|
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
|
||||||
|
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
-- Useful plugin to show you pending keybinds.
|
||||||
|
-- https://github.com/folke/which-key.nvim
|
||||||
|
|
||||||
|
return {
|
||||||
|
'folke/which-key.nvim',
|
||||||
|
event = 'VimEnter', -- Sets the loading event to 'VimEnter'
|
||||||
|
opts = {
|
||||||
|
icons = {
|
||||||
|
-- set icon mappings to true if you have a Nerd Font
|
||||||
|
mappings = vim.g.have_nerd_font,
|
||||||
|
-- If you are using a Nerd Font: set icons.keys to an empty table which will use the
|
||||||
|
-- default whick-key.nvim defined Nerd Font icons, otherwise define a string table
|
||||||
|
keys = vim.g.have_nerd_font and {} or {
|
||||||
|
Up = '<Up> ',
|
||||||
|
Down = '<Down> ',
|
||||||
|
Left = '<Left> ',
|
||||||
|
Right = '<Right> ',
|
||||||
|
C = '<C-…> ',
|
||||||
|
M = '<M-…> ',
|
||||||
|
D = '<D-…> ',
|
||||||
|
S = '<S-…> ',
|
||||||
|
CR = '<CR> ',
|
||||||
|
Esc = '<Esc> ',
|
||||||
|
ScrollWheelDown = '<ScrollWheelDown> ',
|
||||||
|
ScrollWheelUp = '<ScrollWheelUp> ',
|
||||||
|
NL = '<NL> ',
|
||||||
|
BS = '<BS> ',
|
||||||
|
Space = '<Space> ',
|
||||||
|
Tab = '<Tab> ',
|
||||||
|
F1 = '<F1>',
|
||||||
|
F2 = '<F2>',
|
||||||
|
F3 = '<F3>',
|
||||||
|
F4 = '<F4>',
|
||||||
|
F5 = '<F5>',
|
||||||
|
F6 = '<F6>',
|
||||||
|
F7 = '<F7>',
|
||||||
|
F8 = '<F8>',
|
||||||
|
F9 = '<F9>',
|
||||||
|
F10 = '<F10>',
|
||||||
|
F11 = '<F11>',
|
||||||
|
F12 = '<F12>',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Document existing key chains
|
||||||
|
spec = {
|
||||||
|
{ '<leader>c', group = '[C]ode', mode = { 'n', 'x' } },
|
||||||
|
{ '<leader>d', group = '[D]ocument' },
|
||||||
|
{ '<leader>r', group = '[R]ename' },
|
||||||
|
{ '<leader>s', group = '[S]earch' },
|
||||||
|
{ '<leader>w', group = '[W]orkspace' },
|
||||||
|
{ '<leader>t', group = '[T]oggle' },
|
||||||
|
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -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,15 +14,39 @@ 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',
|
||||||
|
|
||||||
-- Add your own debuggers here
|
-- Add your own debuggers here
|
||||||
-- 'leoluz/nvim-dap-go',
|
-- 'leoluz/nvim-dap-go',
|
||||||
'mfussenegger/nvim-dap-python'
|
'mfussenegger/nvim-dap-python',
|
||||||
|
|
||||||
},
|
},
|
||||||
|
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'
|
||||||
|
@ -30,7 +54,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
|
||||||
|
@ -40,51 +64,48 @@ return {
|
||||||
-- online, please don't ask me how to install them :)
|
-- online, please don't ask me how to install them :)
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
-- Update this to ensure that you have the debuggers for the langs you want
|
-- Update this to ensure that you have the debuggers for the langs you want
|
||||||
'delve',
|
-- 'delve', -- for go
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- 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()
|
||||||
-- Set icons to characters that are more likely to work in every terminal.
|
-- {
|
||||||
-- Feel free to remove or use ones that you like more! :)
|
-- -- Set icons to characters that are more likely to work in every terminal.
|
||||||
-- Don't feel like these are good choices.
|
-- -- Feel free to remove or use ones that you like more! :)
|
||||||
icons = { expanded = '▾', collapsed = '▸', current_frame = '*' },
|
-- -- Don't feel like these are good choices.
|
||||||
controls = {
|
-- icons = { expanded = '▾', collapsed = '▸', current_frame = '*' },
|
||||||
icons = {
|
-- controls = {
|
||||||
pause = '⏸',
|
-- icons = {
|
||||||
play = '▶',
|
-- pause = '⏸',
|
||||||
step_into = '⏎',
|
-- play = '▶',
|
||||||
step_over = '⏭',
|
-- step_into = '⏎',
|
||||||
step_out = '⏮',
|
-- step_over = '⏭',
|
||||||
step_back = 'b',
|
-- step_out = '⏮',
|
||||||
run_last = '▶▶',
|
-- step_back = 'b',
|
||||||
terminate = '⏹',
|
-- run_last = '▶▶',
|
||||||
disconnect = '⏏',
|
-- terminate = '⏹',
|
||||||
},
|
-- disconnect = '⏏',
|
||||||
},
|
-- },
|
||||||
}
|
-- },
|
||||||
|
-- }
|
||||||
-- 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 python specific config
|
||||||
|
local path = '~/.local/share/nvim/mason/packages/debugpy/venv/bin/python'
|
||||||
|
require('dap-python').setup(path)
|
||||||
|
|
||||||
-- Install golang specific config
|
-- Install golang specific config
|
||||||
-- require('dap-go').setup()
|
-- require('dap-go').setup {
|
||||||
require('dap-python').setup('~/.virtualenvs/debugpy/bin/python')
|
-- 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', silent = true },
|
||||||
|
},
|
||||||
|
opts = {
|
||||||
|
filesystem = {
|
||||||
|
window = {
|
||||||
|
mappings = {
|
||||||
|
['\\'] = 'close_window',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
Loading…
Reference in New Issue