refactor: blast config
This commit is contained in:
parent
09940eb3db
commit
386017ae10
@ -1,6 +1,19 @@
|
||||
require('pluginsLazy')
|
||||
require('options')
|
||||
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)
|
||||
require("lazy").setup("plugins")
|
||||
require('keymapping')
|
||||
|
||||
require('colorscheme')
|
||||
|
||||
---------------------
|
||||
|
46
nvim/.config/nvim/lazy-lock.json
Normal file
46
nvim/.config/nvim/lazy-lock.json
Normal file
@ -0,0 +1,46 @@
|
||||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "ea7d7ea510c641c4f15042becd27f35b3e5b3c2b" },
|
||||
"bufferline.nvim": { "branch": "main", "commit": "9961d87bb3ec008213c46ba14b3f384a5f520eb5" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"cmp-calc": { "branch": "main", "commit": "ce91d14d2e7a8b3f6ad86d85e34d41c1ae6268d9" },
|
||||
"cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" },
|
||||
"cmp-git": { "branch": "main", "commit": "169202582f900b0e189eed5153b291383bfbba47" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
|
||||
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
|
||||
"dressing.nvim": { "branch": "master", "commit": "c1e1d5fa44fe08811b6ef4aadac2b50e602f9504" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "ebf6d6e83494cdd88a54a429340256f4dbb6a052" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "907ae8636016aab2f283576fc60d46ca3427e579" },
|
||||
"gruvbox.nvim": { "branch": "main", "commit": "7fb36e0f67aa6f3d7f3e54f37ca7032ea1af0b59" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "9637670896b68805430e2f72cf5d16be5b97a22a" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "2a9354c7d2368d78cbd5575a51a2af5bd8a6ad01" },
|
||||
"lspkind-nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" },
|
||||
"markdown-preview.nvim": { "branch": "master", "commit": "02cc3874738bc0f86e4b91f09b8a0ac88aef8e96" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "01b4b6724ebcf5b43fc021486f6a260f1d09311e" },
|
||||
"mason.nvim": { "branch": "main", "commit": "d66c60e17dd6fd8165194b1d14d21f7eb2c1697a" },
|
||||
"mini.bufremove": { "branch": "main", "commit": "7821606e35c1ac931b56d8e3155f45ffe76ee7e5" },
|
||||
"neogit": { "branch": "master", "commit": "50b3e1d9c600deb4027af117cca660bee88223a4" },
|
||||
"nui.nvim": { "branch": "main", "commit": "c8de23342caf8d50b15d6b28368d36a56a69d76f" },
|
||||
"null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "defad64afbf19381fe31488a7582bbac421d6e38" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "360a895125ac4f39df6aa8f763635eff07e69fff" },
|
||||
"nvim-navic": { "branch": "master", "commit": "9c89730da6a05acfeb6a197e212dfadf5aa60ca0" },
|
||||
"nvim-notify": { "branch": "master", "commit": "94859430020f5cf32a1b97ddd9e596fed9db7981" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "94c7c810af205c0f00c8f105dcf490c8eb17658a" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "9ab4e9cc8989e3811b14897cd0eb21ae35e5541e" },
|
||||
"nvim-treesitter-endwise": { "branch": "master", "commit": "9298b3ac8fd6d0d8f9e321194c6d3fd37e417cf9" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "925e2aa30dc9fe9332060199c19f132ec0f3d493" },
|
||||
"nvim-whichkey-setup.lua": { "branch": "main", "commit": "b2df0761b8ba3fca31b7ae1b0afcad2f8a4e89f4" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "9ce85b0f7dcfe5358c0be937ad23e456907d410b" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "a19770625aed49ad2a9f591a5e3946707f7359f6" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "3f85d8ed30e97ceeddbbcf80224245d347053711" },
|
||||
"vim-easyescape": { "branch": "master", "commit": "fd7875f1657fd54fae85088acf289b9723d8a790" },
|
||||
"vim-eunuch": { "branch": "master", "commit": "67f3dd32b4dcd1c427085f42ff5f29c7adc645c6" },
|
||||
"vim-illuminate": { "branch": "master", "commit": "8c910b2f84ae6acd9b4b17330bb94dd783c0c11a" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "7ccf476ebe0445a741b64e36c78a682c1c6118b7" }
|
||||
}
|
@ -4,8 +4,45 @@
|
||||
local keymap = vim.keymap.set
|
||||
local opts = { silent = true }
|
||||
|
||||
vim.g.mapleader= ' '
|
||||
|
||||
|
||||
local function map(mode, lhs, rhs, opts)
|
||||
local keys = require("lazy.core.handler").handlers.keys
|
||||
---@cast keys LazyKeysHandler
|
||||
-- do not create the keymap if a lazy keys handler exists
|
||||
if not keys.active[keys.parse({ lhs, mode = mode }).id] then
|
||||
opts = opts or {}
|
||||
opts.silent = opts.silent ~= false
|
||||
if opts.remap and not vim.g.vscode then
|
||||
opts.remap = nil
|
||||
end
|
||||
vim.keymap.set(mode, lhs, rhs, opts)
|
||||
end
|
||||
end
|
||||
|
||||
-- Move to window using the <ctrl> hjkl keys
|
||||
map("n", "<C-h>", "<C-w>h", { desc = "Go to left window", remap = true })
|
||||
map("n", "<C-j>", "<C-w>j", { desc = "Go to lower window", remap = true })
|
||||
map("n", "<C-k>", "<C-w>k", { desc = "Go to upper window", remap = true })
|
||||
map("n", "<C-l>", "<C-w>l", { desc = "Go to right window", remap = true })
|
||||
|
||||
-- Resize window using <ctrl> arrow keys
|
||||
map("n", "<C-Up>", "<cmd>resize +2<cr>", { desc = "Increase window height" })
|
||||
map("n", "<C-Down>", "<cmd>resize -2<cr>", { desc = "Decrease window height" })
|
||||
map("n", "<C-Left>", "<cmd>vertical resize -2<cr>", { desc = "Decrease window width" })
|
||||
map("n", "<C-Right>", "<cmd>vertical resize +2<cr>", { desc = "Increase window width" })
|
||||
|
||||
-- buffers
|
||||
map("n", "<S-h>", "<cmd>BufferLineCyclePrev<cr>", { desc = "Prev buffer" })
|
||||
map("n", "<S-l>", "<cmd>BufferLineCycleNext<cr>", { desc = "Next buffer" })
|
||||
map("n", "[b", "<cmd>BufferLineCyclePrev<cr>", { desc = "Prev buffer" })
|
||||
map("n", "]b", "<cmd>BufferLineCycleNext<cr>", { desc = "Next buffer" })
|
||||
|
||||
map("n", "<leader>bb", "<cmd>e #<cr>", { desc = "Switch to Other Buffer" })
|
||||
map("n", "<leader>`", "<cmd>e #<cr>", { desc = "Switch to Other Buffer" })
|
||||
|
||||
-- Clear search with <esc>
|
||||
map({ "i", "n" }, "<esc>", "<cmd>noh<cr><esc>", { desc = "Escape and clear hlsearch" })
|
||||
-- Copy and paste with system clipboard
|
||||
|
||||
keymap('v', '<C-c>', '"+y', opts)
|
||||
@ -17,19 +54,46 @@ keymap('i', 'kj','<esc>', opts)
|
||||
|
||||
-- Normal --
|
||||
-- -- Save and quit
|
||||
keymap("n", "<C-s>", ":write<cr>", opts)
|
||||
keymap("n", "<C-q>", ":quit<cr>", opts)
|
||||
map({ "i", "x", "n", "s" }, "<C-s>", "<cmd>w<cr><esc>", { desc = "Save file" })
|
||||
map("n", "<leader>qq", "<cmd>qa<cr>", { desc = "Quit all" })
|
||||
keymap('n', '<C-n>',':NvimTreeToggle<CR>', opts)
|
||||
keymap('n', '<leader>r',':NvimTreeRefresh<CR>', opts)
|
||||
keymap('n', '<leader>n',':NvimTreeFindFile<CR>', opts)
|
||||
keymap("n", "<leader>e", ":NvimTreeToggle<CR>", opts)
|
||||
|
||||
-- Navigate buffers
|
||||
keymap("n", "<C-l>", ":bnext<CR>", opts)
|
||||
keymap("n", "<C-h>", ":bprevious<CR>", opts)
|
||||
|
||||
-- better indenting
|
||||
map("v", "<", "<gv")
|
||||
map("v", ">", ">gv")
|
||||
|
||||
map("n", "<leader>xl", "<cmd>lopen<cr>", { desc = "Location List" })
|
||||
map("n", "<leader>xq", "<cmd>copen<cr>", { desc = "Quickfix List" })
|
||||
map("n", "[q", vim.cmd.cprev, { desc = "Previous quickfix" })
|
||||
map("n", "]q", vim.cmd.cnext, { desc = "Next quickfix" })
|
||||
--keymap('n', '<C-s>',':BufferLinePick<CR>', opts)
|
||||
--force sudo save
|
||||
keymap('c', 'w!!','w !sudo tee > /dev/null %', opts)
|
||||
|
||||
-- floating terminal
|
||||
local lazyterm = function() Util.float_term(nil, { cwd = Util.get_root() }) end
|
||||
map("n", "<leader>ft", lazyterm, { desc = "Terminal (root dir)" })
|
||||
map("n", "<leader>fT", function() Util.float_term() end, { desc = "Terminal (cwd)" })
|
||||
map("n", "<c-/>", lazyterm, { desc = "Terminal (root dir)" })
|
||||
map("n", "<c-_>", lazyterm, { desc = "which_key_ignore" })
|
||||
|
||||
-- Terminal Mappings
|
||||
map("t", "<esc><esc>", "<c-\\><c-n>", { desc = "Enter Normal Mode" })
|
||||
map("t", "<C-h>", "<cmd>wincmd h<cr>", { desc = "Go to left window" })
|
||||
map("t", "<C-j>", "<cmd>wincmd j<cr>", { desc = "Go to lower window" })
|
||||
map("t", "<C-k>", "<cmd>wincmd k<cr>", { desc = "Go to upper window" })
|
||||
map("t", "<C-l>", "<cmd>wincmd l<cr>", { desc = "Go to right window" })
|
||||
map("t", "<C-/>", "<cmd>close<cr>", { desc = "Hide Terminal" })
|
||||
map("t", "<c-_>", "<cmd>close<cr>", { desc = "which_key_ignore" })
|
||||
|
||||
|
||||
-- tabs
|
||||
map("n", "<leader><tab>l", "<cmd>tablast<cr>", { desc = "Last Tab" })
|
||||
map("n", "<leader><tab>f", "<cmd>tabfirst<cr>", { desc = "First Tab" })
|
||||
map("n", "<leader><tab><tab>", "<cmd>tabnew<cr>", { desc = "New Tab" })
|
||||
map("n", "<leader><tab>]", "<cmd>tabnext<cr>", { desc = "Next Tab" })
|
||||
map("n", "<leader><tab>d", "<cmd>tabclose<cr>", { desc = "Close Tab" })
|
||||
map("n", "<leader><tab>[", "<cmd>tabprevious<cr>", { desc = "Previous Tab" })
|
||||
|
@ -1,3 +1,5 @@
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = "\\"
|
||||
-------------
|
||||
-- Options --
|
||||
-- ----------
|
||||
@ -23,8 +25,8 @@ vim.opt.undofile = true -- enable persistent undo
|
||||
vim.opt.updatetime = 100 -- faster completion (4000ms default)
|
||||
vim.opt.writebackup = false -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited
|
||||
vim.opt.expandtab = true -- convert tabs to spaces
|
||||
vim.opt.shiftwidth = 4 -- the number of spaces inserted for each indentation
|
||||
vim.opt.tabstop = 4 -- insert 2 spaces for a tab
|
||||
vim.opt.shiftwidth = 2 -- the number of spaces inserted for each indentation
|
||||
vim.opt.tabstop = 2 -- insert 2 spaces for a tab
|
||||
vim.opt.cursorline = true -- highlight the current line
|
||||
vim.opt.number = true -- set numbered lines
|
||||
vim.opt.relativenumber = true -- show relative line number
|
||||
|
@ -1,178 +0,0 @@
|
||||
-------------
|
||||
-- Plugins --
|
||||
-------------
|
||||
-- Autocommand that reloads neovim whenever you save the plugins.lua file
|
||||
vim.cmd([[
|
||||
augroup packer_user_config
|
||||
autocmd!
|
||||
autocmd BufWritePost plugins.lua source <afile> | PackerCompile
|
||||
augroup end
|
||||
]])
|
||||
|
||||
-- Auto install plugin manager
|
||||
|
||||
local fn = vim.fn
|
||||
|
||||
local ensure_packer = function()
|
||||
local fn = vim.fn
|
||||
local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim'
|
||||
if fn.empty(fn.glob(install_path)) > 0 then
|
||||
fn.system({ 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path })
|
||||
vim.cmd [[packadd packer.nvim]]
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local packer_bootstrap = ensure_packer()
|
||||
|
||||
|
||||
|
||||
return require('packer').startup {
|
||||
function(use)
|
||||
use 'wbthomason/packer.nvim'
|
||||
use 'lewis6991/impatient.nvim'
|
||||
use 'nvim-lua/plenary.nvim'
|
||||
use 'tpope/vim-eunuch'
|
||||
--LSP
|
||||
use({ "https://github.com/neovim/nvim-lspconfig" })
|
||||
use({ "https://github.com/williamboman/mason-lspconfig.nvim" })
|
||||
use({ "https://github.com/williamboman/mason.nvim",
|
||||
config = function()
|
||||
end
|
||||
})
|
||||
use({ "https://github.com/jose-elias-alvarez/null-ls.nvim",
|
||||
config = function()
|
||||
require('plugins.lsp.null-ls')
|
||||
end
|
||||
})
|
||||
|
||||
use {
|
||||
'iamcco/markdown-preview.nvim',
|
||||
run = function()
|
||||
vim.fn['mkdp#util#install'](0)
|
||||
end,
|
||||
config = function()
|
||||
end,
|
||||
}
|
||||
|
||||
|
||||
|
||||
-- telescope
|
||||
use {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
}
|
||||
use {
|
||||
'nvim-telescope/telescope-fzf-native.nvim',
|
||||
run = 'make',
|
||||
config = function()
|
||||
require('plugins.telescope')
|
||||
end
|
||||
}
|
||||
|
||||
|
||||
use {
|
||||
'zhou13/vim-easyescape',
|
||||
config = function()
|
||||
require('plugins.vim-easyescape')
|
||||
end
|
||||
}
|
||||
|
||||
|
||||
|
||||
-- Autocomplete
|
||||
use 'hrsh7th/cmp-nvim-lsp'
|
||||
use 'hrsh7th/cmp-buffer'
|
||||
use 'hrsh7th/cmp-cmdline'
|
||||
use 'hrsh7th/cmp-path'
|
||||
use 'hrsh7th/cmp-calc'
|
||||
use 'hrsh7th/cmp-git'
|
||||
use 'hrsh7th/cmp-nvim-lua'
|
||||
use 'L3MON4D3/LuaSnip'
|
||||
use 'rafamadriz/friendly-snippets'
|
||||
use 'onsails/lspkind-nvim'
|
||||
|
||||
|
||||
use({
|
||||
'hrsh7th/nvim-cmp',
|
||||
config = function()
|
||||
require('plugins.cmp')
|
||||
end
|
||||
})
|
||||
|
||||
-- UI
|
||||
use 'ellisonleao/gruvbox.nvim'
|
||||
use {
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
config = function()
|
||||
require('plugins.indent-blankline')
|
||||
|
||||
end
|
||||
}
|
||||
|
||||
use 'kyazdani42/nvim-web-devicons'
|
||||
use {
|
||||
'akinsho/bufferline.nvim',
|
||||
config = function()
|
||||
require('plugins.bufferline')
|
||||
end
|
||||
}
|
||||
use({
|
||||
"kyazdani42/nvim-tree.lua",
|
||||
config = function()
|
||||
require('plugins.nvim-tree')
|
||||
end,
|
||||
})
|
||||
|
||||
use 'AckslD/nvim-whichkey-setup.lua'
|
||||
use({
|
||||
"folke/which-key.nvim",
|
||||
config = function()
|
||||
require('plugins.which-key')
|
||||
end,
|
||||
})
|
||||
use({ 'nvim-lualine/lualine.nvim',
|
||||
config = function()
|
||||
require('plugins.lualine')
|
||||
end
|
||||
})
|
||||
|
||||
--GIT
|
||||
use {
|
||||
'lewis6991/gitsigns.nvim',
|
||||
config = function()
|
||||
require('plugins.gitsign')
|
||||
end
|
||||
}
|
||||
use {
|
||||
'RRethy/vim-illuminate',
|
||||
}
|
||||
|
||||
use {
|
||||
'TimUntersberger/neogit',
|
||||
config = function()
|
||||
require('plugins.neogit')
|
||||
end
|
||||
}
|
||||
use({
|
||||
'windwp/nvim-autopairs',
|
||||
config = function()
|
||||
require('plugins.autopairs')
|
||||
end
|
||||
})
|
||||
|
||||
--treesitter
|
||||
use 'RRethy/nvim-treesitter-endwise'
|
||||
use({
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
config = function()
|
||||
require('plugins.treesitter')
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
if packer_bootstrap then
|
||||
require('packer').sync()
|
||||
end
|
||||
end
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
local status_ok, autopairs = pcall(require, "nvim-autopairs")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
autopairs.setup({
|
||||
check_ts = true, -- treesitter integration
|
||||
disable_filetype = { "TelescopePrompt" },
|
||||
ts_config = {
|
||||
lua = { "string", "source" },
|
||||
javascript = { "string", "template_string" },
|
||||
java = false,
|
||||
},
|
||||
|
||||
fast_wrap = {
|
||||
map = "<M-e>",
|
||||
chars = { "{", "[", "(", '"', "'" },
|
||||
pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""),
|
||||
offset = 0, -- Offset from pattern match
|
||||
end_key = "$",
|
||||
keys = "qwertyuiopzxcvbnmasdfghjkl",
|
||||
check_comma = true,
|
||||
highlight = "PmenuSel",
|
||||
highlight_grey = "LineNr",
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||
local cmp_status_ok, cmp = pcall(require, "cmp")
|
||||
if not cmp_status_ok then
|
||||
return
|
||||
end
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({}))
|
@ -1,23 +0,0 @@
|
||||
|
||||
local status_ok, bufferline = pcall(require, "bufferline")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
bufferline.setup({
|
||||
options = {
|
||||
close_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions"
|
||||
right_mouse_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions"
|
||||
offsets = { { filetype = "NvimTree", text = "", padding = 1 } },
|
||||
separator_style = "thin", -- | "thick" | "thin" | { 'any', 'any' },
|
||||
offsets = {
|
||||
{
|
||||
filetype = 'NvimTree',
|
||||
text = 'File Explorer',
|
||||
highlight = 'Directory',
|
||||
text_align = 'left'
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
@ -1,20 +1,39 @@
|
||||
return {
|
||||
{
|
||||
"https://github.com/hrsh7th/nvim-cmp",
|
||||
event = "VeryLazy",
|
||||
dependencies = {
|
||||
"https://github.com/hrsh7th/cmp-buffer",
|
||||
"https://github.com/hrsh7th/cmp-nvim-lsp",
|
||||
"https://github.com/hrsh7th/cmp-path",
|
||||
"https://github.com/saadparwaiz1/cmp_luasnip",
|
||||
'hrsh7th/cmp-cmdline',
|
||||
'hrsh7th/cmp-calc',
|
||||
'hrsh7th/cmp-git',
|
||||
'hrsh7th/cmp-nvim-lua',
|
||||
'rafamadriz/friendly-snippets',
|
||||
'onsails/lspkind-nvim',
|
||||
"https://github.com/L3MON4D3/LuaSnip",
|
||||
|
||||
local cmp_status_ok, cmp = pcall(require, "cmp")
|
||||
if not cmp_status_ok then
|
||||
},
|
||||
config = function()
|
||||
|
||||
local cmp_status_ok, cmp = pcall(require, "cmp")
|
||||
if not cmp_status_ok then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
local snip_status_ok, luasnip = pcall(require, "luasnip")
|
||||
if not snip_status_ok then
|
||||
local snip_status_ok, luasnip = pcall(require, "luasnip")
|
||||
if not snip_status_ok then
|
||||
return
|
||||
end
|
||||
require("luasnip/loaders/from_vscode").lazy_load()
|
||||
end
|
||||
require("luasnip/loaders/from_vscode").lazy_load()
|
||||
|
||||
local check_backspace = function()
|
||||
local check_backspace = function()
|
||||
local col = vim.fn.col(".") - 1
|
||||
return col == 0 or vim.fn.getline("."):sub(col, col):match("%s")
|
||||
end
|
||||
local kind_icons = {
|
||||
end
|
||||
local kind_icons = {
|
||||
Text = "",
|
||||
Method = "",
|
||||
Function = "",
|
||||
@ -40,9 +59,9 @@ local kind_icons = {
|
||||
Event = "",
|
||||
Operator = "",
|
||||
TypeParameter = "",
|
||||
}
|
||||
}
|
||||
|
||||
cmp.setup({
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body) -- For `luasnip` users.
|
||||
@ -126,4 +145,7 @@ cmp.setup({
|
||||
experimental = {
|
||||
ghost_text = true,
|
||||
},
|
||||
})
|
||||
})
|
||||
end
|
||||
},
|
||||
}
|
||||
|
181
nvim/.config/nvim/lua/plugins/editor.lua
Normal file
181
nvim/.config/nvim/lua/plugins/editor.lua
Normal file
@ -0,0 +1,181 @@
|
||||
return {
|
||||
{
|
||||
'tpope/vim-eunuch',
|
||||
event= "VeryLazy"
|
||||
},
|
||||
{
|
||||
"https://github.com/iamcco/markdown-preview.nvim",
|
||||
ft = "markdown",
|
||||
build = "cd app && yarn install",
|
||||
setup= function ()
|
||||
require("markdown-preview").setup({})
|
||||
vim.keymap.set("n", "<leader>mp", ":MarkdownPreviewToggle<cr>", { silent = true })
|
||||
end
|
||||
},
|
||||
{
|
||||
'nvim-telescope/telescope.nvim',
|
||||
lazy = true,
|
||||
cmd = "Telescope",
|
||||
keys= {
|
||||
{ "<leader>,", "<cmd>Telescope buffers show_all_buffers=true<cr>", desc = "Switch Buffer" },
|
||||
{ "<leader>/", "<cmd>Telescope live_grep<cr>", desc = "Grep (root dir)" },
|
||||
{ "<leader>:", "<cmd>Telescope command_history<cr>", desc = "Command History" },
|
||||
-- find
|
||||
{ "<leader>fb", "<cmd>Telescope buffers<cr>", desc = "Buffers" },
|
||||
{ "<leader>ff", "<cmd>Telescope find_files<cr>", desc = "Find Files (root dir)" },
|
||||
{ "<leader>fF", function() builtin.find_files({ cwd = utils.buffer_dir() }) end, desc = "Find Files (cwd)" },
|
||||
{ "<leader>fr", "<cmd>Telescope oldfiles<cr>", desc = "Recent" },
|
||||
-- git
|
||||
{ "<leader>gc", "<cmd>Telescope git_commits<CR>", desc = "commits" },
|
||||
{ "<leader>gs", "<cmd>Telescope git_status<CR>", desc = "status" },
|
||||
-- search
|
||||
{ '<leader>s"', "<cmd>Telescope registers<cr>", desc = "Registers" },
|
||||
{ "<leader>sa", "<cmd>Telescope autocommands<cr>", desc = "Auto Commands" },
|
||||
{ "<leader>sb", "<cmd>Telescope current_buffer_fuzzy_find<cr>", desc = "Buffer" },
|
||||
{ "<leader>sc", "<cmd>Telescope command_history<cr>", desc = "Command History" },
|
||||
{ "<leader>sC", "<cmd>Telescope commands<cr>", desc = "Commands" },
|
||||
{ "<leader>sd", "<cmd>Telescope diagnostics bufnr=0<cr>", desc = "Document diagnostics" },
|
||||
{ "<leader>sD", "<cmd>Telescope diagnostics<cr>", desc = "Workspace diagnostics" },
|
||||
{ "<leader>sh", "<cmd>Telescope help_tags<cr>", desc = "Help Pages" },
|
||||
{ "<leader>sH", "<cmd>Telescope highlights<cr>", desc = "Search Highlight Groups" },
|
||||
{ "<leader>sk", "<cmd>Telescope keymaps<cr>", desc = "Key Maps" },
|
||||
{ "<leader>sM", "<cmd>Telescope man_pages<cr>", desc = "Man Pages" },
|
||||
{ "<leader>sm", "<cmd>Telescope marks<cr>", desc = "Jump to Mark" },
|
||||
{ "<leader>so", "<cmd>Telescope vim_options<cr>", desc = "Options" },
|
||||
{ "<leader>sR", "<cmd>Telescope resume<cr>", desc = "Resume" },
|
||||
},
|
||||
config = function()
|
||||
local actions=require 'telescope.actions'
|
||||
require 'telescope'.setup({
|
||||
mappings = {
|
||||
i = {
|
||||
["<Down>"] =actions.cycle_history_next,
|
||||
["<Up>"] = actions.cycle_history_prev,
|
||||
["<C-n>"] = actions.cycle_history_next,
|
||||
["<C-p>"] = actions.cycle_history_prev,
|
||||
["<C-j>"] = actions.move_selection_next,
|
||||
["<C-k>"] = actions.move_selection_previous,
|
||||
n = {
|
||||
["q"] = function(...)
|
||||
return require("telescope.actions").close(...)
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
extensions = {
|
||||
fzf = {
|
||||
fuzzy = true, -- false will only do exact matching
|
||||
override_generic_sorter = true, -- override the generic sorter
|
||||
override_file_sorter = true, -- override the file sorter
|
||||
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
|
||||
-- the default case_mode is "smart_case"
|
||||
}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
},
|
||||
{
|
||||
'nvim-telescope/telescope-fzf-native.nvim',
|
||||
lazy = true,
|
||||
build = 'make',
|
||||
},
|
||||
{
|
||||
'zhou13/vim-easyescape',
|
||||
config = function()
|
||||
vim.g.easyescape_chars = {
|
||||
j = 0,
|
||||
k = 0
|
||||
}
|
||||
vim.g.easyescape_timeout = 99
|
||||
end
|
||||
},
|
||||
|
||||
{
|
||||
"https://github.com/lukas-reineke/indent-blankline.nvim",
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
config = function()
|
||||
require("indent_blankline").setup({
|
||||
show_current_context = true,
|
||||
show_first_indent_level = false,
|
||||
show_trailing_blankline_indent = false,
|
||||
use_treesitter = true,
|
||||
filetype_exclude = {
|
||||
"help",
|
||||
"alpha",
|
||||
"dashboard",
|
||||
"NvimTree",
|
||||
"Trouble",
|
||||
"lazy",
|
||||
"mason",
|
||||
"notify",
|
||||
"toggleterm",
|
||||
"lazyterm",
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
'RRethy/vim-illuminate',
|
||||
},
|
||||
{
|
||||
"https://github.com/windwp/nvim-autopairs",
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
config = function()
|
||||
require("nvim-autopairs").setup({
|
||||
check_ts = true,
|
||||
fast_wrap = {
|
||||
map = "<M-e>",
|
||||
chars = { "{", "[", "(", '"', "'" },
|
||||
pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""),
|
||||
offset = 0, -- Offset from pattern match
|
||||
end_key = "$",
|
||||
keys = "qwertyuiopzxcvbnmasdfghjkl",
|
||||
check_comma = true,
|
||||
highlight = "Search",
|
||||
highlight_grey = "Comment",
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"folke/trouble.nvim",
|
||||
cmd = { "TroubleToggle", "Trouble" },
|
||||
opts = { use_diagnostic_signs = true },
|
||||
keys = {
|
||||
{ "<leader>xx", "<cmd>TroubleToggle document_diagnostics<cr>", desc = "Document Diagnostics (Trouble)" },
|
||||
{ "<leader>xX", "<cmd>TroubleToggle workspace_diagnostics<cr>", desc = "Workspace Diagnostics (Trouble)" },
|
||||
{ "<leader>xL", "<cmd>TroubleToggle loclist<cr>", desc = "Location List (Trouble)" },
|
||||
{ "<leader>xQ", "<cmd>TroubleToggle quickfix<cr>", desc = "Quickfix List (Trouble)" },
|
||||
{
|
||||
"[q",
|
||||
function()
|
||||
if require("trouble").is_open() then
|
||||
require("trouble").previous({ skip_groups = true, jump = true })
|
||||
else
|
||||
local ok, err = pcall(vim.cmd.cprev)
|
||||
if not ok then
|
||||
vim.notify(err, vim.log.levels.ERROR)
|
||||
end
|
||||
end
|
||||
end,
|
||||
desc = "Previous trouble/quickfix item",
|
||||
},
|
||||
{
|
||||
"]q",
|
||||
function()
|
||||
if require("trouble").is_open() then
|
||||
require("trouble").next({ skip_groups = true, jump = true })
|
||||
else
|
||||
local ok, err = pcall(vim.cmd.cnext)
|
||||
if not ok then
|
||||
vim.notify(err, vim.log.levels.ERROR)
|
||||
end
|
||||
end
|
||||
end,
|
||||
desc = "Next trouble/quickfix item",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
35
nvim/.config/nvim/lua/plugins/git.lua
Normal file
35
nvim/.config/nvim/lua/plugins/git.lua
Normal file
@ -0,0 +1,35 @@
|
||||
return {
|
||||
{
|
||||
"https://github.com/lewis6991/gitsigns.nvim",
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("gitsigns").setup({
|
||||
current_line_blame = true,
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"https://github.com/NeogitOrg/neogit",
|
||||
keys = {
|
||||
{
|
||||
'<leader>gs',
|
||||
function()
|
||||
return require('neogit').open()
|
||||
end,
|
||||
desc = 'Open neogit',
|
||||
},
|
||||
},
|
||||
|
||||
cmd = "Neogit",
|
||||
config = function()
|
||||
require("neogit").setup({
|
||||
disable_commit_confirmation = true,
|
||||
kind = "split",
|
||||
integrations = {
|
||||
diffview = true,
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
local status_ok, gitsigns = pcall(require, "gitsigns")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
gitsigns.setup({
|
||||
|
||||
})
|
@ -1,12 +0,0 @@
|
||||
local status_ok, indent_blankline = pcall(require, "indent_blankline")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
indent_blankline.setup {
|
||||
char = "▏",
|
||||
show_first_indent_level = false,
|
||||
show_trailing_blankline_indent = false,
|
||||
use_treesitter = true,
|
||||
show_current_context = true,
|
||||
}
|
@ -8,7 +8,7 @@ end
|
||||
M.capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
M.capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
M.capabilities = cmp_nvim_lsp.default_capabilities(M.capabilities)
|
||||
|
||||
local navic = require("nvim-navic")
|
||||
M.setup = function()
|
||||
local signs = {
|
||||
|
||||
@ -64,9 +64,6 @@ local function lsp_keymaps(bufnr)
|
||||
keymap(bufnr, "n", "<leader>li", "<cmd>LspInfo<cr>", opts)
|
||||
|
||||
keymap(bufnr, "n", "<leader>lI", "<cmd>LspInstallInfo<cr>", opts)
|
||||
keymap(bufnr, "n", "<leader>la", "<cmd>lua vim.lsp.buf.code_action()<cr>", opts)
|
||||
keymap(bufnr, "n", "<leader>lj", "<cmd>lua vim.diagnostic.goto_next({buffer=0})<cr>", opts)
|
||||
keymap(bufnr, "n", "<leader>lk", "<cmd>lua vim.diagnostic.goto_prev({buffer=0})<cr>", opts)
|
||||
keymap(bufnr, "n", "<leader>lr", "<cmd>lua vim.lsp.buf.rename()<cr>", opts)
|
||||
keymap(bufnr, "n", "<leader>ls", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
||||
keymap(bufnr, "n", "<leader>lq", "<cmd>lua vim.diagnostic.setloclist()<CR>", opts)
|
||||
@ -76,7 +73,9 @@ M.on_attach = function(client, bufnr)
|
||||
if client.name == "tsserver" then
|
||||
client.server_capabilities.document_formatting = false
|
||||
end
|
||||
|
||||
if client.server_capabilities.documentSymbolProvider then
|
||||
navic.attach(client, bufnr)
|
||||
end
|
||||
|
||||
lsp_keymaps(bufnr)
|
||||
local status_ok, illuminate = pcall(require, "illuminate")
|
||||
|
96
nvim/.config/nvim/lua/plugins/lsp/init.lua
Normal file
96
nvim/.config/nvim/lua/plugins/lsp/init.lua
Normal file
@ -0,0 +1,96 @@
|
||||
return {
|
||||
{
|
||||
"https://github.com/williamboman/mason-lspconfig.nvim",
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
dependencies = {
|
||||
"https://github.com/williamboman/mason.nvim",
|
||||
"https://github.com/neovim/nvim-lspconfig",
|
||||
},
|
||||
config = function()
|
||||
require("plugins.lsp.handlers").setup()
|
||||
local servers = {
|
||||
"ansiblels",
|
||||
"bashls",
|
||||
"cssls",
|
||||
"dockerls",
|
||||
"gopls",
|
||||
"html",
|
||||
"jsonls",
|
||||
"pyright",
|
||||
"pylsp",
|
||||
"rnix",
|
||||
"lua_ls",
|
||||
"marksman",
|
||||
"sqlls",
|
||||
"terraformls",
|
||||
"tflint",
|
||||
"tsserver",
|
||||
"yamlls",
|
||||
}
|
||||
local settings = {
|
||||
ui = {
|
||||
border = "none",
|
||||
icons = {
|
||||
package_installed = "◍",
|
||||
package_pending = "◍",
|
||||
package_uninstalled = "◍",
|
||||
},
|
||||
},
|
||||
log_level = vim.log.levels.INFO,
|
||||
max_concurrent_installers = 4,
|
||||
}
|
||||
require("mason").setup(settings)
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = servers,
|
||||
automatic_installation = true,
|
||||
})
|
||||
|
||||
|
||||
local lspconfig_status_ok, lspconfig = pcall(require, "lspconfig")
|
||||
if not lspconfig_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
for _, server in pairs(servers) do
|
||||
opts = {
|
||||
on_attach = require("plugins.lsp.handlers").on_attach,
|
||||
capabilities = require("plugins.lsp.handlers").capabilities,
|
||||
}
|
||||
|
||||
server = vim.split(server, "@")[1]
|
||||
|
||||
local require_ok, conf_opts = pcall(require, "plugins.lsp.settings." .. server)
|
||||
if require_ok then
|
||||
opts = vim.tbl_deep_extend("force", conf_opts, opts)
|
||||
end
|
||||
|
||||
lspconfig[server].setup(opts)
|
||||
end
|
||||
end
|
||||
},
|
||||
{
|
||||
"https://github.com/jose-elias-alvarez/null-ls.nvim",
|
||||
lazy = true,
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
config = function()
|
||||
|
||||
null_ls=require"null-ls"
|
||||
require "null-ls".setup({
|
||||
debug = false,
|
||||
sources = {
|
||||
null_ls.builtins.formatting.prettier.with({
|
||||
extra_filetypes = { "toml" },
|
||||
extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" },
|
||||
}),
|
||||
null_ls.builtins.formatting.black.with({ extra_args = { "--fast" } }),
|
||||
null_ls.builtins.formatting.stylua,
|
||||
null_ls.builtins.formatting.google_java_format,
|
||||
null_ls.builtins.diagnostics.flake8,
|
||||
null_ls.builtins.diagnostics.eslint,
|
||||
null_ls.builtins.diagnostics.markdownlint,
|
||||
},
|
||||
})
|
||||
end
|
||||
},
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
require("plugins.lsp.handlers").setup()
|
||||
local servers = {
|
||||
"ansiblels",
|
||||
"bashls",
|
||||
"cssls",
|
||||
"dockerls",
|
||||
"gopls",
|
||||
"html",
|
||||
"jsonls",
|
||||
"pyright",
|
||||
"pylsp",
|
||||
"rnix",
|
||||
"lua_ls",
|
||||
"marksman",
|
||||
"sqlls",
|
||||
"terraformls",
|
||||
"tflint",
|
||||
"tsserver",
|
||||
"yamlls",
|
||||
}
|
||||
local settings = {
|
||||
ui = {
|
||||
border = "none",
|
||||
icons = {
|
||||
package_installed = "◍",
|
||||
package_pending = "◍",
|
||||
package_uninstalled = "◍",
|
||||
},
|
||||
},
|
||||
log_level = vim.log.levels.INFO,
|
||||
max_concurrent_installers = 4,
|
||||
}
|
||||
require("mason").setup(settings)
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = servers,
|
||||
automatic_installation = true,
|
||||
})
|
||||
|
||||
|
||||
local lspconfig_status_ok, lspconfig = pcall(require, "lspconfig")
|
||||
if not lspconfig_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
for _, server in pairs(servers) do
|
||||
opts = {
|
||||
on_attach = require("plugins.lsp.handlers").on_attach,
|
||||
capabilities = require("plugins.lsp.handlers").capabilities,
|
||||
}
|
||||
|
||||
server = vim.split(server, "@")[1]
|
||||
|
||||
local require_ok, conf_opts = pcall(require, "plugins.lsp.settings." .. server)
|
||||
if require_ok then
|
||||
opts = vim.tbl_deep_extend("force", conf_opts, opts)
|
||||
end
|
||||
|
||||
lspconfig[server].setup(opts)
|
||||
end
|
@ -1,27 +0,0 @@
|
||||
|
||||
local null_ls_status_ok, null_ls = pcall(require, "null-ls")
|
||||
if not null_ls_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting
|
||||
local formatting = null_ls.builtins.formatting
|
||||
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics
|
||||
local diagnostics = null_ls.builtins.diagnostics
|
||||
|
||||
-- https://github.com/prettier-solidity/prettier-plugin-solidity
|
||||
null_ls.setup({
|
||||
debug = false,
|
||||
sources = {
|
||||
formatting.prettier.with({
|
||||
extra_filetypes = { "toml" },
|
||||
extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" },
|
||||
}),
|
||||
formatting.black.with({ extra_args = { "--fast" } }),
|
||||
formatting.stylua,
|
||||
formatting.google_java_format,
|
||||
diagnostics.flake8,
|
||||
diagnostics.eslint,
|
||||
diagnostics.markdownlint,
|
||||
},
|
||||
})
|
@ -1,13 +0,0 @@
|
||||
local status_ok, lualine = pcall(require, "lualine")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
lualine.setup({
|
||||
options = {
|
||||
globalstatus=true,
|
||||
theme = "gruvbox_dark",
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -1 +0,0 @@
|
||||
vim.keymap.set("n", "<leader>mp", ":MarkdownPreviewToggle<cr>", { silent = true })
|
@ -1,11 +0,0 @@
|
||||
local status_ok, neogit = pcall(require, "neogit")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
neogit.setup{
|
||||
disable_commit_confirmation = true,
|
||||
disable_context_highlighting = true
|
||||
}
|
||||
|
||||
vim.keymap.set('n', '<LEADER>gs', ':Neogit kind=split<CR>', {silent = true})
|
@ -1,26 +0,0 @@
|
||||
|
||||
local status_ok, nvim_tree = pcall(require, "nvim-tree")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
nvim_tree.setup({
|
||||
update_focused_file = {
|
||||
enable = true,
|
||||
update_cwd = true,
|
||||
},
|
||||
diagnostics = {
|
||||
enable = true,
|
||||
show_on_dirs = true,
|
||||
icons = {
|
||||
hint = "",
|
||||
info = "",
|
||||
warning = "",
|
||||
error = "",
|
||||
},
|
||||
},
|
||||
view = {
|
||||
width = 30,
|
||||
side = "left",
|
||||
},
|
||||
})
|
@ -1,51 +0,0 @@
|
||||
local status_ok, telescope = pcall(require, "telescope")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local actions = require("telescope.actions")
|
||||
local utils = require("telescope.utils")
|
||||
telescope.setup {
|
||||
defaults = {
|
||||
path_display = { "absolute" },
|
||||
file_ignore_patterns = { ".git/", "node_modules" },
|
||||
mappings = {
|
||||
i = {
|
||||
["<Down>"] = actions.cycle_history_next,
|
||||
["<Up>"] = actions.cycle_history_prev,
|
||||
["<C-n>"] = actions.cycle_history_next,
|
||||
["<C-p>"] = actions.cycle_history_prev,
|
||||
["<C-j>"] = actions.move_selection_next,
|
||||
["<C-k>"] = actions.move_selection_previous,
|
||||
},
|
||||
},
|
||||
},
|
||||
extensions = {
|
||||
fzf = {
|
||||
fuzzy = true, -- false will only do exact matching
|
||||
override_generic_sorter = true, -- override the generic sorter
|
||||
override_file_sorter = true, -- override the file sorter
|
||||
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
|
||||
-- the default case_mode is "smart_case"
|
||||
},
|
||||
},
|
||||
pickers = {
|
||||
find_files = {
|
||||
no_ignore = true,
|
||||
no_ignore_parent = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
telescope.load_extension('fzf')
|
||||
require'telescope.themes'.get_ivy()
|
||||
|
||||
local keymap = vim.keymap.set
|
||||
local opts = { silent = true }
|
||||
|
||||
keymap("n", "<leader><leader>", ":Telescope git_files<CR>", opts)
|
||||
keymap("n", "<leader>ff", ":Telescope find_files<CR>", opts)
|
||||
keymap("n", "<leader>fF", function () builtin.find_files({ cwd = utils.buffer_dir() }) end, opts)
|
||||
keymap("n", "<leader>/", ":Telescope live_grep<CR>", opts)
|
||||
keymap("n", "<leader>pp", ":Telescope projects<CR>", opts)
|
||||
keymap("n", "<leader>,", ":Telescope buffers<CR>", opts)
|
@ -1,16 +1,33 @@
|
||||
local status_ok, treesitter = pcall(require, "nvim-treesitter")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local status_ok, configs = pcall(require, "nvim-treesitter.configs")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
configs.setup({
|
||||
return {
|
||||
{ 'RRethy/nvim-treesitter-endwise'
|
||||
},
|
||||
{
|
||||
"https://github.com/nvim-treesitter/nvim-treesitter",
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
config = function()
|
||||
require("nvim-treesitter.configs").setup({
|
||||
ensure_installed = {
|
||||
all
|
||||
"bash",
|
||||
"c",
|
||||
"dockerfile",
|
||||
"gitcommit",
|
||||
"go",
|
||||
"hcl",
|
||||
"javascript",
|
||||
"json",
|
||||
"json5",
|
||||
"jsonnet",
|
||||
"latex",
|
||||
"lua",
|
||||
"nix",
|
||||
"markdown",
|
||||
"proto",
|
||||
"python",
|
||||
"rego",
|
||||
"rust",
|
||||
"terraform",
|
||||
"typescript",
|
||||
"yaml",
|
||||
},
|
||||
highlight = {
|
||||
enable = true,
|
||||
@ -21,15 +38,12 @@ configs.setup({
|
||||
indent = {
|
||||
enable = true,
|
||||
},
|
||||
|
||||
context_commentstring = {
|
||||
enable = true,
|
||||
enable_autocmd = false,
|
||||
},
|
||||
|
||||
endwise = {
|
||||
enable = true,
|
||||
},
|
||||
})
|
||||
})
|
||||
vim.treesitter.language.register("nomad", "hcl")
|
||||
end,
|
||||
},
|
||||
|
||||
vim.treesitter.language.register("nomad","hcl")
|
||||
}
|
||||
|
161
nvim/.config/nvim/lua/plugins/ui.lua
Normal file
161
nvim/.config/nvim/lua/plugins/ui.lua
Normal file
@ -0,0 +1,161 @@
|
||||
return {
|
||||
{
|
||||
'ellisonleao/gruvbox.nvim',
|
||||
event = "VeryLazy",
|
||||
},
|
||||
{
|
||||
"echasnovski/mini.bufremove",
|
||||
-- stylua: ignore
|
||||
keys = {
|
||||
{ "<leader>bd", function() require("mini.bufremove").delete(0, false) end, desc = "Delete Buffer" },
|
||||
{ "<leader>bD", function() require("mini.bufremove").delete(0, true) end, desc = "Delete Buffer (Force)" },
|
||||
},
|
||||
},
|
||||
{
|
||||
"https://github.com/akinsho/bufferline.nvim",
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("bufferline").setup({
|
||||
options = {
|
||||
-- stylua: ignore
|
||||
close_command = function(n) require("mini.bufremove").delete(n, false) end,
|
||||
-- stylu a: ignore
|
||||
right_mouse_command = function(n) require("mini.bufremove").delete(n, false) end,
|
||||
always_show_bufferline = false,
|
||||
offsets = {
|
||||
{
|
||||
filetype = "NvimTree",
|
||||
text = "nvim-tree",
|
||||
highlight = "Directory",
|
||||
text_align = "left",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"kyazdani42/nvim-tree.lua",
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("nvim-tree").setup({
|
||||
update_focused_file = {
|
||||
enable = true,
|
||||
update_cwd = true,
|
||||
},
|
||||
diagnostics = {
|
||||
enable = true,
|
||||
show_on_dirs = true,
|
||||
icons = {
|
||||
hint = "",
|
||||
info = "",
|
||||
warning = "",
|
||||
error = "",
|
||||
},
|
||||
},
|
||||
view = {
|
||||
width = 30,
|
||||
side = "left",
|
||||
},
|
||||
})
|
||||
end
|
||||
},
|
||||
{
|
||||
"https://github.com/folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
plugins = { spelling = true },
|
||||
defaults = {
|
||||
mode = { "n", "v" },
|
||||
["<leader><tab>"] = { name = "+tabs" },
|
||||
["<leader>b"] = { name = "+buffer" },
|
||||
["<leader>c"] = { name = "+code" },
|
||||
["<leader>f"] = { name = "+file/find" },
|
||||
["<leader>g"] = { name = "+git" },
|
||||
["<leader>gh"] = { name = "+hunks" },
|
||||
["<leader>q"] = { name = "+quit/session" },
|
||||
["<leader>s"] = { name = "+search" },
|
||||
["<leader>u"] = { name = "+ui" },
|
||||
["<leader>w"] = { name = "+windows" },
|
||||
["<leader>x"] = { name = "+diagnostics/quickfix" },
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
local wk = require("which-key")
|
||||
wk.setup(opts)
|
||||
wk.register(opts.defaults)
|
||||
end,
|
||||
},
|
||||
{
|
||||
"https://github.com/nvim-lualine/lualine.nvim",
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("lualine").setup({
|
||||
options = {
|
||||
globalstatus = true,
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"https://github.com/j-hui/fidget.nvim",
|
||||
tag = "legacy", -- TODO https://github.com/j-hui/fidget.nvim/issues/131
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("fidget").setup({
|
||||
text = {
|
||||
spinner = "dots",
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"rcarriga/nvim-notify",
|
||||
keys = {
|
||||
{
|
||||
"<leader>un",
|
||||
function()
|
||||
require("notify").dismiss({ silent = true, pending = true })
|
||||
end,
|
||||
desc = "Dismiss all Notifications",
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
timeout = 3000,
|
||||
max_height = function()
|
||||
return math.floor(vim.o.lines * 0.75)
|
||||
end,
|
||||
max_width = function()
|
||||
return math.floor(vim.o.columns * 0.75)
|
||||
end,
|
||||
},
|
||||
},
|
||||
{
|
||||
"stevearc/dressing.nvim",
|
||||
lazy = true,
|
||||
init = function()
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
vim.ui.select = function(...)
|
||||
require("lazy").load({ plugins = { "dressing.nvim" } })
|
||||
return vim.ui.select(...)
|
||||
end
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
vim.ui.input = function(...)
|
||||
require("lazy").load({ plugins = { "dressing.nvim" } })
|
||||
return vim.ui.input(...)
|
||||
end
|
||||
end,
|
||||
},
|
||||
{
|
||||
"SmiteshP/nvim-navic",
|
||||
lazy = true,
|
||||
opts = function()
|
||||
return {
|
||||
separator = " ",
|
||||
highlight = true,
|
||||
depth_limit = 5,
|
||||
}
|
||||
end,
|
||||
},
|
||||
{ "MunifTanjim/nui.nvim", lazy = true }
|
||||
}
|
11
nvim/.config/nvim/lua/plugins/util.lua
Normal file
11
nvim/.config/nvim/lua/plugins/util.lua
Normal file
@ -0,0 +1,11 @@
|
||||
return {
|
||||
{
|
||||
"https://github.com/nvim-lua/plenary.nvim",
|
||||
cmd = { "PlenaryBustedFile", "PlenaryBustedDirectory" },
|
||||
lazy = true,
|
||||
},
|
||||
{
|
||||
'kyazdani42/nvim-web-devicons'
|
||||
},
|
||||
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
vim.g.easyescape_chars = {
|
||||
j = 0,
|
||||
k = 0
|
||||
}
|
||||
vim.g.easyescape_timeout = 99
|
@ -1,2 +0,0 @@
|
||||
vim.api.nvim_set_option("timeoutlen", 300)
|
||||
require("which-key").setup({})
|
@ -1,306 +0,0 @@
|
||||
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)
|
||||
|
||||
return require("lazy").setup({
|
||||
{
|
||||
"https://github.com/nvim-lua/plenary.nvim",
|
||||
cmd = { "PlenaryBustedFile", "PlenaryBustedDirectory" },
|
||||
lazy = true,
|
||||
},
|
||||
{
|
||||
'tpope/vim-eunuch',
|
||||
event= "VeryLazy"
|
||||
},
|
||||
{
|
||||
"https://github.com/williamboman/mason-lspconfig.nvim",
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
dependencies = {
|
||||
"https://github.com/williamboman/mason.nvim",
|
||||
"https://github.com/neovim/nvim-lspconfig",
|
||||
},
|
||||
config = function()
|
||||
require('plugins.lsp.mason')
|
||||
|
||||
end
|
||||
},
|
||||
{
|
||||
"https://github.com/jose-elias-alvarez/null-ls.nvim",
|
||||
lazy = true,
|
||||
config = function()
|
||||
require "null-ls".setup({
|
||||
debug = false,
|
||||
sources = {
|
||||
formatting.prettier.with({
|
||||
extra_filetypes = { "toml" },
|
||||
extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" },
|
||||
}),
|
||||
formatting.black.with({ extra_args = { "--fast" } }),
|
||||
formatting.stylua,
|
||||
formatting.google_java_format,
|
||||
diagnostics.flake8,
|
||||
diagnostics.eslint,
|
||||
diagnostics.markdownlint,
|
||||
},
|
||||
})
|
||||
end
|
||||
},
|
||||
{
|
||||
"https://github.com/iamcco/markdown-preview.nvim",
|
||||
ft = "markdown",
|
||||
build = "cd app && yarn install",
|
||||
setup= function ()
|
||||
require("markdown-preview").setup({})
|
||||
vim.keymap.set("n", "<leader>mp", ":MarkdownPreviewToggle<cr>", { silent = true })
|
||||
end
|
||||
},
|
||||
{
|
||||
'nvim-telescope/telescope.nvim',
|
||||
lazy = true,
|
||||
cmd = "Telescope",
|
||||
config = function()
|
||||
require 'telescope'.setup({
|
||||
extensions = {
|
||||
fzf = {
|
||||
fuzzy = true, -- false will only do exact matching
|
||||
override_generic_sorter = true, -- override the generic sorter
|
||||
override_file_sorter = true, -- override the file sorter
|
||||
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
|
||||
-- the default case_mode is "smart_case"
|
||||
}
|
||||
}
|
||||
})
|
||||
local opts = { silent = true }
|
||||
vim.keymap.set("n", "<leader><leader>", ":Telescope git_files<CR>", opts)
|
||||
vim.keymap.set("n", "<leader>ff", ":Telescope find_files<CR>", opts)
|
||||
vim.keymap.set("n", "<leader>fF", function() builtin.find_files({ cwd = utils.buffer_dir() }) end, opts)
|
||||
vim.keymap.set("n", "<leader>/", ":Telescope live_grep<CR>", opts)
|
||||
vim.keymap.set("n", "<leader>pp", ":Telescope projects<CR>", opts)
|
||||
vim.keymap.set("n", "<leader>,", ":Telescope buffers<CR>", opts)
|
||||
end
|
||||
|
||||
},
|
||||
{
|
||||
'nvim-telescope/telescope-fzf-native.nvim',
|
||||
lazy = true,
|
||||
build = 'make',
|
||||
},
|
||||
{
|
||||
'zhou13/vim-easyescape',
|
||||
config = function()
|
||||
vim.g.easyescape_chars = {
|
||||
j = 0,
|
||||
k = 0
|
||||
}
|
||||
vim.g.easyescape_timeout = 99
|
||||
end
|
||||
},
|
||||
{
|
||||
"https://github.com/hrsh7th/nvim-cmp",
|
||||
event = "VeryLazy",
|
||||
dependencies = {
|
||||
"https://github.com/hrsh7th/cmp-buffer",
|
||||
"https://github.com/hrsh7th/cmp-nvim-lsp",
|
||||
"https://github.com/hrsh7th/cmp-path",
|
||||
"https://github.com/saadparwaiz1/cmp_luasnip",
|
||||
'hrsh7th/cmp-cmdline',
|
||||
'hrsh7th/cmp-calc',
|
||||
'hrsh7th/cmp-git',
|
||||
'hrsh7th/cmp-nvim-lua',
|
||||
'rafamadriz/friendly-snippets',
|
||||
'onsails/lspkind-nvim',
|
||||
"https://github.com/L3MON4D3/LuaSnip",
|
||||
|
||||
},
|
||||
config = function()
|
||||
require('plugins.cmp')
|
||||
end
|
||||
},
|
||||
{
|
||||
'ellisonleao/gruvbox.nvim',
|
||||
event = "VeryLazy",
|
||||
},
|
||||
{
|
||||
"https://github.com/lukas-reineke/indent-blankline.nvim",
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
config = function()
|
||||
require("indent_blankline").setup({
|
||||
show_current_context = true,
|
||||
show_first_indent_level = false,
|
||||
show_trailing_blankline_indent = false,
|
||||
use_treesitter = true,
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
'kyazdani42/nvim-web-devicons'
|
||||
},
|
||||
{
|
||||
"https://github.com/akinsho/bufferline.nvim",
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("bufferline").setup({
|
||||
options = {
|
||||
always_show_bufferline = false,
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"kyazdani42/nvim-tree.lua",
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("nvim-tree").setup({
|
||||
update_focused_file = {
|
||||
enable = true,
|
||||
update_cwd = true,
|
||||
},
|
||||
diagnostics = {
|
||||
enable = true,
|
||||
show_on_dirs = true,
|
||||
icons = {
|
||||
hint = "",
|
||||
info = "",
|
||||
warning = "",
|
||||
error = "",
|
||||
},
|
||||
},
|
||||
view = {
|
||||
width = 30,
|
||||
side = "left",
|
||||
},
|
||||
})
|
||||
end
|
||||
},
|
||||
{
|
||||
'AckslD/nvim-whichkey-setup.lua',
|
||||
event = "VeryLazy",
|
||||
},
|
||||
{
|
||||
"https://github.com/folke/which-key.nvim",
|
||||
lazy = true,
|
||||
config = function()
|
||||
require("which-key").setup({})
|
||||
vim.api.nvim_set_option("timeoutlen", 300)
|
||||
end,
|
||||
cmd = "WhichKey",
|
||||
event = "VeryLazy",
|
||||
},
|
||||
{
|
||||
"https://github.com/nvim-lualine/lualine.nvim",
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("lualine").setup({
|
||||
options = {
|
||||
globalstatus = true,
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"https://github.com/j-hui/fidget.nvim",
|
||||
tag = "legacy", -- TODO https://github.com/j-hui/fidget.nvim/issues/131
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("fidget").setup({
|
||||
text = {
|
||||
spinner = "dots",
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"https://github.com/lewis6991/gitsigns.nvim",
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("gitsigns").setup({
|
||||
current_line_blame = true,
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
'RRethy/vim-illuminate',
|
||||
},
|
||||
{
|
||||
"https://github.com/NeogitOrg/neogit",
|
||||
cmd = "Neogit",
|
||||
config = function()
|
||||
require("neogit").setup({
|
||||
disable_commit_confirmation = true,
|
||||
kind = "split",
|
||||
integrations = {
|
||||
diffview = true,
|
||||
},
|
||||
})
|
||||
vim.keymap.set('n', '<LEADER>gs', ':Neogit kind=split<CR>', { silent = true })
|
||||
end,
|
||||
},
|
||||
{
|
||||
"https://github.com/windwp/nvim-autopairs",
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
config = function()
|
||||
require("nvim-autopairs").setup({
|
||||
check_ts = true,
|
||||
})
|
||||
end,
|
||||
},
|
||||
{ 'RRethy/nvim-treesitter-endwise'
|
||||
},
|
||||
{
|
||||
"https://github.com/nvim-treesitter/nvim-treesitter",
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
config = function()
|
||||
require("nvim-treesitter.configs").setup({
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"c",
|
||||
"dockerfile",
|
||||
"gitcommit",
|
||||
"go",
|
||||
"hcl",
|
||||
"javascript",
|
||||
"json",
|
||||
"json5",
|
||||
"jsonnet",
|
||||
"latex",
|
||||
"lua",
|
||||
"nix",
|
||||
"markdown",
|
||||
"proto",
|
||||
"python",
|
||||
"rego",
|
||||
"rust",
|
||||
"terraform",
|
||||
"typescript",
|
||||
"yaml",
|
||||
},
|
||||
highlight = {
|
||||
enable = true,
|
||||
},
|
||||
indent = {
|
||||
enable = true,
|
||||
},
|
||||
endwise = {
|
||||
enable = true,
|
||||
},
|
||||
})
|
||||
vim.treesitter.language.register("nomad", "hcl")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"https://github.com/mfussenegger/nvim-dap",
|
||||
dependencies = {
|
||||
{ "rcarriga/nvim-dap-ui" },
|
||||
{ "theHamsta/nvim-dap-virtual-text" },
|
||||
},
|
||||
},
|
||||
})
|
@ -1,16 +0,0 @@
|
||||
local tree ={}
|
||||
local g = vim.g
|
||||
-- Explicitly set the nvim tree width
|
||||
g.nvim_tree_width = 30
|
||||
local tree_width = g.nvim_tree_width
|
||||
tree.toggle = function()
|
||||
require('nvim-tree').toggle()
|
||||
if require('nvim-tree.view').win_open() then
|
||||
require('bufferline.state').set_offset(tree_width + 1, 'FileTree')
|
||||
require('nvim-tree').find_file(true)
|
||||
else
|
||||
require('bufferline.state').set_offset(0)
|
||||
end
|
||||
end
|
||||
|
||||
return tree
|
Loading…
Reference in New Issue
Block a user