From c154958bdfd573b38f8359d9ab7792413a7b7f8f Mon Sep 17 00:00:00 2001 From: ccppi Date: Wed, 19 Mar 2025 13:16:01 +0000 Subject: [PATCH] Update vim-config/init.lua --- vim-config/init.lua | 64 ++------------------------------------------- 1 file changed, 2 insertions(+), 62 deletions(-) diff --git a/vim-config/init.lua b/vim-config/init.lua index b938ad2..3ba5c7b 100644 --- a/vim-config/init.lua +++ b/vim-config/init.lua @@ -7,75 +7,15 @@ 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-lua/plenary.nvim') Plug('nvim-telescope/telescope.nvim') Plug('neoclide/coc.nvim',{branch = 'release'}) - 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' })