nvim
This commit is contained in:
		
							parent
							
								
									bdf52d4710
								
							
						
					
					
						commit
						41095142b2
					
				
					 3 changed files with 27 additions and 4 deletions
				
			
		| 
						 | 
					@ -4,6 +4,8 @@ if not ok then
 | 
				
			||||||
    return
 | 
					    return
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					local has_lint, lint = pcall(require, "lint")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
local nmap = require("my.utils").nmap
 | 
					local nmap = require("my.utils").nmap
 | 
				
			||||||
 | 
					
 | 
				
			||||||
local border = {
 | 
					local border = {
 | 
				
			||||||
| 
						 | 
					@ -91,13 +93,28 @@ local on_attach = function(client, bufnr)
 | 
				
			||||||
    if has_lsp_status then
 | 
					    if has_lsp_status then
 | 
				
			||||||
        lsp_status.on_attach(client)
 | 
					        lsp_status.on_attach(client)
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if has_lint then
 | 
				
			||||||
 | 
					        if vim.filetype.match({ buf = bufnr }) == "php" then
 | 
				
			||||||
 | 
					            lint.linters.psalm.cmd = "./vendor/bin/psalm"
 | 
				
			||||||
 | 
					        end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        lint.linters_by_ft = {
 | 
				
			||||||
 | 
					            php = { "psalm" }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        vim.api.nvim_create_autocmd({ "BufWritePost" }, {
 | 
				
			||||||
 | 
					            pattern = { "*.php" },
 | 
				
			||||||
 | 
					            callback = function()
 | 
				
			||||||
 | 
					                lint.try_lint()
 | 
				
			||||||
 | 
					            end
 | 
				
			||||||
 | 
					        })
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
local servers = {
 | 
					local servers = {
 | 
				
			||||||
    gopls = {},
 | 
					    gopls = {},
 | 
				
			||||||
    psalm = {
 | 
					    phpactor = {},
 | 
				
			||||||
        cmd = { "./vendor/bin/psalm-language-server" },
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    pylsp = {},
 | 
					    pylsp = {},
 | 
				
			||||||
    rust_analyzer = {
 | 
					    rust_analyzer = {
 | 
				
			||||||
        assist = {
 | 
					        assist = {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,12 +3,17 @@ if not ok then
 | 
				
			||||||
    return
 | 
					    return
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					local luasnip_ok, luasnip = pcall(require, "luasnip")
 | 
				
			||||||
 | 
					if not luasnip_ok then
 | 
				
			||||||
 | 
					    vim.notify("Luasnip is required for nvim-cmp to work", vim.log.levels.WARN)
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
local lspkind = require "lspkind"
 | 
					local lspkind = require "lspkind"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cmp.setup {
 | 
					cmp.setup {
 | 
				
			||||||
    snippet = {
 | 
					    snippet = {
 | 
				
			||||||
        expand = function(args)
 | 
					        expand = function(args)
 | 
				
			||||||
            require("luasnip").lsp_expand(args.body)
 | 
					            luasnip.lsp_expand(args.body)
 | 
				
			||||||
        end,
 | 
					        end,
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    mapping = cmp.mapping.preset.insert {
 | 
					    mapping = cmp.mapping.preset.insert {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -44,4 +44,5 @@ require "paq" {
 | 
				
			||||||
    "L3MON4D3/LuaSnip",
 | 
					    "L3MON4D3/LuaSnip",
 | 
				
			||||||
    "nvim-lua/lsp-status.nvim",
 | 
					    "nvim-lua/lsp-status.nvim",
 | 
				
			||||||
    "onsails/lspkind.nvim",
 | 
					    "onsails/lspkind.nvim",
 | 
				
			||||||
 | 
					    "mfussenegger/nvim-lint",
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue