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:
@@ -1,9 +1,8 @@
|
||||
:insert
|
||||
# title
|
||||
# filename
|
||||
|
||||
- Created :
|
||||
- Updated :
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
:insert
|
||||
* *Title*:
|
||||
* *Author*:
|
||||
* *Started*:
|
||||
* *Finished*:
|
||||
* *Title*:
|
||||
* *Author*:
|
||||
* *Started*:
|
||||
* *Finished*:
|
||||
* [Goodreads Link]()
|
||||
|
||||
# Highlights / Notes
|
||||
|
||||
33
.vimrc
33
.vimrc
@@ -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,
|
||||
" 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'
|
||||
|
||||
" ALE displays warnings and errors in files being edited before being saved back to the filesystem
|
||||
" https://github.com/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
|
||||
" Suggestions from [Writing Markdown in Vim](https://codeinthehole.com/tips/writing-markdown-in-vim/)
|
||||
" [Vim Markdown](https://github.com/preservim/vim-markdown)
|
||||
@@ -269,13 +274,13 @@ imap <F4> <C-R>=strftime("%H:%M")<CR>
|
||||
" ==> Keymaps: Autoclosing
|
||||
" Autoclose brackets, parens...etc
|
||||
" from: https://stackoverflow.com/a/34992101
|
||||
inoremap " ""<left>
|
||||
inoremap ' ''<left>
|
||||
inoremap ( ()<left>
|
||||
inoremap [ []<left>
|
||||
inoremap { {}<left>
|
||||
inoremap {<CR> {<CR>}<ESC>O
|
||||
inoremap {;<CR> {<CR>};<ESC>O
|
||||
"inoremap " ""<left>
|
||||
"inoremap ' ''<left>
|
||||
"inoremap ( ()<left>
|
||||
"inoremap [ []<left>
|
||||
"inoremap { {}<left>
|
||||
"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)
|
||||
|
||||
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 "normal Go"
|
||||
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 $
|
||||
|
||||
" 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)
|
||||
@@ -373,12 +378,4 @@ autocmd FileType netrw setl bufhidden=delete
|
||||
"autocmd BufNewFile,BufReadPost *.{yaml,yml} set filetype=yaml
|
||||
"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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user