neovim: config refresh with lazyvim

This commit is contained in:
Daniel Lundin 2023-09-17 23:36:17 +02:00
parent 30a2f2074a
commit 3923b20519
25 changed files with 461 additions and 1184 deletions

View file

@ -1,12 +0,0 @@
let g:netrw_dirhistmax =10
let g:netrw_dirhistcnt =4
let g:netrw_dirhist_4='/home/dln/src/github.com/tocaboca/Toca-Days/Infrastructure/Helm'
let g:netrw_dirhist_3='/home/dln/src/github.com/tocaboca/Toca-Days/Infrastructure/Helm/days'
let g:netrw_dirhist_2='/home/dln/src/github.com/tocaboca/toca-days-prod/blessings'
let g:netrw_dirhist_1='/home/dln/src/github.com/tocaboca/toca-infrastructure/flux/k8s/infra/tenants/toca-studio/clusters/studio'
let g:netrw_dirhist_0='/home/dln/src/github.com/tocaboca/toca-infrastructure/linkerd/gateway'
let g:netrw_dirhist_9='/home/dln/src/github.com/tocaboca/toca-infrastructure/cluster/terraform'
let g:netrw_dirhist_8='/home/dln/src/github.com/shelmangroup/tf-infra/lab001/vms/modules/fcos_vault_agent'
let g:netrw_dirhist_7='/tmp/squid/etc'
let g:netrw_dirhist_6='/tmp/squid'
let g:netrw_dirhist_5='/tmp/squid/etc'

View file

@ -1,2 +1,2 @@
require("config.options")
-- bootstrap lazy.nvim, LazyVim and your plugins
require("config.lazy")

View file

@ -0,0 +1,56 @@
{
"LazyVim": { "branch": "main", "commit": "a72a84972d85e5bbc6b9d60a0983b37efef21b8a" },
"LuaSnip": { "branch": "master", "commit": "3657c3f3cb2214a681fc7e95b6ffb509d076ebfb" },
"SchemaStore.nvim": { "branch": "main", "commit": "2a6a5d3e2bc8a5727b6d083d2920d12a392ed05b" },
"alpha-nvim": { "branch": "main", "commit": "234822140b265ec4ba3203e3e0be0e0bb826dff5" },
"bufferline.nvim": { "branch": "main", "commit": "9961d87bb3ec008213c46ba14b3f384a5f520eb5" },
"catppuccin": { "branch": "main", "commit": "85e93601e0f0b48aa2c6bbfae4d0e9d7a1898280" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
"colorbuddy.nvim": { "branch": "master", "commit": "cdb5b0654d3cafe61d2a845e15b2b4b0e78e752a" },
"copilot-cmp": { "branch": "master", "commit": "72fbaa03695779f8349be3ac54fa8bd77eed3ee3" },
"copilot.lua": { "branch": "master", "commit": "2c942f33ba5c621c906e625e00a1bb504b65e2f0" },
"dressing.nvim": { "branch": "master", "commit": "c1e1d5fa44fe08811b6ef4aadac2b50e602f9504" },
"flash.nvim": { "branch": "main", "commit": "8a8e74922a383c253b7f92e042b749150140c8d1" },
"friendly-snippets": { "branch": "main", "commit": "ebf6d6e83494cdd88a54a429340256f4dbb6a052" },
"gitsigns.nvim": { "branch": "main", "commit": "907ae8636016aab2f283576fc60d46ca3427e579" },
"indent-blankline.nvim": { "branch": "master", "commit": "9637670896b68805430e2f72cf5d16be5b97a22a" },
"lazy.nvim": { "branch": "main", "commit": "3ad55ae678876516156cca2f361c51f7952a924b" },
"lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "f014db32437aa61c86fc0ef1067cd2bc6a37205c" },
"mason.nvim": { "branch": "main", "commit": "d66c60e17dd6fd8165194b1d14d21f7eb2c1697a" },
"mini.ai": { "branch": "main", "commit": "7ae226f331885e6f30e9a8229e113debc59308ae" },
"mini.bufremove": { "branch": "main", "commit": "7821606e35c1ac931b56d8e3155f45ffe76ee7e5" },
"mini.comment": { "branch": "main", "commit": "877acea5b2a32ff55f808fc0ebe9aa898648318c" },
"mini.indentscope": { "branch": "main", "commit": "f60e9b51a6214c73a170ffc5445ce91560981031" },
"mini.pairs": { "branch": "main", "commit": "dfa9f6e2576bb8853be277d96b735af59d9be7c2" },
"mini.surround": { "branch": "main", "commit": "9d1956b576d7051da3a483b251dfc778121c60db" },
"neo-tree.nvim": { "branch": "v3.x", "commit": "2d89ca96e08eb6e9c8e50e1bb4738bc5125c9f12" },
"neoconf.nvim": { "branch": "main", "commit": "a4eb3675cb87be2e2dcb283dddc8c7aabd2c50ca" },
"neodev.nvim": { "branch": "main", "commit": "471324e6c746284dbbdc1d357799d1911bb7e120" },
"noice.nvim": { "branch": "main", "commit": "74c2902146b080035beb19944baf6f014a954720" },
"nui.nvim": { "branch": "main", "commit": "c8de23342caf8d50b15d6b28368d36a56a69d76f" },
"null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" },
"nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" },
"nvim-lspconfig": { "branch": "master", "commit": "cc388d3f6b9c7c943ae2b2dcd46ad470fd257f91" },
"nvim-navic": { "branch": "master", "commit": "9c89730da6a05acfeb6a197e212dfadf5aa60ca0" },
"nvim-noirbuddy": { "branch": "master", "commit": "67f945acee6da0ea4c11575c72ce8e930090ea95" },
"nvim-notify": { "branch": "master", "commit": "94859430020f5cf32a1b97ddd9e596fed9db7981" },
"nvim-spectre": { "branch": "master", "commit": "97cfd1b0f5a6ab35979ce1bee6c17f54745fd1e5" },
"nvim-treesitter": { "branch": "master", "commit": "9dd3e07609c5b74c5ac4193d0ce4fe91fb406fea" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "bd103502252027434ec42f628d2dbf54821d4ce6" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "95e9ba9de4289d221666b66fd930d157c7ca08c6" },
"nvim-web-devicons": { "branch": "master", "commit": "973ab742f143a796a779af4d786ec409116a0d87" },
"persistence.nvim": { "branch": "main", "commit": "4b8051c01f696d8849a5cb8afa9767be8db16e40" },
"plenary.nvim": { "branch": "master", "commit": "9ce85b0f7dcfe5358c0be937ad23e456907d410b" },
"telescope.nvim": { "branch": "master", "commit": "b543aaa2c9cf8123ed2fe7dbb6c211a9cd415124" },
"todo-comments.nvim": { "branch": "main", "commit": "3094ead8edfa9040de2421deddec55d3762f64d1" },
"tokyonight.nvim": { "branch": "main", "commit": "9a01eada39558dc3243278e6805d90e8dff45dc0" },
"trouble.nvim": { "branch": "main", "commit": "3f85d8ed30e97ceeddbbcf80224245d347053711" },
"typescript.nvim": { "branch": "main", "commit": "4de85ef699d7e6010528dcfbddc2ed4c2c421467" },
"vim-illuminate": { "branch": "master", "commit": "8c910b2f84ae6acd9b4b17330bb94dd783c0c11a" },
"vim-startuptime": { "branch": "master", "commit": "454b3de856b7bd298700de33d79774ca9b9e3875" },
"which-key.nvim": { "branch": "main", "commit": "7ccf476ebe0445a741b64e36c78a682c1c6118b7" }
}

