added LSP config for C, CPP, rust and zig.
This commit is contained in:
parent
9b4fbc5021
commit
3e851969fe
31
init.lua
31
init.lua
|
|
@ -91,7 +91,7 @@ vim.g.mapleader = ' '
|
||||||
vim.g.maplocalleader = ' '
|
vim.g.maplocalleader = ' '
|
||||||
|
|
||||||
-- Set to true if you have a Nerd Font installed and selected in the terminal
|
-- Set to true if you have a Nerd Font installed and selected in the terminal
|
||||||
vim.g.have_nerd_font = false
|
vim.g.have_nerd_font = true
|
||||||
|
|
||||||
-- [[ Setting options ]]
|
-- [[ Setting options ]]
|
||||||
-- See `:help vim.o`
|
-- See `:help vim.o`
|
||||||
|
|
@ -119,6 +119,11 @@ vim.schedule(function() vim.o.clipboard = 'unnamedplus' end)
|
||||||
-- Enable break indent
|
-- Enable break indent
|
||||||
vim.o.breakindent = true
|
vim.o.breakindent = true
|
||||||
|
|
||||||
|
-- NOTE: my config here. Sets tab and space width to 4, and uses spaces instead of tab chars.
|
||||||
|
vim.opt.tabstop = 4
|
||||||
|
vim.opt.shiftwidth = 4
|
||||||
|
vim.opt.expandtab = true
|
||||||
|
|
||||||
-- Enable undo/redo changes even after closing and reopening a file
|
-- Enable undo/redo changes even after closing and reopening a file
|
||||||
vim.o.undofile = true
|
vim.o.undofile = true
|
||||||
|
|
||||||
|
|
@ -258,6 +263,16 @@ require('lazy').setup({
|
||||||
-- NOTE: Plugins can be added via a link or github org/name. To run setup automatically, use `opts = {}`
|
-- NOTE: Plugins can be added via a link or github org/name. To run setup automatically, use `opts = {}`
|
||||||
{ 'NMAC427/guess-indent.nvim', opts = {} },
|
{ 'NMAC427/guess-indent.nvim', opts = {} },
|
||||||
|
|
||||||
|
-- NOTE: my inclusion of autopairs plugin here
|
||||||
|
{
|
||||||
|
'windwp/nvim-autopairs',
|
||||||
|
event = "InsertEnter",
|
||||||
|
config = function()
|
||||||
|
local autopairs = require('nvim-autopairs')
|
||||||
|
autopairs.setup({})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
-- Alternatively, use `config = function() ... end` for full control over the configuration.
|
-- Alternatively, use `config = function() ... end` for full control over the configuration.
|
||||||
-- If you prefer to call `setup` explicitly, use:
|
-- If you prefer to call `setup` explicitly, use:
|
||||||
-- {
|
-- {
|
||||||
|
|
@ -600,10 +615,13 @@ require('lazy').setup({
|
||||||
-- See `:help lsp-config` for information about keys and how to configure
|
-- See `:help lsp-config` for information about keys and how to configure
|
||||||
---@type table<string, vim.lsp.Config>
|
---@type table<string, vim.lsp.Config>
|
||||||
local servers = {
|
local servers = {
|
||||||
-- clangd = {},
|
clangd = {},
|
||||||
-- gopls = {},
|
-- gopls = {},
|
||||||
-- pyright = {},
|
-- pyright = {},
|
||||||
-- rust_analyzer = {},
|
rust_analyzer = {},
|
||||||
|
zls = {
|
||||||
|
cmd = { '/usr/local/bin/zls' },
|
||||||
|
},
|
||||||
--
|
--
|
||||||
-- Some languages (like typescript) have entire language plugins that can be useful:
|
-- Some languages (like typescript) have entire language plugins that can be useful:
|
||||||
-- https://github.com/pmizio/typescript-tools.nvim
|
-- https://github.com/pmizio/typescript-tools.nvim
|
||||||
|
|
@ -656,6 +674,11 @@ require('lazy').setup({
|
||||||
--
|
--
|
||||||
-- You can press `g?` for help in this menu.
|
-- You can press `g?` for help in this menu.
|
||||||
local ensure_installed = vim.tbl_keys(servers or {})
|
local ensure_installed = vim.tbl_keys(servers or {})
|
||||||
|
-- remove ZLS from the mason install list
|
||||||
|
ensure_installed = vim.tbl_filter(function(name)
|
||||||
|
return name ~= 'zls'
|
||||||
|
end, ensure_installed)
|
||||||
|
|
||||||
vim.list_extend(ensure_installed, {
|
vim.list_extend(ensure_installed, {
|
||||||
-- You can add other tools here that you want Mason to install
|
-- You can add other tools here that you want Mason to install
|
||||||
})
|
})
|
||||||
|
|
@ -889,7 +912,7 @@ require('lazy').setup({
|
||||||
-- [[ Configure Treesitter ]] See `:help nvim-treesitter-intro`
|
-- [[ Configure Treesitter ]] See `:help nvim-treesitter-intro`
|
||||||
config = function()
|
config = function()
|
||||||
-- ensure basic parser are installed
|
-- ensure basic parser are installed
|
||||||
local parsers = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }
|
local parsers = { 'bash', 'c', 'cpp', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc', 'zig' }
|
||||||
require('nvim-treesitter').install(parsers)
|
require('nvim-treesitter').install(parsers)
|
||||||
|
|
||||||
---@param buf integer
|
---@param buf integer
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue