More neovim settings updates
diff --git a/modules/neovim/coc/default.nix b/modules/neovim/coc/default.nix
index d119954..cfdfda9 100644
--- a/modules/neovim/coc/default.nix
+++ b/modules/neovim/coc/default.nix
@@ -12,11 +12,23 @@
coc = {
enable = true;
settings = {
+ diagnostic.floatConfig = {
+ border = true;
+ rounded = true;
+ };
+ signature.floatConfig = {
+ border = true;
+ rounded = true;
+ };
+ hover.floatConfig = {
+ border = true;
+ rounded = true;
+ };
suggest.floatConfig = {
border = true;
rounded = true;
};
- "suggest.noselect" = false;
+ "suggest.noselect" = true;
"cSpell.checkOnlyEnabledfileTypes" = false;
"diagnostic.virtualText" = true;
"diagnostic.virtualTextCurrentLineOnly" = false;
@@ -35,6 +47,7 @@
code_blocks = false;
tables = false;
};
+ MD024.siblings_only = true;
};
languageserver = {
nix = {
@@ -42,6 +55,10 @@
filetypes = ["nix"];
};
};
+ "snippets.extends" = {
+ markdown = ["tex"];
+ };
+ "snippets.autoTrigger" = false;
};
};
plugins = with pkgs.vimPlugins; [
@@ -55,6 +72,7 @@
coc-go
coc-markdownlint
coc-texlab
+ coc-pyright
# Spellchecker
nixpkgs-minion.legacyPackages.${system}.vimPlugins.coc-spell-checker
@@ -68,7 +86,7 @@
vim-snippets
coc-snippets
- # General utils
+ # General utilities
coc-pairs
];
extraConfig = lib.pipe [./keybinds.vim ./theme.vim] [
@@ -82,22 +100,31 @@
rust-analyzer
texlab
omnisharp-roslyn
+ nodePackages.pyright
+ (python3.withPackages (pyPkgs:
+ with pyPkgs; [
+ pycodestyle
+ black
+ rope
+ ]))
];
};
- home.file = lib.pipe ./snippets [
- builtins.readDir
- builtins.attrNames
- (map
- (f: {
- name = ".config/nvim/UltiSnips/${f}";
- value = {
- source = ./snippets + "/${f}";
- target = ".config/nvim/UltiSnips/${f}";
- };
- }))
- builtins.listToAttrs
- lib.traceValSeq
- ] // {
- ".config/coc/placeholder".text = "";
- };
+ home.file =
+ lib.pipe ./snippets [
+ builtins.readDir
+ builtins.attrNames
+ (map
+ (f: {
+ name = ".config/nvim/UltiSnips/${f}";
+ value = {
+ source = ./snippets + "/${f}";
+ target = ".config/nvim/UltiSnips/${f}";
+ };
+ }))
+ builtins.listToAttrs
+ lib.traceValSeq
+ ]
+ // {
+ ".config/coc/placeholder".text = "";
+ };
}
diff --git a/modules/neovim/coc/keybinds.vim b/modules/neovim/coc/keybinds.vim
index 0116a91..ae7e174 100644
--- a/modules/neovim/coc/keybinds.vim
+++ b/modules/neovim/coc/keybinds.vim
@@ -1,5 +1,5 @@
-nmap <silent> ]c :call CocAction('diagnosticNext')<cr>
-nmap <silent> [c :call CocAction('diagnosticPrevious')<cr>
+nmap <silent> ]c :silent! call CocAction('diagnosticNext')<cr>
+nmap <silent> [c :silent! call CocAction('diagnosticPrevious')<cr>
nmap <silent> <Leader>fs <Plug>(coc-codeaction-selected)
nmap <silent> <Leader>fb <Plug>(coc-codeaction)
nmap <silent> <Leader>ff <Plug>(coc-codeaction-cursor)
@@ -29,7 +29,6 @@
snoremap <nowait><silent> <Tab> <Esc>:call UltiSnips#JumpForwards()<cr>
snoremap <nowait><silent> <S-Tab> <Esc>:call UltiSnips#JumpForwards()<cr>
-inoremap <silent><silent> <C-s> <Esc>l:Snippets<cr>
function! s:show_documentation()
@@ -41,3 +40,8 @@
endfunction
nnoremap <silent> K :call <SID>show_documentation()<CR>
+
+command Snippets CocFzfList snippets
+
+autocmd FileType tex let b:coc_pairs = [["$", "$"]]
+autocmd FileType markdown let b:coc_pairs = [["$", "$"]]
diff --git a/modules/neovim/coc/snippets/markdown.snippets b/modules/neovim/coc/snippets/markdown.snippets
index c5c7f21..041cddc 100644
--- a/modules/neovim/coc/snippets/markdown.snippets
+++ b/modules/neovim/coc/snippets/markdown.snippets
@@ -24,27 +24,23 @@
# Online reference: https://github.com/SirVer/ultisnips/blob/master/doc/UltiSnips.txt
snippet latex "A latex block" w
-$${0}$
+$${VISUAL}${1}$${0}
endsnippet
snippet dydx "The derivative" i
-\frac{dy}{dx}
+\frac{d${1:y}}{d${2:x}}${0}
endsnippet
-snippet dydt "The derivative of `y` WRT `t`" i
-\frac{dy}{dx}
+snippet derivative "The derivative" i
+\frac{d${1:y}}{d${2:x}}${0}
endsnippet
-snippet dydx "The derivative of `x` WRT `t`" i
-\frac{dy}{dx}
+snippet inti "Integrate indefinitely" i
+\int ${1} \text{ d}${2:x}${0}
endsnippet
-snippet iidx "Integrate indefinitely with respect to x" i
-\int ${0} \text{ d}x
-endsnippet
-
-snippet iddx "Integrate definitely with respect to x" i
-\int{${0}}{${1}}${2} \text{ d}x
+snippet intd "Integrate definitely" i
+\int{${1}}{${2}}${3} \text{ d}${4:x}${0}
endsnippet
snippet ihat "The I vector" i
@@ -55,12 +51,12 @@
\hat{\bm{j}}
endsnippet
-snippet vec "A vector" i
-\bm{${0}}
+snippet vecbold "A vector" i
+\bm{${1}}${0}
endsnippet
-snippet col "A column vector" i
-\begin{bmatrix}${0}\end{bmatrix}
+snippet veccol2 "A 2-tall column vector" i
+\begin{pmatrix} ${1} \\\\ ${2} \end{pmatrix}${0}
endsnippet
snippet nl "A latex newline (e.g. for column vectors)" i
@@ -68,7 +64,7 @@
endsnippet
snippet d2ydx2 "The second derivative" i
-\frac{d^2y}{dx^2}
+\frac{d^2${1:y}}{d${2:x}^2}${0}
endsnippet
snippet nospell "Disable spellcheck on the visually-selected region"
@@ -77,6 +73,10 @@
<!-- spell-checker:enable -->
endsnippet
-snippet normaldistribution "A normal distribution" w
-X\sim N(${0:mean}, ${1:variance})
+snippet normaldistribution "A normal distribution" i
+X\sim N(${1:mean}, ${2:variance})${0}
+endsnippet
+
+snippet 2x2matrix "A 2 by 2 matrix" i
+\begin{bmatrix} ${1} & ${2} \\\\ ${3} & ${4} \end{bmatrix}${0}
endsnippet
diff --git a/modules/neovim/coc/theme.vim b/modules/neovim/coc/theme.vim
index dae527c..a5f52f5 100644
--- a/modules/neovim/coc/theme.vim
+++ b/modules/neovim/coc/theme.vim
@@ -11,3 +11,8 @@
call g:Highlight("CocPumMenu", g:transparent, g:black)
call g:Highlight("CocFloating", g:transparent, g:black)
call g:Highlight("CocSearch", g:red, g:transparent)
+
+call g:Highlight("DiagnosticVirtualTextInfo", g:darkblue, g:transparent)
+call g:Highlight("DiagnosticVirtualTextHint", g:darkblue, g:transparent)
+call g:Highlight("DiagnosticVirtualTextWarn", g:darkyellow, g:transparent)
+call g:Highlight("DiagnosticVirtualTextError", g:darkred, g:transparent)
diff --git a/modules/neovim/coc/trouble.lua b/modules/neovim/coc/trouble.lua
deleted file mode 100644
index ede4963..0000000
--- a/modules/neovim/coc/trouble.lua
+++ /dev/null
@@ -1,3 +0,0 @@
-require("trouble").setup {
- use_diagnostic_signs = true,
-}
diff --git a/modules/neovim/hardtime/hardtime.vim b/modules/neovim/hardtime/hardtime.vim
index 1f0df2c..29fcc48 100644
--- a/modules/neovim/hardtime/hardtime.vim
+++ b/modules/neovim/hardtime/hardtime.vim
@@ -1,5 +1,5 @@
let g:hardtime_default_on = 1
-let g:list_of_disabled_keys = ["<UP>", "<DOWN>", "<LEFT>", "<RIGHT>"]
+let g:list_of_disabled_keys = ["<UP>", "<DOWN>", "<LEFT>", "<RIGHT>", "<C-UP>", "<C-DOWN>", "<C-LEFT>", "<C-RIGHT>"]
let g:hardtime_showmsg = 1
let g:hardtime_allow_different_key = 1
diff --git a/modules/neovim/indentation/indentation.vim b/modules/neovim/indentation/indentation.vim
index 54812cc..7535f00 100644
--- a/modules/neovim/indentation/indentation.vim
+++ b/modules/neovim/indentation/indentation.vim
@@ -1,6 +1,5 @@
-set tabstop=4
+set tabstop=2
set shiftwidth=0
-set ve+=onemore
exec "highlight IndentBlanklineContextChar ctermfg=" . g:white.cterm . " guifg=" . g:white.gui . " ctermbg=NONE guibg=NONE"
exec "highlight IndentBlanklineContextStart ctermfg=NONE guifg=NONE guisp=white ctermbg=NONE guibg=NONE gui=underline term=underline"
diff --git a/modules/neovim/remote/default.nix b/modules/neovim/remote/default.nix
new file mode 100644
index 0000000..8986bad
--- /dev/null
+++ b/modules/neovim/remote/default.nix
@@ -0,0 +1,17 @@
+{pkgs, ...}: {
+ programs = {
+ neovim = {
+ extraConfig = builtins.readFile ./remote.vim;
+ extraPackages = [
+ pkgs.neovim-remote
+ ];
+ };
+ zsh.initExtra = ''
+ if [ ! -z "$NVIM" ]; then
+ alias nvim="${pkgs.neovim-remote}/bin/nvr"
+ alias vim="${pkgs.neovim-remote}/bin/nvr"
+ alias vi="${pkgs.neovim-remote}/bin/nvr"
+ fi
+ '';
+ };
+}
diff --git a/modules/neovim/remote/remote.vim b/modules/neovim/remote/remote.vim
new file mode 100644
index 0000000..ac2e5a4
--- /dev/null
+++ b/modules/neovim/remote/remote.vim
@@ -0,0 +1,6 @@
+autocmd FileType gitcommit,gitrebase,gitconfig set bufhidden=delete
+
+if has('nvim')
+ let $GIT_EDITOR = 'nvr -cc split --remote-wait'
+ let $EDITOR = 'nvr'
+endif
diff --git a/modules/neovim/venn/default.nix b/modules/neovim/venn/default.nix
new file mode 100644
index 0000000..dae9bc6
--- /dev/null
+++ b/modules/neovim/venn/default.nix
@@ -0,0 +1,10 @@
+{pkgs, ...}: {
+ programs.neovim = {
+ plugins = [
+ pkgs.vimPlugins.venn-nvim
+ ];
+ extraConfig = ''
+ source ${./venn.lua}
+ '';
+ };
+}
diff --git a/modules/neovim/venn/venn.lua b/modules/neovim/venn/venn.lua
new file mode 100644
index 0000000..2a71e39
--- /dev/null
+++ b/modules/neovim/venn/venn.lua
@@ -0,0 +1,27 @@
+-- venn.nvim: enable or disable keymappings
+function _G.Toggle_venn()
+ local venn_enabled = vim.inspect(vim.b.venn_enabled)
+ if venn_enabled == "nil" then
+ vim.b.venn_enabled = true
+ vim.cmd[[setlocal ve=all]]
+ -- draw a line on HJKL keystokes
+ vim.cmd("call HardTimeOff()")
+ vim.api.nvim_buf_set_keymap(0, "n", "J", "<C-v>j:VBox<CR>", {noremap = true})
+ vim.api.nvim_buf_set_keymap(0, "n", "K", "<C-v>k:VBox<CR>", {noremap = true})
+ vim.api.nvim_buf_set_keymap(0, "n", "L", "<C-v>l:VBox<CR>", {noremap = true})
+ vim.api.nvim_buf_set_keymap(0, "n", "H", "<C-v>h:VBox<CR>", {noremap = true})
+ -- draw a box by pressing "f" with visual selection
+ vim.api.nvim_buf_set_keymap(0, "v", "f", ":VBox<CR>", {noremap = true})
+ print("Enabled draw-mode")
+ else
+ vim.cmd("call HardTimeOn()")
+ vim.cmd[[setlocal ve=]]
+ vim.cmd[[mapclear <buffer>]]
+ vim.b.venn_enabled = nil
+ print("Disabled draw-mode")
+ end
+end
+-- toggle keymappings for venn using <leader>v
+vim.api.nvim_set_keymap('n', '<leader>d', ":lua Toggle_venn()<CR>", { noremap = true})
+vim.api.nvim_set_keymap('n', '<leader>v', ":lua Toggle_venn()<CR>", { noremap = true})
+
diff --git a/modules/neovim/vimpager/default.nix b/modules/neovim/vimpager/default.nix
index 3d73eb2..311c878 100644
--- a/modules/neovim/vimpager/default.nix
+++ b/modules/neovim/vimpager/default.nix
@@ -2,8 +2,8 @@
home = {
packages = [pkgs.nvimpager];
shellAliases = {
- less = "${pkgs.nvimpager}/bin/nvimpager";
- zless = "${pkgs.nvimpager}/bin/nvimpager";
+ less = "${pkgs.nvimpager}/bin/nvimpager -p";
+ zless = "${pkgs.nvimpager}/bin/nvimpager -p";
vimpager = "${pkgs.nvimpager}/bin/nvimpager";
};
sessionVariables = {
diff --git a/modules/neovim/wiki/wiki.vim b/modules/neovim/wiki/wiki.vim
index 13f6a33..e891588 100644
--- a/modules/neovim/wiki/wiki.vim
+++ b/modules/neovim/wiki/wiki.vim
@@ -7,12 +7,23 @@
let g:wiki_map_create_page = 'WikiCreateTransform'
function WikiCreateTransform(name) abort
let l:name = wiki#get_root() . '/' . a:name
+ let g:lastWikiOriginalName = substitute(a:name, "\.private$", "", "")
" If the file is new, then append the current date
return filereadable(l:name)
\ ? a:name
\ : a:name =~ ".*\.private$"
- \ ? substitute(substitute(a:name, " ", "_", "g"), "\.private$", "", "") . "_" . strftime("%Y%m%d") . ".private"
- \ : substitute(a:name, " ", "_", "g") . '_' . strftime('%Y%m%d')
+ \ ? substitute(g:lastWikiOriginalName, " ", "_", "g") . "_" . strftime("%Y%m%d") . ".private"
+ \ : substitute(g:lastWikiOriginalName, " ", "_", "g") . '_' . strftime('%Y%m%d')
endfunction
+
+function! TemplateFallback(context)
+ call append(0, ['# ' . g:lastWikiOriginalName, ''])
+endfunction
+
+let g:wiki_templates = [
+ \ { 'match_func': {x -> v:true},
+ \ 'source_func': function('TemplateFallback')},
+ \]
+
nnoremap <silent> <Leader>wf :WikiFzfPages<CR>