#require 'lspconfig'.clangd.setup{} vim.g.zig_fmt_autosave = 0 vim.cmd("set number") vim.cmd("set tabstop=4") vim.cmd("set softtabstop=4") vim.cmd("set expandtab") vim.cmd("set shiftwidth=4") vim.cmd("set ttyfast") vim.cmd("let mapleader=','") vim.cmd("set makeprg=zig\\ run\\ %<.zig") local vim = vim local Plug = vim.fn['plug#'] vim.call('plug#begin') Plug('neovim/nvim-lspconfig') -- https://github.com/neovim/nvim-lspconfig Plug('ziglang/zig.vim') -- https://github.com/ziglang/zig.vim Plug('ray-x/lsp_signature.nvim') Plug('nvim-lua/plenary.nvim') Plug('nvim-telescope/telescope.nvim') vim.call('plug#end') require 'lspconfig'.zls.setup{} vim.api.nvim_create_autocmd("LspAttach", { callback = function(args) local bufnr = args.buf local client = vim.lsp.get_client_by_id(args.data.client_id) if vim.tbl_contains({ 'null-ls' }, client.name) then -- blacklist lsp return end require("lsp_signature").on_attach({ -- ... setup options here ... }, bufnr) end, }) -- don't show parse errors in a separate window vim.g.zig_fmt_parse_errors = 0 -- disable format-on-save from `ziglang/zig.vim` vim.g.zig_fmt_autosave = 0 -- enable format-on-save from nvim-lspconfig + ZLS -- -- Formatting with ZLS matches `zig fmt`. -- The Zig FAQ answers some questions about `zig fmt`: -- https://github.com/ziglang/zig/wiki/FAQ vim.api.nvim_create_autocmd('BufWritePre',{ pattern = {"*.zig", "*.zon"}, callback = function(ev) -- vim.lsp.buf.format() end }) local lspconfig = require('lspconfig') lspconfig.zls.setup { -- Server-specific settings. See `:help lspconfig-setup` -- omit the following line if `zls` is in your PATH -- cmd = { '/path/to/zls_executable' }, -- There are two ways to set config options: -- - edit your `zls.json` that applies to any editor that uses ZLS -- - set in-editor config options with the `settings` field below. -- -- Further information on how to configure ZLS: -- https://zigtools.org/zls/configure/ settings = { zls = { -- Whether to enable build-on-save diagnostics -- -- Further information about build-on save: -- https://zigtools.org/zls/guides/build-on-save/ -- enable_build_on_save = true, -- omit the following line if `zig` is in your PATH -- zig_exe_path = '/path/to/zig_executable' } } } local builtin = require('telescope.builtin') vim.keymap.set('n','ff',builtin.find_files, { desc = "Telescope find files" }) vim.keymap.set('n', 'fg', builtin.live_grep, { desc = 'Telescope live grep' }) vim.keymap.set('n', 'fb', builtin.buffers, { desc = 'Telescope buffers' }) vim.keymap.set('n', 'fh', builtin.help_tags, { desc = 'Telescope help tags' }) vim.keymap.set('n', 'fr', builtin.lsp_references, { desc = 'Telescope list reference under cursor' }) vim.keymap.set('n', 'fs', builtin.lsp_document_symbols, { desc = 'Telescope list all document symbols' }) vim.keymap.set('n', 'fd', builtin.lsp_definitions, { desc = 'Telescope defintions under cursor' }) vim.keymap.set('n', 'ft', builtin.lsp_type_definitions, { desc = 'Telescope definition of type under cursor' })