aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCody Hiar <cody@hiar.ca>2022-07-07 14:48:03 -0600
committerCody Hiar <cody@hiar.ca>2022-07-07 14:48:03 -0600
commit863a5b2ad4c00000d3b4ab0e1679d1b7b065c605 (patch)
tree3d54890b7d5fc634195e2960f362f3e418d74407
parent3dd8c079fff354c57dafee9ae7487cc0a6d5852e (diff)
Fixing paragraph functions, Goyo toggle, toggle ale linting
-rw-r--r--flake.nix2
-rw-r--r--init.lua29
2 files changed, 29 insertions, 2 deletions
diff --git a/flake.nix b/flake.nix
index 5fd2fcb..d80ecbf 100644
--- a/flake.nix
+++ b/flake.nix
@@ -52,7 +52,7 @@
${pkgs.lib.readFile ./init.lua}
EOF
" lua doesn't like the special characters
- nnoremap <leader>pl vipJvip:s/[.!?] */& /g :noh
+ nnoremap <leader>pl vipJV:s/[.!?] */& /g :noh
let g:languagetool_server_command = '${languagetool}/bin/languagetool-http-server'
'';
packages.myPlugins = with vimPlugins; {
diff --git a/init.lua b/init.lua
index 70776a7..68233bc 100644
--- a/init.lua
+++ b/init.lua
@@ -64,6 +64,12 @@ au VimEnter * hi Blanks ctermfg=07 ctermbg=NONE
au VimEnter * hi ColorColumn ctermbg=cyan
au VimEnter * hi IndentBlanklineIndent1 ctermbg=234 ctermfg=NONE
au VimEnter * hi IndentBlanklineIndent2 ctermbg=235 ctermfg=NONE
+
+function! s:goyo_leave()
+hi NonText ctermbg=none
+hi Normal guibg=NONE ctermbg=NONE
+endfunction
+autocmd! User GoyoLeave call <SID>goyo_leave()
]]
-- Along with the highlight definition for ColorColumn above, these options
@@ -124,13 +130,16 @@ vim.api.nvim_set_keymap('n', '<expr> j', [[(v:count > 1 ? "m'" . v:count : '') .
-- Call Ale Fix
vim.api.nvim_set_keymap('n', '<leader>ef', '<cmd>ALEFix<cr>', { noremap = true })
vim.api.nvim_set_keymap('n', '<leader>el', '<cmd>ALELint<cr>', { noremap = true })
-vim.api.nvim_set_keymap('n', '<leader>et', '<cmd>ALEToggle<cr>', { noremap = true })
+vim.api.nvim_set_keymap('n', '<leader>et', '<cmd>lua toggle_ale_linting()<cr>', { noremap = true })
-- Markdown functions
vim.api.nvim_set_keymap('n', '<leader>po', '<cmd>AngryReviewer<cr><c-w>k<cmd>ALELint<cr><cmd>lopen<cr><c-w>k', { noremap = true })
vim.api.nvim_set_keymap('n', '<leader>pse', '<cmd>LanguageToolSetUp<cr>', { noremap = true })
vim.api.nvim_set_keymap('n', '<leader>psc', '<cmd>LanguageToolCheck<cr>', { noremap = true })
vim.api.nvim_set_keymap('n', '<leader>psu', '<cmd>LanguageToolSummary<cr>', { noremap = true })
+vim.api.nvim_set_keymap('n', '<leader>psl', '<cmd>LanguageToolClear<cr>', { noremap = true })
vim.api.nvim_set_keymap('n', '<leader>pc', '<cmd>cclose<cr><cmd>lclose<cr>', { noremap = true })
+vim.api.nvim_set_keymap('n', '<leader>pg', '<cmd>Goyo<cr>', { noremap = true })
+vim.api.nvim_set_keymap('n', '<leader>pp', 'vipJVgq', { noremap = true })
-- Build a custom status line
local status_line = {
@@ -323,6 +332,24 @@ require'hop'.setup { keys = 'etovxqpdygfblzhckisuran' }
-- ale
vim.g.ale_lint_on_enter = 0
vim.g.ale_lint_on_save = 0
+vim.g.ale_lint_on_insert_leave = 0
+vim.g.ale_lint_on_text_changed = 0
+-- Custom function for completely toggling ale linting
+function _G.toggle_ale_linting()
+ if (vim.g.ale_lint_on_insert_leave == 0) then
+ vim.api.nvim_command("ALEEnable")
+ vim.g.ale_lint_on_enter = 1
+ vim.g.ale_lint_on_save = 1
+ vim.g.ale_lint_on_insert_leave = 1
+ vim.g.ale_lint_on_text_changed = 1
+ else
+ vim.api.nvim_command("ALEDisable")
+ vim.g.ale_lint_on_enter = 0
+ vim.g.ale_lint_on_save = 0
+ vim.g.ale_lint_on_insert_leave = 0
+ vim.g.ale_lint_on_text_changed = 0
+ end
+end
vim.g.ale_linters = {
sh = { "shellcheck", },
python = { "flake8" },