format with nixfmt

This commit is contained in:
megit 2024-08-07 09:08:11 +08:00
parent 89382ce25e
commit 9c77d8a217
22 changed files with 847 additions and 826 deletions

View file

@ -1,220 +1,237 @@
{
plugins = {
lsp-format = {
enable = false; # Enable it if you want lsp-format integration for none-ls
};
lsp = {
enable = true;
capabilities = "offsetEncoding = 'utf-16'";
servers = {
texlab = {
enable = true;
# cmd = ["texlab"];
# filetypes = ["tex" "plaintex" "bib"];
# extraOptions = {
# settings = {
# texlab = {
# auxDirectory = "tex_aux_output";
# rootDirectory = nil;
# build = {
# # -- forwardSearchAfter = true,
# executable = "latexmk";
# args = [
# "-xelatex"
# "-verbose"
# # -- "-outdir=%f_output",
# # -- "-auxdir=%f_aux",
# "-outdir=tex_aux_output"
# "-file-line-error"
# "-synctex=1"
# "-interaction=nonstopmode"
# "-pv"
# "%f"
# ];
# isContinuous = false;
# # -- "onSave = true" failed to work properly with large files like moderncv
# # -- it would not build properly until you delete all the intermediate files
# # -- onSave = true
# };
# # --------------------------------
# # -- END texlab main config
# # -- if used with texmagic, disable this
# # --------------------------------
# # --https://github.com/latex-lsp/texlab/wiki/Previewing
# # -- https://github.com/f3fora/nvim-texlabconfig
# forwardSearch = {
# executable = "zathura";
# args = [
# # -- This is for moving lines in nvim
# "--synctex-editor-command"
# # -- I don't know why but after switching to lazy.vim, need %%% to escape the % character, so "pgrep zathura -a" can see the % sign
# "[[nvim-texlabconfig -file '%%%{input}' -line %%%{line} -server ]] .. vim.v.servername"
# "--synctex-forward"
# "%l:1:%f"
# "%p"
# ];
# };
# diagnosticsDelay = 300;
# };
# };
# };
};
clangd = {enable = true;};
lua-ls = {
enable = true;
extraOptions = {
settings = {
Lua = {
completion = {
callSnippet = "Replace";
};
telemetry = {
enabled = false;
};
hint = {enable = true;};
};
};
};
};
nil_ls = {enable = true;};
tsserver = {
enable = false;
filetypes = ["javascript" "javascriptreact" "typescript" "typescriptreact"];
extraOptions = {
settings = {
javascript = {
inlayHints = {
includeInlayEnumMemberValueHints = true;
includeInlayFunctionLikeReturnTypeHints = true;
includeInlayFunctionParameterTypeHints = true;
includeInlayParameterNameHints = "all";
includeInlayParameterNameHintsWhenArgumentMatchesName = true;
includeInlayPropertyDeclarationTypeHints = true;
includeInlayVariableTypeHints = true;
};
};
typescript = {
inlayHints = {
includeInlayEnumMemberValueHints = true;
includeInlayFunctionLikeReturnTypeHints = true;
includeInlayFunctionParameterTypeHints = true;
includeInlayParameterNameHints = "all";
includeInlayParameterNameHintsWhenArgumentMatchesName = true;
includeInlayPropertyDeclarationTypeHints = true;
includeInlayVariableTypeHints = true;
};
};
};
};
};
eslint = {enable = true;};
pyright = {enable = true;};
ruff-lsp = {enable = true;};
rust-analyzer = {
enable = true;
installCargo = true;
installRustc = true;
plugins = {
lsp-format = {
enable = false; # Enable it if you want lsp-format integration for none-ls
};
lsp = {
enable = true;
capabilities = "offsetEncoding = 'utf-16'";
servers = {
texlab = {
enable = true;
# cmd = ["texlab"];
# filetypes = ["tex" "plaintex" "bib"];
# extraOptions = {
# settings = {
# texlab = {
# auxDirectory = "tex_aux_output";
# rootDirectory = nil;
# build = {
# # -- forwardSearchAfter = true,
# executable = "latexmk";
# args = [
# "-xelatex"
# "-verbose"
# # -- "-outdir=%f_output",
# # -- "-auxdir=%f_aux",
# "-outdir=tex_aux_output"
# "-file-line-error"
# "-synctex=1"
# "-interaction=nonstopmode"
# "-pv"
# "%f"
# ];
# isContinuous = false;
# # -- "onSave = true" failed to work properly with large files like moderncv
# # -- it would not build properly until you delete all the intermediate files
# # -- onSave = true
# };
# # --------------------------------
# # -- END texlab main config
# # -- if used with texmagic, disable this
# # --------------------------------
# # --https://github.com/latex-lsp/texlab/wiki/Previewing
# # -- https://github.com/f3fora/nvim-texlabconfig
# forwardSearch = {
# executable = "zathura";
# args = [
# # -- This is for moving lines in nvim
# "--synctex-editor-command"
# # -- I don't know why but after switching to lazy.vim, need %%% to escape the % character, so "pgrep zathura -a" can see the % sign
# "[[nvim-texlabconfig -file '%%%{input}' -line %%%{line} -server ]] .. vim.v.servername"
# "--synctex-forward"
# "%l:1:%f"
# "%p"
# ];
# };
# diagnosticsDelay = 300;
# };
# };
# };
};
clangd = {
enable = true;
};
lua-ls = {
enable = true;
extraOptions = {
settings = {
checkOnSave = true;
check = {
command = "clippy";
};
# inlayHints = {
# enable = true;
# showParameterNames = true;
# parameterHintsPrefix = "<- ";
# otherHintsPrefix = "=> ";
# };
procMacro = {
enable = true;
Lua = {
completion = {
callSnippet = "Replace";
};
telemetry = {
enabled = false;
};
hint = {
enable = true;
};
};
};
};
};
# keymaps = {
# silent = true;
# lspBuf = {
# gd = {
# action = "definition";
# desc = "Goto Definition";
# };
# gr = {
# action = "references";
# desc = "Goto References";
# };
# gD = {
# action = "declaration";
# desc = "Goto Declaration";
# };
# gI = {
# action = "implementation";
# desc = "Goto Implementation";
# };
# gT = {
# action = "type_definition";
# desc = "Type Definition";
# };
# K = {
# action = "hover";
# desc = "Hover";
# };
# "<leader>cw" = {
# action = "workspace_symbol";
# desc = "Workspace Symbol";
# };
# "<leader>cr" = {
# action = "rename";
# desc = "Rename";
# };
# "<leader>ca" = {
# action = "code_action";
# desc = "Code Action";
# };
# "<C-k>" = {
# action = "signature_help";
# desc = "Signature Help";
# };
# };
# diagnostic = {
# "<leader>cd" = {
# action = "open_float";
# desc = "Line Diagnostics";
# };
# "[d" = {
# action = "goto_next";
# desc = "Next Diagnostic";
# };
# "]d" = {
# action = "goto_prev";
# desc = "Previous Diagnostic";
# };
# };
# };
nil_ls = {
enable = true;
};
tsserver = {
enable = false;
filetypes = [
"javascript"
"javascriptreact"
"typescript"
"typescriptreact"
];
extraOptions = {
settings = {
javascript = {
inlayHints = {
includeInlayEnumMemberValueHints = true;
includeInlayFunctionLikeReturnTypeHints = true;
includeInlayFunctionParameterTypeHints = true;
includeInlayParameterNameHints = "all";
includeInlayParameterNameHintsWhenArgumentMatchesName = true;
includeInlayPropertyDeclarationTypeHints = true;
includeInlayVariableTypeHints = true;
};
};
typescript = {
inlayHints = {
includeInlayEnumMemberValueHints = true;
includeInlayFunctionLikeReturnTypeHints = true;
includeInlayFunctionParameterTypeHints = true;
includeInlayParameterNameHints = "all";
includeInlayParameterNameHintsWhenArgumentMatchesName = true;
includeInlayPropertyDeclarationTypeHints = true;
includeInlayVariableTypeHints = true;
};
};
};
};
};
eslint = {
enable = true;
};
pyright = {
enable = true;
};
ruff-lsp = {
enable = true;
};
rust-analyzer = {
enable = true;
installCargo = true;
installRustc = true;
settings = {
checkOnSave = true;
check = {
command = "clippy";
};
# inlayHints = {
# enable = true;
# showParameterNames = true;
# parameterHintsPrefix = "<- ";
# otherHintsPrefix = "=> ";
# };
procMacro = {
enable = true;
};
};
};
};
# keymaps = {
# silent = true;
# lspBuf = {
# gd = {
# action = "definition";
# desc = "Goto Definition";
# };
# gr = {
# action = "references";
# desc = "Goto References";
# };
# gD = {
# action = "declaration";
# desc = "Goto Declaration";
# };
# gI = {
# action = "implementation";
# desc = "Goto Implementation";
# };
# gT = {
# action = "type_definition";
# desc = "Type Definition";
# };
# K = {
# action = "hover";
# desc = "Hover";
# };
# "<leader>cw" = {
# action = "workspace_symbol";
# desc = "Workspace Symbol";
# };
# "<leader>cr" = {
# action = "rename";
# desc = "Rename";
# };
# "<leader>ca" = {
# action = "code_action";
# desc = "Code Action";
# };
# "<C-k>" = {
# action = "signature_help";
# desc = "Signature Help";
# };
# };
# diagnostic = {
# "<leader>cd" = {
# action = "open_float";
# desc = "Line Diagnostics";
# };
# "[d" = {
# action = "goto_next";
# desc = "Next Diagnostic";
# };
# "]d" = {
# action = "goto_prev";
# desc = "Previous Diagnostic";
# };
# };
# };
};
extraConfigLua = ''
local _border = "rounded"
};
extraConfigLua = ''
local _border = "rounded"
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(
vim.lsp.handlers.hover, {
border = _border
}
)
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(
vim.lsp.handlers.hover, {
border = _border
}
)
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(
vim.lsp.handlers.signature_help, {
border = _border
}
)
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(
vim.lsp.handlers.signature_help, {
border = _border
}
)
vim.diagnostic.config{
float={border=_border}
};
vim.diagnostic.config{
float={border=_border}
};
require('lspconfig.ui.windows').default_options = {
border = _border
}
require('lspconfig.ui.windows').default_options = {
border = _border
}
@ -224,88 +241,88 @@
------------------------------
-- START texmagic, texlab
------------------------------
-- Below this one line is for texmagic only
-- vim.g['tex_flavor'] = 'latex'
------------------------------
-- START texmagic, texlab
------------------------------
-- Below this one line is for texmagic only
-- vim.g['tex_flavor'] = 'latex'
require('lspconfig').texlab.setup{
cmd = {"texlab"},
filetypes = {"tex", "plaintex", "bib"},
single_file_support = true,
settings = {
-- https://github.com/latex-lsp/texlab/wiki/Configuration
texlab = {
----------------------------------
-- START for texmagic only
----------------------------------
--
-- build = _G.TeXMagicBuildConfig,
--
----------------------------------
-- END for texmagic only
----------------------------------
require('lspconfig').texlab.setup{
cmd = {"texlab"},
filetypes = {"tex", "plaintex", "bib"},
single_file_support = true,
settings = {
-- https://github.com/latex-lsp/texlab/wiki/Configuration
texlab = {
----------------------------------
-- START for texmagic only
----------------------------------
--
-- build = _G.TeXMagicBuildConfig,
--
----------------------------------
-- END for texmagic only
----------------------------------
--------------------------------
-- START texlab main config
-- if used with texmagic, disable this
--------------------------------
auxDirectory = "tex_aux_output",
rootDirectory = nil,
build = {
-- forwardSearchAfter = true,
executable = "latexmk",
args = {
"-xelatex",
"-verbose",
-- "-outdir=%f_output",
-- "-auxdir=%f_aux",
"-outdir=tex_aux_output",
"-file-line-error",
"-synctex=1",
"-interaction=nonstopmode",
"-pv",
"%f",
},
isContinuous = false,
-- "onSave = true" failed to work properly with large files like moderncv
-- it would not build properly until you delete all the intermediate files
-- onSave = true
},
--------------------------------
-- END texlab main config
-- if used with texmagic, disable this
--------------------------------
--https://github.com/latex-lsp/texlab/wiki/Previewing
-- https://github.com/f3fora/nvim-texlabconfig
forwardSearch = {
executable = "zathura",
args = {
-- This is for moving lines in nvim
'--synctex-editor-command',
-- I don't know why but after switching to lazy.vim, need %%% to escape the % character, so "pgrep zathura -a" can see the % sign
[[nvim-texlabconfig -file '%%%{input}' -line %%%{line} -server ]] .. vim.v.servername,
'--synctex-forward',
'%l:1:%f',
'%p',
},
},
diagnosticsDelay = 300,
}
}
}
-- compile laTeX keymap
vim.keymap.set('n', '<leader>l', ':TexlabBuild<CR>' )
-- forwardSearch
vim.keymap.set('n', '<leader>k', ':TexlabForward<CR>' )
-- if lsp failed to start, start manually
vim.keymap.set('n', '<leader>j', ':LspStart<CR>' )
------------------------------
-- END texmagic, texlab
------------------------------
'';
--------------------------------
-- START texlab main config
-- if used with texmagic, disable this
--------------------------------
auxDirectory = "tex_aux_output",
rootDirectory = nil,
build = {
-- forwardSearchAfter = true,
executable = "latexmk",
args = {
"-xelatex",
"-verbose",
-- "-outdir=%f_output",
-- "-auxdir=%f_aux",
"-outdir=tex_aux_output",
"-file-line-error",
"-synctex=1",
"-interaction=nonstopmode",
"-pv",
"%f",
},
isContinuous = false,
-- "onSave = true" failed to work properly with large files like moderncv
-- it would not build properly until you delete all the intermediate files
-- onSave = true
},
--------------------------------
-- END texlab main config
-- if used with texmagic, disable this
--------------------------------
--https://github.com/latex-lsp/texlab/wiki/Previewing
-- https://github.com/f3fora/nvim-texlabconfig
forwardSearch = {
executable = "zathura",
args = {
-- This is for moving lines in nvim
'--synctex-editor-command',
-- I don't know why but after switching to lazy.vim, need %%% to escape the % character, so "pgrep zathura -a" can see the % sign
[[nvim-texlabconfig -file '%%%{input}' -line %%%{line} -server ]] .. vim.v.servername,
'--synctex-forward',
'%l:1:%f',
'%p',
},
},
diagnosticsDelay = 300,
}
}
}
-- compile laTeX keymap
vim.keymap.set('n', '<leader>l', ':TexlabBuild<CR>' )
-- forwardSearch
vim.keymap.set('n', '<leader>k', ':TexlabForward<CR>' )
-- if lsp failed to start, start manually
vim.keymap.set('n', '<leader>j', ':LspStart<CR>' )
------------------------------
-- END texmagic, texlab
------------------------------
'';
}