View file

@ -0,0 +1,3 @@
-- Autocmds are automatically loaded on the VeryLazy event
-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua
-- Add any additional autocmds here

View file

@ -0,0 +1,3 @@
-- Keymaps are automatically loaded on the VeryLazy event
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
-- Add any additional keymaps here

View file

@ -1,33 +1,49 @@
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", lazypath })
vim.fn.system({ "git", "-C", lazypath, "checkout", "tags/stable" }) -- last stable release
-- bootstrap lazy.nvim
-- stylua: ignore
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
end
vim.opt.runtimepath:prepend(lazypath)
-- require("lazy").setup("plugins")
vim.opt.rtp:prepend(vim.env.LAZY or lazypath)
require("lazy").setup({
import = "plugins",
defaults = { lazy = true },
checker = { enabled = false },
performance = {
cache = {
enabled = true,
},
rtp = {
disabled_plugins = {
"gzip",
"matchit",
"matchparen",
"netrwPlugin",
"rplugin",
"tarPlugin",
"tohtml",
"tutor",
"zipPlugin",
},
},
},
debug = false,
spec = {
-- add LazyVim and import its plugins
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
-- import any extras modules here
-- { import = "lazyvim.plugins.extras.lang.json" },
-- { import = "lazyvim.plugins.extras.ui.mini-animate" },
{ import = "lazyvim.plugins.extras.coding.copilot" },
{ import = "lazyvim.plugins.extras.lang.go" },
{ import = "lazyvim.plugins.extras.lang.typescript" },
{ import = "lazyvim.plugins.extras.lang.yaml" },
-- import/override with your plugins
{ import = "plugins" },
},
defaults = {
-- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup.
-- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default.
lazy = false,
-- It's recommended to leave version=false for now, since a lot the plugin that support versioning,
-- have outdated releases, which may break your Neovim install.
version = false, -- always use the latest git commit
-- version = "*", -- try installing the latest stable version for plugins that support semver
},
install = { colorscheme = { "noirbuddy", "tokyonight", "habamax" } },
checker = { enabled = true }, -- automatically check for plugin updates
performance = {
rtp = {
-- disable some rtp plugins
disabled_plugins = {
"gzip",
-- "matchit",
-- "matchparen",
-- "netrwPlugin",
"tarPlugin",
"tohtml",
"tutor",
"zipPlugin",
},
},
},
})

View file

@ -1,78 +1,9 @@
vim.cmd([[set undofile]])
vim.cmd([[set completeopt-=preview]])
vim.cmd([[set viewoptions-=options]])
vim.g.mapleader = ","
vim.o.hidden = true
vim.o.mouse = "a"
vim.o.splitbelow = true
vim.o.splitright = true
vim.o.ttimeout = true
vim.o.ttimeoutlen = 50
vim.o.updatetime = 100
vim.o.autochdir = true
vim.o.backupdir = "/home/dln/.local/share/nvim/backup/"
vim.o.backup = true
vim.g.netrw_dirhistmax = 0
-- vim.o.clipboard = "unnamedplus"
vim.g.do_filetype_lua = 1
vim.o.spell = false
vim.o.spelllang = "en_us"
vim.opt.winbar = nil
-- Options are automatically loaded before lazy.nvim startup
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
-- Add any additional options here
--- Indent
vim.o.autoindent = true
vim.o.breakindent = true
vim.o.expandtab = true
vim.o.smartindent = true
vim.o.joinspaces = false
vim.o.listchars = "extends:,precedes:,nbsp:·,tab:→ ,trail:·"
vim.wo.foldlevel = 99
vim.wo.linebreak = true
vim.wo.list = true
vim.o.shiftwidth = 2
vim.o.tabstop = 2
vim.o.softtabstop = 2
local opt = vim.opt
--- Search
vim.cmd("set path+=**")
vim.cmd("set wildignore+=/var/*,*.so,*.swp,*.zip,*.tar,*.pyc")
vim.o.ignorecase = true
vim.o.smartcase = true
vim.o.wildmode = "longest:full,full"
opt.relativenumber = false
if vim.fn.executable("rg") then
vim.o.grepprg = "rg --vimgrep --no-heading --smart-case"
end
--- Completion
vim.cmd("set shortmess+=c")
vim.opt.completeopt = { "menuone", "noselect" }
--- Appearance
vim.o.scrolloff = 7
vim.o.showmode = false
vim.o.sidescrolloff = 5
vim.o.termguicolors = true
vim.wo.cursorline = true
vim.wo.number = true
vim.wo.signcolumn = "yes"
vim.o.laststatus = 3
vim.o.cmdheight = 1
-- vim.o.statusline = "═"
-- vim.o.title = true
-- vim.o.titlestring = "%F%m %r %y"
vim.o.fillchars = "stl: ,stlnc: ,eob:🮙"
-- vim.wo.foldmethod = "expr"
-- vim.wo.foldexpr = "nvim_treesitter#foldexpr()"
vim.g.netrw_dirhistmax = 0
--- Key mappings
vim.keymap.set("n", "<C-l>", ':let @/=""<CR>') -- clear search
vim.keymap.set("n", ",L", ":luafile %<CR>") -- Reload lua file
-- AutoCommand OSC7 workaround for tmux
-- see https://github.com/neovim/neovim/issues/21771
vim.api.nvim_create_autocmd("dirchanged", {
pattern = "*",
command = 'call chansend(v:stderr, printf("\\033]7;%s\\033", v:event.cwd))',
})

View file

@ -1,47 +0,0 @@
return {
"hrsh7th/nvim-cmp",
dependencies = {
"andersevenrud/cmp-tmux",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-emoji",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
"hrsh7th/cmp-nvim-lsp-signature-help",
"onsails/lspkind-nvim",
{ "zbirenbaum/copilot-cmp", opts = {} },
},
event = "InsertEnter",
config = function()
local cmp = require("cmp")
cmp.setup({
formatting = {
format = require("lspkind").cmp_format(),
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert({
["<Up>"] = cmp.mapping.select_prev_item(),
["<Down>"] = cmp.mapping.select_next_item(),
["<C-d>"] = cmp.mapping.scroll_docs(-2),
["<C-u>"] = cmp.mapping.scroll_docs(2),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = false }),
["<Tab>"] = cmp.mapping.confirm({ select = true }),
["<C-Space>"] = cmp.mapping.complete(),
}),
sources = cmp.config.sources({
{ name = "nvim_lsp", priority = 3 },
{ name = "nvim_lsp_signature_help", priority = 10 },
{ name = "buffer", keyword_length = 3 },
{ name = "copilot" },
{ name = "emoji" },
}),
})
end,
}

View file

@ -0,0 +1,80 @@
return {
{
"jesseleite/nvim-noirbuddy",
as = "noirbuddy",
lazy = false,
dependencies = {
{ "tjdevries/colorbuddy.nvim" },
},
},
{
"LazyVim/LazyVim",
opts = {
-- colorscheme = "noirbuddy",
colorscheme = function()
require("noirbuddy").setup({
preset = "slate",
styles = {
italic = true,
bold = true,
underline = true,
undercurl = true,
},
colors = {
primary = "#FFECB3",
secondary = "#B0BEC5",
-- background = "#1d2229",
background = "#0d1219",
},
})
local Color, colors, Group, groups, styles = require("colorbuddy").setup()
Color.new("string", "#D7CCC8")
Color.new("symbol", "#ECEFF1")
--
Color.new("comment", "#E57373", nil, styles.italic)
Color.new("hlargs", "#FFF8E1")
Color.new("illuminate_bg", "#112210")
Color.new("illuminate_fg", "#66FFEE")
-- Color.new("search_bg", "#554411")
-- Color.new("search_fg", "#FFF0C0")
--
Color.new("search_bg", "#223311")
Color.new("search_fg", "#CCFF33")
Group.new("TelescopeTitle", colors.primary)
Group.new("TelescopeBorder", colors.secondary)
Group.new("@comment", colors.comment, nil, styles.italic)
Group.new("@string", colors.string, nil, styles.italic)
Group.new("@keyword", colors.noir_2)
Group.new("@keyword.function", colors.noir_2)
Group.new("@keyword.return", colors.noir_1)
Group.new("@operator", colors.noir_1)
Group.new("@keyword.operator", colors.noir_1)
-- Group.new("Hlargs", colors.noir_3, nil, styles.italic)
Group.new("@type.builtin", colors.noir_2)
Group.new("@variable", colors.symbol, nil, styles.italic)
Group.new("Hlargs", colors.hlargs, nil, styles.italic)
Group.new("@function", colors.noir_1, nil, styles.bold)
Group.new("@method", colors.noir_1, nil, styles.bold)
Group.new("@punctuation", colors.noir_4)
Group.new("@punctuation.bracket", colors.noir_4)
Group.new("@punctuation.delimiter", colors.noir_4)
Group.new("IlluminatedWordText", colors.illuminate_fg, colors.illuminate_bg)
Group.new("Search", colors.search_fg, colors.search_bg, styles.italic + styles.undercurl)
Group.new("IncSearch", colors.search_fg, colors.search_bg)
end,
},
},
}

View file

@ -1,18 +1,6 @@
local M = {
return {
"zbirenbaum/copilot.lua",
event = { "VeryLazy" },
dependencies = {
{
"zbirenbaum/copilot-cmp",
config = function()
require("copilot_cmp").setup()
end,
},
},
}
function M.config()
require("copilot").setup({
opts = {
panel = {
enabled = true,
auto_refresh = false,
@ -48,7 +36,5 @@ function M.config()
},
copilot_node_command = "node", -- Node version must be < 18
server_opts_overrides = {},
})
end
return M
},
}

View file

