mirror of
				https://github.com/tiyn/dotfiles.git
				synced 2025-11-03 22:11:16 +01:00 
			
		
		
		
	nvim: added dictionaries and changed ltex lsp settings
This commit is contained in:
		@@ -118,6 +118,9 @@ vim.g.mapleader = ","
 | 
			
		||||
-- load general mapped keys
 | 
			
		||||
require('style')
 | 
			
		||||
 | 
			
		||||
-- load dictionaries and helper functions
 | 
			
		||||
require('dictionaries')
 | 
			
		||||
 | 
			
		||||
-- load plugins (autoload all files in plugin folder)
 | 
			
		||||
require('loadplugins')
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										47
									
								
								.config/nvim/lua/dictionaries.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								.config/nvim/lua/dictionaries.lua
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,47 @@
 | 
			
		||||
-- local dictionary_base = vim.fn.getenv("XDG_CONFIG_HOME") .. "/nvim/lua/dictionaries/"
 | 
			
		||||
local dictionary_base = "/home/user/.config/nvim/lua/dictionaries/"
 | 
			
		||||
 | 
			
		||||
local Dictionary_files = {
 | 
			
		||||
  ["de-DE"] = {"dictionary_de-de.txt", "dictionary_names.txt"},
 | 
			
		||||
  ["en-US"] = {"dictionary_en-us.txt", "dictionary_names.txt"},
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function GetDictFiles(lang)
 | 
			
		||||
  local files = Dictionary_files[lang]
 | 
			
		||||
  if files then
 | 
			
		||||
    return files
 | 
			
		||||
  else
 | 
			
		||||
    return nil
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
function ReadFiles(lang)
 | 
			
		||||
  local files = GetDictFiles(lang)
 | 
			
		||||
  local dict = {}
 | 
			
		||||
  if files then
 | 
			
		||||
    for _, file in ipairs(files) do
 | 
			
		||||
      local f = assert(io.open(file, "r"))
 | 
			
		||||
      if f then
 | 
			
		||||
        for l in f:lines() do
 | 
			
		||||
          table.insert(dict, l)
 | 
			
		||||
        end
 | 
			
		||||
      else
 | 
			
		||||
        print("Can not read dict file %q", file)
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  else
 | 
			
		||||
    print("Lang %q has no files", lang)
 | 
			
		||||
  end
 | 
			
		||||
  return dict
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
for k,v in pairs(Dictionary_files) do
 | 
			
		||||
  for a,b in pairs(v) do
 | 
			
		||||
    Dictionary_files[k][a] = dictionary_base .. b
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
Dictionaries = {
 | 
			
		||||
  ["de-DE"] = ReadFiles("de-DE"),
 | 
			
		||||
  ["en-US"] = ReadFiles("en-US"),
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										4
									
								
								.config/nvim/lua/dictionaries/dictionary_de-de.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								.config/nvim/lua/dictionaries/dictionary_de-de.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
			
		||||
Bonitur
 | 
			
		||||
Königinnensubstanz
 | 
			
		||||
Magazinbeute
 | 
			
		||||
Pollenhose
 | 
			
		||||
							
								
								
									
										0
									
								
								.config/nvim/lua/dictionaries/dictionary_en-us.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								.config/nvim/lua/dictionaries/dictionary_en-us.txt
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										3
									
								
								.config/nvim/lua/dictionaries/dictionary_names.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								.config/nvim/lua/dictionaries/dictionary_names.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
			
		||||
Akallabêth
 | 
			
		||||
Edain
 | 
			
		||||
Númenor
 | 
			
		||||
@@ -38,6 +38,7 @@ return {
 | 
			
		||||
          "yamlls",
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
 | 
			
		||||
      local servers = {
 | 
			
		||||
        lua_ls = {
 | 
			
		||||
          Lua = {
 | 
			
		||||
@@ -46,6 +47,13 @@ return {
 | 
			
		||||
            },
 | 
			
		||||
            telemetry = { enable = false },
 | 
			
		||||
          },
 | 
			
		||||
        },
 | 
			
		||||
        ltex = {
 | 
			
		||||
          ltex = {
 | 
			
		||||
            -- language = "de-DE",
 | 
			
		||||
            enabled = { "latex" },
 | 
			
		||||
            dictionary = Dictionaries,
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      local default = { __index = function() return {} end }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user