major overhaul, draft 1
This commit is contained in:
108
init.lua
108
init.lua
@@ -1,10 +1,14 @@
|
||||
vim.cmd("set ww=<,>,[,],h,l")
|
||||
vim.g.mapleader = "\\"
|
||||
vim.cmd("colorscheme slate")
|
||||
vim.cmd("set linebreak")
|
||||
vim.cmd("set number")
|
||||
vim.cmd("set ruler")
|
||||
vim.cmd("set expandtab")
|
||||
vim.cmd("set shiftwidth=4 smarttab")
|
||||
|
||||
vim.opt.ww = "<,>,[,],h,l"
|
||||
vim.opt.linebreak = true
|
||||
vim.opt.number = true
|
||||
vim.opt.ruler = true
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.shiftwidth = 4
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.smarttab = true
|
||||
|
||||
-- writing mode for markdown files
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
@@ -16,47 +20,83 @@ vim.api.nvim_create_autocmd("FileType", {
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
vim.deprecate = function() end
|
||||
|
||||
-- Bootstrap lazy.nvim
|
||||
-- Bootstrap lazy.nvim (from https://lazy.folke.io/installation)
|
||||
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,
|
||||
})
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo({
|
||||
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||
{ out, "WarningMsg" },
|
||||
{ "\nPress any key to exit..." },
|
||||
}, true, {})
|
||||
vim.fn.getchar()
|
||||
os.exit(1)
|
||||
end
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require("lazy").setup({
|
||||
-- Better syntax highlighting
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
},
|
||||
-- Better syntax highlighting
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
lazy = false,
|
||||
build = ":TSUpdate",
|
||||
},
|
||||
|
||||
-- Easy LSP config (works with pyright)
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
},
|
||||
-- temporarily disable b/c it wasn't working
|
||||
-- { "arborist-ts/arborist.nvim" }, -- replacement for treesitter w/ auto-install on opening files
|
||||
|
||||
-- LSP configs
|
||||
{ "neovim/nvim-lspconfig" },
|
||||
|
||||
{ "mason-org/mason.nvim" },
|
||||
|
||||
{ "mason-org/mason-lspconfig.nvim",
|
||||
opts = {
|
||||
ensure_installed = { "pyright", "ts_ls", "clangd" },
|
||||
},
|
||||
dependencies = {
|
||||
{ "mason-org/mason.nvim", opts = {} },
|
||||
"neovim/nvim-lspconfig",
|
||||
},
|
||||
},
|
||||
|
||||
{ "saghen/blink.cmp",
|
||||
version = "1.*",
|
||||
dependencies = { 'rafamadriz/friendly-snippets' },
|
||||
opts = {
|
||||
keymap = {
|
||||
preset = "default",
|
||||
['<CR>'] = { 'select_and_accept', 'fallback' },
|
||||
['<Tab>'] = { 'snippet_forward', 'select_and_accept', 'fallback' },
|
||||
},
|
||||
completion = {
|
||||
documentation = { auto_show = true },
|
||||
},
|
||||
sources = { default = { 'lsp', 'path' } }, -- add 'snippets' for e.g. a pre-formatted `for` loop
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
local lspconfig = require("lspconfig")
|
||||
lspconfig.pyright.setup({})
|
||||
-- require("arborist").setup({
|
||||
-- install_popular = false,
|
||||
-- prefer_wasm = false,
|
||||
-- })
|
||||
|
||||
require("nvim-treesitter.configs").setup({
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
enable = true,
|
||||
},
|
||||
-- turn on treesitter highlighting
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
pattern = { '*' },
|
||||
callback = function()
|
||||
pcall(vim.treesitter.start)
|
||||
end,
|
||||
})
|
||||
|
||||
-- LSP stuff
|
||||
vim.keymap.set('n', ' ', vim.lsp.buf.hover, {})
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, {})
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.references, {})
|
||||
vim.keymap.set('n', 'cd', vim.lsp.buf.rename, {})
|
||||
vim.keymap.set('n', 'g.', vim.lsp.buf.code_action, {})
|
||||
vim.keymap.set("n", "<leader>e", vim.diagnostic.open_float)
|
||||
|
||||
Reference in New Issue
Block a user