@ -1,53 +0,0 @@
return {
"mfussenegger/nvim-dap",
dependencies = {
{
"theHamsta/nvim-dap-virtual-text",
config = function()
require("nvim-dap-virtual-text").setup({
commented = true,
})
end,
},
{
"leoluz/nvim-dap-go",
config = function()
require("dap-go").setup()
end,
},
},
keys = {
{ "DD", ":lua require'dap'.toggle_breakpoint()<cr>", desc = "Toggle Breakpoint" },
{ "Dc", ":lua require'dap'.continue()<cr>", desc = "Continue" },
{ "Di", ":lua require'dap'.step_into()<cr>", desc = "Step Into" },
{ "Do", ":lua require'dap'.step_over()<cr>", desc = "Step Over" },
{ "DO", ":lua require'dap'.step_out()<cr>", desc = "Step Out" },
{ "Dh", ":lua require'dap.ui.widgets'.hover()<cr>", desc = "Hover" },
{ "Dr", ":lua require'dap'.repl.toggle({height = 5})<cr>", desc = "Toogle Repl" },
},
config = function()
require("dap")
require("dap.ext.vscode").load_launchjs()
vim.fn.sign_define(
"DapBreakpoint",
{ text = "", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" }
)
vim.fn.sign_define(
"DapBreakpointCondition",
{ text = "", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" }
)
vim.fn.sign_define(
"DapBreakpointRejected",
{ text = "", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" }
)
vim.fn.sign_define(
"DapLogPoint",
{ text = "", texthl = "DapLogPoint", linehl = "DapLogPoint", numhl = "DapLogPoint" }
)
vim.fn.sign_define(
"DapStopped",
{ text = "", texthl = "DapStopped", linehl = "DapStopped", numhl = "DapStopped" }
)
end,
}

View file

@ -0,0 +1,266 @@
-- since this is just an example spec, don't actually load anything here and return an empty spec
-- stylua: ignore
if true then return {} end
-- every spec file under the "plugins" directory will be loaded automatically by lazy.nvim
--
-- In your plugin files, you can:
-- * add extra plugins
-- * disable/enabled LazyVim plugins
-- * override the configuration of LazyVim plugins
return {
-- add gruvbox
{ "ellisonleao/gruvbox.nvim" },
-- Configure LazyVim to load gruvbox
{
"LazyVim/LazyVim",
opts = {
colorscheme = "gruvbox",
},
},
-- change trouble config
{
"folke/trouble.nvim",
-- opts will be merged with the parent spec
opts = { use_diagnostic_signs = true },
},
-- disable trouble
{ "folke/trouble.nvim", enabled = false },
-- add symbols-outline
{
"simrat39/symbols-outline.nvim",
cmd = "SymbolsOutline",
keys = { { "<leader>cs", "<cmd>SymbolsOutline<cr>", desc = "Symbols Outline" } },
config = true,
},
-- override nvim-cmp and add cmp-emoji
{
"hrsh7th/nvim-cmp",
dependencies = { "hrsh7th/cmp-emoji" },
---@param opts cmp.ConfigSchema
opts = function(_, opts)
local cmp = require("cmp")
opts.sources = cmp.config.sources(vim.list_extend(opts.sources, { { name = "emoji" } }))
end,
},
-- change some telescope options and a keymap to browse plugin files
{
"nvim-telescope/telescope.nvim",
keys = {
-- add a keymap to browse plugin files
-- stylua: ignore
{
"<leader>fp",
function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end,
desc = "Find Plugin File",
},
},
-- change some options
opts = {
defaults = {
layout_strategy = "horizontal",
layout_config = { prompt_position = "top" },
sorting_strategy = "ascending",
winblend = 0,
},
},
},
-- add telescope-fzf-native
{
"telescope.nvim",
dependencies = {
"nvim-telescope/telescope-fzf-native.nvim",
build = "make",
config = function()
require("telescope").load_extension("fzf")
end,
},
},
-- add pyright to lspconfig
{
"neovim/nvim-lspconfig",
---@class PluginLspOpts
opts = {
---@type lspconfig.options
servers = {
-- pyright will be automatically installed with mason and loaded with lspconfig
pyright = {},
},
},
},
-- add tsserver and setup with typescript.nvim instead of lspconfig
{
"neovim/nvim-lspconfig",
dependencies = {
"jose-elias-alvarez/typescript.nvim",
init = function()
require("lazyvim.util").on_attach(function(_, buffer)
-- stylua: ignore
vim.keymap.set( "n", "<leader>co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" })
vim.keymap.set("n", "<leader>cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer })
end)
end,
},
---@class PluginLspOpts
opts = {
---@type lspconfig.options
servers = {
-- tsserver will be automatically installed with mason and loaded with lspconfig
tsserver = {},
},
-- you can do any additional lsp server setup here
-- return true if you don't want this server to be setup with lspconfig
---@type table<string, fun(server:string, opts:_.lspconfig.options):boolean?>
setup = {
-- example to setup with typescript.nvim
tsserver = function(_, opts)
require("typescript").setup({ server = opts })
return true
end,
-- Specify * to use this function as a fallback for any server
-- ["*"] = function(server, opts) end,
},
},
},
-- for typescript, LazyVim also includes extra specs to properly setup lspconfig,
-- treesitter, mason and typescript.nvim. So instead of the above, you can use:
{ import = "lazyvim.plugins.extras.lang.typescript" },
-- add more treesitter parsers
{
"nvim-treesitter/nvim-treesitter",
opts = {
ensure_installed = {
"bash",
"html",
"javascript",
"json",
"lua",
"markdown",
"markdown_inline",
"python",
"query",
"regex",
"tsx",
"typescript",
"vim",
"yaml",
},
},
},
-- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above
-- would overwrite `ensure_installed` with the new value.
-- If you'd rather extend the default config, use the code below instead:
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
-- add tsx and treesitter
vim.list_extend(opts.ensure_installed, {
"tsx",
"typescript",
})
end,
},
-- the opts function can also be used to change the default opts:
{
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
opts = function(_, opts)
table.insert(opts.sections.lualine_x, "😄")
end,
},
-- or you can return new options to override all the defaults
{
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
opts = function()
return {
--[[add your custom lualine config here]]
}
end,
},
-- use mini.starter instead of alpha
{ import = "lazyvim.plugins.extras.ui.mini-starter" },
-- add jsonls and schemastore packages, and setup treesitter for json, json5 and jsonc
{ import = "lazyvim.plugins.extras.lang.json" },
-- add any tools you want to have installed below
{
"williamboman/mason.nvim",
opts = {
ensure_installed = {
"stylua",
"shellcheck",
"shfmt",
"flake8",
},
},
},
-- Use <tab> for completion and snippets (supertab)
-- first: disable default <tab> and <s-tab> behavior in LuaSnip
{
"L3MON4D3/LuaSnip",
keys = function()
return {}
end,
},
-- then: setup supertab in cmp
{
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-emoji",
},
---@param opts cmp.ConfigSchema
opts = function(_, opts)
local has_words_before = function()
unpack = unpack or table.unpack
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
local luasnip = require("luasnip")
local cmp = require("cmp")
opts.mapping = vim.tbl_extend("force", opts.mapping, {
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
-- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
-- this way you will only jump inside the snippet region
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
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" }),
})
end,
},
}

View file

@ -1,38 +0,0 @@
local M = {
"lewis6991/gitsigns.nvim",
}
function M.config()
require("gitsigns").setup({
numhl = true,
signs = {
add = { hl = "GitSignsAdd", text = "", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" },
change = {
hl = "GitSignsChange",
text = "",
numhl = "GitSignsChangeNr",
linehl = "GitSignsChangeLn",
},
delete = {
hl = "GitSignsDelete",
text = "",
numhl = "GitSignsDeleteNr",
linehl = "GitSignsDeleteLn",
},
topdelete = {
hl = "GitSignsDelete",
text = "",
numhl = "GitSignsDeleteNr",
linehl = "GitSignsDeleteLn",
},
changedelete = {
hl = "GitSignsChange",
text = "~",
numhl = "GitSignsChangeNr",
linehl = "GitSignsChangeLn",
},
},
})
end
return M

View file

@ -1,9 +0,0 @@
local M = {
"RRethy/vim-illuminate",
event = "BufReadPost",
config = function()
require("illuminate").configure({ delay = 200 })
end,
}
return M

View file

@ -1,44 +0,0 @@
local M = {
"lukas-reineke/indent-blankline.nvim",
event = "BufReadPre",
config = {
buftype_exclude = { "terminal", "nofile" },
filetype_exclude = {
"help",
"neogitstatus",
"NvimTree",
"neo-tree",
"Trouble",
},
char = "",
-- char = "┊",
char_highlight_list = { "Indent1", "Indent2", "Indent3", "Indent4", "Indent5", "Indent6" },
use_treesitter_scope = false,
show_trailing_blankline_indent = false,
show_current_context = true,
context_patterns = {
"class",
"return",
"function",
"method",
"^if",
"^while",
"jsx_element",
"^for",
"^object",
"^table",
"block",
"arguments",
"if_statement",
"else_clause",
"jsx_element",
"jsx_self_closing_element",
"try_statement",
"catch_clause",
"import_statement",
"operation_type",
},
},
}
return M

View file

@ -1,241 +0,0 @@
local M = {
"neovim/nvim-lspconfig",
event = "VeryLazy",
}
function M.config()
local lspconfig = require("lspconfig")
local capabilities = require("cmp_nvim_lsp").default_capabilities()
vim.keymap.set("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>")
vim.keymap.set("i", "<C-k>", "<Cmd>lua vim.lsp.buf.signature_help()<CR>")
vim.keymap.set("n", "1gd", "<Cmd>lua vim.lsp.buf.type_definition()<CR>")
vim.keymap.set("n", "gf", "<Cmd>lua vim.lsp.buf.format()<CR>")
vim.keymap.set("n", "[d", "<Cmd>lua vim.lsp.diagnostic.goto_prev()<CR>")
vim.keymap.set("n", "]d", "<Cmd>lua vim.lsp.diagnostic.goto_next()<CR>")
vim.keymap.set("n", "gwa", "<Cmd>lua vim.lsp.buf.add_workspace_folder()<CR>")
vim.keymap.set("n", "gwr", "<Cmd>lua vim.lsp.buf.add_workspace_folder()<CR>")
vim.keymap.set("n", "gwl", "<Cmd>lua vim.lsp.buf.add_workspace_folder()<CR>")
vim.cmd([[autocmd BufWritePre * lua vim.lsp.buf.format({sync = true})]])
local border = {
{ "🭽", "FloatBorder" },
{ "", "FloatBorder" },
{ "🭾", "FloatBorder" },
{ "", "FloatBorder" },
{ "🭿", "FloatBorder" },
{ "", "FloatBorder" },
{ "🭼", "FloatBorder" },
{ "", "FloatBorder" },
}
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.signature_help, { border = border })
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
update_in_insert = false,
virtual_text = false,
})
local signs = { Error = "🔥", Warn = "⚠️ ", Hint = "💡", Info = "💡" }
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
end
local function on_attach(client, bufnr)
require("nvim-navic").attach(client, bufnr)
end
-- simple setups --
local servers = {
"bashls",
"bufls",
"dockerls",
"gopls",
"jsonls",
-- "sql",
"pyright",
"lua_ls",
"terraformls",
"yamlls",
}
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup({ on_attach = on_attach })
end
local efm_prettier = {
formatCommand = "prettier --stdin-filepath ${INPUT}",
formatStdin = true,
}
lspconfig.gopls.setup({
on_attach = on_attach,
settings = {
gopls = {
directoryFilters = {
"-bazel-bin",
"-bazel-out",
"-bazel-testlogs",
"-proto",
},
},
},
})
lspconfig.lua_ls.setup({
on_attach = function(client, bufnr)
on_attach(client, bufnr)
vim.cmd([[autocmd BufWritePre <buffer> lua require'stylua-nvim'.format_file()]])
end,
settings = {
Lua = {
completion = { kewordSnippet = "Disable" },
diagnostics = {
enable = true,
globals = { "renoise", "use", "vim" },
},
runtime = {
version = "LuaJIT",
path = { "?.lua", "?/init.lua", "?/?.lua" },
},
workspace = {
library = vim.api.nvim_get_runtime_file("", true),
maxPreload = 2000,
preloadFileSize = 1000,
checkThirdParty = false,
},
},
},
})
lspconfig.terraformls.setup({})
local yaml_is_k8s = function(bufnr)
local lines = vim.api.nvim_buf_get_lines(bufnr, 0, 50, false) -- Stop after the first 50 lines
for _, l in pairs(lines) do
if string.find(l, "apiVersion") ~= nil then
return true
end
end
return false
end
lspconfig.cssls.setup({
cmd = { "vscode-css-languageserver", "--stdio" },
capabilities = capabilities,
})
lspconfig.cssmodules_ls.setup({})
lspconfig.html.setup({
cmd = { "vscode-html-languageserver", "--stdio" },
filetypes = { "html" },
init_options = {
configurationSection = { "html", "css", "javascript" },
embeddedLanguages = {
css = true,
javascript = true,
},
},
settings = {},
})
lspconfig.yamlls.setup({
settings = {
yaml = {
format = { enable = true, singleQuote = true },
schemaStore = { enable = true, url = "https://json.schemastore.org" },
schemas = {
-- ["https://json.schemastore.org/github-workflow"] = "*.github/workflows/*",
["https://json.schemastore.org/kustomization.json"] = "kustomization.yaml",
-- ["https://json.schemastore.org/ansible-role-2.9.json"] = "*/tasks/*.y*ml",
kubernetes = {
"clusterrolebinding.yaml",
"clusterrole-contour.yaml",
"clusterrole.yaml",
"configmap.yaml",
"cronjob.yaml",
"daemonset.yaml",
"deployment-*.yaml",
"deployment.yaml",
"*-deployment.yaml",
"hpa.yaml",
"ingress.yaml",
"job.yaml",
"namespace.yaml",
"pvc.yaml",
"rbac.yaml",
"rolebinding.yaml",
"role.yaml",
"sa.yaml",
"secret.yaml",
"serviceaccounts.yaml",
"service-account.yaml",
"serviceaccount.yaml",
"service-*.yaml",
"service.yaml",
"*-service.yaml",
"statefulset.yaml",
},
},
validate = true,
},
},
})
require("lspconfig").tsserver.setup({
root_dir = vim.loop.cwd,
})
-- npm install -g typescript typescript-language-server
-- require("lspconfig").tsserver.setup({
-- on_attach = function(client, bufnr)
-- client.resolved_capabilities.document_formatting = false
-- on_attach(client)
-- local ts_utils = require("nvim-lsp-ts-utils")
-- ts_utils.setup({
-- debug = false,
-- disable_commands = false,
-- enable_import_on_completion = false,
-- import_all_timeout = 5000, -- ms
-- -- eslint
-- eslint_enable_code_actions = true,
-- eslint_enable_disable_comments = true,
-- eslint_bin = "eslint_d",
-- eslint_config_fallback = nil,
-- eslint_enable_diagnostics = true,
-- -- formatting
-- enable_formatting = true,
-- formatter = "prettier",
-- formatter_config_fallback = nil,
-- -- parentheses completion
-- complete_parens = false,
-- signature_help_in_parens = false,
-- -- update imports on file move
-- update_imports_on_move = true,
-- require_confirmation_on_move = true,
-- watch_dir = nil,
-- })
-- ts_utils.setup_client(client)
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<Leader>co", ":TSLspOrganize<CR>", { silent = true })
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "qq", ":TSLspFixCurrent<CR>", { silent = true })
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<Leader>cR", ":TSLspRenameFile<CR>", { silent = true })
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<Leader>ci", ":TSLspImportAll<CR>", { silent = true })
-- end,
-- })
--
end
return M

