From 5697225533c9d5e2dba3d50888da4682293ffbc0 Mon Sep 17 00:00:00 2001 From: PowerUser64 Date: Fri, 29 Apr 2022 14:38:28 -0700 Subject: [PATCH] nvim: new bind (:w!!) and enable linewrap in markdown files (aucmd) --- .config/nvim/lua/blake/settings.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.config/nvim/lua/blake/settings.lua b/.config/nvim/lua/blake/settings.lua index bcf6898..baa2d37 100644 --- a/.config/nvim/lua/blake/settings.lua +++ b/.config/nvim/lua/blake/settings.lua @@ -67,6 +67,9 @@ vim.cmd 'command! Term tabnew | term' -- Genereate ctags vim.cmd 'command! MakeTags !ctags -R .' +-- Write buffer as root +vim.cmd 'cmap w!! w !sudo tee > /dev/null %' + -- Press Alt h to toggle highlighting on/off, and show current value. vim.cmd 'nnoremap noh' vim.cmd 'inoremap noh' @@ -113,6 +116,9 @@ vim.cmd 'let g:markdown_fenced_languages = [ "bash=sh", "javascript", "cpp=cpp", vim.cmd 'autocmd FileType crontab set commentstring=#%s' -- vim.cmd 'autocmd FileType rmd set commentstring=' +-- Enable linewrap in markdown files +vim.cmd [[ autocmd FileType markdown setlocal wrap ]] + -- Automatically jump to the last position in a file when opening vim.cmd [[ au BufReadPost * if expand('%:p') !~# '\m/\.git/' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif ]]