feat(nvim): configuration, refactoring, fixes

This commit is contained in:
2024-09-23 09:52:11 +03:00
parent 093f58f129
commit e22762255d
15 changed files with 427 additions and 375 deletions

View File

@@ -1,3 +1,4 @@
ansible
pipenv
semgrep
neovim

24
config/nvim/.neoconf.json Normal file
View File

@@ -0,0 +1,24 @@
{
"neodev": {
"library": {
"enabled": true,
"plugins": [
"nvim-lspconfig",
"lsp",
"completion",
]
}
},
"neoconf": {
"plugins": {
"lua_ls": {
"enabled": true
},
}
},
"lspconfig": {
"lua_ls": {
"Lua.completion.callSnippet": "Replace",
},
}
}

View File

@@ -3,15 +3,18 @@
-- Install lazylazy
-- https://github.com/folke/lazy.nvim
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,
}
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
vim.api.nvim_echo({
{ 'Failed to clone lazy.nvim:\n', 'ErrorMsg' },
{ out, 'WarningMsg' },
{ '\nPress any key to exit...' },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
@@ -22,14 +25,20 @@ require('lazy').setup {
checker = {
-- Automatically check for updates
enabled = true,
nofity = false,
},
spec = {
-- Useful plugin to show you pending keybinds.
-- https://github.com/folke/which-key.nvim
{
'folke/which-key.nvim',
event = 'VimEnter', -- Sets the loading event to 'VimEnter'
lazy = false, -- Load this plugin lazily
version = '*',
priority = 1001, -- Make sure to load this as soon as possible
dependencies = {
'nvim-lua/plenary.nvim',
'echasnovski/mini.icons',
},
config = function() -- This is the function that runs, AFTER loading
local wk = require 'which-key'
wk.setup()
@@ -38,15 +47,14 @@ require('lazy').setup {
{ '<leader>b', group = '[b] Buffer' },
{ '<leader>c', group = '[c] Code' },
{ '<leader>d', group = '[d] Document' },
{ '<leader>f', group = '[f] File' },
{ '<leader>g', group = '[g] Git' },
{ '<leader>l', group = '[l] LSP' },
{ '<leader>o', group = '[o] Open' },
{ '<leader>p', group = '[p] Project' },
{ '<leader>q', group = '[q] Quit' },
{ '<leader>s', group = '[s] Search' },
{ '<leader>t', group = '[t] Toggle' },
{ '<leader>w', group = '[w] Workspace' },
{ '<leader>x', group = '[z] Trouble' },
{ '<leader>z', group = '[x] FZF' },
{ '<leader>?', group = '[?] Help' },
{
@@ -63,5 +71,3 @@ require('lazy').setup {
{ import = 'plugins' },
},
}
require 'config.misc'

View File

@@ -1,10 +0,0 @@
-- Go
local format_sync_grp = vim.api.nvim_create_augroup('GoFormat', {})
vim.api.nvim_create_autocmd('BufWritePre', {
pattern = '*.go',
callback = function()
require('go.format').goimport()
end,
group = format_sync_grp,
})
require('go').setup()

View File

@@ -1,15 +1,12 @@
vim.api.nvim_set_keymap('i', 'jj', '<Esc>', { noremap = false })
-- twilight
vim.api.nvim_set_keymap('n', 'tw', ':Twilight<enter>', { noremap = false })
-- buffers
vim.api.nvim_set_keymap('n', '<leader>bk', ':blast<enter>', { desc = 'Last', noremap = false })
vim.api.nvim_set_keymap('n', '<leader>bj', ':bfirst<enter>', { desc = 'First', noremap = false })
vim.api.nvim_set_keymap('n', '<leader>bh', ':bprev<enter>', { desc = 'Prev', noremap = false })
vim.api.nvim_set_keymap('n', '<leader>bl', ':bnext<enter>', { desc = 'Next', noremap = false })
vim.api.nvim_set_keymap('n', '<leader>bd', ':bdelete<enter>', { desc = 'Delete', noremap = false })
vim.api.nvim_set_keymap('n', '<C-w>', ':bdelete<enter>', { desc = 'Delete buffer', noremap = false })
vim.api.nvim_set_keymap('n', '<leader>bk', ':blast<enter>', { desc = 'Buffer: Last', noremap = false })
vim.api.nvim_set_keymap('n', '<leader>bj', ':bfirst<enter>', { desc = 'Buffer: First', noremap = false })
vim.api.nvim_set_keymap('n', '<leader>bh', ':bprev<enter>', { desc = 'Buffer: Prev', noremap = false })
vim.api.nvim_set_keymap('n', '<leader>bl', ':bnext<enter>', { desc = 'Buffer: Next', noremap = false })
vim.api.nvim_set_keymap('n', '<leader>bd', ':Bdelete<enter>', { desc = 'Buffer: Delete', noremap = false })
vim.api.nvim_set_keymap('n', '<leader>bw', ':Bwipeout<enter>', { desc = 'Buffer: Wipeout', noremap = false })
-- files
vim.api.nvim_set_keymap('n', 'QQ', ':q!<enter>', { desc = 'Quickly Quit', noremap = false })
@@ -34,9 +31,6 @@ vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
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 })
-- Noice
vim.api.nvim_set_keymap('n', '<leader>nn', ':Noice dismiss<CR>', { desc = 'Noice dismiss', noremap = true })
vim.keymap.set('n', '<leader>xe', '<cmd>GoIfErr<cr>', { desc = 'Go If Error', silent = true, noremap = true })
-- TIP: Disable arrow keys in normal mode

View File

@@ -78,3 +78,8 @@ vim.o.undofile = true
vim.o.completeopt = 'menuone,noselect'
-- Fixes Notify opacity issues
vim.o.termguicolors = true
-- Set spell checking
vim.o.spell = true
vim.g.loaded_perl_provider = 0

View File

@@ -1,9 +1,5 @@
return {
-- fugitive.vim: A Git wrapper so awesome, it should be illegal
-- https://github.com/tpope/vim-fugitive
{ 'tpope/vim-fugitive' },
-- Git integration for buffers
-- https://github.com/lewis6991/gitsigns.nvim
{
@@ -19,7 +15,7 @@ return {
},
current_line_blame = false,
on_attach = function(bufnr)
local gs = package.loaded.gitsigns
local gs = require 'gitsigns'
local function map(mode, l, r, opts)
opts = opts or {}

View File

@@ -2,6 +2,9 @@ return {
-- A small Neovim plugin for previewing definitions using floating windows.
-- https://github.com/rmagatti/goto-preview
'rmagatti/goto-preview',
dependencies = {
{ 'nvim-telescope/telescope.nvim' },
},
config = function()
require('goto-preview').setup {
width = 120, -- Width of the floating window

View File

@@ -1,254 +1,262 @@
-- Quickstart configs for Nvim LSP
-- https://github.com/neovim/nvim-lspconfig
return {
'neovim/nvim-lspconfig',
dependencies = {
-- Automatically install LSPs to stdpath for neovim
'williamboman/mason.nvim',
'williamboman/mason-lspconfig.nvim',
'WhoIsSethDaniel/mason-tool-installer.nvim',
-- Useful status updates for LSP
{
'j-hui/fidget.nvim',
opts = {
notification = {
window = {
winblend = 50,
align = 'top',
-- Neovim plugin to manage global and project-local settings
-- Should be included before LSP Config
-- https://github.com/folke/neoconf.nvim
{
'folke/neoconf.nvim',
keys = {
{ '<leader>?c', '<cmd>Neoconf<CR>', desc = 'Neoconf: Open' },
{ '<leader>?g', '<cmd>Neoconf global<CR>', desc = 'Neoconf: Global' },
{ '<leader>?l', '<cmd>Neoconf local<CR>', desc = 'Neoconf: Local' },
{ '<leader>?m', '<cmd>Neoconf lsp<CR>', desc = 'Neoconf: Show merged LSP config' },
{ '<leader>?s', '<cmd>Neoconf show<CR>', desc = 'Neoconf: Show merged config' },
},
config = function()
require('neoconf').setup()
end,
},
{
'neovim/nvim-lspconfig',
dependencies = {
-- Automatically install LSPs to stdpath for neovim
'williamboman/mason.nvim',
'williamboman/mason-lspconfig.nvim',
'WhoIsSethDaniel/mason-tool-installer.nvim',
-- Useful status updates for LSP
{
'j-hui/fidget.nvim',
opts = {
notification = {
window = {
winblend = 50,
align = 'top',
},
},
},
},
},
'b0o/schemastore.nvim',
{
-- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
-- used for completion, annotations and signatures of Neovim apis
'folke/lazydev.nvim',
ft = 'lua',
opts = {
library = {
-- Load luvit types when the `vim.uv` word is found
{ path = 'luvit-meta/library', words = { 'vim%.uv' } },
'b0o/schemastore.nvim',
{
-- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
-- used for completion, annotations and signatures of Neovim apis
'folke/lazydev.nvim',
dependencies = {
-- `wezterm-types` provides types for the Wezterm terminal
{
'justinsgithub/wezterm-types',
as = 'wezterm',
},
},
ft = 'lua',
opts = {
library = {
-- Load luvit types when the `vim.uv` word is found
{ path = 'luvit-meta/library', words = { 'vim%.uv' } },
-- Load wezterm types when the `wezterm` word is found
{ path = 'wezterm-types', mods = { 'wezterm' } },
},
},
},
'folke/neoconf.nvim',
},
},
config = function()
-- Diagnostic keymaps
vim.keymap.set('n', 'dp', vim.diagnostic.goto_prev, { desc = 'Diagnostic: Goto Prev' })
vim.keymap.set('n', 'dn', vim.diagnostic.goto_next, { desc = 'Diagnostic: Goto Next' })
vim.keymap.set('n', '<leader>do', vim.diagnostic.open_float, { desc = 'Diagnostic: Open float' })
vim.keymap.set('n', '<leader>dq', vim.diagnostic.setloclist, { desc = 'Diagnostic: Set loc list' })
-- LSP settings.
-- This function gets run when an LSP connects to a particular buffer.
local on_attach = function(_, bufnr)
local nmap = function(keys, func, desc)
if desc then
desc = 'LSP: ' .. desc
end
vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc })
keys = {
{ '<leader>do', '<cmd>lua vim.diagnostic.open_float()<CR>', desc = 'Diagnostic: Open float' },
{ '<leader>dq', '<cmd>lua vim.diagnostic.setloclist()<CR>', desc = 'Diagnostic: Set loc list' },
{ 'dn', '<cmd>lua vim.diagnostic.goto_next()<CR>', desc = 'Diagnostic: Goto Next' },
{ 'dp', '<cmd>lua vim.diagnostic.goto_prev()<CR>', desc = 'Diagnostic: Goto Prev' },
{ '<leader>cr', '<cmd>lua vim.lsp.buf.rename()<CR>', desc = 'LSP: Rename' },
{ '<leader>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', desc = 'LSP: Code Action' },
{ 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', desc = 'LSP: Goto Definition' },
{ 'gr', '<cmd>lua require("telescope.builtin").lsp_references()<CR>', desc = 'LSP: Goto References' },
{ 'gI', '<cmd>lua vim.lsp.buf.implementation()<CR>', desc = 'LSP: Goto Implementation' },
{ '<leader>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', desc = 'LSP: Type Definition' },
{ '<leader>ds', '<cmd>lua require("telescope.builtin").lsp_document_symbols()<CR>', desc = 'LSP: Document Symbols' },
{ '<leader>ws', '<cmd>lua require("telescope.builtin").lsp_dynamic_workspace_symbols()<CR>', desc = 'LSP: Workspace Symbols' },
{ 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', desc = 'LSP: Hover Documentation' },
{ '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', desc = 'LSP: Signature Documentation' },
{ 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', desc = 'LSP: Goto Declaration' },
{ '<leader>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', desc = 'LSP: Workspace Add Folder' },
{ '<leader>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', desc = 'LSP: Workspace Remove Folder' },
{ '<leader>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', desc = 'LSP: Workspace List Folders' },
},
config = function()
-- LSP settings.
-- This function gets run when an LSP connects to a particular buffer.
local on_attach = function(_, bufnr)
-- Create a command `:Format` local to the LSP buffer
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
if vim.lsp.buf.format then
vim.lsp.buf.format()
elseif vim.lsp.buf.formatting then
vim.lsp.buf.formatting()
end
end, { desc = 'Format current buffer with LSP' })
end
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
nmap('<leader>ca', vim.lsp.buf.code_action, '[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')
-- Setup mason so it can manage external tooling
require('mason').setup()
-- 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')
-- Enable the following language servers
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
local servers = {
-- :help lspconfig-all for all pre-configured LSPs
ast_grep = {},
-- 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')
actionlint = {}, -- GitHub Actions
ansiblels = {}, -- Ansible
bashls = {}, -- Bash
css_variables = {}, -- CSS
cssls = {}, -- CSS
docker_compose_language_service = {}, -- Docker compose
dockerls = {}, -- Docker
eslint = {}, -- ESLint
gitlab_ci_ls = {}, -- GitLab CI
gopls = {}, -- Go
html = {}, -- HTML
intelephense = {}, -- PHP
pest_ls = {}, -- Pest (PHP)
phpactor = {}, -- PHP
psalm = {}, -- PHP
pyright = {}, -- Python
semgrep = {}, -- Security
shellcheck = {}, -- Shell scripts
shfmt = {}, -- Shell scripts formatting
stylelint_lsp = {}, -- Stylelint for S/CSS
stylua = {}, -- Used to format Lua code
tailwindcss = {}, -- Tailwind CSS
terraformls = {}, -- Terraform
tflint = {}, -- Terraform
ts_ls = {}, -- TypeScript/JS
typos_lsp = {}, -- Better writing
volar = {}, -- Vue
yamlls = {}, -- YAML
-- Create a command `:Format` local to the LSP buffer
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
if vim.lsp.buf.format then
vim.lsp.buf.format()
elseif vim.lsp.buf.formatting then
vim.lsp.buf.formatting()
end
end, { desc = 'Format current buffer with LSP' })
end
-- Setup mason so it can manage external tooling
require('mason').setup()
-- Enable the following language servers
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
local servers = {
-- :help lspconfig-all for all pre-configured LSPs
ast_grep = {},
actionlint = {}, -- GitHub Actions
ansiblels = {}, -- Ansible
bashls = {}, -- Bash
css_variables = {}, -- CSS
cssls = {}, -- CSS
docker_compose_language_service = {}, -- Docker compose
dockerls = {}, -- Docker
eslint = {}, -- ESLint
gitlab_ci_ls = {}, -- GitLab CI
gopls = {}, -- Go
grammarly = {}, -- Grammar and better writing
html = {}, -- HTML
intelephense = {}, -- PHP
jinja_lsp = {}, -- Jinja templates
pest_ls = {}, -- Pest (PHP)
phpactor = {}, -- PHP
psalm = {}, -- PHP
pyright = {}, -- Python
semgrep = {}, -- Security
shellcheck = {}, -- Shell scripts
shfmt = {}, -- Shell scripts formatting
stylelint_lsp = {}, -- Stylelint for S/CSS
stylua = {}, -- Used to format Lua code
tailwindcss = {}, -- Tailwind CSS
terraformls = {}, -- Terraform
tflint = {}, -- Terraform
ts_ls = {}, -- TypeScript/JS
typos_lsp = {}, -- Better writing
volar = {}, -- Vue
yamlls = {}, -- YAML
lua_ls = {
-- cmd = {...},
-- filetypes = { ...},
-- capabilities = {},
settings = {
Lua = {
completion = {
callSnippet = 'Replace',
lua_ls = {
settings = {
Lua = {
completion = {
callSnippet = 'Replace',
},
-- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
diagnostics = { disable = { 'missing-fields' } },
},
-- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
diagnostics = { disable = { 'missing-fields' } },
},
},
},
jsonls = {
settings = {
json = {
schemas = require('schemastore').json.schemas(),
validate = { enable = true },
},
yaml = {
schemaStore = {
-- You must disable built-in schemaStore support if you want to use
-- this plugin and its advanced options like `ignore`.
enable = false,
-- Avoid TypeError: Cannot read properties of undefined (reading 'length')
url = '',
jsonls = {
settings = {
json = {
schemas = require('schemastore').json.schemas(),
validate = { enable = true },
},
yaml = {
schemaStore = {
-- You must disable built-in schemaStore support if you want to use
-- this plugin and its advanced options like `ignore`.
enable = false,
-- Avoid TypeError: Cannot read properties of undefined (reading 'length')
url = '',
},
schemas = require('schemastore').yaml.schemas(),
},
schemas = require('schemastore').yaml.schemas(),
},
},
},
}
}
local ensure_installed = vim.tbl_keys(servers or {})
vim.list_extend(ensure_installed, {
'actionlint',
'ansible-language-server',
'ansible-lint',
'bash-language-server',
'blade-formatter',
'codespell',
'commitlint',
'diagnostic-languageserver',
'docker-compose-language-service',
'dockerfile-language-server',
'editorconfig-checker',
'fixjson',
'flake8',
'html-lsp',
'jq',
'jsonlint',
'luacheck',
'php-cs-fixer',
'phpcs',
'phpmd',
'semgrep',
'shellcheck',
'shfmt',
'stylelint',
'stylua',
'yamllint',
})
require('mason-tool-installer').setup {
ensure_installed = ensure_installed,
auto_update = true,
}
local ensure_installed = vim.tbl_keys(servers or {})
vim.list_extend(ensure_installed, {
'actionlint',
'ansible-language-server',
'ansible-lint',
'bash-language-server',
'blade-formatter',
'commitlint',
'diagnostic-languageserver',
'docker-compose-language-service',
'dockerfile-language-server',
'editorconfig-checker',
'fixjson',
'flake8',
'html-lsp',
'jq',
'jsonlint',
'luacheck',
'php-cs-fixer',
'phpcs',
'phpmd',
'semgrep',
'shellcheck',
'shfmt',
'stylelint',
'stylua',
'yamllint',
})
require('mason-tool-installer').setup {
ensure_installed = ensure_installed,
auto_update = true,
}
-- Ensure the servers above are installed
require('mason-lspconfig').setup {
automatic_installation = true,
ensure_installed = servers,
}
-- Ensure the servers above are installed
require('mason-lspconfig').setup {
automatic_installation = true,
ensure_installed = servers,
}
-- nvim-cmp supports additional completion capabilities
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
-- nvim-cmp supports additional completion capabilities
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
for _, lsp in ipairs(servers) do
require('lspconfig')[lsp].setup {
for _, lsp in ipairs(servers) do
require('lspconfig')[lsp].setup {
on_attach = on_attach,
capabilities = capabilities,
}
end
-- Turn on lsp status information
require('fidget').setup()
-- Example custom configuration for lua
--
-- Make runtime files discoverable to the server
local runtime_path = vim.split(package.path, ';')
table.insert(runtime_path, 'lua/?.lua')
table.insert(runtime_path, 'lua/?/init.lua')
require('lspconfig').lua_ls.setup {
on_attach = on_attach,
capabilities = capabilities,
}
end
-- Turn on lsp status information
require('fidget').setup()
-- Example custom configuration for lua
--
-- Make runtime files discoverable to the server
local runtime_path = vim.split(package.path, ';')
table.insert(runtime_path, 'lua/?.lua')
table.insert(runtime_path, 'lua/?/init.lua')
require('lspconfig').lua_ls.setup {
on_attach = on_attach,
capabilities = capabilities,
settings = {
Lua = {
runtime = {
-- Tell the language server which version of Lua you're using (most likely LuaJIT)
version = 'LuaJIT',
-- Setup your lua path
path = runtime_path,
settings = {
Lua = {
runtime = {
-- Tell the language server which version of Lua you're using (most likely LuaJIT)
version = 'LuaJIT',
-- Setup your lua path
path = runtime_path,
},
diagnostics = {
globals = { 'vim' },
},
workspace = {
library = vim.api.nvim_get_runtime_file('', true),
checkThirdParty = false,
},
-- Do not send telemetry data containing a randomized but unique identifier
telemetry = { enable = false },
},
diagnostics = {
globals = { 'vim' },
},
workspace = {
library = vim.api.nvim_get_runtime_file('', true),
checkThirdParty = false,
},
-- Do not send telemetry data containing a randomized but unique identifier
telemetry = { enable = false },
},
},
}
}
vim.api.nvim_create_autocmd('FileType', {
pattern = 'sh',
callback = function()
vim.lsp.start {
name = 'bash-language-server',
cmd = { 'bash-language-server', 'start' },
}
end,
})
end,
vim.api.nvim_create_autocmd('FileType', {
pattern = 'sh',
callback = function()
vim.lsp.start {
name = 'bash-language-server',
cmd = { 'bash-language-server', 'start' },
}
end,
})
end,
},
}

View File

@@ -2,6 +2,10 @@
-- https://github.com/nvim-lualine/lualine.nvim
return {
'nvim-lualine/lualine.nvim',
dependencies = {
'kyazdani42/nvim-web-devicons',
'folke/noice.nvim',
},
config = function()
require('lualine').setup {
options = {

View File

@@ -30,7 +30,7 @@ return {
},
cmd = 'Neotree',
keys = {
{ '<leader>e', ':Neotree reveal<CR>', { desc = 'NeoTree reveal' } },
{ '<leader>e', ':Neotree reveal<CR>', desc = 'NeoTree reveal' },
},
opts = {
close_if_last_window = true,

View File

@@ -2,79 +2,83 @@ return {
-- Highly experimental plugin that completely replaces the UI
-- for messages, cmdline and the popupmenu.
-- https://github.com/folke/noice.nvim
{
'folke/noice.nvim',
dependencies = {
'MunifTanjim/nui.nvim',
-- A fancy, configurable, notification manager for NeoVim
-- https://github.com/rcarriga/nvim-notify
{
'rcarriga/nvim-notify',
config = function()
require('notify').setup {
background_colour = '#000000',
enabled = false,
}
end,
},
},
setup = function()
vim.g.noice_ignored_filetypes = { 'fugitiveblame', 'fugitive', 'gitcommit' }
require('noice').setup {
-- you can enable a preset for easier configuration
presets = {
bottom_search = true, -- use a classic bottom cmdline for search
command_palette = true, -- position the cmdline and popupmenu together
long_message_to_split = true, -- long messages will be sent to a split
inc_rename = false, -- enables an input dialog for inc-rename.nvim
lsp_doc_border = false, -- add a border to hover docs and signature help
},
views = {
cmdline_popup = {
position = {
row = 5,
col = '50%',
},
size = {
width = 60,
height = 'auto',
},
},
popupmenu = {
relative = 'editor',
position = {
row = 8,
col = '50%',
},
size = {
width = 60,
height = 10,
},
border = {
style = 'rounded',
padding = { 0, 1 },
},
win_options = {
winhighlight = { Normal = 'Normal', FloatBorder = 'DiagnosticInfo' },
},
},
},
routes = {
{
filter = {
event = 'msg_show',
any = {
{ find = '%d+L, %d+B' },
{ find = '; after #%d+' },
{ find = '; before #%d+' },
{ find = '%d fewer lines' },
{ find = '%d more lines' },
},
},
opts = { skip = true },
},
},
}
end,
'folke/noice.nvim',
lazy = false,
enabled = true,
dependencies = {
'MunifTanjim/nui.nvim',
-- A fancy, configurable, notification manager for NeoVim
-- https://github.com/rcarriga/nvim-notify
'rcarriga/nvim-notify',
'hrsh7th/nvim-cmp',
},
keys = {
{ 'n', '<leader>tn', ':Noice dismiss<CR>', desc = 'Noice dismiss' },
},
config = function()
vim.g.noice_ignored_filetypes = { 'fugitiveblame', 'fugitive', 'gitcommit', 'noice' }
require('noice').setup {
lsp = {
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
override = {
['vim.lsp.util.convert_input_to_markdown_lines'] = true,
['vim.lsp.util.stylize_markdown'] = true,
['cmp.entry.get_documentation'] = true, -- requires hrsh7th/nvim-cmp
},
},
-- you can enable a preset for easier configuration
presets = {
bottom_search = false, -- use a classic bottom cmdline for search
command_palette = true, -- position the cmdline and popupmenu together
long_message_to_split = true, -- long messages will be sent to a split
inc_rename = false, -- enables an input dialog for inc-rename.nvim
lsp_doc_border = false, -- add a border to hover docs and signature help
},
routes = {
{
filter = {
event = 'msg_show',
any = {
{ find = '%d+L, %d+B' },
{ find = '; after #%d+' },
{ find = '; before #%d+' },
{ find = '%d fewer lines' },
{ find = '%d more lines' },
},
},
opts = { skip = true },
},
},
views = {
cmdline_popup = {
position = {
row = 5,
col = '50%',
},
size = {
width = 60,
height = 'auto',
},
},
popupmenu = {
relative = 'editor',
position = {
row = 8,
col = '50%',
},
size = {
width = 60,
height = 10,
},
border = {
style = 'rounded',
padding = { 0, 1 },
},
win_options = {
winhighlight = { Normal = 'Normal', FloatBorder = 'DiagnosticInfo' },
},
},
},
}
end,
}

View File

@@ -4,9 +4,12 @@ return {
{
'nvim-telescope/telescope.nvim',
version = '*',
lazy = false,
dependencies = {
{ 'nvim-lua/plenary.nvim' },
{ 'nvim-telescope/telescope-symbols.nvim' },
{ 'folke/which-key.nvim' },
{ 'ThePrimeagen/harpoon' },
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
-- Only load if `make` is available
@@ -16,13 +19,10 @@ return {
cond = vim.fn.executable 'make' == 1,
},
},
setup = function()
config = function()
local t = require 'telescope'
local a = require 'telescope.actions'
local b = require 'telescope.builtin'
local themes = require 'telescope.themes'
require('telescope').load_extension 'harpoon'
t.load_extension 'git_worktree'
-- [[ Configure Telescope ]]
-- See `:help telescope` and `:help telescope.setup()`
@@ -54,11 +54,34 @@ return {
},
}
-- Load extensions
pcall(t.load_extension, 'harpoon')
pcall(t.load_extension, 'git_worktree')
-- Enable telescope fzf native, if installed
pcall(t.load_extension, 'fzf')
-- [[ Telescope Keymaps ]]
-- See `:help telescope.builtin`
vim.keymap.set('n', '<leader>so', b.oldfiles, { desc = '[?] Find recently opened files' })
-- See `:help telescope.keymap`
local b = require 'telescope.builtin'
local wk = require 'which-key'
wk.add {
-- { '<leader><space>', b.buffers, desc = '[ ] Find existing buffers' },
{ '<leader>gR', "<cmd>lua require('telescope').extensions.git_worktree.create_git_worktree()<CR>", desc = 'Create Git worktree' },
{ '<leader>gr', "<cmd>lua require('telescope').extensions.git_worktree.git_worktrees()<CR>", desc = 'Git worktrees' },
{ '<leader>sS', b.git_status, desc = '' },
{ '<leader>sd', b.diagnostics, desc = '[S]earch [D]iagnostics' },
{ '<leader>sf', b.find_files, desc = '[S]earch [F]iles' },
{ '<leader>sg', b.live_grep, desc = '[S]earch by [G]rep' },
{ '<leader>sm', ':Telescope harpoon marks<CR>', desc = 'Harpoon Marks' },
{ '<leader>sn', "<cmd>lua require('telescope').extensions.notify.notify()<CR>", desc = 'Notify' },
{ '<leader>so', b.oldfiles, desc = '[?] Find recently opened files' },
{ '<leader>sw', b.grep_string, desc = '[S]earch current [W]ord' },
{ '<leader>st', ':TodoTelescope<CR>', desc = 'Telescope: Todo' },
{ '<leader><tab>', "<Cmd>lua require('telescope.builtin').commands()<CR>", desc = 'Telescope: Commands' },
}
vim.keymap.set('n', '<leader>/', function()
-- You can pass additional configuration to telescope to change theme, layout, etc.
b.current_buffer_fuzzy_find(themes.get_dropdown {
@@ -66,20 +89,6 @@ return {
previewer = true,
})
end, { desc = '[/] Fuzzily search in current buffer]' })
vim.keymap.set('n', '<leader>sf', b.find_files, { desc = '[S]earch [F]iles' })
vim.keymap.set('n', '<leader>sw', b.grep_string, { desc = '[S]earch current [W]ord' })
vim.keymap.set('n', '<leader>sg', b.live_grep, { desc = '[S]earch by [G]rep' })
vim.keymap.set('n', '<leader>sd', b.diagnostics, { desc = '[S]earch [D]iagnostics' })
vim.keymap.set('n', '<leader>sb', b.buffers, { desc = '[ ] Find existing buffers' })
vim.keymap.set('n', '<leader>sS', b.git_status, { desc = '' })
vim.keymap.set('n', '<leader>sm', ':Telescope harpoon marks<CR>', { desc = 'Harpoon [M]arks' })
vim.keymap.set('n', '<Leader>sr', "<CMD>lua require('telescope').extensions.git_worktree.git_worktrees()<CR>")
vim.keymap.set('n', '<Leader>sR', "<CMD>lua require('telescope').extensions.git_worktree.create_git_worktree()<CR>")
vim.keymap.set('n', '<Leader>sn', "<CMD>lua require('telescope').extensions.notify.notify()<CR>")
vim.api.nvim_set_keymap('n', 'st', ':TodoTelescope<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', '<Leader><tab>', "<Cmd>lua require('telescope.builtin').commands()<CR>", { noremap = false })
end,
},
}

View File

@@ -9,12 +9,17 @@ return {
auto_close = true,
use_lsp_diagnostic_signs = true,
}
vim.keymap.set('n', '<leader>xx', '<cmd>TroubleToggle<cr>', { silent = true, noremap = true })
vim.keymap.set('n', '<leader>xw', '<cmd>TroubleToggle workspace_diagnostics<cr>', { silent = true, noremap = true })
vim.keymap.set('n', '<leader>xd', '<cmd>TroubleToggle document_diagnostics<cr>', { silent = true, noremap = true })
vim.keymap.set('n', '<leader>xl', '<cmd>TroubleToggle loclist<cr>', { silent = true, noremap = true })
vim.keymap.set('n', '<leader>xq', '<cmd>TroubleToggle quickfix<cr>', { silent = true, noremap = true })
vim.keymap.set('n', 'gR', '<cmd>TroubleToggle lsp_references<cr>', { silent = true, noremap = true })
-- Keybindings
local wk = require 'which-key'
wk.add {
{ '<leader>xx', '<cmd>TroubleToggle<cr>', desc = 'Toggle Trouble' },
{ '<leader>xw', '<cmd>TroubleToggle workspace_diagnostics<cr>', desc = 'Toggle Workspace Diagnostics' },
{ '<leader>xd', '<cmd>TroubleToggle document_diagnostics<cr>', desc = 'Toggle Document Diagnostics' },
{ '<leader>xl', '<cmd>TroubleToggle loclist<cr>', desc = 'Toggle Loclist' },
{ '<leader>xq', '<cmd>TroubleToggle quickfix<cr>', desc = 'Toggle Quickfix' },
{ 'gR', '<cmd>TroubleToggle lsp_references<cr>', desc = 'Toggle LSP References' },
}
-- Diagnostic signs
-- https://github.com/folke/trouble.nvim/issues/52

View File

@@ -39,6 +39,9 @@ return {
{
'folke/twilight.nvim',
ft = 'markdown', -- Highlight markdown files
keys = {
{ 'n', 'tw', '<cmd>Twilight<cr>', desc = 'Twilight' },
},
},
-- Seamless navigation between tmux panes and vim splits
@@ -55,11 +58,11 @@ return {
'TmuxNavigatePrevious',
},
keys = {
{ '<c-h>', '<cmd><C-U>TmuxNavigateLeft<cr>' },
{ '<c-j>', '<cmd><C-U>TmuxNavigateDown<cr>' },
{ '<c-k>', '<cmd><C-U>TmuxNavigateUp<cr>' },
{ '<c-l>', '<cmd><C-U>TmuxNavigateRight<cr>' },
{ '<c-\\>', '<cmd><C-U>TmuxNavigatePrevious<cr>' },
{ '<c-h>', '<cmd><C-U>TmuxNavigateLeft<cr>', desc = 'tmux: Navigate Left' },
{ '<c-j>', '<cmd><C-U>TmuxNavigateDown<cr>', desc = 'tmux: Navigate Down' },
{ '<c-k>', '<cmd><C-U>TmuxNavigateUp<cr>', desc = 'tmux: Navigate Up' },
{ '<c-l>', '<cmd><C-U>TmuxNavigateRight<cr>', desc = 'tmux: Navigate Right' },
{ '<c-\\>', '<cmd><C-U>TmuxNavigatePrevious<cr>', desc = 'tmux: Navigate Previous' },
},
},
-- Cloak allows you to overlay *'s over defined patterns in defined files.
@@ -127,11 +130,11 @@ return {
wk.add {
{ '<leader>cb', group = 'CommentBox' },
{ '<Leader>cbt', '<Cmd>CBccbox<CR>', desc = 'CommentBox: Box Title' },
{ '<Leader>cbd', '<Cmd>CBd<CR>', desc = 'Remove a box' },
{ '<Leader>cbl', '<Cmd>CBline<CR>', desc = 'CommentBox: Simple Line' },
{ '<Leader>cbm', '<Cmd>CBllbox14<CR>', desc = 'CommentBox: Marked' },
{ '<Leader>cbt', '<Cmd>CBllline<CR>', desc = 'CommentBox: Titled Line' },
{ '<leader>cbb', '<Cmd>CBccbox<CR>', desc = 'CommentBox: Box Title' },
{ '<leader>cbd', '<Cmd>CBd<CR>', desc = 'CommentBox: Remove a box' },
{ '<leader>cbl', '<Cmd>CBline<CR>', desc = 'CommentBox: Simple Line' },
{ '<leader>cbm', '<Cmd>CBllbox14<CR>', desc = 'CommentBox: Marked' },
{ '<leader>cbt', '<Cmd>CBllline<CR>', desc = 'CommentBox: Titled Line' },
}
end,
},