mirror of
https://github.com/keanuplayz/dotfiles.git
synced 2024-08-15 02:33:12 +00:00
Compare commits
3 commits
e01e6a06fa
...
cd84490790
Author | SHA1 | Date | |
---|---|---|---|
|
cd84490790 | ||
|
444dc81d1b | ||
|
a7d2efc750 |
3 changed files with 65 additions and 0 deletions
34
nvim/dotfiles/lspconfigs/html.lua
Normal file
34
nvim/dotfiles/lspconfigs/html.lua
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
local utils = require('kdotfiles.utils')
|
||||||
|
local lspconfig = require('lspconfig')
|
||||||
|
|
||||||
|
local file = '/etc/os-release'
|
||||||
|
local lines = utils.lines_from(file)
|
||||||
|
local os_name = utils.get_os(lines)
|
||||||
|
|
||||||
|
local cmd = (os_name == 'arch') and {'vscode-html-languageserver'} or {'vscode-html-language-server'}
|
||||||
|
vim.list_extend(cmd, {'--stdio'})
|
||||||
|
|
||||||
|
lspconfig['html'].setup({
|
||||||
|
cmd = cmd;
|
||||||
|
filetypes = {'html', 'handlebars', 'htmldjango', 'blade'};
|
||||||
|
completion_menu_label = 'HTML';
|
||||||
|
|
||||||
|
settings_scopes = {'html', 'css', 'javascript'};
|
||||||
|
settings = {
|
||||||
|
html = {
|
||||||
|
format = {
|
||||||
|
enable = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
javascript = {
|
||||||
|
format = {
|
||||||
|
enable = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
css = {
|
||||||
|
format = {
|
||||||
|
enable = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
3
nvim/dotfiles/lspconfigs/php.lua
Normal file
3
nvim/dotfiles/lspconfigs/php.lua
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
local lspconfig = require('lspconfig')
|
||||||
|
|
||||||
|
lspconfig['phpactor'].setup({})
|
28
nvim/lua/kdotfiles/utils.lua
Normal file
28
nvim/lua/kdotfiles/utils.lua
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
local M = require('dotfiles.autoload')('kdotfiles.utils')
|
||||||
|
|
||||||
|
function M.file_exists(file)
|
||||||
|
local f = io.open(file, "rb")
|
||||||
|
if f then f:close() end
|
||||||
|
return f ~= nil
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.lines_from(file)
|
||||||
|
if not M.file_exists(file) then return {} end
|
||||||
|
lines = {}
|
||||||
|
for line in io.lines(file) do
|
||||||
|
lines[#lines + 1] = line
|
||||||
|
end
|
||||||
|
return lines
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.get_os(lines)
|
||||||
|
os_name = "Unknown"
|
||||||
|
for k,v in pairs(lines) do
|
||||||
|
if string.match(v, "^ID=") then
|
||||||
|
os_name = string.sub(v, 4)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return os_name
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
Loading…
Add table
Add a link
Reference in a new issue