View file

@ -1,52 +0,0 @@
local M = {
"nvim-lualine/lualine.nvim",
dependencies = { "kyazdani42/nvim-web-devicons" },
event = "VeryLazy",
}
local function clock()
return os.date("%H:%M")
end
function M.config()
local lualine = require("lualine")
lualine.setup({
options = {
globalstatus = true,
theme = "onedark",
-- theme = "wombat",
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
},
sections = {
lualine_a = { "hostname" },
lualine_c = {
{
"filename",
path = 1,
file_status = true,
},
{
function()
local navic = require("nvim-navic")
local ret = navic.get_location()
return ret:len() > 2000 and "navic error" or ret
end,
cond = function()
if package.loaded["nvim-navic"] then
local navic = require("nvim-navic")
return navic.is_available()
end
end,
color = { fg = "#ff8f00" },
},
},
lualine_x = { "filetype" },
lualine_y = { "location" },
lualine_z = { clock },
},
})
end
return M

View file

@ -1,37 +0,0 @@
local M = {
"chentoast/marks.nvim",
event = "VeryLazy",
}
function M.config()
local marks = require("marks")
marks.setup({
default_mappings = true,
-- which builtin marks to show. default {}
-- builtin_marks = { ".", "<", ">", "^" },
cyclic = true,
force_write_shada = false,
-- marks, and bookmarks.
-- can be either a table with all/none of the keys, or a single number, in which case
-- the priority applies to all marks.
-- default 10.
-- sign_priority = { lower=10, upper=15, builtin=8, bookmark=20 },
--
-- disables mark tracking for specific filetypes. default {}
excluded_filetypes = {},
-- marks.nvim allows you to configure up to 10 bookmark groups, each with its own
-- sign/virttext. Bookmarks can be used to group together positions and quickly move
-- across multiple buffers. default sign is '!@#$%^&*()' (from 0 to 9), and
-- default virt_text is "".
bookmark_1 = {
sign = "",
virt_text = "",
},
})
end
return M

View file

@ -1,197 +0,0 @@
return {
"tjdevries/colorbuddy.vim",
"wbthomason/packer.nvim",
"jose-elias-alvarez/nvim-lsp-ts-utils",
"jjo/vim-cue",
"ckipp01/stylua-nvim",
{
"jesseleite/nvim-noirbuddy",
dependencies = { "tjdevries/colorbuddy.nvim" },
config = function()
require("noirbuddy").setup({
styles = {
italic = true,
bold = true,
underline = true,
undercurl = true,
},
colors = {
primary = "#FFECB3",
secondary = "#B0BEC5",
-- background = "#1d2229",
background = "#0d1219",
},
})
local Color, colors, Group, groups, styles = require("colorbuddy").setup()
Color.new("string", "#D7CCC8")
Color.new("symbol", "#ECEFF1")
Color.new("comment", "#E57373")
Color.new("hlargs", "#FFF8E1")
Color.new("illuminate_bg", "#112210")
Color.new("illuminate_fg", "#66FFEE")
-- Color.new("search_bg", "#554411")
-- Color.new("search_fg", "#FFF0C0")
--
Color.new("search_bg", "#223311")
Color.new("search_fg", "#CCFF33")
Group.new("TelescopeTitle", colors.primary)
Group.new("TelescopeBorder", colors.secondary)
Group.new("@comment", colors.comment, nil, styles.bold + styles.italic)
Group.new("@string", colors.string, nil, styles.italic)
Group.new("@keyword", colors.noir_2)
Group.new("@keyword.function", colors.noir_2)
Group.new("@keyword.return", colors.noir_1)
Group.new("@operator", colors.noir_1)
Group.new("@keyword.operator", colors.noir_1)
-- Group.new("Hlargs", colors.noir_3, nil, styles.italic)
Group.new("@type.builtin", colors.noir_2)
Group.new("@variable", colors.symbol, nil, styles.italic)
Group.new("Hlargs", colors.hlargs, nil, styles.italic)
Group.new("@function", colors.noir_1, nil, styles.bold)
Group.new("@method", colors.noir_1, nil, styles.bold)
Group.new("@punctuation", colors.noir_4)
Group.new("@punctuation.bracket", colors.noir_4)
Group.new("@punctuation.delimiter", colors.noir_4)
Group.new("IlluminatedWordText", colors.illuminate_fg, colors.illuminate_bg)
Group.new("Search", colors.search_fg, colors.search_bg, styles.italic + styles.undercurl)
Group.new("IncSearch", colors.search_fg, colors.search_bg)
end,
},
{
"lukas-reineke/headlines.nvim",
-- config = {
-- ft = { "go" },
-- go = {
-- query = vim.treesitter.parse_query(
-- "go",
-- [[
-- (function_declaration @headline)
-- ]]
-- ),
-- -- treesitter_language = "go",
-- },
-- },
},
{
"m-demare/hlargs.nvim",
event = "VeryLazy",
enabled = true,
config = {
excluded_argnames = {
usages = {
lua = { "self", "use" },
},
},
},
},
{
"folke/trouble.nvim",
cmd = { "TroubleToggle", "Trouble" },
config = {
auto_open = false,
use_diagnostic_signs = true,
},
keys = {
{ "<leader>xx", "<cmd>TroubleToggle<cr>" },
{ "<leader>xw", "<cmd>TroubleToggle workspace_diagnostics<cr>" },
{ "<leader>xd", "<cmd>TroubleToggle document_diagnostics<cr>" },
{ "<leader>xl", "<cmd>TroubleToggle loclist<cr>" },
{ "<leader>xq", "<cmd>TroubleToggle quickfix<cr>" },
{ "gR", "<cmd>TroubleToggle lsp_references<cr>" },
},
},
{
"danymat/neogen",
keys = {
{
"<leader>cc",
function()
require("neogen").generate({})
end,
desc = "Neogen Comment",
},
},
opts = { snippet_engine = "luasnip" },
},
{
"smjonas/inc-rename.nvim",
cmd = "IncRename",
config = true,
keys = {
{ "<Leader>rn", ":IncRename " },
},
},
{
"SmiteshP/nvim-navic",
config = function()
vim.g.navic_silence = true
require("nvim-navic").setup({ separator = " ", highlight = true, depth_limit = 5 })
end,
},
{
"numToStr/Comment.nvim",
keys = {
{ "<C-_>", "<Plug>(comment_toggle_linewise_current)" },
{ "<C-_>", "<Plug>(comment_toggle_linewise_visual)", mode = "v" },
},
dependencies = {
"JoosepAlviste/nvim-ts-context-commentstring",
},
config = function()
require("Comment").setup({
pre_hook = require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook(),
})
end,
},
{
"ray-x/go.nvim",
config = function()
require("go").setup({
comment_placeholder = "",
icons = { breakpoint = "🧘", currentpos = "🏃" },
dap_debug_gui = false,
})
vim.cmd("autocmd FileType go nmap <Leader>c :lua require('go.comment').gen()<cr>")
vim.cmd("autocmd BufWritePre *.go :silent! lua require('go.format').gofmt()")
vim.cmd("autocmd BufWritePre (InsertLeave?) <buffer> lua vim.lsp.buf.formatting_sync(nil,500)")
end,
},
{
"onsails/lspkind-nvim",
config = function()
require("lspkind").init({})
end,
},
-- {
-- url = "https://git.sr.ht/~whynothugo/lsp_lines.nvim",
-- config = function()
-- require("lsp_lines").setup()
-- vim.diagnostic.config({
-- virtual_text = false,
-- })
-- end,
-- },
}

