nvim
This commit is contained in:
		
							parent
							
								
									38fc909733
								
							
						
					
					
						commit
						0f6fc5bd2f
					
				
					 1 changed files with 19 additions and 2 deletions
				
			
		| 
						 | 
					@ -4,6 +4,14 @@ if not ok then
 | 
				
			||||||
    return
 | 
					    return
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					local root_dir
 | 
				
			||||||
 | 
					for dir in vim.fs.parents(vim.api.nvim_buf_get_name(0)) do
 | 
				
			||||||
 | 
					    if vim.fn.isdirectory(dir .. "/.git") == 1 then
 | 
				
			||||||
 | 
					        root_dir = dir
 | 
				
			||||||
 | 
					        break
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
local border = {
 | 
					local border = {
 | 
				
			||||||
    { "┌", "FloatBorder" },
 | 
					    { "┌", "FloatBorder" },
 | 
				
			||||||
    { "─", "FloatBorder" },
 | 
					    { "─", "FloatBorder" },
 | 
				
			||||||
| 
						 | 
					@ -64,8 +72,16 @@ local on_attach = function(client, bufnr)
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					local function prettier_command()
 | 
				
			||||||
 | 
					    if vim.fs.basename(root_dir .. "node_modules/prettier") then
 | 
				
			||||||
 | 
					        return "npx prettier"
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					        return "prettier"
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
local prettier = {
 | 
					local prettier = {
 | 
				
			||||||
    formatCommand = [[prettier --stdin-filepath ${INPUT} ${--tab-width:tab_width}]],
 | 
					    formatCommand = prettier_command() .. [[ --stdin-filepath ${INPUT} ${--tab-width:tab_width}]],
 | 
				
			||||||
    formatStdin = true,
 | 
					    formatStdin = true,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -92,7 +108,7 @@ local shellcheck = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
local servers = {
 | 
					local servers = {
 | 
				
			||||||
    efm = {
 | 
					    efm = {
 | 
				
			||||||
        filetypes = { "typescript", "typescriptreact", "sh" },
 | 
					        filetypes = { "typescript", "typescriptreact", "sh", "php" },
 | 
				
			||||||
        init_options = { documentFormatting = true },
 | 
					        init_options = { documentFormatting = true },
 | 
				
			||||||
        settings = {
 | 
					        settings = {
 | 
				
			||||||
            rootMarkers = { ".git/" },
 | 
					            rootMarkers = { ".git/" },
 | 
				
			||||||
| 
						 | 
					@ -100,6 +116,7 @@ local servers = {
 | 
				
			||||||
                typescript = { prettier, eslint },
 | 
					                typescript = { prettier, eslint },
 | 
				
			||||||
                typescriptreact = { prettier, eslint },
 | 
					                typescriptreact = { prettier, eslint },
 | 
				
			||||||
                sh = { shellcheck },
 | 
					                sh = { shellcheck },
 | 
				
			||||||
 | 
					                php = { prettier },
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue