commit c14267846df383e16160e92405d75d93065fb6d0
parent 349499a7dbd1cc77fe10f8705b7ec7449381decd
Author: Tomas Nemec <nemi@skaut.cz>
Date: Thu, 20 Oct 2022 08:04:54 +0200
update
Diffstat:
9 files changed, 72 insertions(+), 53 deletions(-)
diff --git a/after/plugin/treesitter.lua b/after/plugin/treesitter.lua
@@ -28,7 +28,7 @@ parser_configs.norg_table = {
},
}
-require 'nvim-treesitter.configs'.setup {
+require'nvim-treesitter.configs'.setup {
ensure_intalled = 'all',
ignore_install = { 'lua', 'vim', 'c' },
highlight = { enable = true, disable = { 'lua', 'vim' } },
@@ -100,7 +100,6 @@ vim.api.nvim_create_user_command('TSHRefresh', 'write|TSBufEnable highlight', {}
vim.keymap.set('n', '<leader>su', '<cmd>TSHRefresh<cr>')
require('tms.colors').update(function(t)
- t.Group.new('TreesitterContext', t.colors.none, t.dimm(t.groups.Normal.bg, 0.03))
t.Group.new('TSDefinition', t.colors.none, t.colors.none)
t.Group.new('TSCurentScope', t.colors.none, t.colors.none)
t.Group.new('TSDefinitionUsage', t.colors.none, t.dimm(t.groups.Normal.bg, 0.03))
diff --git a/colors/tms.lua b/colors/tms.lua
@@ -88,3 +88,34 @@ colorscheme.update(function(t)
Group.new('Typedef', colors.c3, colors.none)
Group.new('WinSeparator', nil, colors.none)
end)
+
+local highlights = {
+ ['@string.regex'] = { link = 'String', default = true },
+ ['@string.special'] = { link = 'SpecialChar', default = true },
+ ['@parameter.reference'] = { link = '@parameter', default = true },
+ ['@annotation'] = { link = 'PreProc', default = true },
+ ['@attribute'] = { link = 'PreProc', default = true },
+ ['@namespace'] = { link = 'Include', default = true },
+ ['@symbol'] = { link = 'Identifier', default = true },
+ ['@keyword.operator'] = { link = '@operator', default = true },
+ ['@variable.builtin'] = { link = 'Special', default = true },
+ ['@text.strong'] = { bold = true, default = true },
+ ['@text.emphasis'] = { italic = true, default = true },
+ ['@text.strike'] = { strikethrough = true },
+ ['@text.math'] = { link = 'Special', default = true },
+ ['@text.reference'] = { link = 'Constant', default = true },
+ ['@text.environment'] = { link = 'Macro', default = true },
+ ['@text.environment.name'] = { link = 'Type', default = true },
+ ['@text.title'] = { link = 'Title', default = true },
+ ['@text.literal'] = { link = 'String', default = true },
+ ['@text.uri'] = { link = 'Underlined', default = true },
+ ['@text.note'] = { link = 'SpecialComment', default = true },
+ ['@text.warning'] = { link = 'Todo', default = true },
+ ['@text.danger'] = { link = 'WarningMsg', default = true },
+ ['@tag'] = { link = 'Label', default = true },
+ ['@tag.delimiter'] = { link = 'Delimiter', default = true },
+ ['@tag.attribute'] = { link = '@property', default = true },
+}
+for group, hl_map in pairs(highlights) do
+ vim.api.nvim_set_hl(0, group, hl_map)
+end
diff --git a/compiler/lua.lua b/compiler/lua.lua
@@ -0,0 +1,11 @@
+-- Vim compiler file
+-- Compiler: Lua
+-- Maintainer: Tomas Nemec <owl@tms.dev>
+-- Last Change: 18.10.2022
+if vim.fn.exists('current_compiler') then
+ return
+end
+vim.g.current_compiler = 'lua'
+
+vim.opt_local.makeprg = 'lua %:S'
+vim.opt_local.errorformat = 'lua: %f:%l: %m'
diff --git a/compiler/lua.vim b/compiler/lua.vim
@@ -1,18 +0,0 @@
-" Vim compiler file
-" Compiler: Lua
-" Maintainer: Tomas Nemec <nemi@skaut.cz>
-" Last Change: Jun 10 2021
-
-if exists("current_compiler")
- finish
-endif
-let current_compiler = "lua"
-
-let s:cpo_save = &cpo
-set cpo&vim
-
-set makeprg=lua\ %:S
-set errorformat=lua:\ %f:%l:\ %m
-
-let &cpo = s:cpo_save
-unlet s:cpo_save
diff --git a/lua/plugins.lua b/lua/plugins.lua
@@ -113,7 +113,7 @@ return packer.startup({
use 'williamboman/mason.nvim'
use 'williamboman/mason-lspconfig.nvim'
use 'b0o/schemastore.nvim'
- use 'folke/lua-dev.nvim'
+ use 'folke/neodev.nvim'
use { 'jose-elias-alvarez/null-ls.nvim', requires = { 'nvim-lua/plenary.nvim' } }
use 'stevearc/aerial.nvim'
diff --git a/lua/tms/colors.lua b/lua/tms/colors.lua
@@ -1,6 +1,6 @@
local M = {}
-M.load_colorscheme = function()
+function M.load_colorscheme()
local colors = {}
if vim.fn.empty('/home/tms/.cache/wal') > 0 then
@@ -33,7 +33,7 @@ M.load_colorscheme = function()
return colors
end
-M.setup_colors = function(colors)
+function M.setup_colors(colors)
local Color = require('colorbuddy.color').Color
-- Special
@@ -69,9 +69,11 @@ M.setup_colors = function(colors)
Color.new('c15', colors.color15)
end
-M.is_dark = function(colors) return colors.foreg.L > colors.backg.L end
+function M.is_dark(colors)
+ return colors.foreg.L > colors.backg.L
+end
-M.dimm = function(color, amount, is_dark)
+function M.dimm(color, amount, is_dark)
if is_dark then
return color:light(amount)
else
@@ -79,7 +81,7 @@ M.dimm = function(color, amount, is_dark)
end
end
-M.update = function(fn)
+function M.update(fn)
local colors = require('colorbuddy.color').colors
local is_dark = M.is_dark(colors)
fn({
@@ -88,7 +90,9 @@ M.update = function(fn)
Group = require('colorbuddy.group').Group,
groups = require('colorbuddy.group').groups,
styles = require('colorbuddy.style').styles,
- dimm = function(color, amount) return M.dimm(color, amount, is_dark) end,
+ dimm = function(color, amount)
+ return M.dimm(color, amount, is_dark)
+ end,
is_dark = is_dark,
})
end
diff --git a/lua/tms/lsp/init.lua b/lua/tms/lsp/init.lua
@@ -1,17 +1,17 @@
local M = {}
-M.capabilities = function()
+function M.capabilities()
local cap = vim.lsp.protocol.make_client_capabilities()
- local has_cmp, cmp = pcall(require, 'cmp_nvim_lsp')
+ local has_cmp, cmp_lsp = pcall(require, 'cmp_nvim_lsp')
if has_cmp then
- cap = cmp.update_capabilities(cap)
+ cap = vim.tbl_deep_extend('force', cap, cmp_lsp.default_capabilities())
end
return cap
end
-M.make_opts = function(name)
+function M.make_opts(name)
local opts = {}
opts.name = name
opts.capabilities = M.capabilities()
diff --git a/lua/tms/lsp/servers.lua b/lua/tms/lsp/servers.lua
@@ -1,22 +1,25 @@
-- Custom configuration for servers
local M = {}
-M.jsonls = function(opts)
+function M.jsonls(opts)
opts.settings = { json = { schemas = require('schemastore').json.schemas() } }
return opts
end
-M.yamlls = function(opts)
+function M.yamlls(opts)
opts.settings = { yaml = { schemaStore = { enable = true } } }
return opts
end
-M.cssls = function(opts)
+function M.cssls(opts)
opts.capabilities.textDocument.completion.completionItem.snippetSupport = true
return opts
end
-M.sumneko_lua = function(opts)
+function M.sumneko_lua(opts)
+ if pcall(require, 'neodev') then
+ require('neodev').setup {}
+ end
opts.settings = {
Lua = {
--
@@ -27,46 +30,35 @@ M.sumneko_lua = function(opts)
},
telemetry = { enable = false },
workspace = { checkThirdParty = false },
+ completion = { callSnippet = 'Replace' },
},
-
}
- opts = require('lua-dev').setup({
- library = {
- vimruntime = true, -- runtime path
- types = true, -- full signature, docs and completion of vim.api, vim.treesitter, vim.lsp and others
- plugins = true, -- installed opt or start plugins in packpath
- -- you can also specify the list of plugins to make available as a workspace library
- -- plugins = { "nvim-treesitter", "plenary.nvim", "telescope.nvim" },
- },
- runtime_path = true, -- enable this to get completion in require strings. Slow!
- lspconfig = opts,
- })
return opts
end
-M.emmet_ls = function(opts)
+function M.emmet_ls(opts)
opts.root_dir = require('lspconfig').util.root_pattern('.git', vim.fn.getcwd())
return opts
end
-M.gopls = function(opts)
+function M.gopls(opts)
opts.root_dir = require('lspconfig').util.root_pattern('go.work', 'go.mod', '.git', vim.fn.getcwd())
return opts
end
-M.html = function(opts)
+function M.html(opts)
opts.init_options = { provideFormatter = false }
return opts
end
-M.dartls = function(opts)
+function M.dartls(opts)
local dart_tools_lsp = require('dart-tools.lsp')
if dart_tools_lsp then
return dart_tools_lsp.make_opts(opts)
end
end
-M.intelephense = function(opts)
+function M.intelephense(opts)
opts.init_options = {
clearCache = true,
licenceKey = os.getenv('XDG_CONFIG_HOME') .. '/intelephense/licenceKey.txt',
diff --git a/plugin/globals.lua b/plugin/globals.lua
@@ -1,4 +1,4 @@
-R = function(p)
+function R(p)
package.loaded[p] = nil
return require(p)
end