View file

@ -1,19 +0,0 @@
local M = {
"folke/noice.nvim",
event = "VeryLazy",
dependencies = {
"MunifTanjim/nui.nvim",
},
}
function M.config()
require("noice").setup({
presets = {
inc_rename = true,
long_message_to_split = true,
lsp_doc_border = true,
},
})
end
return M

View file

@ -1,44 +0,0 @@
local M = {
"jose-elias-alvarez/null-ls.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
}
function M.config()
local null_ls = require("null-ls")
local builtins = require("null-ls.builtins")
null_ls.setup({
sources = {
builtins.code_actions.eslint_d,
builtins.completion.spell,
builtins.diagnostics.buf.with({
args = { "lint", "--disable-symlinks", "--path", "$FILENAME" },
cwd = function()
local file_dir = vim.fn.expand("%:p:h") .. ";"
local buf_yaml = vim.fn.findfile("buf.yaml", file_dir)
if buf_yaml then
return vim.fn.fnamemodify(buf_yaml, ":h")
end
end,
}),
builtins.diagnostics.buildifier,
builtins.diagnostics.cue_fmt,
builtins.diagnostics.eslint_d,
builtins.diagnostics.golangci_lint,
builtins.formatting.black,
builtins.formatting.buf,
builtins.formatting.buildifier,
builtins.formatting.cue_fmt,
builtins.formatting.prettierd,
builtins.formatting.shfmt,
builtins.formatting.sqlfluff,
builtins.formatting.stylua,
},
debug = true,
})
end
return M

View file

@ -1,18 +0,0 @@
local M = {
"ojroques/nvim-osc52",
}
function M.config()
local osc52 = require("osc52")
osc52.setup({
max_length = 0, -- Maximum length of selection (0 for no limit)
silent = false, -- Disable message on successful copy
trim = false, -- Trim text before copy
})
vim.keymap.set("n", "<leader>c", require("osc52").copy_operator, { expr = true })
vim.keymap.set("n", "<leader>cc", "<leader>c_", { remap = true })
vim.keymap.set("x", "<leader>c", require("osc52").copy_visual)
end
return M

View file

@ -1,11 +0,0 @@
return {}
-- return {
-- name = "shelman-theme",
-- dir = "~/.config/shelman-theme/current/neovim",
-- dev = true,
-- lazy = false,
-- priority = 1000,
-- config = function()
-- vim.cmd([[colorscheme shelman]])
-- end,
-- }

View file

