Template changes

Since my markdown templates use `Title` and the keyword for the filename
and my ReadingList template also used `Title` as a keyword, my
automations were getting confused.

I changed `Title` in the markdown template to `filename` to solve.

Also, I reverted my `poor man's surround` keybindings for an actual
plugin: `tpope/vim-surround`
This commit is contained in:
2024-02-27 11:51:57 -05:00
parent 8298e74e22
commit ba1cd76362
3 changed files with 20 additions and 24 deletions

View File

@@ -1,9 +1,8 @@
:insert :insert
# title # filename
- Created : - Created :
- Updated : - Updated :
--- ---

33
.vimrc
View File

@@ -99,13 +99,18 @@ Plug 'junegunn/fzf.vim'
" Fugitive is the premier Vim plugin for Git. Or maybe it's the premier Git plugin for Vim? Either way, " Fugitive is the premier Vim plugin for Git. Or maybe it's the premier Git plugin for Vim? Either way,
" it's so awesome, it should be illegal. That's why it's called Fugitive " it's so awesome, it should be illegal. That's why it's called Fugitive
" https://github.com/tpope/vim-fugitivefugitive.vim for git " https://github.com/tpope/vim-fugitive
Plug 'tpope/vim-fugitive' Plug 'tpope/vim-fugitive'
" ALE displays warnings and errors in files being edited before being saved back to the filesystem " ALE displays warnings and errors in files being edited before being saved back to the filesystem
" https://github.com/dense-analysis/ale " https://github.com/dense-analysis/ale
"Plug 'dense-analysis/ale' "Plug 'dense-analysis/ale'
" Vim surround
" I tried to do this from scratch, but it seems this is the best alternative
" https://github.com/tpope/vim-surround
Plug 'tpope/vim-surround'
" Vim Markdown " Vim Markdown
" Suggestions from [Writing Markdown in Vim](https://codeinthehole.com/tips/writing-markdown-in-vim/) " Suggestions from [Writing Markdown in Vim](https://codeinthehole.com/tips/writing-markdown-in-vim/)
" [Vim Markdown](https://github.com/preservim/vim-markdown) " [Vim Markdown](https://github.com/preservim/vim-markdown)
@@ -269,13 +274,13 @@ imap <F4> <C-R>=strftime("%H:%M")<CR>
" ==> Keymaps: Autoclosing " ==> Keymaps: Autoclosing
" Autoclose brackets, parens...etc " Autoclose brackets, parens...etc
" from: https://stackoverflow.com/a/34992101 " from: https://stackoverflow.com/a/34992101
inoremap " ""<left> "inoremap " ""<left>
inoremap ' ''<left> "inoremap ' ''<left>
inoremap ( ()<left> "inoremap ( ()<left>
inoremap [ []<left> "inoremap [ []<left>
inoremap { {}<left> "inoremap { {}<left>
inoremap {<CR> {<CR>}<ESC>O "inoremap {<CR> {<CR>}<ESC>O
inoremap {;<CR> {<CR>};<ESC>O "inoremap {;<CR> {<CR>};<ESC>O
" --------------------------------------------------------------------------------------------------------------------- " ---------------------------------------------------------------------------------------------------------------------
" --------------------------------------------------------------------------------------------------------------------- " ---------------------------------------------------------------------------------------------------------------------
@@ -323,7 +328,7 @@ hi SpellCap cterm=underline ctermbg=black ctermfg=red
" ==> Templates: markdown documents (.md) " ==> Templates: markdown documents (.md)
autocmd BufNewFile *.md so $HOME/.vim/templates/md autocmd BufNewFile *.md so $HOME/.vim/templates/md
autocmd BufNewFile *.md %s/title/\=expand('%:t:r')/g autocmd BufNewFile *.md %s/filename/\=expand('%:t:r')/g
autocmd BufNewFile *.md exe "g/^- Created :.*/s//- Created : " .strftime("%Y-%m-%d") autocmd BufNewFile *.md exe "g/^- Created :.*/s//- Created : " .strftime("%Y-%m-%d")
autocmd BufNewFile *.md exe "normal Go" autocmd BufNewFile *.md exe "normal Go"
autocmd BufWritePre,filewritepre *.md execute "normal ma" autocmd BufWritePre,filewritepre *.md execute "normal ma"
@@ -358,7 +363,7 @@ nnoremap ,begend :-1read $HOME/.vim/templates/begend<CR>jA
nnoremap ,rl :0read $HOME/.vim/templates/readinglist<CR> <bar> :1<CR>dd $ nnoremap ,rl :0read $HOME/.vim/templates/readinglist<CR> <bar> :1<CR>dd $
" section markdown file header " section markdown file header
nnoremap ,md :0read $HOME/.vim/templates/md<CR> <bar> :1<CR>dd <bar> :%s/title/\=expand('%:t:r')/g<CR> nnoremap ,md :0read $HOME/.vim/templates/md<CR> <bar> :1<CR>dd <bar> :%s/filename/\=expand('%:t:r')/g<CR>
" --------------------------------------------------------------------------------------------------------------------- " ---------------------------------------------------------------------------------------------------------------------
" ==> NetrwTreeListing readonly fix (https://vi.stackexchange.com/a/13012) " ==> NetrwTreeListing readonly fix (https://vi.stackexchange.com/a/13012)
@@ -373,12 +378,4 @@ autocmd FileType netrw setl bufhidden=delete
"autocmd BufNewFile,BufReadPost *.{yaml,yml} set filetype=yaml "autocmd BufNewFile,BufReadPost *.{yaml,yml} set filetype=yaml
"autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab "autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
" ---------------------------------------------------------------------------------------------------------------------
" ==> VimWiki
" Use MarkDown
" Default directory
"let g:vimwiki_list = [{'path': '$HOME/repos/thevimwiki/', 'syntax': 'markdown', 'ext': '.md'}]
"let g:vimwiki_global_ext = 0
"let g:vimwiki_autowriteall = 1
"au FileType vimwiki setlocal shiftwidth=6 tabstop=6 noexpandtab