Cleanup and switched to dot- prefix now that stow has been fixed
This commit is contained in:
4
nvim/dot-config/nvim/.gitignore
vendored
Normal file
4
nvim/dot-config/nvim/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
tags
|
||||
test.sh
|
||||
.luarc.json
|
||||
nvim
|
||||
19
nvim/dot-config/nvim/LICENSE.md
Normal file
19
nvim/dot-config/nvim/LICENSE.md
Normal file
@@ -0,0 +1,19 @@
|
||||
MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
130
nvim/dot-config/nvim/README.md
Normal file
130
nvim/dot-config/nvim/README.md
Normal file
@@ -0,0 +1,130 @@
|
||||
# kickstart.nvim
|
||||
|
||||
### Introduction
|
||||
|
||||
A starting point for Neovim that is:
|
||||
|
||||
* Small
|
||||
* Single-file (with examples of moving to multi-file)
|
||||
* Documented
|
||||
* Modular
|
||||
|
||||
This repo is meant to be used as by **YOU** to begin your Neovim journey; remove the things you don't use and add what you miss.
|
||||
|
||||
Distribution Alternatives:
|
||||
- [LazyVim](https://www.lazyvim.org/): A delightful distribution maintained by @folke (the author of lazy.nvim, the package manager used here)
|
||||
|
||||
### Installation
|
||||
|
||||
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.
|
||||
|
||||
* Backup your previous configuration
|
||||
* (Recommended) Fork this repo (so that you have your own copy that you can modify).
|
||||
* Clone the kickstart repo into `$HOME/.config/nvim/` (Linux/Mac) or `~/AppData/Local/nvim/` (Windows)
|
||||
* If you don't want to include it as a git repo, you can just clone it and then move the files to this location
|
||||
* Start Neovim (`nvim`) and allow `lazy.nvim` to complete installation.
|
||||
* Restart Neovim
|
||||
* **You're ready to go!**
|
||||
|
||||
Additional system requirements:
|
||||
- Make sure to review the readmes of the plugins if you are experiencing errors. In particular:
|
||||
- [ripgrep](https://github.com/BurntSushi/ripgrep#installation) is required for multiple [telescope](https://github.com/nvim-telescope/telescope.nvim#suggested-dependencies) pickers.
|
||||
- See as well [Windows Installation](#Windows-Installation)
|
||||
|
||||
### Configuration And Extension
|
||||
|
||||
* Inside of your fork, feel free to modify any file you like! It's your fork!
|
||||
* Then there are two primary configuration options available:
|
||||
* Include the `lua/kickstart/plugins/*` files in your configuration.
|
||||
* Add new configuration in `lua/custom/plugins/*` files, which will be auto sourced using `lazy.nvim`
|
||||
* NOTE: To enable this, you need to uncomment `{ import = 'custom.plugins' }` in your `init.lua`
|
||||
|
||||
You can also merge updates/changes from the repo back into your fork, to keep up-to-date with any changes for the default configuration
|
||||
|
||||
#### Example: Adding an autopairs plugin
|
||||
|
||||
In the file: `lua/custom/plugins/autopairs.lua`, add:
|
||||
|
||||
```lua
|
||||
-- File: lua/custom/plugins/autopairs.lua
|
||||
|
||||
return {
|
||||
"windwp/nvim-autopairs",
|
||||
config = function()
|
||||
require("nvim-autopairs").setup {}
|
||||
end,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
This will automatically install `nvim-autopairs` and enable it on startup. For more information, see documentation for [lazy.nvim](https://github.com/folke/lazy.nvim).
|
||||
|
||||
#### Example: Adding a file tree plugin
|
||||
|
||||
In the file: `lua/custom/plugins/filetree.lua`, add:
|
||||
|
||||
```lua
|
||||
-- Unless you are still migrating, remove the deprecated commands from v1.x
|
||||
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]])
|
||||
|
||||
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",
|
||||
},
|
||||
config = function ()
|
||||
require('neo-tree').setup {}
|
||||
end,
|
||||
}
|
||||
```
|
||||
|
||||
This will install the tree plugin and add the command `:NeoTree` for you. You can explore the documentation at [neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim) for more information.
|
||||
|
||||
#### Example: Adding a file to change default options
|
||||
|
||||
To change default options, you can add a file in the `/after/plugin/` folder (see `:help load-plugins`) to include your own options, keymaps, autogroups, and more. The following is an example `defaults.lua` file (located at `$HOME/.config/nvim/after/plugin/defaults.lua`).
|
||||
|
||||
```lua
|
||||
vim.opt.relativenumber = true
|
||||
|
||||
vim.keymap.set('n', '<leader>sr', require('telescope.builtin').resume, { desc = '[S]earch [R]esume' })
|
||||
```
|
||||
|
||||
### Contribution
|
||||
|
||||
Pull-requests are welcome. The goal of this repo is not to create a Neovim configuration framework, but to offer a starting template that shows, by example, available features in Neovim. Some things that will not be included:
|
||||
|
||||
* Custom language server configuration (null-ls templates)
|
||||
* Theming beyond a default colorscheme necessary for LSP highlight groups
|
||||
|
||||
Each PR, especially those which increase the line count, should have a description as to why the PR is necessary.
|
||||
|
||||
### FAQ
|
||||
|
||||
* What should I do if I already have a pre-existing neovim configuration?
|
||||
* You should back it up, then delete all files associated with it.
|
||||
* This includes your existing init.lua and the neovim files in `~/.local` which can be deleted with `rm -rf ~/.local/share/nvim/`
|
||||
* You may also want to look at the [migration guide for lazy.nvim](https://github.com/folke/lazy.nvim#-migration-guide)
|
||||
* What if I want to "uninstall" this configuration:
|
||||
* See [lazy.nvim uninstall](https://github.com/folke/lazy.nvim#-uninstalling) information
|
||||
* Are there any cool videos about this plugin?
|
||||
* Current iteration of kickstart (coming soon)
|
||||
* Here is one about the previous iteration of kickstart: [video introduction to Kickstart.nvim](https://youtu.be/stqUbv-5u2s).
|
||||
|
||||
### Windows Installation
|
||||
|
||||
Installation may require installing build tools, and updating the run command for `telescope-fzf-native`
|
||||
|
||||
See `telescope-fzf-native` documention 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' }
|
||||
```
|
||||
|
||||
607
nvim/dot-config/nvim/init.lua
Normal file
607
nvim/dot-config/nvim/init.lua
Normal file
@@ -0,0 +1,607 @@
|
||||
--[[
|
||||
|
||||
=====================================================================
|
||||
==================== READ THIS BEFORE CONTINUING ====================
|
||||
=====================================================================
|
||||
|
||||
Kickstart.nvim is *not* a distribution.
|
||||
|
||||
Kickstart.nvim is a template for your own configuration.
|
||||
The goal is that you can read every line of code, top-to-bottom, and understand
|
||||
what your configuration is doing.
|
||||
|
||||
Once you've done that, you should start exploring, configuring and tinkering to
|
||||
explore Neovim!
|
||||
|
||||
If you don't know anything about Lua, I recommend taking some time to read through
|
||||
a guide. One possible example:
|
||||
- https://learnxinyminutes.com/docs/lua/
|
||||
|
||||
And then you can explore or search through `:help lua-guide`
|
||||
|
||||
|
||||
Kickstart Guide:
|
||||
|
||||
I have left several `:help X` comments throughout the init.lua
|
||||
You should run that command and read that help section for more information.
|
||||
|
||||
In addition, I have some `NOTE:` items throughout the file.
|
||||
These are for you, the reader to help understand what is happening. Feel free to delete
|
||||
them once you know what you're doing, but they should serve as a guide for when you
|
||||
are first encountering a few different constructs in your nvim config.
|
||||
|
||||
I hope you enjoy your Neovim journey,
|
||||
- TJ
|
||||
|
||||
P.S. You can delete this when you're done too. It's your config now :)
|
||||
--]]
|
||||
-- Set <space> as the leader key
|
||||
-- See `:help mapleader`
|
||||
-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used)
|
||||
vim.g.mapleader = ' '
|
||||
vim.g.maplocalleader = ' '
|
||||
|
||||
-- Install package 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 {
|
||||
'git',
|
||||
'clone',
|
||||
'--filter=blob:none',
|
||||
'https://github.com/folke/lazy.nvim.git',
|
||||
'--branch=stable', -- latest stable release
|
||||
lazypath,
|
||||
}
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
local symbols = require('constant.symbols');
|
||||
local border = 'rounded';
|
||||
|
||||
-- NOTE: Here is where you install your plugins.
|
||||
-- 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: This is where your plugins related to LSP can be installed.
|
||||
-- The configuration is done below. Search for lspconfig to find it below.
|
||||
{
|
||||
-- LSP Configuration & Plugins
|
||||
'neovim/nvim-lspconfig',
|
||||
dependencies = {
|
||||
-- Automatically install LSPs to stdpath for neovim
|
||||
'williamboman/mason.nvim',
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
|
||||
-- Useful status updates for LSP
|
||||
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
|
||||
{ 'j-hui/fidget.nvim', opts = {} },
|
||||
|
||||
-- Additional lua configuration, makes nvim stuff amazing!
|
||||
'folke/neodev.nvim',
|
||||
|
||||
-- Add document color
|
||||
'mrshmllow/document-color.nvim',
|
||||
|
||||
'b0o/schemastore.nvim',
|
||||
|
||||
-- Rename with immediate visual feedback
|
||||
{
|
||||
'smjonas/inc-rename.nvim',
|
||||
config = function()
|
||||
require('inc_rename').setup {
|
||||
preview_empty_name = true,
|
||||
}
|
||||
end
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
'ray-x/lsp_signature.nvim',
|
||||
dependencies = {
|
||||
'neovim/nvim-lspconfig',
|
||||
},
|
||||
opts = {
|
||||
hint_enable = false,
|
||||
handler_opts = {
|
||||
border = border
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
-- Autocompletion
|
||||
'hrsh7th/nvim-cmp',
|
||||
dependencies = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip', 'hrsh7th/cmp-path',
|
||||
'onsails/lspkind-nvim', },
|
||||
},
|
||||
|
||||
-- Useful plugin to show you pending keybinds.
|
||||
{ 'folke/which-key.nvim', opts = {} },
|
||||
{
|
||||
-- Adds git releated signs to the gutter, as well as utilities for managing changes
|
||||
'lewis6991/gitsigns.nvim',
|
||||
init = function()
|
||||
vim.keymap.set('n', '<leader>gs', require('gitsigns.actions').stage_hunk, { desc = "[G]it [S]tage hunk" })
|
||||
vim.keymap.set('n', '<leader>gS', require('gitsigns.actions').undo_stage_hunk, { desc = "[G]it undo [S]tage hunk" })
|
||||
vim.keymap.set('n', '<leader>gd', require('gitsigns.actions').preview_hunk_inline, { desc = "[G]it [D]iff hunk " })
|
||||
vim.keymap.set('n', ']g', require('gitsigns.actions').next_hunk, { desc = "Go to next hunk" })
|
||||
vim.keymap.set('n', '[g', require('gitsigns.actions').prev_hunk, { desc = "Go to previous hunk" })
|
||||
end,
|
||||
opts = {
|
||||
-- See `:help gitsigns.txt`
|
||||
signs = {
|
||||
add = { text = '+' },
|
||||
change = { text = '~' },
|
||||
delete = { text = '_' },
|
||||
topdelete = { text = '‾' },
|
||||
changedelete = { text = '~' },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
-- Set lualine as statusline
|
||||
'nvim-lualine/lualine.nvim',
|
||||
-- See `:help lualine.txt`
|
||||
opts = {
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = 'gruvbox',
|
||||
component_separators = { left = '', right = '' },
|
||||
section_separators = { left = '', right = '' },
|
||||
},
|
||||
sections = {
|
||||
lualine_b = {
|
||||
'branch',
|
||||
'diff',
|
||||
{ 'diagnostics', symbols = { error = '', warn = '', info = '', hint = '' } },
|
||||
},
|
||||
lualine_c = {
|
||||
{
|
||||
'filename',
|
||||
path = 1,
|
||||
symbols = {
|
||||
modified = symbols.file.modified,
|
||||
readonly = symbols.file.readonly,
|
||||
}
|
||||
},
|
||||
},
|
||||
lualine_x = {
|
||||
'encoding', { 'fileformat', icons_enabled = false }, 'filetype',
|
||||
},
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_c = {
|
||||
{ 'filename', path = 1 },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
-- Add indentation guides even on blank lines
|
||||
'lukas-reineke/indent-blankline.nvim',
|
||||
-- Enable `lukas-reineke/indent-blankline.nvim`
|
||||
-- See `:help indent_blankline.txt`
|
||||
main = "ibl",
|
||||
opts = {
|
||||
indent = {
|
||||
char = '¦',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
-- Fuzzy Finder (files, lsp, etc)
|
||||
{
|
||||
'nvim-telescope/telescope.nvim',
|
||||
version = '*',
|
||||
dependencies = { 'nvim-lua/plenary.nvim',
|
||||
'nvim-telescope/telescope-ui-select.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',
|
||||
'nvim-treesitter/nvim-treesitter-context',
|
||||
},
|
||||
config = function()
|
||||
pcall(require('nvim-treesitter.install').update { with_sync = true })
|
||||
end,
|
||||
},
|
||||
|
||||
require 'themes.gruvbox',
|
||||
{ import = 'plugins' },
|
||||
}, {
|
||||
install = {
|
||||
colorscheme = {
|
||||
'gruvbox',
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
require('options')
|
||||
require('keymaps')
|
||||
require('autocmds')
|
||||
|
||||
-- [[ Configure Telescope ]]
|
||||
-- See `:help telescope` and `:help telescope.setup()`
|
||||
require('telescope').setup {
|
||||
pickers = {
|
||||
find_files = {
|
||||
hidden = true,
|
||||
},
|
||||
},
|
||||
defaults = {
|
||||
file_ignore_patterns = {
|
||||
".git/",
|
||||
},
|
||||
mappings = {
|
||||
n = {
|
||||
['<c-d>'] = "delete_buffer",
|
||||
['<Tab>'] = "move_selection_next",
|
||||
['<S-Tab>'] = "move_selection_previous",
|
||||
},
|
||||
i = {
|
||||
['<c-d>'] = "delete_buffer",
|
||||
['<Tab>'] = "move_selection_next",
|
||||
['<S-Tab>'] = "move_selection_previous",
|
||||
},
|
||||
},
|
||||
},
|
||||
extensions = {
|
||||
["ui-select"] = {
|
||||
require('telescope.themes').get_dropdown {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-- Enable telescope fzf native, if installed
|
||||
pcall(require('telescope').load_extension, 'fzf')
|
||||
pcall(require('telescope').load_extension, 'ui-select')
|
||||
|
||||
-- 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()
|
||||
require('telescope.builtin').current_buffer_fuzzy_find({
|
||||
-- Show matches in the order they appear in the document
|
||||
sorting_strategy = "ascending",
|
||||
})
|
||||
end, { desc = '[/] Fuzzily search in current buffer' })
|
||||
|
||||
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', function()
|
||||
require('telescope.builtin').grep_string({
|
||||
-- Show matches in the order they appear in the document
|
||||
sorting_strategy = "ascending",
|
||||
})
|
||||
end, { 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>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`
|
||||
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', 'typescript', 'vimdoc', 'vim', 'markdown',
|
||||
'markdown_inline', 'bash', 'zig' },
|
||||
|
||||
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
|
||||
auto_install = true,
|
||||
|
||||
highlight = { enable = true },
|
||||
-- Disabled because it caueses issues with nvim-autopair
|
||||
indent = { enable = false, disable = { 'python' } },
|
||||
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',
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- LSP settings.
|
||||
|
||||
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(
|
||||
vim.lsp.handlers.hover,
|
||||
{ border = border }
|
||||
)
|
||||
|
||||
vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(
|
||||
vim.lsp.handlers.hover,
|
||||
{ border = border }
|
||||
)
|
||||
|
||||
vim.diagnostic.config {
|
||||
float = {
|
||||
border = border
|
||||
}
|
||||
}
|
||||
|
||||
-- Set the diagnostic symbols (Also used by Neo-tree)
|
||||
local signs = {
|
||||
Error = symbols.diagnostic.error,
|
||||
Warn = symbols.diagnostic.warning,
|
||||
Hint = symbols.diagnostic.hint,
|
||||
Info = symbols.diagnostic.info
|
||||
}
|
||||
for type, icon in pairs(signs) do
|
||||
local hl = "DiagnosticSign" .. type
|
||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
|
||||
end
|
||||
|
||||
-- This function gets run when an LSP connects to a particular buffer.
|
||||
local on_attach = function(client, 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
|
||||
|
||||
vim.keymap.set('n', '<leader>rn', function()
|
||||
return ':IncRename ' .. vim.fn.expand('<cword>')
|
||||
end, { expr = true, desc = '[R]e[n]ame' })
|
||||
|
||||
-- nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
|
||||
-- Should allow code actions in visual mode
|
||||
vim.keymap.set({ 'v', 'n' }, '<leader>ca', vim.lsp.buf.code_action,
|
||||
{ buffer = bufnr, desc = 'LSP: [C]ode [A]ction', remap = true })
|
||||
-- nmap('<leader>ca', require('telescope.builtin')., '[C]ode [A]ction')
|
||||
|
||||
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
|
||||
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
||||
nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation')
|
||||
nmap('<leader>D', vim.lsp.buf.type_definition, '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' })
|
||||
|
||||
-- Format on save
|
||||
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.format()
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
-- Attach document colour support
|
||||
if client.server_capabilities.colorProvider then
|
||||
require("document-color").buf_attach(bufnr)
|
||||
end
|
||||
end
|
||||
|
||||
-- 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
|
||||
-- the `settings` field of the server config. You must look up that documentation yourself.
|
||||
local servers = {
|
||||
clangd = {},
|
||||
gopls = {},
|
||||
pyright = {},
|
||||
zls = {},
|
||||
rust_analyzer = {
|
||||
-- enable clippy on save
|
||||
["rust-analyzer"] = {
|
||||
checkOnSave = {
|
||||
command = "clippy",
|
||||
},
|
||||
check = {
|
||||
allTargets = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
tsserver = {},
|
||||
tailwindcss = {},
|
||||
-- cssls = {},
|
||||
|
||||
lua_ls = {
|
||||
Lua = {
|
||||
workspace = { checkThirdParty = false },
|
||||
telemetry = { enable = false },
|
||||
},
|
||||
},
|
||||
jsonls = {
|
||||
json = {
|
||||
schemas = require('schemastore').json.schemas(),
|
||||
},
|
||||
},
|
||||
yamlls = {
|
||||
yaml = {
|
||||
schemas = require('schemastore').yaml.schemas(),
|
||||
},
|
||||
},
|
||||
taplo = {},
|
||||
cmake = {}
|
||||
}
|
||||
|
||||
-- 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)
|
||||
capabilities.textDocument.colorProvider = {
|
||||
dynamicRegistration = true
|
||||
}
|
||||
|
||||
-- Setup mason so it can manage external tooling
|
||||
require('mason').setup()
|
||||
|
||||
-- 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],
|
||||
}
|
||||
end,
|
||||
}
|
||||
|
||||
-- nvim-cmp setup
|
||||
local cmp = require 'cmp'
|
||||
local luasnip = require 'luasnip'
|
||||
local lspkind = require 'lspkind'
|
||||
|
||||
luasnip.config.setup {}
|
||||
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
-- Include the source of the cmp entry
|
||||
formatting = {
|
||||
format = lspkind.cmp_format({
|
||||
mode = "text",
|
||||
menu = {
|
||||
nvim_lsp = "[LSP]",
|
||||
luasnip = "[LuaSnip]",
|
||||
path = "[Path]",
|
||||
},
|
||||
}),
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert {
|
||||
['<C-u>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete {},
|
||||
['<CR>'] = cmp.mapping.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
},
|
||||
['<Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_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.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
},
|
||||
sources = {
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'path' },
|
||||
},
|
||||
}
|
||||
|
||||
-- The line beneath this is called `modeline`. See `:help modeline`
|
||||
-- vim: ts=2 sts=2 sw=2 et
|
||||
48
nvim/dot-config/nvim/lazy-lock.json
Normal file
48
nvim/dot-config/nvim/lazy-lock.json
Normal file
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
|
||||
"LuaSnip": { "branch": "master", "commit": "be7be2ca7f55bb881a7ffc16b2efa5af034ab06b" },
|
||||
"bufferline.nvim": { "branch": "main", "commit": "243893ba9d5d1049dd451a25cab32ec7f8f67bcf" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
|
||||
"document-color.nvim": { "branch": "main", "commit": "74c487f0e5accfaae033755451b9e367220693fd" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "1ba38e4cbb24683973e00c2e36f53ae64da38ef5" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "c097cb255096f333e14d341082a84f572b394fa2" },
|
||||
"gruvbox.nvim": { "branch": "main", "commit": "487598d979868224aff92cf8818195c1a60e5dfe" },
|
||||
"guess-indent.nvim": { "branch": "main", "commit": "b8ae749fce17aa4c267eec80a6984130b94f80b2" },
|
||||
"inc-rename.nvim": { "branch": "main", "commit": "5e03e986625961d1fac296d1bf332a6510c3add6" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "3d08501caef2329aba5121b753e903904088f7e6" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "31ddbea7c10b6920c9077b66c97951ca8682d5c8" },
|
||||
"lsp_signature.nvim": { "branch": "master", "commit": "c6aeb2f1d2538bbdfdaab1664d9d4c3c75aa9db8" },
|
||||
"lspkind-nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "44509689b9bf3984d729cc264aacb31cb7f41668" },
|
||||
"mason.nvim": { "branch": "main", "commit": "751b1fcbf3d3b783fcf8d48865264a9bcd8f9b10" },
|
||||
"neo-tree.nvim": { "branch": "v2.x", "commit": "b529fb2ae9206ca1d84ee72b596deecbc088ac59" },
|
||||
"neodev.nvim": { "branch": "main", "commit": "ce9a2e8eaba5649b553529c5498acb43a6c317cd" },
|
||||
"nui.nvim": { "branch": "main", "commit": "cbd2668414331c10039278f558630ed19b93e69b" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "4f41e5940bc0443fdbe5f995e2a596847215cd2a" },
|
||||
"nvim-bufdel": { "branch": "main", "commit": "523d58e94e7212fff3e05c247b962dc8f93bcfde" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "ce16de5665c766f39c271705b17fff06f7bcb84f" },
|
||||
"nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "b3014f2209503944f2714cf27c95591433a0c7d8" },
|
||||
"nvim-surround": { "branch": "main", "commit": "a4e30d33add8a9743b4f518b3a788b3c8e5def71" },
|
||||
"nvim-tmux-navigation": { "branch": "main", "commit": "4898c98702954439233fdaf764c39636681e2861" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "b0ac1135fe304edd34e18204304906744db0fe63" },
|
||||
"nvim-treesitter-context": { "branch": "master", "commit": "f19766163c18515fb4d3c12d572bf9cba6cdb990" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "67ac27f859ee3f7584f3edef81d0942bb61d5344" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "531f48334c422222aebc888fd36e7d109cb354cd" },
|
||||
"peek.nvim": { "branch": "master", "commit": "5820d937d5414baea5f586dc2a3d912a74636e5b" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "8aad4396840be7fc42896e3011751b7609ca4119" },
|
||||
"schemastore.nvim": { "branch": "main", "commit": "c5d5abc86910fb31b9f734cae2547322e81d3a26" },
|
||||
"symbols-outline.nvim": { "branch": "master", "commit": "564ee65dfc9024bdde73a6621820866987cbb256" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" },
|
||||
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "6312868392331c9c0f22725041f1ec2bef57c751" },
|
||||
"todo-comments.nvim": { "branch": "main", "commit": "a736bbe08c8eff370dfa60701f1e669816d4e3c8" },
|
||||
"treesj": { "branch": "main", "commit": "60e27280030f9cd8dfb6ceb335922c6ff76682cc" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "b9cf677f20bb2faa2dacfa870b084e568dca9572" },
|
||||
"undotree": { "branch": "master", "commit": "aa93a7e5890dbbebbc064cd22260721a6db1a196" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" },
|
||||
"whitespace.nvim": { "branch": "master", "commit": "34d319e07f86a628deeb237133088f01f8432bc0" }
|
||||
}
|
||||
34
nvim/dot-config/nvim/lua/autocmds.lua
Normal file
34
nvim/dot-config/nvim/lua/autocmds.lua
Normal file
@@ -0,0 +1,34 @@
|
||||
-- Highlight on yank
|
||||
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
|
||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||
callback = function()
|
||||
vim.highlight.on_yank({ higroup = 'YankHighlight' })
|
||||
end,
|
||||
group = highlight_group,
|
||||
pattern = '*',
|
||||
})
|
||||
|
||||
-- show cursor line only in active window
|
||||
local cursor_group = vim.api.nvim_create_augroup('ActiveCursor', { clear = true })
|
||||
vim.api.nvim_create_autocmd({ "InsertLeave", "WinEnter" }, {
|
||||
callback = function()
|
||||
local ok, cl = pcall(vim.api.nvim_win_get_var, 0, "auto-cursorline")
|
||||
if ok and cl then
|
||||
vim.wo.cursorline = true
|
||||
vim.api.nvim_win_del_var(0, "auto-cursorline")
|
||||
end
|
||||
end,
|
||||
group = cursor_group,
|
||||
pattern = '*',
|
||||
})
|
||||
vim.api.nvim_create_autocmd({ "InsertEnter", "WinLeave" }, {
|
||||
callback = function()
|
||||
local cl = vim.wo.cursorline
|
||||
if cl then
|
||||
vim.api.nvim_win_set_var(0, "auto-cursorline", cl)
|
||||
vim.wo.cursorline = false
|
||||
end
|
||||
end,
|
||||
group = cursor_group,
|
||||
pattern = '*',
|
||||
})
|
||||
15
nvim/dot-config/nvim/lua/constant/symbols/diagnostic.lua
Normal file
15
nvim/dot-config/nvim/lua/constant/symbols/diagnostic.lua
Normal file
@@ -0,0 +1,15 @@
|
||||
-- Symbols to use for diagnostics
|
||||
return {
|
||||
-- LSP Status symbols
|
||||
error = "",
|
||||
warning = "",
|
||||
info = "",
|
||||
hint = "",
|
||||
-- Comment type symbols
|
||||
bug = "",
|
||||
todo = "",
|
||||
hack = "",
|
||||
performance = "",
|
||||
note = "",
|
||||
test = "",
|
||||
}
|
||||
6
nvim/dot-config/nvim/lua/constant/symbols/file.lua
Normal file
6
nvim/dot-config/nvim/lua/constant/symbols/file.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
-- Symbols to use for files
|
||||
return {
|
||||
icon = '',
|
||||
modified = '●',
|
||||
readonly = ''
|
||||
}
|
||||
6
nvim/dot-config/nvim/lua/constant/symbols/fold.lua
Normal file
6
nvim/dot-config/nvim/lua/constant/symbols/fold.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
-- Symbols to use for folds
|
||||
return {
|
||||
open = '',
|
||||
closed = '',
|
||||
empty = ''
|
||||
}
|
||||
14
nvim/dot-config/nvim/lua/constant/symbols/git.lua
Normal file
14
nvim/dot-config/nvim/lua/constant/symbols/git.lua
Normal file
@@ -0,0 +1,14 @@
|
||||
-- Symbols to use for git
|
||||
return {
|
||||
-- Change type
|
||||
added = '✚',
|
||||
modified = '●',
|
||||
deleted = '✖',
|
||||
renamed = '',
|
||||
-- Status type
|
||||
untracked = '',
|
||||
ignored = '',
|
||||
unstaged = '',
|
||||
staged = '',
|
||||
conflict = '',
|
||||
}
|
||||
6
nvim/dot-config/nvim/lua/constant/symbols/init.lua
Normal file
6
nvim/dot-config/nvim/lua/constant/symbols/init.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
return {
|
||||
diagnostic = require("constant.symbols.diagnostic"),
|
||||
fold = require("constant.symbols.fold"),
|
||||
file = require("constant.symbols.file"),
|
||||
git = require("constant.symbols.git"),
|
||||
}
|
||||
25
nvim/dot-config/nvim/lua/keymaps.lua
Normal file
25
nvim/dot-config/nvim/lua/keymaps.lua
Normal file
@@ -0,0 +1,25 @@
|
||||
-- See `:help vim.keymap.set()`
|
||||
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { noremap = true, silent = true })
|
||||
|
||||
-- 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 })
|
||||
|
||||
-- Keybinds for resizing windows
|
||||
vim.keymap.set("n", "<S-Up>", "<cmd>resize +2<CR>")
|
||||
vim.keymap.set("n", "<S-Down>", "<cmd>resize -2<CR>")
|
||||
vim.keymap.set("n", "<S-Left>", "<cmd>vertical resize -2<CR>")
|
||||
vim.keymap.set("n", "<S-Right>", "<cmd>vertical resize +2<CR>")
|
||||
|
||||
-- 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" })
|
||||
-- Disabled in favor of using Trouble (<F3>)
|
||||
-- vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = "Open diagnostics list" })
|
||||
|
||||
-- Some nice adjustments
|
||||
vim.keymap.set('n', '<C-d>', '<C-d>zz')
|
||||
vim.keymap.set('n', '<C-u>', '<C-u>zz')
|
||||
vim.keymap.set('n', 'n', 'nzz')
|
||||
vim.keymap.set('n', 'N', 'Nzz')
|
||||
54
nvim/dot-config/nvim/lua/options.lua
Normal file
54
nvim/dot-config/nvim/lua/options.lua
Normal file
@@ -0,0 +1,54 @@
|
||||
-- See `:help vim.o`
|
||||
-- Set highlight on search
|
||||
vim.o.hlsearch = false
|
||||
|
||||
-- Make line numbers default
|
||||
vim.wo.number = true
|
||||
vim.wo.relativenumber = 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.timeout = true
|
||||
vim.o.timeoutlen = 300
|
||||
|
||||
-- Set completeopt to have a better completion experience
|
||||
vim.o.completeopt = 'menuone,noselect'
|
||||
|
||||
-- NOTE: You should make sure your terminal supports this
|
||||
vim.o.termguicolors = true
|
||||
|
||||
-- Default tab settings
|
||||
-- Tab settings are automatically detected by vim-sleuth
|
||||
-- Can be overriden by .editorconfig and modeline
|
||||
vim.o.tabstop = 4
|
||||
vim.o.softtabstop = 4
|
||||
vim.o.shiftwidth = 4
|
||||
vim.o.expandtab = false
|
||||
vim.o.smarttab = true
|
||||
|
||||
-- Ask for confirmation instead of failing
|
||||
vim.o.confirm = true
|
||||
|
||||
-- Turn on cursorline
|
||||
vim.o.cursorline = true
|
||||
6
nvim/dot-config/nvim/lua/plugins/autopairs.lua
Normal file
6
nvim/dot-config/nvim/lua/plugins/autopairs.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
-- https://github.com/windwp/nvim-autopairs
|
||||
return {
|
||||
'windwp/nvim-autopairs',
|
||||
event = "VeryLazy",
|
||||
opts = {},
|
||||
}
|
||||
6
nvim/dot-config/nvim/lua/plugins/autotag.lua
Normal file
6
nvim/dot-config/nvim/lua/plugins/autotag.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
-- https://github.com/windwp/nvim-ts-autotag
|
||||
return {
|
||||
'windwp/nvim-ts-autotag',
|
||||
event = "VeryLazy",
|
||||
opts = {},
|
||||
}
|
||||
23
nvim/dot-config/nvim/lua/plugins/bufdel.lua
Normal file
23
nvim/dot-config/nvim/lua/plugins/bufdel.lua
Normal file
@@ -0,0 +1,23 @@
|
||||
-- https://github.com/ojroques/nvim-bufdel
|
||||
return {
|
||||
'ojroques/nvim-bufdel',
|
||||
cmd = { "BufDel", "BuffDelOthers" },
|
||||
keys = {
|
||||
{
|
||||
'<leader>bd',
|
||||
function()
|
||||
require('bufdel').delete_buffer_expr(nil, false)
|
||||
end,
|
||||
silent = true,
|
||||
desc = '[B]uffer [d]elete'
|
||||
},
|
||||
{
|
||||
'<leader>bD',
|
||||
function()
|
||||
require('bufdel').delete_buffer_others(false)
|
||||
end,
|
||||
silent = true,
|
||||
desc = '[B]uffer [D]elete others'
|
||||
},
|
||||
},
|
||||
}
|
||||
61
nvim/dot-config/nvim/lua/plugins/bufferline.lua
Normal file
61
nvim/dot-config/nvim/lua/plugins/bufferline.lua
Normal file
@@ -0,0 +1,61 @@
|
||||
-- https://github.com/akinsho/bufferline.nvim
|
||||
return {
|
||||
'akinsho/bufferline.nvim',
|
||||
version = "v3.*",
|
||||
dependencies = {
|
||||
'ojroques/nvim-bufdel',
|
||||
},
|
||||
config = function()
|
||||
-- Enable mousemoveevent if possible
|
||||
vim.o.mousemoveevent = true;
|
||||
|
||||
local bufferline = require('bufferline');
|
||||
|
||||
-- Setup keybinds to move between buffers
|
||||
vim.keymap.set('n', '<tab>', function()
|
||||
bufferline.cycle(1)
|
||||
end, { silent = true, desc = 'Goto next buffer' })
|
||||
vim.keymap.set('n', '<S-tab>', function()
|
||||
bufferline.cycle(-1)
|
||||
end, { silent = true, desc = 'Goto previous buffer' })
|
||||
|
||||
-- Setup keybinds to move buffers around
|
||||
vim.keymap.set('n', '<leader>b[', function()
|
||||
bufferline.move(-1)
|
||||
end, { silent = true, desc = '[B]uffer to the [ left' })
|
||||
vim.keymap.set('n', '<leader>b]', function()
|
||||
bufferline.move(1)
|
||||
end, { silent = true, desc = '[B]uffer to the ] right' })
|
||||
|
||||
local symbols = require('constant.symbols');
|
||||
|
||||
bufferline.setup {
|
||||
options = {
|
||||
show_buffer_icons = false,
|
||||
show_buffer_close_icons = true,
|
||||
diagnostics = "nvim_lsp",
|
||||
close_command = "BufDel %d",
|
||||
right_mouse_command = "BufDel %d",
|
||||
separator_style = "thick",
|
||||
left_trunc_marker = '',
|
||||
right_trunc_marker = '',
|
||||
sort_by = "insert_at_end",
|
||||
indicator = {
|
||||
style = 'none',
|
||||
},
|
||||
modified_icon = symbols.file.modified,
|
||||
---@diagnostic disable-next-line: unused-local
|
||||
diagnostics_indicator = function(count, level, diagnostics_dict, context)
|
||||
local s = " "
|
||||
for e, n in pairs(diagnostics_dict) do
|
||||
local sym = e == "error" and symbols.diagnostic.error .. ' '
|
||||
or (e == "warning" and symbols.diagnostic.warning .. ' ')
|
||||
or (e == "info" and symbols.diagnostic.info .. ' ' or symbols.diagnostic.hint .. ' ')
|
||||
s = s .. n .. sym
|
||||
end
|
||||
return s
|
||||
end
|
||||
},
|
||||
}
|
||||
end
|
||||
}
|
||||
29
nvim/dot-config/nvim/lua/plugins/colorizer.lua
Normal file
29
nvim/dot-config/nvim/lua/plugins/colorizer.lua
Normal file
@@ -0,0 +1,29 @@
|
||||
-- https://github.com/NvChad/nvim-colorizer.lua
|
||||
return {
|
||||
'NvChad/nvim-colorizer.lua',
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
filetypes = {
|
||||
'*', -- Enable color highlighting for all files
|
||||
'!neo-tree', -- Exclude neo-tree
|
||||
},
|
||||
buftypes = {
|
||||
"*",
|
||||
"!prompt",
|
||||
"!popup",
|
||||
},
|
||||
always_update = true,
|
||||
},
|
||||
-- Fix lazy loading: https://github.com/NvChad/nvim-colorizer.lua
|
||||
config = function(_, opts)
|
||||
local colorizer = require('colorizer');
|
||||
colorizer.setup(opts)
|
||||
|
||||
-- nvim-colorizer doesn't work on the initial buffer if we lazy load, so force it to attach
|
||||
-- on load.
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
if bufnr and not colorizer.is_buffer_attached(bufnr) then
|
||||
colorizer.attach_to_buffer(bufnr)
|
||||
end
|
||||
end
|
||||
}
|
||||
6
nvim/dot-config/nvim/lua/plugins/comment.lua
Normal file
6
nvim/dot-config/nvim/lua/plugins/comment.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
-- https://github.com/numToStr/Comment.nvim
|
||||
return {
|
||||
'numToStr/Comment.nvim',
|
||||
event = "VeryLazy",
|
||||
opts = {},
|
||||
}
|
||||
12
nvim/dot-config/nvim/lua/plugins/guess-indent.lua
Normal file
12
nvim/dot-config/nvim/lua/plugins/guess-indent.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
-- https://github.com/NMAC427/guess-indent.nvim
|
||||
return {
|
||||
-- Adds a command to automatically detect the identation settings
|
||||
-- Prefer to use .editorconfig for projects and modeline for files
|
||||
'NMAC427/guess-indent.nvim',
|
||||
keys = {
|
||||
{ "<leader>gi", "<cmd>GuessIndent<cr>", desc = "[G]uess [I]ndentation" },
|
||||
},
|
||||
opts = {
|
||||
auto_cmd = false,
|
||||
},
|
||||
}
|
||||
65
nvim/dot-config/nvim/lua/plugins/neotree.lua
Normal file
65
nvim/dot-config/nvim/lua/plugins/neotree.lua
Normal file
@@ -0,0 +1,65 @@
|
||||
-- https://github.com/nvim-neo-tree/neo-tree.nvim
|
||||
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]])
|
||||
return {
|
||||
'nvim-neo-tree/neo-tree.nvim',
|
||||
version = "v2.x",
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'MunifTanjim/nui.nvim',
|
||||
},
|
||||
cmd = { 'Neotree' },
|
||||
keys = {
|
||||
{ '<F2>', '<cmd>Neotree toggle reveal filesystem float<cr>', desc = 'Open floating Neo-tree window' },
|
||||
},
|
||||
config = function()
|
||||
local symbols = require('constant.symbols');
|
||||
|
||||
require('neo-tree').setup {
|
||||
close_if_last_window = true,
|
||||
enable_diagnostics = true,
|
||||
source_selector = {
|
||||
winbar = true,
|
||||
},
|
||||
default_component_configs = {
|
||||
icon = {
|
||||
folder_closed = symbols.fold.closed,
|
||||
folder_open = symbols.fold.open,
|
||||
folder_empty = symbols.fold.empty,
|
||||
default = symbols.file.icon,
|
||||
},
|
||||
modified = {
|
||||
symbol = symbols.file.modified,
|
||||
},
|
||||
name = {
|
||||
use_git_status_colors = false,
|
||||
},
|
||||
git_status = {
|
||||
symbols = symbols.git,
|
||||
}
|
||||
},
|
||||
filesystem = {
|
||||
filtered_items = {
|
||||
hide_dotfiles = false,
|
||||
hide_by_name = {
|
||||
".git"
|
||||
}
|
||||
},
|
||||
use_libuv_file_watcher = true,
|
||||
},
|
||||
window = {
|
||||
mappings = {
|
||||
["<C-c>"] = "close_window",
|
||||
["<esc>"] = "close_window",
|
||||
},
|
||||
},
|
||||
buffers = {
|
||||
window = {
|
||||
mappings = {
|
||||
["bd"] = nil,
|
||||
["<C-d>"] = "buffer_delete",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
}
|
||||
17
nvim/dot-config/nvim/lua/plugins/null-ls.lua
Normal file
17
nvim/dot-config/nvim/lua/plugins/null-ls.lua
Normal file
@@ -0,0 +1,17 @@
|
||||
return {
|
||||
enabled = false,
|
||||
'jose-elias-alvarez/null-ls.nvim',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
},
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
local null_ls = require('null-ls')
|
||||
|
||||
null_ls.setup {
|
||||
sources = {
|
||||
null_ls.builtins.code_actions.gitsigns,
|
||||
}
|
||||
}
|
||||
end,
|
||||
}
|
||||
34
nvim/dot-config/nvim/lua/plugins/peek.lua
Normal file
34
nvim/dot-config/nvim/lua/plugins/peek.lua
Normal file
@@ -0,0 +1,34 @@
|
||||
-- https://github.com/toppair/peek.nvim
|
||||
return {
|
||||
'toppair/peek.nvim',
|
||||
build = 'deno task --quiet build:fast',
|
||||
cond = function()
|
||||
return vim.fn.executable 'deno' == 1
|
||||
end,
|
||||
lazy = true,
|
||||
cmds = { "PeekOpen", "PeekClose" },
|
||||
init = function()
|
||||
vim.api.nvim_create_user_command('PeekOpen', function() require('peek').open() end, {})
|
||||
vim.api.nvim_create_user_command('PeekClose', function() require('peek').close() end, {})
|
||||
|
||||
local augroup = vim.api.nvim_create_augroup('Peek', { clear = true })
|
||||
|
||||
-- Automatically open a markdown preview window
|
||||
vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||
callback = function()
|
||||
require('peek').open()
|
||||
end,
|
||||
group = augroup,
|
||||
pattern = "markdown",
|
||||
})
|
||||
end,
|
||||
opts = {},
|
||||
-- config = function()
|
||||
-- local peek = require('peek');
|
||||
--
|
||||
--
|
||||
-- peek.setup {
|
||||
--
|
||||
-- }
|
||||
-- end
|
||||
}
|
||||
7
nvim/dot-config/nvim/lua/plugins/surround.lua
Normal file
7
nvim/dot-config/nvim/lua/plugins/surround.lua
Normal file
@@ -0,0 +1,7 @@
|
||||
-- https://github.com/kylechui/nvim-surround
|
||||
return {
|
||||
'kylechui/nvim-surround',
|
||||
version = '*', -- Use for stability; omit to use `main` branch for the latest features
|
||||
event = 'VeryLazy',
|
||||
config = true,
|
||||
}
|
||||
14
nvim/dot-config/nvim/lua/plugins/symbols-outline.lua
Normal file
14
nvim/dot-config/nvim/lua/plugins/symbols-outline.lua
Normal file
@@ -0,0 +1,14 @@
|
||||
-- https://github.com/simrat39/symbols-outline.nvim
|
||||
return {
|
||||
'simrat39/symbols-outline.nvim',
|
||||
keys = {
|
||||
{
|
||||
'<F5>',
|
||||
function()
|
||||
require('symbols-outline').toggle_outline()
|
||||
end,
|
||||
desc = 'Toggle symbols outline'
|
||||
},
|
||||
},
|
||||
opts = {},
|
||||
}
|
||||
18
nvim/dot-config/nvim/lua/plugins/tmux-navigation.lua
Normal file
18
nvim/dot-config/nvim/lua/plugins/tmux-navigation.lua
Normal file
@@ -0,0 +1,18 @@
|
||||
-- https://github.com/alexghergh/nvim-tmux-navigation
|
||||
return {
|
||||
'alexghergh/nvim-tmux-navigation',
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
local nvim_tmux_nav = require('nvim-tmux-navigation')
|
||||
|
||||
nvim_tmux_nav.setup {
|
||||
disable_when_zoomed = true,
|
||||
keybindings = {
|
||||
left = '<M-h>',
|
||||
down = '<M-j>',
|
||||
up = '<M-k>',
|
||||
right = '<M-l>',
|
||||
},
|
||||
}
|
||||
end
|
||||
}
|
||||
58
nvim/dot-config/nvim/lua/plugins/todo-comments.lua
Normal file
58
nvim/dot-config/nvim/lua/plugins/todo-comments.lua
Normal file
@@ -0,0 +1,58 @@
|
||||
-- https://github.com/folke/todo-comments.nvim
|
||||
return {
|
||||
-- NOTE: Using a fork for the time being upstream does not support authors
|
||||
-- 'folke/todo-comments.nvim',
|
||||
'doongjohn/todo-comments.nvim',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
},
|
||||
config = function()
|
||||
local symbols = require('constant.symbols')
|
||||
|
||||
vim.keymap.set("n", "]t", function()
|
||||
require("todo-comments").jump_next()
|
||||
end, { desc = "Next todo comment" })
|
||||
|
||||
vim.keymap.set("n", "[t", function()
|
||||
require("todo-comments").jump_prev()
|
||||
end, { desc = "Previous todo comment" })
|
||||
|
||||
if pcall(require, "trouble") then
|
||||
-- TODO: Use cwd to only show todo's in the current file
|
||||
-- vim.keymap.set("n", "<F4>", "<cmd>TroubleToggle todo cwd=%<cr>", { desc = "Next todo comment" })
|
||||
vim.keymap.set("n", "<F4>", "<cmd>TroubleToggle todo<cr>", { desc = "Next todo comment" })
|
||||
end
|
||||
if pcall(require, "telescope") then
|
||||
vim.keymap.set('n', '<leader>st', '<cmd>TodoTelescope<cr>', { desc = '[S]earch [T]odo' })
|
||||
end
|
||||
|
||||
require('todo-comments').setup {
|
||||
keywords = {
|
||||
FIX = { icon = symbols.diagnostic.bug },
|
||||
TODO = { icon = symbols.diagnostic.todo },
|
||||
HACK = { icon = symbols.diagnostic.hack },
|
||||
WARN = { icon = symbols.diagnostic.warning },
|
||||
PERF = { icon = symbols.diagnostic.performance },
|
||||
NOTE = { icon = symbols.diagnostic.note },
|
||||
TEST = { icon = symbols.diagnostic.test },
|
||||
},
|
||||
highlight = {
|
||||
-- TODO: Have multiline, but end when %p (punctuation) is at the end of a line
|
||||
multiline = false,
|
||||
before = "fg",
|
||||
pattern = [[(KEYWORDS)\s*(\([^\)]*\))?:]],
|
||||
},
|
||||
search = {
|
||||
pattern = [[\b(KEYWORDS)(\(.*\))?:]]
|
||||
},
|
||||
colors = {
|
||||
error = { "DiagnosticError", "ErrorMsg", "#DC2626" },
|
||||
warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" },
|
||||
info = { "Todo", "#2563EB" },
|
||||
hint = { "DiagnosticHint", "#10B981" },
|
||||
default = { "Identifier", "#7C3AED" },
|
||||
test = { "Identifier", "#FF00FF" }
|
||||
},
|
||||
}
|
||||
end,
|
||||
}
|
||||
17
nvim/dot-config/nvim/lua/plugins/treesj.lua
Normal file
17
nvim/dot-config/nvim/lua/plugins/treesj.lua
Normal file
@@ -0,0 +1,17 @@
|
||||
-- https://github.com/Wansmer/treesj
|
||||
return {
|
||||
'Wansmer/treesj',
|
||||
keys = {
|
||||
{
|
||||
'<space>m',
|
||||
function()
|
||||
require('treesj').toggle()
|
||||
end,
|
||||
desc = "Split or Join code block"
|
||||
},
|
||||
},
|
||||
dependencies = { 'nvim-treesitter/nvim-treesitter' },
|
||||
opts = {
|
||||
use_default_keymaps = false,
|
||||
}
|
||||
}
|
||||
18
nvim/dot-config/nvim/lua/plugins/trouble.lua
Normal file
18
nvim/dot-config/nvim/lua/plugins/trouble.lua
Normal file
@@ -0,0 +1,18 @@
|
||||
-- https://github.com/folke/trouble.nvim
|
||||
return {
|
||||
'folke/trouble.nvim',
|
||||
cmd = { 'Trouble', 'TroubleToggle', },
|
||||
keys = {
|
||||
{ '<F3>', '<cmd>TroubleToggle workspace_diagnostics<cr>', desc = 'Goto previous buffer' },
|
||||
},
|
||||
config = function()
|
||||
local symbols = require('constant.symbols');
|
||||
require('trouble').setup {
|
||||
icons = false,
|
||||
auto_close = true,
|
||||
fold_open = symbols.fold.open, -- icon used for open folds
|
||||
fold_closed = symbols.fold.close, -- icon used for closed folds
|
||||
use_diagnostic_signs = true,
|
||||
}
|
||||
end
|
||||
}
|
||||
7
nvim/dot-config/nvim/lua/plugins/undotree.lua
Normal file
7
nvim/dot-config/nvim/lua/plugins/undotree.lua
Normal file
@@ -0,0 +1,7 @@
|
||||
-- https://github.com/mbbill/undotree
|
||||
return {
|
||||
'mbbill/undotree',
|
||||
keys = {
|
||||
{ '<F6>', vim.cmd.UndotreeToggle, desc = 'Toggle undotree' },
|
||||
},
|
||||
}
|
||||
18
nvim/dot-config/nvim/lua/plugins/whitespace.lua
Normal file
18
nvim/dot-config/nvim/lua/plugins/whitespace.lua
Normal file
@@ -0,0 +1,18 @@
|
||||
return {
|
||||
'johnfrankmorgan/whitespace.nvim',
|
||||
config = function()
|
||||
require('whitespace-nvim').setup({
|
||||
-- configuration options and their defaults
|
||||
|
||||
-- `highlight` configures which highlight is used to display
|
||||
-- trailing whitespace
|
||||
highlight = 'CursorLine',
|
||||
-- `ignored_filetypes` configures which filetypes to ignore when
|
||||
-- displaying trailing whitespace
|
||||
ignored_filetypes = { 'TelescopePrompt', 'Trouble', 'help' },
|
||||
})
|
||||
|
||||
-- remove trailing whitespace with a keybinding
|
||||
vim.keymap.set('n', '<Leader>t', require('whitespace-nvim').trim, { desc = "Remove trailing whitespace" })
|
||||
end
|
||||
}
|
||||
24
nvim/dot-config/nvim/lua/themes/gruvbox.lua
Normal file
24
nvim/dot-config/nvim/lua/themes/gruvbox.lua
Normal file
@@ -0,0 +1,24 @@
|
||||
-- https://github.com/ellisonleao/gruvbox.nvim
|
||||
return {
|
||||
'ellisonleao/gruvbox.nvim',
|
||||
commit = "487598d979868224aff92cf8818195c1a60e5dfe", -- Commit before things start breaking
|
||||
priority = 1000,
|
||||
config = function()
|
||||
local config = require("gruvbox").config
|
||||
local colors = require("gruvbox.palette").get_base_colors(vim.o.background, config.contrast)
|
||||
|
||||
require('gruvbox').setup {
|
||||
background = "dark",
|
||||
italic = {
|
||||
strings = false,
|
||||
},
|
||||
overrides = {
|
||||
YankHighlight = { fg = colors.blue, bg = colors.bg0, reverse = config.inverse },
|
||||
IncSearch = { fg = colors.aqua },
|
||||
Search = { fg = colors.aqua },
|
||||
}
|
||||
}
|
||||
|
||||
vim.cmd.colorscheme 'gruvbox'
|
||||
end,
|
||||
}
|
||||
Reference in New Issue
Block a user