@ -1,112 +0,0 @@
local function project_files()
require("telescope.builtin").find_files({
cwd = require("lspconfig.util").root_pattern(".git")(vim.fn.expand("%:p")),
})
end
local M = {
"nvim-telescope/telescope.nvim",
lazy = false,
dependencies = {
"nvim-lua/popup.nvim",
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope-fzy-native.nvim",
"nvim-telescope/telescope-github.nvim",
"nvim-telescope/telescope-dap.nvim",
"nvim-telescope/telescope-ui-select.nvim",
},
}
function M.config()
local telescope = require("telescope")
local actions = require("telescope.actions")
local previewers = require("telescope.previewers")
vim.keymap.set("n", "<leader>b", '<cmd>lua require("telescope.builtin").buffers()<CR>')
vim.keymap.set("n", "<leader>f", '<cmd>lua require("telescope.builtin").oldfiles()<CR>')
vim.keymap.set("n", "<space>", '<cmd>lua require("telescope.builtin").oldfiles()<CR>')
vim.keymap.set("n", "<leader><space>", '<cmd>lua require("telescope.builtin").oldfiles({cwd_only=true})<CR>')
vim.keymap.set("n", "<leader>d", '<cmd>lua require("telescope.builtin").diagnostics({bufnr=0})<CR>')
vim.keymap.set("n", "<leader>e", '<cmd>lua require("telescope.builtin").git_files()<CR>')
vim.keymap.set("n", "<leader>g", '<cmd>lua require("telescope.builtin").git_status()<CR>')
vim.keymap.set("n", "<leader>a", '<cmd>lua require("telescope.builtin").lsp_code_actions()<CR>')
vim.keymap.set("n", "<leader>m", '<cmd>lua require("telescope.builtin").marks()<CR>')
vim.keymap.set("n", "<leader>s", '<cmd>lua require("telescope.builtin").lsp_document_symbols()<CR>')
vim.keymap.set("n", "<leader>S", '<cmd>lua require("telescope.builtin").lsp_dynamic_workspace_symbols()<CR>')
vim.keymap.set("n", "<leader>t", '<cmd>lua require("telescope.builtin").treesitter()<CR>')
vim.keymap.set("n", "<leader>/", '<cmd>lua require("telescope.builtin").live_grep()<CR>')
vim.keymap.set("n", "<leader>.", '<cmd>lua require("telescope.builtin").file_browser()<CR>')
vim.keymap.set("n", "<leader>p", '<cmd>lua require("telescope.builtin").registers()<CR>')
vim.keymap.set("n", "ga", "<cmd>lua vim.lsp.buf.code_action()<CR>")
vim.keymap.set("n", "gr", '<cmd>lua require("telescope.builtin").lsp_references()<CR>')
vim.keymap.set("n", "gd", '<cmd>lua require("telescope.builtin").lsp_definitions()<CR>')
vim.keymap.set("n", "gi", '<cmd>lua require("telescope.builtin").lsp_implementations()<CR>')
vim.keymap.set("n", "g/", '<cmd>lua require("telescope.builtin").lsp_document_symbols()<CR>')
vim.keymap.set(
"n",
"g?",
'<cmd>lua require("telescope.builtin").lsp_workspace_symbols({query=(vim.bo.filetype == "go" and "\'" or "")})<CR>'
)
vim.keymap.set("n", "ge", '<cmd>lua require("telescope.builtin").lsp_document_diagnostics()<CR>')
vim.keymap.set("n", "Db", '<cmd>lua require("telescope").extensions.dap.list_breakpoints()<CR>')
vim.keymap.set("n", "Dcc", '<cmd>lua require("telescope").extensions.dap.commands()<CR>')
vim.keymap.set("n", "Df", '<cmd>lua require("telescope").extensions.dap.frames()<CR>')
vim.keymap.set("n", "Dv", '<cmd>lua require("telescope").extensions.dap.variables()<CR>')
-- Setup
telescope.setup({
defaults = {
layout_strategy = "flex",
-- layout_defaults = {flip_columns = 160},
layout_config = {
preview_cutoff = 10,
prompt_position = "bottom",
mirror = true,
},
mappings = {
i = {
["<CR>"] = actions.select_default + actions.center,
["<esc>"] = actions.close,
["<tab>"] = actions.add_selection,
},
},
color_devicons = true,
file_previewer = previewers.vim_buffer_cat.new,
grep_previewer = previewers.vim_buffer_vimgrep.new,
qflist_previewer = previewers.vim_buffer_qflist.new,
},
extensions = {
["ui-select"] = {
require("telescope.themes").get_dropdown({
-- even more opts
}),
},
},
})
local layout_strategies = require("telescope.pickers.layout_strategies")
local config = require("telescope.config")
layout_strategies.flex = function(self, max_columns, max_lines)
local layout_config = self.layout_config or {}
local flip_columns = layout_config.flip_columns or 160 -- Here's why.
local flip_lines = layout_config.flip_lines or 20
if max_columns < flip_columns and max_lines > flip_lines then
self.layout_config = (config.values.layout_defaults or {})["vertical"]
return layout_strategies.vertical(self, max_columns, max_lines)
else
self.layout_config = (config.values.layout_defaults or {})["horizontal"]
return layout_strategies.horizontal(self, max_columns, max_lines)
end
end
-- Extensions
telescope.load_extension("dap")
telescope.load_extension("fzy_native")
telescope.load_extension("gh")
telescope.load_extension("ui-select")
end
return M

View file

@ -1,130 +0,0 @@
return {
{ "nvim-treesitter/playground", cmd = "TSPlaygroundToggle" },
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
event = "BufReadPost",
dependencies = {
"nvim-treesitter/nvim-treesitter-textobjects",
"windwp/nvim-ts-autotag",
},
config = function()
require("nvim-treesitter.configs").setup({
ensure_installed = {
"bash",
"c",
"cmake",
"cpp",
"css",
"diff",
"dockerfile",
"gdscript",
"git_rebase",
"gitcommit",
"gitignore",
"go",
"gomod",
"graphql",
"help",
"hcl",
"html",
"http",
"java",
"javascript",
"jsdoc",
"json",
"jsonc",
"kotlin",
"latex",
"lua",
"make",
"markdown",
"markdown_inline",
"meson",
"ninja",
"php",
"proto",
"python",
"query",
"regex",
"rego",
"rust",
"scss",
"sql",
"svelte",
"teal",
"toml",
"tsx",
"typescript",
"vhs",
"vim",
"vue",
"wgsl",
"yaml",
"zig",
},
highlight = {
enable = true,
use_languagetree = true,
},
indent = {
enable = false,
},
context_commentstring = { enable = true, enable_autocmd = false },
playground = {
enable = true,
disable = {},
updatetime = 25,
persist_queries = false,
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "ss",
node_incremental = "sq",
scope_incremental = "sd",
node_decremental = "sa",
},
},
query_linter = {
enable = true,
use_virtual_text = true,
lint_events = { "BufWrite", "CursorHold" },
},
textobjects = {
move = {
enable = true,
goto_next_start = {
["]]"] = "@function.outer",
["]m"] = "@class.outer",
},
goto_next_end = {
["]["] = "@function.outer",
["]M"] = "@class.outer",
},
goto_previous_start = {
["[["] = "@function.outer",
["[m"] = "@class.outer",
},
goto_previous_end = {
["[]"] = "@function.outer",
["[M"] = "@class.outer",
},
},
select = {
enable = true,
keymaps = {
["uc"] = "@comment.outer",
},
},
},
--- nvim-ts-autotag ---
autotag = {
enable = true,
filetypes = { "html", "javascriptreact", "xml" },
},
})
end,
},
}