Compare commits
14 Commits
tweaking-t
...
astronvim
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
41321a8818 | ||
|
|
4d7c7b7c9e | ||
|
|
a2d266132c | ||
|
|
9bb11a28e4 | ||
|
|
2f4095512a | ||
| 34ea1ee888 | |||
| 45458b78c1 | |||
| 50dc0c9f93 | |||
| 7f529c4270 | |||
| e3bd8537e2 | |||
|
|
7040f7d16c | ||
|
|
0b78c0c95f | ||
|
|
b4da99b909 | ||
|
|
8f22556eef |
35
README.md
35
README.md
@@ -1,3 +1,34 @@
|
|||||||
# Neovim config
|
# AstroNvim Template
|
||||||
|
|
||||||
This is my fork of kickstart.nvim!
|
**NOTE:** This is for AstroNvim v5+
|
||||||
|
|
||||||
|
A template for getting started with [AstroNvim](https://github.com/AstroNvim/AstroNvim)
|
||||||
|
|
||||||
|
## 🛠️ Installation
|
||||||
|
|
||||||
|
#### Make a backup of your current nvim and shared folder
|
||||||
|
|
||||||
|
```shell
|
||||||
|
mv ~/.config/nvim ~/.config/nvim.bak
|
||||||
|
mv ~/.local/share/nvim ~/.local/share/nvim.bak
|
||||||
|
mv ~/.local/state/nvim ~/.local/state/nvim.bak
|
||||||
|
mv ~/.cache/nvim ~/.cache/nvim.bak
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Create a new user repository from this template
|
||||||
|
|
||||||
|
Press the "Use this template" button above to create a new repository to store your user configuration.
|
||||||
|
|
||||||
|
You can also just clone this repository directly if you do not want to track your user configuration in GitHub.
|
||||||
|
|
||||||
|
#### Clone the repository
|
||||||
|
|
||||||
|
```shell
|
||||||
|
git clone https://github.com/<your_user>/<your_repository> ~/.config/nvim
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Start Neovim
|
||||||
|
|
||||||
|
```shell
|
||||||
|
nvim
|
||||||
|
```
|
||||||
|
|||||||
65
clean.sh
Executable file
65
clean.sh
Executable file
@@ -0,0 +1,65 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SRC_DIRS=(
|
||||||
|
"$HOME/.local/share/nvim"
|
||||||
|
"$HOME/.local/state/nvim"
|
||||||
|
"$HOME/.cache/nvim"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Ask if user wants to backup
|
||||||
|
printf "Do you want to backup before cleaning? [Y/n]: "
|
||||||
|
read -r BACKUP_CHOICE
|
||||||
|
case ${BACKUP_CHOICE:-} in
|
||||||
|
[nN]|[nN][oO])
|
||||||
|
BACKUP=false
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
BACKUP=true
|
||||||
|
TAG=.bak-$(date +%Y-%m-%d_%H-%M-%S)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Show plan and confirm
|
||||||
|
printf "\n"
|
||||||
|
if [ "$BACKUP" = true ]; then
|
||||||
|
printf "This will back up and clean your Neovim directories.\n"
|
||||||
|
printf "Backup suffix to be appended: %s\n\n" "$TAG"
|
||||||
|
printf "Plan:\n"
|
||||||
|
for SRC in "${SRC_DIRS[@]}"; do
|
||||||
|
if [ -e "$SRC" ]; then
|
||||||
|
DEST="${SRC}${TAG}"
|
||||||
|
printf " %s ➡️ %s\n" "$SRC" "$DEST"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
printf "This will remove your Neovim directories WITHOUT backup.\n\n"
|
||||||
|
printf "Plan:\n"
|
||||||
|
for SRC in "${SRC_DIRS[@]}"; do
|
||||||
|
if [ -e "$SRC" ]; then
|
||||||
|
printf " %s ❌\n" "$SRC"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "\n"
|
||||||
|
read -r -p "Are you sure you want to proceed? [y/N]: " CONFIRM
|
||||||
|
case ${CONFIRM:-} in
|
||||||
|
[yY]|[yY][eE][sS]) ;;
|
||||||
|
*) printf "Aborted!\n"; exit 0;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Perform action based on backup choice
|
||||||
|
for SRC in "${SRC_DIRS[@]}"; do
|
||||||
|
if [ -e "$SRC" ]; then
|
||||||
|
if [ "$BACKUP" = true ]; then
|
||||||
|
DEST="${SRC}${TAG}"
|
||||||
|
mv "$SRC" "$DEST"
|
||||||
|
else
|
||||||
|
rm -rf "$SRC"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
printf "Done!"
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
================================================================================
|
|
||||||
INTRODUCTION *kickstart.nvim*
|
|
||||||
|
|
||||||
Kickstart.nvim is a project to help you get started on your neovim journey.
|
|
||||||
|
|
||||||
*kickstart-is-not*
|
|
||||||
It is not:
|
|
||||||
- Complete framework for every plugin under the sun
|
|
||||||
- Place to add every plugin that could ever be useful
|
|
||||||
|
|
||||||
*kickstart-is*
|
|
||||||
It is:
|
|
||||||
- Somewhere that has a good start for the most common "IDE" type features:
|
|
||||||
- autocompletion
|
|
||||||
- goto-definition
|
|
||||||
- find references
|
|
||||||
- fuzzy finding
|
|
||||||
- and hinting at what more can be done :)
|
|
||||||
- A place to _kickstart_ your journey.
|
|
||||||
- You should fork this project and use/modify it so that it matches your
|
|
||||||
style and preferences. If you don't want to do that, there are probably
|
|
||||||
other projects that would fit much better for you (and that's great!)!
|
|
||||||
|
|
||||||
vim:tw=78:ts=8:ft=help:norl:
|
|
||||||
723
init.lua
723
init.lua
@@ -1,710 +1,27 @@
|
|||||||
require 'opts'
|
-- This file simply bootstraps the installation of Lazy.nvim and then calls other files for execution
|
||||||
|
-- This file doesn't necessarily need to be touched, BE CAUTIOUS editing this file and proceed at your own risk.
|
||||||
|
local lazypath = vim.env.LAZY or vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
|
||||||
|
|
||||||
require 'keymaps'
|
if not (vim.env.LAZY or (vim.uv or vim.loop).fs_stat(lazypath)) then
|
||||||
|
-- stylua: ignore
|
||||||
-- [[ Basic Autocommands ]]
|
local result = vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
|
||||||
-- See `:help lua-guide-autocommands`
|
|
||||||
|
|
||||||
-- Highlight when yanking (copying) text
|
|
||||||
-- Try it with `yap` in normal mode
|
|
||||||
-- See `:help vim.hl.on_yank()`
|
|
||||||
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()
|
|
||||||
vim.hl.on_yank()
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- [[ Install `lazy.nvim` plugin manager ]]
|
|
||||||
-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
|
|
||||||
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
|
||||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
|
||||||
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
|
|
||||||
local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
|
|
||||||
if vim.v.shell_error ~= 0 then
|
if vim.v.shell_error ~= 0 then
|
||||||
error('Error cloning lazy.nvim:\n' .. out)
|
-- stylua: ignore
|
||||||
|
vim.api.nvim_echo({ { ("Error cloning lazy.nvim:\n%s\n"):format(result), "ErrorMsg" }, { "Press any key to exit...", "MoreMsg" } }, true, {})
|
||||||
|
vim.fn.getchar()
|
||||||
|
vim.cmd.quit()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
---@type vim.Option
|
vim.opt.rtp:prepend(lazypath)
|
||||||
local rtp = vim.opt.rtp
|
|
||||||
rtp:prepend(lazypath)
|
|
||||||
|
|
||||||
-- [[ Configure and install plugins ]]
|
-- validate that lazy is available
|
||||||
--
|
if not pcall(require, "lazy") then
|
||||||
-- To check the current status of your plugins, run
|
-- stylua: ignore
|
||||||
-- :Lazy
|
vim.api.nvim_echo({ { ("Unable to load lazy from: %s\n"):format(lazypath), "ErrorMsg" }, { "Press any key to exit...", "MoreMsg" } }, true, {})
|
||||||
--
|
vim.fn.getchar()
|
||||||
-- You can press `?` in this menu for help. Use `:q` to close the window
|
vim.cmd.quit()
|
||||||
--
|
end
|
||||||
-- To update plugins you can run
|
|
||||||
-- :Lazy update
|
|
||||||
--
|
|
||||||
require('lazy').setup({
|
|
||||||
'NMAC427/guess-indent.nvim', -- Detect tabstop and shiftwidth automatically
|
|
||||||
|
|
||||||
{ -- Useful plugin to show you pending keybinds.
|
require "lazy_setup"
|
||||||
'folke/which-key.nvim',
|
require "polish"
|
||||||
event = 'VimEnter', -- Sets the loading event to 'VimEnter'
|
|
||||||
opts = {
|
|
||||||
-- delay between pressing a key and opening which-key (milliseconds)
|
|
||||||
-- this setting is independent of vim.o.timeoutlen
|
|
||||||
delay = 0,
|
|
||||||
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 which-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>s', group = '[S]earch' },
|
|
||||||
{ '<leader>t', group = '[T]oggle' },
|
|
||||||
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
{ -- Fuzzy Finder (files, lsp, etc)
|
|
||||||
'nvim-telescope/telescope.nvim',
|
|
||||||
event = 'VimEnter',
|
|
||||||
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,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- LSP Plugins
|
|
||||||
{
|
|
||||||
-- `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 = '${3rd}/luv/library', words = { 'vim%.uv' } },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
-- Main LSP Configuration
|
|
||||||
'neovim/nvim-lspconfig',
|
|
||||||
dependencies = {
|
|
||||||
-- Automatically install LSPs and related tools to stdpath for Neovim
|
|
||||||
-- Mason must be loaded before its dependents so we need to set it up here.
|
|
||||||
-- NOTE: `opts = {}` is the same as calling `require('mason').setup({})`
|
|
||||||
{ 'mason-org/mason.nvim', opts = {} },
|
|
||||||
'mason-org/mason-lspconfig.nvim',
|
|
||||||
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
|
||||||
|
|
||||||
-- Useful status updates for LSP.
|
|
||||||
{ 'j-hui/fidget.nvim', opts = {} },
|
|
||||||
|
|
||||||
-- Allows extra capabilities provided by blink.cmp
|
|
||||||
'saghen/blink.cmp',
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
-- 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
|
|
||||||
|
|
||||||
-- Rename the variable under your cursor.
|
|
||||||
-- Most Language Servers support renaming across files, etc.
|
|
||||||
map('grn', 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('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' })
|
|
||||||
|
|
||||||
-- Find references for the word under your cursor.
|
|
||||||
map('grr', 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('gri', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
|
|
||||||
|
|
||||||
-- 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('grd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
|
|
||||||
|
|
||||||
-- WARN: This is not Goto Definition, this is Goto Declaration.
|
|
||||||
-- For example, in C this would take you to the header.
|
|
||||||
map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
|
||||||
|
|
||||||
-- Fuzzy find all the symbols in your current document.
|
|
||||||
-- Symbols are things like variables, functions, types, etc.
|
|
||||||
map('gO', require('telescope.builtin').lsp_document_symbols, 'Open Document Symbols')
|
|
||||||
|
|
||||||
-- Fuzzy find all the symbols in your current workspace.
|
|
||||||
-- Similar to document symbols, except searches over your entire project.
|
|
||||||
map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols, 'Open Workspace Symbols')
|
|
||||||
|
|
||||||
-- 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('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition')
|
|
||||||
|
|
||||||
-- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
|
|
||||||
---@param client vim.lsp.Client
|
|
||||||
---@param method vim.lsp.protocol.Method
|
|
||||||
---@param bufnr? integer some lsp support methods only in specific files
|
|
||||||
---@return boolean
|
|
||||||
local function client_supports_method(client, method, bufnr)
|
|
||||||
if vim.fn.has 'nvim-0.11' == 1 then
|
|
||||||
return client:supports_method(method, bufnr)
|
|
||||||
else
|
|
||||||
return client.supports_method(method, { bufnr = bufnr })
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 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(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) 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(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) 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,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Diagnostic Config
|
|
||||||
-- See :help vim.diagnostic.Opts
|
|
||||||
vim.diagnostic.config {
|
|
||||||
severity_sort = true,
|
|
||||||
float = { border = 'rounded', source = 'if_many' },
|
|
||||||
underline = { severity = vim.diagnostic.severity.ERROR },
|
|
||||||
signs = vim.g.have_nerd_font and {
|
|
||||||
text = {
|
|
||||||
[vim.diagnostic.severity.ERROR] = ' ',
|
|
||||||
[vim.diagnostic.severity.WARN] = ' ',
|
|
||||||
[vim.diagnostic.severity.INFO] = ' ',
|
|
||||||
[vim.diagnostic.severity.HINT] = ' ',
|
|
||||||
},
|
|
||||||
} or {},
|
|
||||||
virtual_text = {
|
|
||||||
source = 'if_many',
|
|
||||||
spacing = 2,
|
|
||||||
format = function(diagnostic)
|
|
||||||
local diagnostic_message = {
|
|
||||||
[vim.diagnostic.severity.ERROR] = diagnostic.message,
|
|
||||||
[vim.diagnostic.severity.WARN] = diagnostic.message,
|
|
||||||
[vim.diagnostic.severity.INFO] = diagnostic.message,
|
|
||||||
[vim.diagnostic.severity.HINT] = diagnostic.message,
|
|
||||||
}
|
|
||||||
return diagnostic_message[diagnostic.severity]
|
|
||||||
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 blink.cmp, luasnip, etc. Neovim now has *more* capabilities.
|
|
||||||
-- So, we create new capabilities with blink.cmp, and then broadcast that to the servers.
|
|
||||||
local capabilities = require('blink.cmp').get_lsp_capabilities()
|
|
||||||
|
|
||||||
-- Enable the following language servers
|
|
||||||
-- 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 = {},
|
|
||||||
-- pyright = {},
|
|
||||||
-- 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 = {},
|
|
||||||
|
|
||||||
lua_ls = {
|
|
||||||
-- cmd = { ... },
|
|
||||||
-- filetypes = { ... },
|
|
||||||
-- capabilities = {},
|
|
||||||
settings = {
|
|
||||||
Lua = {
|
|
||||||
completion = {
|
|
||||||
callSnippet = 'Replace',
|
|
||||||
},
|
|
||||||
-- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
|
|
||||||
-- diagnostics = { disable = { 'missing-fields' } },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
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 {
|
|
||||||
ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
|
|
||||||
automatic_installation = false,
|
|
||||||
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,
|
|
||||||
},
|
|
||||||
|
|
||||||
{ -- Autoformat
|
|
||||||
'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 }
|
|
||||||
if disable_filetypes[vim.bo[bufnr].filetype] then
|
|
||||||
return nil
|
|
||||||
else
|
|
||||||
return {
|
|
||||||
timeout_ms = 500,
|
|
||||||
lsp_format = 'fallback',
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
formatters_by_ft = {
|
|
||||||
lua = { 'stylua' },
|
|
||||||
-- Conform can also run multiple formatters sequentially
|
|
||||||
-- python = { "isort", "black" },
|
|
||||||
--
|
|
||||||
-- You can use 'stop_after_first' to run the first available formatter from the list
|
|
||||||
-- javascript = { "prettierd", "prettier", stop_after_first = true },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
{ -- Autocompletion
|
|
||||||
'saghen/blink.cmp',
|
|
||||||
event = 'VimEnter',
|
|
||||||
version = '1.*',
|
|
||||||
dependencies = {
|
|
||||||
-- Snippet Engine
|
|
||||||
{
|
|
||||||
'L3MON4D3/LuaSnip',
|
|
||||||
version = '2.*',
|
|
||||||
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,
|
|
||||||
-- },
|
|
||||||
},
|
|
||||||
opts = {},
|
|
||||||
},
|
|
||||||
'folke/lazydev.nvim',
|
|
||||||
},
|
|
||||||
--- @module 'blink.cmp'
|
|
||||||
--- @type blink.cmp.Config
|
|
||||||
opts = {
|
|
||||||
keymap = {
|
|
||||||
-- 'default' (recommended) for mappings similar to built-in completions
|
|
||||||
-- <c-y> to accept ([y]es) the completion.
|
|
||||||
-- This will auto-import if your LSP supports it.
|
|
||||||
-- This will expand snippets if the LSP sent a snippet.
|
|
||||||
-- 'super-tab' for tab to accept
|
|
||||||
-- 'enter' for enter to accept
|
|
||||||
-- 'none' for no mappings
|
|
||||||
--
|
|
||||||
-- For an understanding of why the 'default' preset is recommended,
|
|
||||||
-- you will need to read `:help ins-completion`
|
|
||||||
--
|
|
||||||
-- No, but seriously. Please read `:help ins-completion`, it is really good!
|
|
||||||
--
|
|
||||||
-- All presets have the following mappings:
|
|
||||||
-- <tab>/<s-tab>: move to right/left of your snippet expansion
|
|
||||||
-- <c-space>: Open menu or open docs if already open
|
|
||||||
-- <c-n>/<c-p> or <up>/<down>: Select next/previous item
|
|
||||||
-- <c-e>: Hide menu
|
|
||||||
-- <c-k>: Toggle signature help
|
|
||||||
--
|
|
||||||
-- See :h blink-cmp-config-keymap for defining your own keymap
|
|
||||||
preset = 'default',
|
|
||||||
|
|
||||||
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
|
|
||||||
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
|
|
||||||
},
|
|
||||||
|
|
||||||
appearance = {
|
|
||||||
-- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
|
|
||||||
-- Adjusts spacing to ensure icons are aligned
|
|
||||||
nerd_font_variant = 'mono',
|
|
||||||
},
|
|
||||||
|
|
||||||
completion = {
|
|
||||||
-- By default, you may press `<c-space>` to show the documentation.
|
|
||||||
-- Optionally, set `auto_show = true` to show the documentation after a delay.
|
|
||||||
documentation = { auto_show = false, auto_show_delay_ms = 500 },
|
|
||||||
},
|
|
||||||
|
|
||||||
sources = {
|
|
||||||
default = { 'lsp', 'path', 'snippets', 'lazydev' },
|
|
||||||
providers = {
|
|
||||||
lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
snippets = { preset = 'luasnip' },
|
|
||||||
|
|
||||||
-- Blink.cmp includes an optional, recommended rust fuzzy matcher,
|
|
||||||
-- which automatically downloads a prebuilt binary when enabled.
|
|
||||||
--
|
|
||||||
-- By default, we use the Lua implementation instead, but you may enable
|
|
||||||
-- the rust implementation via `'prefer_rust_with_warning'`
|
|
||||||
--
|
|
||||||
-- See :h blink-cmp-config-fuzzy for more information
|
|
||||||
fuzzy = { implementation = 'lua' },
|
|
||||||
|
|
||||||
-- Shows a signature help window while you type arguments for a function
|
|
||||||
signature = { enabled = true },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
{ -- You can easily change to a different colorscheme.
|
|
||||||
-- Change the name of the colorscheme plugin below, and then
|
|
||||||
-- change the command in the config to whatever the name of that colorscheme is.
|
|
||||||
--
|
|
||||||
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
|
|
||||||
'folke/tokyonight.nvim',
|
|
||||||
priority = 1000, -- Make sure to load this before all the other start plugins.
|
|
||||||
config = function()
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
|
||||||
require('tokyonight').setup {
|
|
||||||
styles = {
|
|
||||||
comments = { italic = false }, -- Disable italics in comments
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
-- 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 'tokyonight-night'
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Highlight todo, notes, etc in comments
|
|
||||||
{ 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } },
|
|
||||||
|
|
||||||
{ -- Collection of various small independent plugins/modules
|
|
||||||
'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
|
|
||||||
|
|
||||||
-- ... and there is more!
|
|
||||||
-- Check out: https://github.com/echasnovski/mini.nvim
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{ -- Highlight, edit, and navigate code
|
|
||||||
'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', 'go', 'graphql' },
|
|
||||||
-- 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
|
|
||||||
},
|
|
||||||
|
|
||||||
-- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the
|
|
||||||
-- init.lua. If you want these files, they are in the repository, so you can just download them and
|
|
||||||
-- place them in the correct locations.
|
|
||||||
|
|
||||||
-- NOTE: Next step on your Neovim journey: Add/Configure additional plugins for Kickstart
|
|
||||||
--
|
|
||||||
-- Here are some example plugins that I've included in the Kickstart repository.
|
|
||||||
-- Uncomment any of the lines below to enable them (you will need to restart nvim).
|
|
||||||
--
|
|
||||||
require 'kickstart.plugins.debug',
|
|
||||||
-- require 'kickstart.plugins.indent_line',
|
|
||||||
-- require 'kickstart.plugins.lint',
|
|
||||||
require 'kickstart.plugins.autopairs',
|
|
||||||
require 'kickstart.plugins.neo-tree',
|
|
||||||
require 'kickstart.plugins.gitsigns',
|
|
||||||
|
|
||||||
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
|
|
||||||
-- This is the easiest way to modularize your config.
|
|
||||||
--
|
|
||||||
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
|
|
||||||
-- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins`
|
|
||||||
{ import = 'custom.plugins' },
|
|
||||||
}, {
|
|
||||||
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 = '💤 ',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
-- The line beneath this is called `modeline`. See `:help modeline`
|
|
||||||
-- vim: ts=2 sts=2 sw=2 et
|
|
||||||
|
|||||||
18
lua/community.lua
Normal file
18
lua/community.lua
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
-- AstroCommunity: import any community modules here
|
||||||
|
-- We import this file in `lazy_setup.lua` before the `plugins/` folder.
|
||||||
|
-- This guarantees that the specs are processed before any user plugins.
|
||||||
|
|
||||||
|
---@type LazySpec
|
||||||
|
return {
|
||||||
|
'AstroNvim/astrocommunity',
|
||||||
|
|
||||||
|
{ import = 'astrocommunity.colorscheme.tokyonight-nvim' },
|
||||||
|
|
||||||
|
{ import = 'astrocommunity.editing-support.conform-nvim' },
|
||||||
|
{ import = 'astrocommunity.git.diffview-nvim' },
|
||||||
|
|
||||||
|
{ import = 'astrocommunity.pack.go' },
|
||||||
|
{ import = 'astrocommunity.pack.lua' },
|
||||||
|
|
||||||
|
{ import = 'astrocommunity.test.neotest' },
|
||||||
|
}
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
return {
|
|
||||||
'sindrets/diffview.nvim',
|
|
||||||
cmd = { 'DiffviewOpen', 'DiffviewClose', 'DiffviewToggleFiles', 'DiffviewFocusFiles' },
|
|
||||||
}
|
|
||||||
@@ -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 {}
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
return {
|
|
||||||
'karb94/neoscroll.nvim',
|
|
||||||
config = function()
|
|
||||||
local neoscroll = require 'neoscroll'
|
|
||||||
neoscroll.setup {
|
|
||||||
mappings = {
|
|
||||||
'<C-u>',
|
|
||||||
'<C-d>',
|
|
||||||
'<C-b>',
|
|
||||||
'<C-f>',
|
|
||||||
'zt',
|
|
||||||
'zz',
|
|
||||||
'zb',
|
|
||||||
},
|
|
||||||
easing = 'quadratic',
|
|
||||||
}
|
|
||||||
|
|
||||||
local keymap = {
|
|
||||||
['<C-u>'] = function()
|
|
||||||
neoscroll.ctrl_u { duration = 150 }
|
|
||||||
end,
|
|
||||||
['<C-d>'] = function()
|
|
||||||
neoscroll.ctrl_d { duration = 150 }
|
|
||||||
end,
|
|
||||||
['<C-b>'] = function()
|
|
||||||
neoscroll.ctrl_b { duration = 300 }
|
|
||||||
end,
|
|
||||||
['<C-f>'] = function()
|
|
||||||
neoscroll.ctrl_f { duration = 300 }
|
|
||||||
end,
|
|
||||||
['zt'] = function()
|
|
||||||
neoscroll.zt { half_win_duration = 150 }
|
|
||||||
end,
|
|
||||||
['zz'] = function()
|
|
||||||
neoscroll.zz { half_win_duration = 150 }
|
|
||||||
end,
|
|
||||||
['zb'] = function()
|
|
||||||
neoscroll.zb { half_win_duration = 150 }
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
local modes = { 'n', 'v', 'x' }
|
|
||||||
for key, func in pairs(keymap) do
|
|
||||||
vim.keymap.set(modes, key, func)
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
-- move lines up & down
|
|
||||||
vim.keymap.set('v', 'J', ":m '>+1<CR>gv=gv")
|
|
||||||
vim.keymap.set('v', 'K', ":m '<-2<CR>gv=gv")
|
|
||||||
|
|
||||||
-- move around centered
|
|
||||||
vim.keymap.set('n', '<C-d>', '<C-d>zz')
|
|
||||||
vim.keymap.set('n', '<C-u>', '<C-u>zz')
|
|
||||||
vim.keymap.set('n', 'n', 'nzzzv')
|
|
||||||
vim.keymap.set('n', 'N', 'Nzzzv')
|
|
||||||
|
|
||||||
-- copy & paste
|
|
||||||
vim.keymap.set('x', '<leader>p', '"_dP')
|
|
||||||
|
|
||||||
vim.keymap.set('n', '<leader>y', '"+y')
|
|
||||||
vim.keymap.set('v', '<leader>y', '"+y')
|
|
||||||
vim.keymap.set('n', '<leader>Y', '"+Y')
|
|
||||||
|
|
||||||
vim.keymap.set('n', '<leader>d', '"_d')
|
|
||||||
vim.keymap.set('v', '<leader>d', '"_d')
|
|
||||||
|
|
||||||
-- [[ 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' })
|
|
||||||
|
|
||||||
-- 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' })
|
|
||||||
|
|
||||||
-- buffer management
|
|
||||||
vim.keymap.set('n', '<leader>cc', ':bp<bar>sp<bar>bn<bar>bd<CR>', { desc = '[C]lose [C]urrent buffer' })
|
|
||||||
vim.keymap.set('n', '<leader>ch', function()
|
|
||||||
local bufinfos = vim.fn.getbufinfo { buflisted = 1 }
|
|
||||||
local skipCount = 0
|
|
||||||
local deleteCount = 0
|
|
||||||
vim.tbl_map(function(bufinfo)
|
|
||||||
if bufinfo.changed == 1 then
|
|
||||||
skipCount = skipCount + 1
|
|
||||||
elseif not bufinfo.windows or #bufinfo.windows == 0 then
|
|
||||||
deleteCount = deleteCount + 1
|
|
||||||
vim.api.nvim_buf_delete(bufinfo.bufnr, { force = false, unload = false })
|
|
||||||
end
|
|
||||||
print(('Deleted %d out of %d hidden buffers'):format(deleteCount, deleteCount + skipCount))
|
|
||||||
end, bufinfos)
|
|
||||||
end, { desc = '[C]lose [H]idden buffers' })
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
--[[
|
|
||||||
--
|
|
||||||
-- 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,16 +0,0 @@
|
|||||||
-- 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,
|
|
||||||
}
|
|
||||||
@@ -1,111 +0,0 @@
|
|||||||
return {
|
|
||||||
'mfussenegger/nvim-dap',
|
|
||||||
dependencies = {
|
|
||||||
'rcarriga/nvim-dap-ui',
|
|
||||||
'nvim-neotest/nvim-nio',
|
|
||||||
'williamboman/mason.nvim',
|
|
||||||
'jay-babu/mason-nvim-dap.nvim',
|
|
||||||
'leoluz/nvim-dap-go',
|
|
||||||
},
|
|
||||||
keys = function(_, keys)
|
|
||||||
local dap = require 'dap'
|
|
||||||
local dapui = require 'dapui'
|
|
||||||
local dapgo = require 'dap-go'
|
|
||||||
|
|
||||||
return {
|
|
||||||
-- Basic debugging keymaps, feel free to change to your liking!
|
|
||||||
{ '<F5>', dap.continue, desc = 'Debug: Start/Continue' },
|
|
||||||
{ '<F6>', dap.step_into, desc = 'Debug: Step Into' },
|
|
||||||
{ '<F7>', dap.step_over, desc = 'Debug: Step Over' },
|
|
||||||
{ '<F8>', dap.step_out, desc = 'Debug: Step Out' },
|
|
||||||
{
|
|
||||||
'<F9>',
|
|
||||||
function()
|
|
||||||
dap.terminate(nil, nil, nil)
|
|
||||||
end,
|
|
||||||
desc = 'Debug: Terminate',
|
|
||||||
},
|
|
||||||
{ '<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.
|
|
||||||
{ '<leader>td', dapui.toggle, desc = 'Debug: [T]oggle [D]AP ui.' },
|
|
||||||
{ '<leader>rl', dap.run_last, desc = 'Debug: [R]un [l]ast' },
|
|
||||||
{ '<leader>rt', dapgo.debug_test, desc = 'Debug: [R]un [t]est' },
|
|
||||||
unpack(keys),
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
|
|
||||||
config = function()
|
|
||||||
local dap = require 'dap'
|
|
||||||
local dapui = require 'dapui'
|
|
||||||
|
|
||||||
require('mason-nvim-dap').setup {
|
|
||||||
-- Makes a best effort to setup the various debuggers with
|
|
||||||
-- reasonable debug configurations
|
|
||||||
automatic_installation = true,
|
|
||||||
|
|
||||||
-- You can provide additional configuration to the handlers,
|
|
||||||
-- see mason-nvim-dap README for more information
|
|
||||||
handlers = {},
|
|
||||||
|
|
||||||
-- You'll need to check that you have the required things installed
|
|
||||||
-- online, please don't ask me how to install them :)
|
|
||||||
ensure_installed = {
|
|
||||||
-- Update this to ensure that you have the debuggers for the langs you want
|
|
||||||
'delve',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Dap UI setup
|
|
||||||
-- For more information, see |:help nvim-dap-ui|
|
|
||||||
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! :)
|
|
||||||
-- Don't feel like these are good choices.
|
|
||||||
icons = {
|
|
||||||
expanded = '▾',
|
|
||||||
collapsed = '▸',
|
|
||||||
current_frame = '*',
|
|
||||||
},
|
|
||||||
|
|
||||||
controls = {
|
|
||||||
icons = {
|
|
||||||
pause = '⏸',
|
|
||||||
play = '▶',
|
|
||||||
step_into = '⏎',
|
|
||||||
step_over = '⏭',
|
|
||||||
step_out = '⏮',
|
|
||||||
step_back = 'b',
|
|
||||||
run_last = '▶▶',
|
|
||||||
terminate = '⏹',
|
|
||||||
disconnect = '⏏',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
vim.fn.sign_define('DapBreakpoint', { text = '🔴', texthl = '', linehl = '', numhl = '' })
|
|
||||||
vim.fn.sign_define('DapBreakpointCondition', { text = '🟠', texthl = '', linehl = '', numhl = '' })
|
|
||||||
vim.fn.sign_define('DapBreakpointRejected', { text = '⚪', texthl = '', linehl = '', numhl = '' })
|
|
||||||
vim.fn.sign_define('DapLogPoint', { text = '🔵', texthl = '', linehl = '', numhl = '' })
|
|
||||||
vim.fn.sign_define('DapStopped', { text = '👉', texthl = '', linehl = '', numhl = '' })
|
|
||||||
|
|
||||||
dap.listeners.after.event_initialized['dapui_config'] = dapui.open
|
|
||||||
-- dap.listeners.before.event_terminated['dapui_config'] = dapui.close
|
|
||||||
-- dap.listeners.before.event_exited['dapui_config'] = dapui.close
|
|
||||||
|
|
||||||
-- Install golang specific config
|
|
||||||
require('dap-go').setup {
|
|
||||||
delve = {
|
|
||||||
-- On Windows delve must be run attached or it crashes.
|
|
||||||
-- See https://github.com/leoluz/nvim-dap-go/blob/main/README.md#configuring
|
|
||||||
detached = vim.fn.has 'win32' == 0,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
return {
|
|
||||||
{
|
|
||||||
'lewis6991/gitsigns.nvim',
|
|
||||||
opts = {
|
|
||||||
signs = {
|
|
||||||
add = { text = '+' },
|
|
||||||
change = { text = '~' },
|
|
||||||
delete = { text = '_' },
|
|
||||||
topdelete = { text = '‾' },
|
|
||||||
changedelete = { text = '~' },
|
|
||||||
},
|
|
||||||
|
|
||||||
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,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
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 = {},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
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,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
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 = {
|
|
||||||
hijack_netrw_behavior = 'open_default',
|
|
||||||
window = {
|
|
||||||
mappings = {
|
|
||||||
['\\'] = 'close_window',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
filtered_items = {
|
|
||||||
visible = false,
|
|
||||||
hide_dotfiles = false,
|
|
||||||
hide_gitignored = true,
|
|
||||||
hide_by_name = {
|
|
||||||
'.git',
|
|
||||||
'.DS_Store',
|
|
||||||
},
|
|
||||||
never_show = {},
|
|
||||||
always_show_by_pattern = {
|
|
||||||
'.env*',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
buffers = {
|
|
||||||
follow_current_file = {
|
|
||||||
enabled = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
window = {
|
|
||||||
mappings = {
|
|
||||||
['<C-v>'] = 'open_vsplit',
|
|
||||||
['Y'] = function(state)
|
|
||||||
local node = state.tree:get_node()
|
|
||||||
local filepath = node:get_id()
|
|
||||||
local filename = node.name
|
|
||||||
|
|
||||||
local results = {
|
|
||||||
vim.fn.fnamemodify(filepath, ':.'),
|
|
||||||
filepath,
|
|
||||||
filename,
|
|
||||||
}
|
|
||||||
|
|
||||||
local i = vim.fn.inputlist {
|
|
||||||
'Choose what to copy:',
|
|
||||||
'1. ' .. results[1],
|
|
||||||
'2. ' .. results[2],
|
|
||||||
'3. ' .. results[3],
|
|
||||||
}
|
|
||||||
|
|
||||||
if i > 0 then
|
|
||||||
local result = results[i]
|
|
||||||
if not result then
|
|
||||||
return print('Invalid choice: ' .. i)
|
|
||||||
end
|
|
||||||
vim.fn.setreg('"', result)
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
32
lua/lazy_setup.lua
Normal file
32
lua/lazy_setup.lua
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
require("lazy").setup({
|
||||||
|
{
|
||||||
|
"AstroNvim/AstroNvim",
|
||||||
|
version = "^5", -- Remove version tracking to elect for nightly AstroNvim
|
||||||
|
import = "astronvim.plugins",
|
||||||
|
opts = { -- AstroNvim options must be set here with the `import` key
|
||||||
|
mapleader = " ", -- This ensures the leader key must be configured before Lazy is set up
|
||||||
|
maplocalleader = ",", -- This ensures the localleader key must be configured before Lazy is set up
|
||||||
|
icons_enabled = true, -- Set to false to disable icons (if no Nerd Font is available)
|
||||||
|
pin_plugins = nil, -- Default will pin plugins when tracking `version` of AstroNvim, set to true/false to override
|
||||||
|
update_notifications = true, -- Enable/disable notification about running `:Lazy update` twice to update pinned plugins
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ import = "community" },
|
||||||
|
{ import = "plugins" },
|
||||||
|
} --[[@as LazySpec]], {
|
||||||
|
-- Configure any other `lazy.nvim` configuration options here
|
||||||
|
install = { colorscheme = { "astrotheme", "habamax" } },
|
||||||
|
ui = { backdrop = 100 },
|
||||||
|
performance = {
|
||||||
|
rtp = {
|
||||||
|
-- disable some rtp plugins, add more to your liking
|
||||||
|
disabled_plugins = {
|
||||||
|
"gzip",
|
||||||
|
"netrwPlugin",
|
||||||
|
"tarPlugin",
|
||||||
|
"tohtml",
|
||||||
|
"zipPlugin",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
} --[[@as LazyConfig]])
|
||||||
78
lua/opts.lua
78
lua/opts.lua
@@ -1,78 +0,0 @@
|
|||||||
-- Set <space> as the leader key
|
|
||||||
-- See `:help mapleader`
|
|
||||||
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
|
|
||||||
vim.g.mapleader = ' '
|
|
||||||
vim.g.maplocalleader = ' '
|
|
||||||
|
|
||||||
vim.g.have_nerd_font = true
|
|
||||||
|
|
||||||
-- Line numbers
|
|
||||||
vim.opt.number = true
|
|
||||||
vim.opt.relativenumber = true
|
|
||||||
|
|
||||||
-- 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.o.clipboard = 'unnamedplus'
|
|
||||||
end)
|
|
||||||
|
|
||||||
vim.opt.tabstop = 4
|
|
||||||
vim.opt.softtabstop = 4
|
|
||||||
vim.opt.shiftwidth = 4
|
|
||||||
vim.opt.expandtab = true
|
|
||||||
|
|
||||||
vim.o.breakindent = true
|
|
||||||
|
|
||||||
vim.opt.wrap = false
|
|
||||||
|
|
||||||
-- 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
|
|
||||||
|
|
||||||
vim.opt.swapfile = false
|
|
||||||
vim.opt.backup = false
|
|
||||||
vim.opt.undodir = os.getenv 'HOME' .. '/.vim/undodir'
|
|
||||||
vim.opt.undofile = true
|
|
||||||
|
|
||||||
vim.opt.hlsearch = true
|
|
||||||
vim.opt.incsearch = 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
|
|
||||||
|
|
||||||
-- Preview substitutions live, as you type!
|
|
||||||
vim.opt.inccommand = 'split'
|
|
||||||
-- Sets how neovim will display certain whitespace characters in the editor.
|
|
||||||
-- See `:help 'list'5
|
|
||||||
-- and `:help 'listchars'`
|
|
||||||
-- vim.opt.list = true
|
|
||||||
-- vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' }
|
|
||||||
|
|
||||||
-- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`),
|
|
||||||
-- instead raise a dialog asking if you wish to save the current file(s)
|
|
||||||
-- See `:help 'confirm'`
|
|
||||||
vim.o.confirm = true
|
|
||||||
|
|
||||||
--vim.cmd [[autocmd BufWritePre * lua vim.lsp.buf.format()]]
|
|
||||||
165
lua/plugins/astrocore.lua
Normal file
165
lua/plugins/astrocore.lua
Normal file
@@ -0,0 +1,165 @@
|
|||||||
|
-- AstroCore provides a central place to modify mappings, vim options, autocommands, and more!
|
||||||
|
-- Configuration documentation can be found with `:h astrocore`
|
||||||
|
-- NOTE: We highly recommend setting up the Lua Language Server (`:LspInstall lua_ls`)
|
||||||
|
-- as this provides autocomplete and documentation while editing
|
||||||
|
|
||||||
|
---@type LazySpec
|
||||||
|
return {
|
||||||
|
'AstroNvim/astrocore',
|
||||||
|
---@type AstroCoreOpts
|
||||||
|
opts = {
|
||||||
|
-- Configure core features of AstroNvim
|
||||||
|
features = {
|
||||||
|
large_buf = { size = 1024 * 256, lines = 10000 }, -- set global limits for large files for disabling features like treesitter
|
||||||
|
autopairs = true, -- enable autopairs at start
|
||||||
|
cmp = true, -- enable completion at start
|
||||||
|
diagnostics = { virtual_text = true, virtual_lines = false }, -- diagnostic settings on startup
|
||||||
|
highlighturl = true, -- highlight URLs at start
|
||||||
|
notifications = true, -- enable notifications at start
|
||||||
|
},
|
||||||
|
-- Diagnostics configuration (for vim.diagnostics.config({...})) when diagnostics are on
|
||||||
|
diagnostics = {
|
||||||
|
virtual_text = true,
|
||||||
|
underline = true,
|
||||||
|
},
|
||||||
|
-- passed to `vim.filetype.add`
|
||||||
|
filetypes = {
|
||||||
|
-- see `:h vim.filetype.add` for usage
|
||||||
|
extension = {
|
||||||
|
foo = 'fooscript',
|
||||||
|
},
|
||||||
|
filename = {
|
||||||
|
['.foorc'] = 'fooscript',
|
||||||
|
},
|
||||||
|
pattern = {
|
||||||
|
['.*/etc/foo/.*'] = 'fooscript',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- vim options can be configured here
|
||||||
|
options = {
|
||||||
|
opt = { -- vim.opt.<key>
|
||||||
|
relativenumber = true, -- sets vim.opt.relativenumber
|
||||||
|
number = true, -- sets vim.opt.number
|
||||||
|
spell = false, -- sets vim.opt.spell
|
||||||
|
signcolumn = 'yes', -- sets vim.opt.signcolumn to yes
|
||||||
|
wrap = false, -- sets vim.opt.wrap
|
||||||
|
},
|
||||||
|
g = { -- vim.g.<key>
|
||||||
|
-- configure global vim variables (vim.g)
|
||||||
|
-- NOTE: `mapleader` and `maplocalleader` must be set in the AstroNvim opts or before `lazy.setup`
|
||||||
|
-- This can be found in the `lua/lazy_setup.lua` file
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- Mappings can be configured through AstroCore as well.
|
||||||
|
-- NOTE: keycodes follow the casing in the vimdocs. For example, `<Leader>` must be capitalized
|
||||||
|
mappings = {
|
||||||
|
-- first key is the mode
|
||||||
|
n = {
|
||||||
|
-- second key is the lefthand side of the map
|
||||||
|
|
||||||
|
-- navigate buffer tabs
|
||||||
|
[']b'] = {
|
||||||
|
function()
|
||||||
|
require('astrocore.buffer').nav(vim.v.count1)
|
||||||
|
end,
|
||||||
|
desc = 'Next buffer',
|
||||||
|
},
|
||||||
|
['[b'] = {
|
||||||
|
function()
|
||||||
|
require('astrocore.buffer').nav(-vim.v.count1)
|
||||||
|
end,
|
||||||
|
desc = 'Previous buffer',
|
||||||
|
},
|
||||||
|
|
||||||
|
-- mappings seen under group name "Buffer"
|
||||||
|
['<Leader>bd'] = {
|
||||||
|
function()
|
||||||
|
require('astroui.status.heirline').buffer_picker(function(bufnr)
|
||||||
|
require('astrocore.buffer').close(bufnr)
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
desc = 'Close buffer from tabline',
|
||||||
|
},
|
||||||
|
|
||||||
|
['<Leader>xq'] = {
|
||||||
|
function()
|
||||||
|
local win_id
|
||||||
|
for _, win in ipairs(vim.fn.getwininfo()) do
|
||||||
|
if win.quickfix == 1 then
|
||||||
|
win_id = win.winid
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if win_id then
|
||||||
|
if vim.api.nvim_get_current_win() ~= win_id then
|
||||||
|
vim.api.nvim_set_current_win(win_id)
|
||||||
|
else
|
||||||
|
vim.cmd.cclose()
|
||||||
|
end
|
||||||
|
else
|
||||||
|
vim.cmd.copen()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
desc = 'Toggle Quickfix list',
|
||||||
|
},
|
||||||
|
|
||||||
|
['<Leader>xl'] = {
|
||||||
|
function()
|
||||||
|
local win_id
|
||||||
|
for _, win in ipairs(vim.fn.getwininfo()) do
|
||||||
|
if win.loclist == 1 then
|
||||||
|
win_id = win.winid
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if win_id then
|
||||||
|
if vim.api.nvim_get_current_win() ~= win_id then
|
||||||
|
vim.api.nvim_set_current_win(win_id)
|
||||||
|
else
|
||||||
|
vim.cmd.lclose()
|
||||||
|
end
|
||||||
|
else
|
||||||
|
vim.cmd.lopen()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
desc = 'Toggle Local list',
|
||||||
|
},
|
||||||
|
|
||||||
|
['<Leader>tr'] = {
|
||||||
|
function()
|
||||||
|
require('neotest').run.run()
|
||||||
|
end,
|
||||||
|
desc = 'Test: run nearest test',
|
||||||
|
},
|
||||||
|
|
||||||
|
['<Leader>td'] = {
|
||||||
|
function()
|
||||||
|
require('neotest').run.run { strategy = 'dap' }
|
||||||
|
end,
|
||||||
|
desc = 'Test: debug nearest test',
|
||||||
|
},
|
||||||
|
|
||||||
|
['<Leader>ta'] = {
|
||||||
|
function()
|
||||||
|
require('neotest').run.run(vim.fn.expand '%')
|
||||||
|
end,
|
||||||
|
desc = 'Test: run all test in file',
|
||||||
|
},
|
||||||
|
|
||||||
|
-- tables with just a `desc` key will be registered with which-key if it's installed
|
||||||
|
-- this is useful for naming menus
|
||||||
|
-- ["<Leader>b"] = { desc = "Buffers" },
|
||||||
|
|
||||||
|
-- setting a mapping to false will disable it
|
||||||
|
-- ["<C-S>"] = false,
|
||||||
|
},
|
||||||
|
|
||||||
|
v = {
|
||||||
|
['J'] = ":m '>+1<CR>gv=gv",
|
||||||
|
['K'] = ":m '<-2<CR>gv=gv",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
110
lua/plugins/astrolsp.lua
Normal file
110
lua/plugins/astrolsp.lua
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
-- AstroLSP allows you to customize the features in AstroNvim's LSP configuration engine
|
||||||
|
-- Configuration documentation can be found with `:h astrolsp`
|
||||||
|
-- NOTE: We highly recommend setting up the Lua Language Server (`:LspInstall lua_ls`)
|
||||||
|
-- as this provides autocomplete and documentation while editing
|
||||||
|
|
||||||
|
---@type LazySpec
|
||||||
|
return {
|
||||||
|
'AstroNvim/astrolsp',
|
||||||
|
---@type AstroLSPOpts
|
||||||
|
opts = {
|
||||||
|
-- Configuration table of features provided by AstroLSP
|
||||||
|
features = {
|
||||||
|
codelens = true, -- enable/disable codelens refresh on start
|
||||||
|
inlay_hints = false, -- enable/disable inlay hints on start
|
||||||
|
semantic_tokens = true, -- enable/disable semantic token highlighting
|
||||||
|
},
|
||||||
|
-- customize lsp formatting options
|
||||||
|
formatting = {
|
||||||
|
-- control auto formatting on save
|
||||||
|
format_on_save = {
|
||||||
|
enabled = true, -- enable or disable format on save globally
|
||||||
|
allow_filetypes = { -- enable format on save for specified filetypes only
|
||||||
|
-- "go",
|
||||||
|
},
|
||||||
|
ignore_filetypes = { -- disable format on save for specified filetypes
|
||||||
|
-- "python",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
disabled = { -- disable formatting capabilities for the listed language servers
|
||||||
|
-- disable lua_ls formatting capability if you want to use StyLua to format your lua code
|
||||||
|
-- "lua_ls",
|
||||||
|
},
|
||||||
|
timeout_ms = 1000, -- default format timeout
|
||||||
|
-- filter = function(client) -- fully override the default formatting function
|
||||||
|
-- return true
|
||||||
|
-- end
|
||||||
|
},
|
||||||
|
-- enable servers that you already have installed without mason
|
||||||
|
servers = {
|
||||||
|
-- "pyright"
|
||||||
|
},
|
||||||
|
-- customize language server configuration options passed to `lspconfig`
|
||||||
|
---@diagnostic disable: missing-fields
|
||||||
|
config = {
|
||||||
|
-- clangd = { capabilities = { offsetEncoding = "utf-8" } },
|
||||||
|
},
|
||||||
|
-- customize how language servers are attached
|
||||||
|
handlers = {
|
||||||
|
-- a function without a key is simply the default handler, functions take two parameters, the server name and the configured options table for that server
|
||||||
|
-- function(server, opts) require("lspconfig")[server].setup(opts) end
|
||||||
|
|
||||||
|
-- the key is the server that is being setup with `lspconfig`
|
||||||
|
-- rust_analyzer = false, -- setting a handler to false will disable the set up of that language server
|
||||||
|
-- pyright = function(_, opts) require("lspconfig").pyright.setup(opts) end -- or a custom handler function can be passed
|
||||||
|
},
|
||||||
|
-- Configure buffer local auto commands to add when attaching a language server
|
||||||
|
autocmds = {
|
||||||
|
-- first key is the `augroup` to add the auto commands to (:h augroup)
|
||||||
|
lsp_codelens_refresh = {
|
||||||
|
-- Optional condition to create/delete auto command group
|
||||||
|
-- can either be a string of a client capability or a function of `fun(client, bufnr): boolean`
|
||||||
|
-- condition will be resolved for each client on each execution and if it ever fails for all clients,
|
||||||
|
-- the auto commands will be deleted for that buffer
|
||||||
|
cond = 'textDocument/codeLens',
|
||||||
|
-- cond = function(client, bufnr) return client.name == "lua_ls" end,
|
||||||
|
-- list of auto commands to set
|
||||||
|
{
|
||||||
|
-- events to trigger
|
||||||
|
event = { 'InsertLeave', 'BufEnter' },
|
||||||
|
-- the rest of the autocmd options (:h nvim_create_autocmd)
|
||||||
|
desc = 'Refresh codelens (buffer)',
|
||||||
|
callback = function(args)
|
||||||
|
if require('astrolsp').config.features.codelens then
|
||||||
|
vim.lsp.codelens.refresh { bufnr = args.buf }
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- mappings to be set up on attaching of a language server
|
||||||
|
mappings = {
|
||||||
|
n = {
|
||||||
|
-- a `cond` key can provided as the string of a server capability to be required to attach, or a function with `client` and `bufnr` parameters from the `on_attach` that returns a boolean
|
||||||
|
gD = {
|
||||||
|
function()
|
||||||
|
vim.lsp.buf.declaration()
|
||||||
|
end,
|
||||||
|
desc = 'Declaration of current symbol',
|
||||||
|
cond = 'textDocument/declaration',
|
||||||
|
},
|
||||||
|
['<Leader>uY'] = {
|
||||||
|
function()
|
||||||
|
require('astrolsp.toggles').buffer_semantic_tokens()
|
||||||
|
end,
|
||||||
|
desc = 'Toggle LSP semantic highlight (buffer)',
|
||||||
|
cond = function(client)
|
||||||
|
return client.supports_method 'textDocument/semanticTokens/full' and vim.lsp.semantic_tokens ~= nil
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- A custom `on_attach` function to be run after the default `on_attach` function
|
||||||
|
-- takes two parameters `client` and `bufnr` (`:h lspconfig-setup`)
|
||||||
|
on_attach = function(client, bufnr)
|
||||||
|
-- this would disable semanticTokensProvider for all clients
|
||||||
|
-- client.server_capabilities.semanticTokensProvider = nil
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
35
lua/plugins/astroui.lua
Normal file
35
lua/plugins/astroui.lua
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
-- AstroUI provides the basis for configuring the AstroNvim User Interface
|
||||||
|
-- Configuration documentation can be found with `:h astroui`
|
||||||
|
|
||||||
|
---@type LazySpec
|
||||||
|
return {
|
||||||
|
'AstroNvim/astroui',
|
||||||
|
---@type AstroUIOpts
|
||||||
|
opts = {
|
||||||
|
colorscheme = 'tokyonight-moon',
|
||||||
|
-- AstroUI allows you to easily modify highlight groups easily for any and all colorschemes
|
||||||
|
highlights = {
|
||||||
|
init = { -- this table overrides highlights in all themes
|
||||||
|
-- Normal = { bg = "#000000" },
|
||||||
|
},
|
||||||
|
astrodark = { -- a table of overrides/changes when applying the astrotheme theme
|
||||||
|
-- Normal = { bg = "#000000" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
folding = false,
|
||||||
|
-- Icons can be configured throughout the interface
|
||||||
|
icons = {
|
||||||
|
-- configure the loading of the lsp in the status line
|
||||||
|
LSPLoading1 = '⠋',
|
||||||
|
LSPLoading2 = '⠙',
|
||||||
|
LSPLoading3 = '⠹',
|
||||||
|
LSPLoading4 = '⠸',
|
||||||
|
LSPLoading5 = '⠼',
|
||||||
|
LSPLoading6 = '⠴',
|
||||||
|
LSPLoading7 = '⠦',
|
||||||
|
LSPLoading8 = '⠧',
|
||||||
|
LSPLoading9 = '⠇',
|
||||||
|
LSPLoading10 = '⠏',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
9
lua/plugins/claude-code.lua
Normal file
9
lua/plugins/claude-code.lua
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
return {
|
||||||
|
'greggh/claude-code.nvim',
|
||||||
|
dependencies = {
|
||||||
|
'nvim-lua/plenary.nvim',
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require('claude-code').setup()
|
||||||
|
end,
|
||||||
|
}
|
||||||
19
lua/plugins/mason.lua
Normal file
19
lua/plugins/mason.lua
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
---@type LazySpec
|
||||||
|
return {
|
||||||
|
-- use mason-tool-installer for automatically installing Mason packages
|
||||||
|
{
|
||||||
|
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
||||||
|
-- overrides `require("mason-tool-installer").setup(...)`
|
||||||
|
opts = {
|
||||||
|
-- Make sure to use the names found in `:Mason`
|
||||||
|
ensure_installed = {
|
||||||
|
'jq',
|
||||||
|
'vacuum', -- openapi
|
||||||
|
'bash-language-server',
|
||||||
|
|
||||||
|
-- install any other package
|
||||||
|
'tree-sitter-cli',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
18
lua/plugins/neo-tree.lua
Normal file
18
lua/plugins/neo-tree.lua
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
return {
|
||||||
|
'nvim-neo-tree/neo-tree.nvim',
|
||||||
|
opts = function(_, opts)
|
||||||
|
opts.filesystem.filtered_items = {
|
||||||
|
visible = true,
|
||||||
|
always_show = { -- remains visible even if other settings would normally hide it
|
||||||
|
'.gitignore',
|
||||||
|
},
|
||||||
|
always_show_by_pattern = {
|
||||||
|
'.env*',
|
||||||
|
},
|
||||||
|
never_show = { -- remains hidden even if visible is toggled to true, this overrides always_show
|
||||||
|
'.DS_Store',
|
||||||
|
--"thumbs.db"
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
}
|
||||||
24
lua/plugins/none-ls.lua
Normal file
24
lua/plugins/none-ls.lua
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE
|
||||||
|
|
||||||
|
-- Customize None-ls sources
|
||||||
|
|
||||||
|
---@type LazySpec
|
||||||
|
return {
|
||||||
|
"nvimtools/none-ls.nvim",
|
||||||
|
opts = function(_, opts)
|
||||||
|
-- opts variable is the default configuration table for the setup function call
|
||||||
|
-- local null_ls = require "null-ls"
|
||||||
|
|
||||||
|
-- Check supported formatters and linters
|
||||||
|
-- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/formatting
|
||||||
|
-- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics
|
||||||
|
|
||||||
|
-- Only insert new sources, do not replace the existing ones
|
||||||
|
-- (If you wish to replace, use `opts.sources = {}` instead of the `list_insert_unique` function)
|
||||||
|
opts.sources = require("astrocore").list_insert_unique(opts.sources, {
|
||||||
|
-- Set a formatter
|
||||||
|
-- null_ls.builtins.formatting.stylua,
|
||||||
|
-- null_ls.builtins.formatting.prettier,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
19
lua/plugins/treesitter.lua
Normal file
19
lua/plugins/treesitter.lua
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
-- Customize Treesitter
|
||||||
|
|
||||||
|
---@type LazySpec
|
||||||
|
return {
|
||||||
|
'nvim-treesitter/nvim-treesitter',
|
||||||
|
opts = {
|
||||||
|
ensure_installed = {
|
||||||
|
'bash',
|
||||||
|
'diff',
|
||||||
|
'html',
|
||||||
|
'luadoc',
|
||||||
|
'markdown',
|
||||||
|
'markdown_inline',
|
||||||
|
'query',
|
||||||
|
'vim',
|
||||||
|
'vimdoc',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
77
lua/plugins/user.lua
Normal file
77
lua/plugins/user.lua
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
-- You can also add or configure plugins by creating files in this `plugins/` folder
|
||||||
|
-- PLEASE REMOVE THE EXAMPLES YOU HAVE NO INTEREST IN BEFORE ENABLING THIS FILE
|
||||||
|
-- Here are some examples:
|
||||||
|
|
||||||
|
---@type LazySpec
|
||||||
|
return {
|
||||||
|
|
||||||
|
-- == Examples of Adding Plugins ==
|
||||||
|
|
||||||
|
{
|
||||||
|
'ray-x/lsp_signature.nvim',
|
||||||
|
event = 'BufRead',
|
||||||
|
config = function()
|
||||||
|
require('lsp_signature').setup()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- == Examples of Overriding Plugins ==
|
||||||
|
|
||||||
|
-- customize dashboard options
|
||||||
|
{
|
||||||
|
'folke/snacks.nvim',
|
||||||
|
opts = {
|
||||||
|
dashboard = {
|
||||||
|
preset = {
|
||||||
|
header = table.concat({
|
||||||
|
' █████ ███████ ████████ ██████ ██████ ',
|
||||||
|
'██ ██ ██ ██ ██ ██ ██ ██',
|
||||||
|
'███████ ███████ ██ ██████ ██ ██',
|
||||||
|
'██ ██ ██ ██ ██ ██ ██ ██',
|
||||||
|
'██ ██ ███████ ██ ██ ██ ██████ ',
|
||||||
|
'',
|
||||||
|
'███ ██ ██ ██ ██ ███ ███',
|
||||||
|
'████ ██ ██ ██ ██ ████ ████',
|
||||||
|
'██ ██ ██ ██ ██ ██ ██ ████ ██',
|
||||||
|
'██ ██ ██ ██ ██ ██ ██ ██ ██',
|
||||||
|
'██ ████ ████ ██ ██ ██',
|
||||||
|
}, '\n'),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- You can disable default plugins as follows:
|
||||||
|
{ 'max397574/better-escape.nvim', enabled = false },
|
||||||
|
|
||||||
|
-- You can also easily customize additional setup of plugins that is outside of the plugin's setup call
|
||||||
|
{
|
||||||
|
'L3MON4D3/LuaSnip',
|
||||||
|
config = function(plugin, opts)
|
||||||
|
require 'astronvim.plugins.configs.luasnip'(plugin, opts) -- include the default astronvim config that calls the setup call
|
||||||
|
-- add more custom luasnip configuration such as filetype extend or custom snippets
|
||||||
|
local luasnip = require 'luasnip'
|
||||||
|
luasnip.filetype_extend('javascript', { 'javascriptreact' })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
'windwp/nvim-autopairs',
|
||||||
|
config = function(plugin, opts)
|
||||||
|
require 'astronvim.plugins.configs.nvim-autopairs'(plugin, opts) -- include the default astronvim config that calls the setup call
|
||||||
|
-- local npairs = require "nvim-autopairs"
|
||||||
|
-- local Rule = require "nvim-autopairs.rule"
|
||||||
|
|
||||||
|
-- npairs.add_rules(
|
||||||
|
-- -- disable for .vim files, but it work for another filetypes
|
||||||
|
-- Rule("a", "a", "-vim")
|
||||||
|
-- )
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
'folke/todo-comments.nvim',
|
||||||
|
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||||
|
opts = {},
|
||||||
|
},
|
||||||
|
}
|
||||||
5
lua/polish.lua
Normal file
5
lua/polish.lua
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
if true then return end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE
|
||||||
|
|
||||||
|
-- This will run last in the setup process.
|
||||||
|
-- This is just pure lua so anything that doesn't
|
||||||
|
-- fit in the normal config locations above can go here
|
||||||
6
neovim.yml
Normal file
6
neovim.yml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
base: lua51
|
||||||
|
|
||||||
|
globals:
|
||||||
|
vim:
|
||||||
|
any: true
|
||||||
8
selene.toml
Normal file
8
selene.toml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
std = "neovim"
|
||||||
|
|
||||||
|
[rules]
|
||||||
|
global_usage = "allow"
|
||||||
|
if_same_then_else = "allow"
|
||||||
|
incorrect_standard_library_use = "allow"
|
||||||
|
mixed_table = "allow"
|
||||||
|
multiple_statements = "allow"
|
||||||
Reference in New Issue
Block a user