Merge pull request 'Migrate from Packer to Lazy' (#4) from lazy-nvim into main
Reviewed-on: #4
This commit is contained in:
commit
d04bdc8308
@ -1,32 +0,0 @@
|
|||||||
# Neovim Configuration
|
|
||||||
|
|
||||||
Running neovim with packer for plugins and lsp stuff.
|
|
||||||
|
|
||||||
`init.lua` is the entry point for neovim.
|
|
||||||
`plugin/*.lua` run on startup.
|
|
||||||
|
|
||||||
## Plugins & LSP
|
|
||||||
|
|
||||||
```sh
|
|
||||||
:PackerInstall
|
|
||||||
:PackerUpdate
|
|
||||||
:Mason -> U # Update all LSP servers
|
|
||||||
```
|
|
||||||
|
|
||||||
Mason should auto-install LSP servers. However, the following is what should be installed:
|
|
||||||
|
|
||||||
- `prettier`
|
|
||||||
- `lua-language-server`
|
|
||||||
- `luaformatter`
|
|
||||||
- `eslint_d`
|
|
||||||
- `typescript-language-server`
|
|
||||||
- `stylelint-lsp`
|
|
||||||
|
|
||||||
`prettierd` and `eslintd` will need to be installed manually via pnpm as a global package.
|
|
||||||
|
|
||||||
## Custom key binds
|
|
||||||
|
|
||||||
- `<space>f` to toggle NerdTREE
|
|
||||||
- `?` to view code action items
|
|
||||||
- `>` to go to next diagnostic
|
|
||||||
- `<` to go to previous diagnostic
|
|
@ -1,4 +1,28 @@
|
|||||||
require('pfych.base')
|
-- Bootstrap lazy.nvim
|
||||||
require('pfych.plugins')
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||||
require('pfych.colours')
|
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||||
require('pfych.keybinds')
|
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||||
|
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||||
|
if vim.v.shell_error ~= 0 then
|
||||||
|
vim.api.nvim_echo({
|
||||||
|
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||||
|
{ out, "WarningMsg" },
|
||||||
|
{ "\nPress any key to exit..." },
|
||||||
|
}, true, {})
|
||||||
|
vim.fn.getchar()
|
||||||
|
os.exit(1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
|
-- Plugin setup
|
||||||
|
require("lazy").setup({
|
||||||
|
spec = { { import = "plugins" } },
|
||||||
|
install = { colorscheme = { "catppuccin" } },
|
||||||
|
checker = { enabled = true }
|
||||||
|
})
|
||||||
|
|
||||||
|
-- General vim
|
||||||
|
require("base")
|
||||||
|
|
||||||
|
|
||||||
|
17
.config/nvim/lazy-lock.json
Normal file
17
.config/nvim/lazy-lock.json
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"barbar.nvim": { "branch": "master", "commit": "807bede7ef1d8e2ac5f108e9ac8123b1e2d321e3" },
|
||||||
|
"catppuccin": { "branch": "main", "commit": "4bb938bbba41d306db18bf0eb0633a5f28fd7ba0" },
|
||||||
|
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||||
|
"cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" },
|
||||||
|
"conform.nvim": { "branch": "master", "commit": "a6f5bdb78caa305496357d17e962bbc4c0b392e2" },
|
||||||
|
"gitsigns.nvim": { "branch": "main", "commit": "4c40357994f386e72be92a46f41fc1664c84c87d" },
|
||||||
|
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||||
|
"neo-tree.nvim": { "branch": "v3.x", "commit": "e96fd85bf18bc345dab332b345098fa5460dffac" },
|
||||||
|
"nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" },
|
||||||
|
"nvim-cmp": { "branch": "main", "commit": "5a11682453ac6b13dbf32cd403da4ee9c07ef1c3" },
|
||||||
|
"nvim-lspconfig": { "branch": "master", "commit": "99c75820f2606b6b446cad7c75ec2ef7ee8a1317" },
|
||||||
|
"nvim-web-devicons": { "branch": "master", "commit": "1020869742ecb191f260818234517f4a1515cfe8" },
|
||||||
|
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
||||||
|
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
|
||||||
|
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
|
||||||
|
}
|
@ -1,12 +1,8 @@
|
|||||||
vim.cmd("autocmd!")
|
|
||||||
|
|
||||||
vim.scriptencoding = 'utf-8'
|
vim.scriptencoding = 'utf-8'
|
||||||
vim.opt.encoding = 'utf-8'
|
vim.opt.encoding = 'utf-8'
|
||||||
vim.opt.fileencoding = 'utf-8'
|
vim.opt.fileencoding = 'utf-8'
|
||||||
|
|
||||||
vim.wo.relativenumber = true
|
vim.wo.relativenumber = true
|
||||||
vim.wo.number = true
|
vim.wo.number = true
|
||||||
|
|
||||||
vim.opt.title = true
|
vim.opt.title = true
|
||||||
vim.opt.autoindent = true
|
vim.opt.autoindent = true
|
||||||
vim.opt.smartindent = true
|
vim.opt.smartindent = true
|
||||||
@ -18,13 +14,9 @@ vim.opt.tabstop = 2
|
|||||||
vim.opt.mouse = "a"
|
vim.opt.mouse = "a"
|
||||||
vim.opt.undofile = true
|
vim.opt.undofile = true
|
||||||
vim.opt.undodir = vim.fn.expand('~/.vim/undodir')
|
vim.opt.undodir = vim.fn.expand('~/.vim/undodir')
|
||||||
|
|
||||||
-- UXN Assembly on save
|
|
||||||
vim.cmd("command Uxnasm !uxnasm % %<.rom")
|
|
||||||
vim.cmd("autocmd BufWritePost *.tal :Uxnasm")
|
|
||||||
|
|
||||||
-- Line wrap config
|
|
||||||
vim.opt.wrap = true
|
vim.opt.wrap = true
|
||||||
vim.opt.linebreak = true
|
vim.opt.linebreak = true
|
||||||
vim.opt.breakindent = true
|
vim.opt.breakindent = true
|
||||||
vim.opt.breakindentopt = "shift:2,min:40,sbr"
|
vim.opt.breakindentopt = "shift:2,min:40,sbr"
|
||||||
|
|
||||||
|
vim.cmd('colorscheme catppuccin')
|
@ -1,33 +0,0 @@
|
|||||||
require("catppuccin").setup({
|
|
||||||
flavour = "mocha", -- latte, frappe, macchiato, mocha
|
|
||||||
background = { -- :h background
|
|
||||||
light = "latte",
|
|
||||||
dark = "mocha",
|
|
||||||
},
|
|
||||||
transparent_background = false,
|
|
||||||
no_italic = false, -- Force no italic
|
|
||||||
no_bold = false, -- Force no bold
|
|
||||||
styles = {
|
|
||||||
comments = { "italic" },
|
|
||||||
conditionals = {},
|
|
||||||
loops = {},
|
|
||||||
functions = {},
|
|
||||||
keywords = {},
|
|
||||||
strings = {},
|
|
||||||
variables = {},
|
|
||||||
numbers = {},
|
|
||||||
booleans = {},
|
|
||||||
properties = {},
|
|
||||||
types = {},
|
|
||||||
operators = {},
|
|
||||||
},
|
|
||||||
color_overrides = {
|
|
||||||
},
|
|
||||||
integrations = {
|
|
||||||
cmp = true,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
-- setup must be called before loading
|
|
||||||
vim.cmd('colorscheme catppuccin')
|
|
||||||
vim.api.nvim_set_hl(0, "Normal", { guibg = NONE, ctermbg = NONE })
|
|
@ -1,7 +0,0 @@
|
|||||||
-- CodeActionsMenu with ?
|
|
||||||
vim.api.nvim_set_keymap("n", "?", ":CodeActionMenu<CR>", { silent = true, noremap = true })
|
|
||||||
vim.api.nvim_set_keymap("n", ">", ":lua vim.diagnostic.goto_next()<CR>", { silent = true, noremap = true })
|
|
||||||
vim.api.nvim_set_keymap("n", "<", ":lua vim.diagnostic.goto_prev()<CR>", { silent = true, noremap = true })
|
|
||||||
|
|
||||||
vim.opt.splitright = true
|
|
||||||
vim.api.nvim_set_keymap("n", "<space>f", ":NERDTreeToggle<CR>", { noremap = true })
|
|
@ -1,31 +0,0 @@
|
|||||||
local status, packer = pcall(require, "packer")
|
|
||||||
if (not status) then
|
|
||||||
print("Packer is not installed")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.cmd [[packadd packer.nvim]]
|
|
||||||
|
|
||||||
packer.startup(function(use)
|
|
||||||
use 'wbthomason/packer.nvim'
|
|
||||||
|
|
||||||
use 'hrsh7th/cmp-buffer' -- nvim-cmp source for buffer words
|
|
||||||
use 'hrsh7th/cmp-nvim-lsp' -- nvim-cmp source for neovim's built-in LSP
|
|
||||||
use 'hrsh7th/nvim-cmp' -- Completion
|
|
||||||
use 'L3MON4D3/LuaSnip'
|
|
||||||
use 'neovim/nvim-lspconfig' -- LSP
|
|
||||||
use 'jose-elias-alvarez/null-ls.nvim'
|
|
||||||
use 'williamboman/mason.nvim' -- LSP Installer
|
|
||||||
use 'williamboman/mason-lspconfig.nvim'
|
|
||||||
use 'nvim-tree/nvim-web-devicons'
|
|
||||||
use { 'catppuccin/nvim', as = "catppuccin" }
|
|
||||||
use {
|
|
||||||
'nvim-telescope/telescope.nvim', tag = '0.1.8', -- For file searching :Telescope find_files
|
|
||||||
requires = { { 'nvim-lua/plenary.nvim' } }
|
|
||||||
}
|
|
||||||
use { 'prettier/vim-prettier', build = 'pnpm install' }
|
|
||||||
use { 'weilbith/nvim-code-action-menu', cmd = 'CodeActionMenu' }
|
|
||||||
use 'bellinitte/uxntal.vim'
|
|
||||||
use 'preservim/nerdtree' -- For file-browser :NERDTree
|
|
||||||
use 'elkowar/yuck.vim'
|
|
||||||
end)
|
|
9
.config/nvim/lua/plugins/barbar.lua
Normal file
9
.config/nvim/lua/plugins/barbar.lua
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
return {
|
||||||
|
"romgrk/barbar.nvim",
|
||||||
|
dependencies = {
|
||||||
|
'lewis6991/gitsigns.nvim',
|
||||||
|
'nvim-tree/nvim-web-devicons',
|
||||||
|
},
|
||||||
|
init = function() vim.g.barbar_auto_setup = false end,
|
||||||
|
opts = {},
|
||||||
|
}
|
28
.config/nvim/lua/plugins/cattpuucin.lua
Normal file
28
.config/nvim/lua/plugins/cattpuucin.lua
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
return {
|
||||||
|
"catppuccin/nvim",
|
||||||
|
name = "catppuccin",
|
||||||
|
lazy = false,
|
||||||
|
priority = 1000,
|
||||||
|
config = function() require("catppuccin").setup({
|
||||||
|
flavour = "mocha",
|
||||||
|
background = {
|
||||||
|
light = "latte",
|
||||||
|
dark = "mocha",
|
||||||
|
},
|
||||||
|
color_overrides = {
|
||||||
|
mocha = {
|
||||||
|
base = "#000000",
|
||||||
|
mantle = "#000000"
|
||||||
|
},
|
||||||
|
},
|
||||||
|
transparent_background = false,
|
||||||
|
no_italic = false,
|
||||||
|
no_bold = false,
|
||||||
|
styles = {
|
||||||
|
comments = { "italic" },
|
||||||
|
},
|
||||||
|
integrations = {
|
||||||
|
cmp = true,
|
||||||
|
},
|
||||||
|
}) end,
|
||||||
|
}
|
11
.config/nvim/lua/plugins/conform.lua
Normal file
11
.config/nvim/lua/plugins/conform.lua
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
return {
|
||||||
|
'stevearc/conform.nvim',
|
||||||
|
opts = {
|
||||||
|
formatters_by_ft = {
|
||||||
|
typescript = { "prettierd" },
|
||||||
|
javascript = { "prettierd" },
|
||||||
|
scss = { "prettierd" },
|
||||||
|
},
|
||||||
|
format_on_save = { timeout_ms = 500 },
|
||||||
|
},
|
||||||
|
}
|
74
.config/nvim/lua/plugins/lsp.lua
Normal file
74
.config/nvim/lua/plugins/lsp.lua
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
return {
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
dependencies = {
|
||||||
|
"hrsh7th/nvim-cmp",
|
||||||
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
|
"hrsh7th/cmp-buffer",
|
||||||
|
},
|
||||||
|
lazy = false,
|
||||||
|
config = function()
|
||||||
|
local nvim_lsp = require("lspconfig")
|
||||||
|
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||||
|
|
||||||
|
local cmp = require("cmp")
|
||||||
|
cmp.setup({
|
||||||
|
expand = function ()
|
||||||
|
require("cmp.config").set_onetime({ sources = {} })
|
||||||
|
end,
|
||||||
|
window = {
|
||||||
|
completion = cmp.config.window.bordered(),
|
||||||
|
documentation = cmp.config.window.bordered()
|
||||||
|
},
|
||||||
|
sources = {
|
||||||
|
{ name = "path" },
|
||||||
|
{ name = "nvim_lsp" },
|
||||||
|
{ name = "buffer" }
|
||||||
|
},
|
||||||
|
formatting = {
|
||||||
|
fields = {"menu", "abbr", "kind"},
|
||||||
|
format = function(entry, item)
|
||||||
|
local menu_icon = {
|
||||||
|
nvim_lsp = 'λ',
|
||||||
|
buffer = 'Ω',
|
||||||
|
path = '⊏',
|
||||||
|
}
|
||||||
|
|
||||||
|
item.menu = menu_icon[entry.source.name]
|
||||||
|
return item
|
||||||
|
end
|
||||||
|
},
|
||||||
|
mapping = cmp.mapping.preset.insert({
|
||||||
|
["<Tab>"] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
local entry = cmp.get_selected_entry()
|
||||||
|
if not entry then
|
||||||
|
cmp.select_next_item({ behavior = cmp.SelectBehavior.Select })
|
||||||
|
end
|
||||||
|
cmp.confirm()
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, {"i","s","c",}),
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
nvim_lsp.lua_ls.setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
diagnostics = {
|
||||||
|
globals = { 'vim' },
|
||||||
|
},
|
||||||
|
workspace = {
|
||||||
|
library = vim.api.nvim_get_runtime_file("", true),
|
||||||
|
checkThirdParty = false
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
nvim_lsp.ts_ls.setup({
|
||||||
|
capabilities = capabilities
|
||||||
|
})
|
||||||
|
end
|
||||||
|
}
|
9
.config/nvim/lua/plugins/neo-tree.lua
Normal file
9
.config/nvim/lua/plugins/neo-tree.lua
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
return {
|
||||||
|
"nvim-neo-tree/neo-tree.nvim",
|
||||||
|
branch = "v3.x",
|
||||||
|
dependencies = {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
"nvim-tree/nvim-web-devicons",
|
||||||
|
"MunifTanjim/nui.nvim",
|
||||||
|
}
|
||||||
|
}
|
5
.config/nvim/lua/plugins/telescope.lua
Normal file
5
.config/nvim/lua/plugins/telescope.lua
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
return {
|
||||||
|
"nvim-telescope/telescope.nvim",
|
||||||
|
tag = "0.1.8",
|
||||||
|
dependencies = { "nvim-lua/plenary.nvim" }
|
||||||
|
}
|
12
.config/nvim/lua/plugins/which-key.lua
Normal file
12
.config/nvim/lua/plugins/which-key.lua
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
return {
|
||||||
|
"folke/which-key.nvim",
|
||||||
|
event = "VeryLazy",
|
||||||
|
opts = {},
|
||||||
|
keys = {
|
||||||
|
{ "<leader>d", "<cmd>Neotree<cr>", desc = "Open Neotree" },
|
||||||
|
{ "<leader>f", "<cmd>:Telescope find_files<cr>", desc = "Search for files" },
|
||||||
|
{ "<leader>s", "<cmd>:Telescope live_grep<cr>", desc = "Search file content (requires ripgrep)" },
|
||||||
|
{ "<leader>>", "<cmd>:lua vim.diagnostic.goto_next()<cr>", desc = "Jump to next issue" },
|
||||||
|
{ "<leader><", "<cmd>:lua vim.diagnostic.goto_prev()<cr>", desc = "Jump to prev issue" },
|
||||||
|
},
|
||||||
|
}
|
@ -1,33 +0,0 @@
|
|||||||
local cmp = require'cmp'
|
|
||||||
|
|
||||||
local cmpStatus, cmp = pcall(require, "cmp")
|
|
||||||
if (not cmpStatus) then
|
|
||||||
print("cmp is not installed")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
cmp.setup({
|
|
||||||
snippet = {
|
|
||||||
expand = function(args)
|
|
||||||
require('luasnip').lsp_expand(args.body)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
mapping = cmp.mapping.preset.insert({
|
|
||||||
["<Tab>"] = cmp.mapping(function(fallback)
|
|
||||||
if cmp.visible() then
|
|
||||||
local entry = cmp.get_selected_entry()
|
|
||||||
if not entry then
|
|
||||||
cmp.select_next_item({ behavior = cmp.SelectBehavior.Select })
|
|
||||||
else
|
|
||||||
cmp.confirm()
|
|
||||||
end
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end, {"i","s","c",}),
|
|
||||||
}),
|
|
||||||
sources = cmp.config.sources({
|
|
||||||
{ name = 'nvim_lsp' },
|
|
||||||
{ name = 'buffer' },
|
|
||||||
})
|
|
||||||
})
|
|
@ -1,117 +0,0 @@
|
|||||||
local status, nvim_lsp = pcall(require, "lspconfig")
|
|
||||||
if (not status) then
|
|
||||||
print("LSPConfig is not installed")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local protocol = require('vim.lsp.protocol')
|
|
||||||
|
|
||||||
local augroup_format = vim.api.nvim_create_augroup("Format", { clear = true })
|
|
||||||
local enable_format_on_save = function(_, bufnr)
|
|
||||||
vim.api.nvim_clear_autocmds({ group = augroup_format, buffer = bufnr })
|
|
||||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
|
||||||
group = augroup_format,
|
|
||||||
buffer = bufnr,
|
|
||||||
callback = function()
|
|
||||||
vim.lsp.buf.format({ bufnr = bufnr })
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
local on_attach = function(client, bufnr)
|
|
||||||
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
|
|
||||||
|
|
||||||
local opts = { noremap = true, silent = true }
|
|
||||||
|
|
||||||
buf_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
|
||||||
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
|
||||||
end
|
|
||||||
|
|
||||||
protocol.CompletionItemKind = {
|
|
||||||
'', -- Text
|
|
||||||
'', -- Method
|
|
||||||
'', -- Function
|
|
||||||
'', -- Constructor
|
|
||||||
'', -- Field
|
|
||||||
'', -- Variable
|
|
||||||
'', -- Class
|
|
||||||
'ﰮ', -- Interface
|
|
||||||
'', -- Module
|
|
||||||
'', -- Property
|
|
||||||
'', -- Unit
|
|
||||||
'', -- Value
|
|
||||||
'', -- Enum
|
|
||||||
'', -- Keyword
|
|
||||||
'', -- Snippet
|
|
||||||
'', -- Color
|
|
||||||
'', -- File
|
|
||||||
'', -- Reference
|
|
||||||
'', -- Folder
|
|
||||||
'', -- EnumMember
|
|
||||||
'', -- Constant
|
|
||||||
'', -- Struct
|
|
||||||
'', -- Event
|
|
||||||
'ﬦ', -- Operator
|
|
||||||
'', -- TypeParameter
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Set up completion using nvim_cmp with LSP source
|
|
||||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
|
||||||
|
|
||||||
nvim_lsp.stylelint_lsp.setup {
|
|
||||||
filetypes = { "css", "scss" }
|
|
||||||
}
|
|
||||||
|
|
||||||
nvim_lsp.ts_ls.setup {
|
|
||||||
on_attach = on_attach,
|
|
||||||
filetypes = { "typescript", "typescriptreact", "typescript.tsx" },
|
|
||||||
cmd = { "typescript-language-server", "--stdio" },
|
|
||||||
capabilities = capabilities
|
|
||||||
}
|
|
||||||
|
|
||||||
nvim_lsp.lua_ls.setup {
|
|
||||||
capabilities = capabilities,
|
|
||||||
on_attach = function(client, bufnr)
|
|
||||||
on_attach(client, bufnr)
|
|
||||||
enable_format_on_save(client, bufnr)
|
|
||||||
end,
|
|
||||||
settings = {
|
|
||||||
Lua = {
|
|
||||||
diagnostics = {
|
|
||||||
-- Get the language server to recognize the `vim` global
|
|
||||||
globals = { 'vim' },
|
|
||||||
},
|
|
||||||
workspace = {
|
|
||||||
-- Make the server aware of Neovim runtime files
|
|
||||||
library = vim.api.nvim_get_runtime_file("", true),
|
|
||||||
checkThirdParty = false
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
|
|
||||||
vim.lsp.diagnostic.on_publish_diagnostics, {
|
|
||||||
underline = true,
|
|
||||||
update_in_insert = false,
|
|
||||||
virtual_text = { spacing = 4, prefix = "●" },
|
|
||||||
severity_sort = true,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
-- Diagnostic symbols in the sign column (gutter)
|
|
||||||
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 = "" })
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.diagnostic.config({
|
|
||||||
virtual_text = {
|
|
||||||
prefix = '●'
|
|
||||||
},
|
|
||||||
update_in_insert = true,
|
|
||||||
float = {
|
|
||||||
source = "always", -- Or "if_many"
|
|
||||||
},
|
|
||||||
})
|
|
@ -1,17 +0,0 @@
|
|||||||
local status, mason = pcall(require, "mason")
|
|
||||||
if (not status) then
|
|
||||||
print("Mason is not installed")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
mason.setup({
|
|
||||||
ensure_installed = {
|
|
||||||
"prettier",
|
|
||||||
"lua-language-server",
|
|
||||||
"luaformatter",
|
|
||||||
"eslint_d",
|
|
||||||
"typescript-language-server",
|
|
||||||
"stylelint-lsp"
|
|
||||||
},
|
|
||||||
automatic_installation = true
|
|
||||||
})
|
|
@ -1,43 +0,0 @@
|
|||||||
local status, null_ls = pcall(require, "null-ls")
|
|
||||||
if (not status) then return end
|
|
||||||
|
|
||||||
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
|
||||||
|
|
||||||
local lsp_formatting = function(bufnr)
|
|
||||||
vim.lsp.buf.format({
|
|
||||||
filter = function(client)
|
|
||||||
return client.name == "null-ls"
|
|
||||||
end,
|
|
||||||
bufnr = bufnr,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
null_ls.setup {
|
|
||||||
sources = {
|
|
||||||
null_ls.builtins.formatting.prettierd,
|
|
||||||
null_ls.builtins.diagnostics.eslint_d.with({
|
|
||||||
diagnostics_format = '[eslint] #{m}\n(#{c})'
|
|
||||||
}),
|
|
||||||
null_ls.builtins.diagnostics.fish
|
|
||||||
},
|
|
||||||
on_attach = function(client, bufnr)
|
|
||||||
if client.supports_method("textDocument/formatting") then
|
|
||||||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
|
||||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
|
||||||
group = augroup,
|
|
||||||
buffer = bufnr,
|
|
||||||
callback = function()
|
|
||||||
lsp_formatting(bufnr)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
vim.api.nvim_create_user_command(
|
|
||||||
'DisableLspFormatting',
|
|
||||||
function()
|
|
||||||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = 0 })
|
|
||||||
end,
|
|
||||||
{ nargs = 0 }
|
|
||||||
)
|
|
@ -1,199 +0,0 @@
|
|||||||
-- Automatically generated packer.nvim plugin loader code
|
|
||||||
|
|
||||||
if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then
|
|
||||||
vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"')
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.api.nvim_command('packadd packer.nvim')
|
|
||||||
|
|
||||||
local no_errors, error_msg = pcall(function()
|
|
||||||
|
|
||||||
_G._packer = _G._packer or {}
|
|
||||||
_G._packer.inside_compile = true
|
|
||||||
|
|
||||||
local time
|
|
||||||
local profile_info
|
|
||||||
local should_profile = false
|
|
||||||
if should_profile then
|
|
||||||
local hrtime = vim.loop.hrtime
|
|
||||||
profile_info = {}
|
|
||||||
time = function(chunk, start)
|
|
||||||
if start then
|
|
||||||
profile_info[chunk] = hrtime()
|
|
||||||
else
|
|
||||||
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
time = function(chunk, start) end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function save_profiles(threshold)
|
|
||||||
local sorted_times = {}
|
|
||||||
for chunk_name, time_taken in pairs(profile_info) do
|
|
||||||
sorted_times[#sorted_times + 1] = {chunk_name, time_taken}
|
|
||||||
end
|
|
||||||
table.sort(sorted_times, function(a, b) return a[2] > b[2] end)
|
|
||||||
local results = {}
|
|
||||||
for i, elem in ipairs(sorted_times) do
|
|
||||||
if not threshold or threshold and elem[2] > threshold then
|
|
||||||
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if threshold then
|
|
||||||
table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)')
|
|
||||||
end
|
|
||||||
|
|
||||||
_G._packer.profile_output = results
|
|
||||||
end
|
|
||||||
|
|
||||||
time([[Luarocks path setup]], true)
|
|
||||||
local package_path_str = "/Users/noah/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/Users/noah/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/Users/noah/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/Users/noah/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua"
|
|
||||||
local install_cpath_pattern = "/Users/noah/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so"
|
|
||||||
if not string.find(package.path, package_path_str, 1, true) then
|
|
||||||
package.path = package.path .. ';' .. package_path_str
|
|
||||||
end
|
|
||||||
|
|
||||||
if not string.find(package.cpath, install_cpath_pattern, 1, true) then
|
|
||||||
package.cpath = package.cpath .. ';' .. install_cpath_pattern
|
|
||||||
end
|
|
||||||
|
|
||||||
time([[Luarocks path setup]], false)
|
|
||||||
time([[try_loadstring definition]], true)
|
|
||||||
local function try_loadstring(s, component, name)
|
|
||||||
local success, result = pcall(loadstring(s), name, _G.packer_plugins[name])
|
|
||||||
if not success then
|
|
||||||
vim.schedule(function()
|
|
||||||
vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {})
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
return result
|
|
||||||
end
|
|
||||||
|
|
||||||
time([[try_loadstring definition]], false)
|
|
||||||
time([[Defining packer_plugins]], true)
|
|
||||||
_G.packer_plugins = {
|
|
||||||
LuaSnip = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/Users/noah/.local/share/nvim/site/pack/packer/start/LuaSnip",
|
|
||||||
url = "https://github.com/L3MON4D3/LuaSnip"
|
|
||||||
},
|
|
||||||
catppuccin = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/Users/noah/.local/share/nvim/site/pack/packer/start/catppuccin",
|
|
||||||
url = "https://github.com/catppuccin/nvim"
|
|
||||||
},
|
|
||||||
["cmp-buffer"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/Users/noah/.local/share/nvim/site/pack/packer/start/cmp-buffer",
|
|
||||||
url = "https://github.com/hrsh7th/cmp-buffer"
|
|
||||||
},
|
|
||||||
["cmp-nvim-lsp"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/Users/noah/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
|
|
||||||
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
|
|
||||||
},
|
|
||||||
["mason-lspconfig.nvim"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/Users/noah/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim",
|
|
||||||
url = "https://github.com/williamboman/mason-lspconfig.nvim"
|
|
||||||
},
|
|
||||||
["mason.nvim"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/Users/noah/.local/share/nvim/site/pack/packer/start/mason.nvim",
|
|
||||||
url = "https://github.com/williamboman/mason.nvim"
|
|
||||||
},
|
|
||||||
["null-ls.nvim"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/Users/noah/.local/share/nvim/site/pack/packer/start/null-ls.nvim",
|
|
||||||
url = "https://github.com/jose-elias-alvarez/null-ls.nvim"
|
|
||||||
},
|
|
||||||
["nvim-cmp"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/Users/noah/.local/share/nvim/site/pack/packer/start/nvim-cmp",
|
|
||||||
url = "https://github.com/hrsh7th/nvim-cmp"
|
|
||||||
},
|
|
||||||
["nvim-code-action-menu"] = {
|
|
||||||
commands = { "CodeActionMenu" },
|
|
||||||
loaded = false,
|
|
||||||
needs_bufread = true,
|
|
||||||
only_cond = false,
|
|
||||||
path = "/Users/noah/.local/share/nvim/site/pack/packer/opt/nvim-code-action-menu",
|
|
||||||
url = "https://github.com/weilbith/nvim-code-action-menu"
|
|
||||||
},
|
|
||||||
["nvim-lspconfig"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/Users/noah/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
|
|
||||||
url = "https://github.com/neovim/nvim-lspconfig"
|
|
||||||
},
|
|
||||||
["nvim-treesitter"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/Users/noah/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
|
|
||||||
url = "https://github.com/nvim-treesitter/nvim-treesitter"
|
|
||||||
},
|
|
||||||
["nvim-web-devicons"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/Users/noah/.local/share/nvim/site/pack/packer/start/nvim-web-devicons",
|
|
||||||
url = "https://github.com/nvim-tree/nvim-web-devicons"
|
|
||||||
},
|
|
||||||
["packer.nvim"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/Users/noah/.local/share/nvim/site/pack/packer/start/packer.nvim",
|
|
||||||
url = "https://github.com/wbthomason/packer.nvim"
|
|
||||||
},
|
|
||||||
["plenary.nvim"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/Users/noah/.local/share/nvim/site/pack/packer/start/plenary.nvim",
|
|
||||||
url = "https://github.com/nvim-lua/plenary.nvim"
|
|
||||||
},
|
|
||||||
["telescope-file-browser.nvim"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/Users/noah/.local/share/nvim/site/pack/packer/start/telescope-file-browser.nvim",
|
|
||||||
url = "https://github.com/nvim-telescope/telescope-file-browser.nvim"
|
|
||||||
},
|
|
||||||
["telescope.nvim"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/Users/noah/.local/share/nvim/site/pack/packer/start/telescope.nvim",
|
|
||||||
url = "https://github.com/nvim-telescope/telescope.nvim"
|
|
||||||
},
|
|
||||||
["uxntal.vim"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/Users/noah/.local/share/nvim/site/pack/packer/start/uxntal.vim",
|
|
||||||
url = "https://github.com/bellinitte/uxntal.vim"
|
|
||||||
},
|
|
||||||
["vim-prettier"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/Users/noah/.local/share/nvim/site/pack/packer/start/vim-prettier",
|
|
||||||
url = "https://github.com/prettier/vim-prettier"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
time([[Defining packer_plugins]], false)
|
|
||||||
|
|
||||||
-- Command lazy-loads
|
|
||||||
time([[Defining lazy-load commands]], true)
|
|
||||||
pcall(vim.api.nvim_create_user_command, 'CodeActionMenu', function(cmdargs)
|
|
||||||
require('packer.load')({'nvim-code-action-menu'}, { cmd = 'CodeActionMenu', l1 = cmdargs.line1, l2 = cmdargs.line2, bang = cmdargs.bang, args = cmdargs.args, mods = cmdargs.mods }, _G.packer_plugins)
|
|
||||||
end,
|
|
||||||
{nargs = '*', range = true, bang = true, complete = function()
|
|
||||||
require('packer.load')({'nvim-code-action-menu'}, {}, _G.packer_plugins)
|
|
||||||
return vim.fn.getcompletion('CodeActionMenu ', 'cmdline')
|
|
||||||
end})
|
|
||||||
time([[Defining lazy-load commands]], false)
|
|
||||||
|
|
||||||
|
|
||||||
_G._packer.inside_compile = false
|
|
||||||
if _G._packer.needs_bufread == true then
|
|
||||||
vim.cmd("doautocmd BufRead")
|
|
||||||
end
|
|
||||||
_G._packer.needs_bufread = false
|
|
||||||
|
|
||||||
if should_profile then save_profiles() end
|
|
||||||
|
|
||||||
end)
|
|
||||||
|
|
||||||
if not no_errors then
|
|
||||||
error_msg = error_msg:gsub('"', '\\"')
|
|
||||||
vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None')
|
|
||||||
end
|
|
@ -1,7 +0,0 @@
|
|||||||
local status, telescope = pcall(require, "telescope")
|
|
||||||
if (not status) then
|
|
||||||
print("Telescope is not installed")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
telescope.setup({})
|
|
@ -1,31 +0,0 @@
|
|||||||
local status, ts = pcall(require, "nvim-treesitter.configs")
|
|
||||||
if (not status) then return end
|
|
||||||
|
|
||||||
ts.setup {
|
|
||||||
highlight = {
|
|
||||||
enable = true,
|
|
||||||
disable = {},
|
|
||||||
},
|
|
||||||
indent = {
|
|
||||||
enable = true,
|
|
||||||
disable = {},
|
|
||||||
},
|
|
||||||
ensure_installed = {
|
|
||||||
"markdown",
|
|
||||||
"markdown_inline",
|
|
||||||
"tsx",
|
|
||||||
"json",
|
|
||||||
"yaml",
|
|
||||||
"css",
|
|
||||||
"scss",
|
|
||||||
"html",
|
|
||||||
"lua",
|
|
||||||
"vim",
|
|
||||||
},
|
|
||||||
autotag = {
|
|
||||||
enable = true,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
|
|
||||||
parser_config.tsx.filetype_to_parsername = { "javascript", "typescript.tsx" }
|
|
@ -17,11 +17,11 @@ configPrompt() {
|
|||||||
*) PROMPT_EMOJI="😵💫";;
|
*) PROMPT_EMOJI="😵💫";;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ -x "$(command -v wezterm)" ]; then
|
# if [ -x "$(command -v wezterm)" ]; then
|
||||||
if [ "$TERM_PROGRAM" = "WezTerm" ]; then
|
# if [ "$TERM_PROGRAM" = "WezTerm" ]; then
|
||||||
wezterm cli set-tab-title "$PROMPT_EMOJI $(pwd)"
|
# wezterm cli set-tab-title "$PROMPT_EMOJI $(pwd)"
|
||||||
fi
|
# fi
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
PROMPT="$PROMPT_EMOJI [%c] "
|
PROMPT="$PROMPT_EMOJI [%c] "
|
||||||
RPROMPT="$(git_super_status)"
|
RPROMPT="$(git_super_status)"
|
||||||
|
Loading…
Reference in New Issue
Block a user