diff --git a/config/default.nix b/config/default.nix index 4015a90..bfcb93f 100644 --- a/config/default.nix +++ b/config/default.nix @@ -11,13 +11,16 @@ ./plugins/bufferline.nix ./plugins/comment.nix + ./plugins/fugitive.nix ./plugins/indent-blankline.nix ./plugins/leap.nix - ./plugins/lsp/lsp.nix - # ./plugins/lsp/conform.nix ./plugins/lualine.nix ./plugins/nvim-tree.nix + ./plugins/sleuth.nix ./plugins/telescope.nix - # ./plugins/none-ls/none-ls.nix + + ./plugins/lsp/lsp.nix + + ./plugins/extra/vim-rhubarb.nix ]; } diff --git a/config/plugins/extra/vim-rhubarb.nix b/config/plugins/extra/vim-rhubarb.nix new file mode 100644 index 0000000..4341235 --- /dev/null +++ b/config/plugins/extra/vim-rhubarb.nix @@ -0,0 +1,6 @@ +{ pkgs +, ...}:{ + extraPlugins = with pkgs.vimPlugins; [ + vim-rhubarb + ]; +} diff --git a/config/plugins/extra/vim-sleuth.nix b/config/plugins/extra/vim-sleuth.nix new file mode 100644 index 0000000..f27a30f --- /dev/null +++ b/config/plugins/extra/vim-sleuth.nix @@ -0,0 +1,6 @@ +{ pkgs +, ...}:{ + extraPlugins = with pkgs.vimPlugins; [ + vim-sleuth + ]; +} diff --git a/config/plugins/fugitive.nix b/config/plugins/fugitive.nix new file mode 100644 index 0000000..0e53f19 --- /dev/null +++ b/config/plugins/fugitive.nix @@ -0,0 +1,7 @@ +{ + plugins = { + fugitive = { + enable = true; + }; + }; +} diff --git a/config/plugins/indent-blankline.nix b/config/plugins/indent-blankline.nix index ad26f26..823d3f6 100644 --- a/config/plugins/indent-blankline.nix +++ b/config/plugins/indent-blankline.nix @@ -2,6 +2,10 @@ plugins = { indent-blankline = { enable = true; + settings.indent = { + char = "▎"; + tab_char = "┊"; + }; }; }; } diff --git a/config/plugins/leap.nix b/config/plugins/leap.nix index d641d0a..0f669e4 100644 --- a/config/plugins/leap.nix +++ b/config/plugins/leap.nix @@ -1,12 +1,15 @@ { plugins.leap = { enable = true; + addDefaultMappings = false; }; keymaps = [ { mode = [ "n" "x" "o" ]; key = "ss"; - action = "function() require('leap').leap { } end"; + action = "function() require('leap').leap {} end"; + lua = true; + # action = "require('leap').leap"; } { mode = [ "n" "x" "o" ]; diff --git a/config/plugins/lsp/lsp.nix b/config/plugins/lsp/lsp.nix index d632f43..bebdcbe 100644 --- a/config/plugins/lsp/lsp.nix +++ b/config/plugins/lsp/lsp.nix @@ -7,6 +7,58 @@ 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; @@ -58,7 +110,6 @@ eslint = {enable = true;}; pyright = {enable = true;}; ruff-lsp = {enable = true;}; - texlab = {enable = true;}; rust-analyzer = { enable = true; @@ -164,5 +215,97 @@ require('lspconfig.ui.windows').default_options = { border = _border } + + + + + + + + + +------------------------------ +-- 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 + ---------------------------------- + + -------------------------------- + -- 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', 'l', ':TexlabBuild' ) +-- forwardSearch +vim.keymap.set('n', 'k', ':TexlabForward' ) +-- if lsp failed to start, start manually +vim.keymap.set('n', 'j', ':LspStart' ) + +------------------------------ +-- END texmagic, texlab +------------------------------ + ''; } diff --git a/config/plugins/sleuth.nix b/config/plugins/sleuth.nix new file mode 100644 index 0000000..6aafa0f --- /dev/null +++ b/config/plugins/sleuth.nix @@ -0,0 +1,7 @@ +{ + plugins = { + sleuth = { + enable = true; + }; + }; +} diff --git a/config/sets.nix b/config/sets.nix index 825c356..f01daa1 100644 --- a/config/sets.nix +++ b/config/sets.nix @@ -1,7 +1,11 @@ # The line beneath this is called `modeline`. See `:help modeline` -# vim: ts=4:sts=0:sw=0:tw=78:noet +# vim: ts=4:sts=0:sw=0:noet { config = { + globals = { + mapleader = " "; + maplocalleader = " "; + }; options = { relativenumber = true; splitbelow = true; @@ -56,7 +60,7 @@ # Decrease update time updatetime = 250; timeout = true; - timeoutlen = 300; + timeoutlen = 1000; # time of valid keypress like for leader key in millisecond # Set completeopt to have a better completion experience completeopt = "menuone,noselect";