Clean up vimrc and remove votion python scripts

main
Felix Martin 2022-08-27 10:38:14 -04:00
parent 1c28e6c71d
commit 2d91504378
4 changed files with 34 additions and 87 deletions

View File

@ -1,17 +0,0 @@
import os
import vim
import datetime
FILE_TEMPLATE = """"""
def create_daily_journal():
file_name = datetime.datetime.now().strftime("journal-%Y-%m-%d.md")
file_path = os.path.join("/home/felixm/owc/archive/2022", file_name)
if not os.path.isfile(file_path):
with open(file_path, "w") as f:
f.write(FILE_TEMPLATE)
return file_path
file_path = create_daily_journal()
vim.command(f":edit {file_path}")

View File

@ -1,21 +0,0 @@
import os
import vim
import datetime
FILE_TEMPLATE = """---
title:
tags: []
---
"""
def create_page():
file_name = datetime.datetime.now().strftime("new-note-%Y-%m-%dT%H-%M-%S.md")
file_path = os.path.join("/home/felixm/owc/active", file_name)
with open(file_path, "w") as f:
f.write(FILE_TEMPLATE)
return file_path
file_path = create_page()
vim.command(f":edit {file_path}")

View File

@ -252,29 +252,33 @@ augroup END
" Filetype rust {{{
augroup filetype_rust
autocmd!
autocmd FileType rust noremap <buffer> <c-r> :w<CR> :!cargo run<CR>
autocmd FileType rust inoremap <buffer> <c-r> <esc>:w<CR>:!cargo run<CR>
autocmd FileType rust noremap <buffer> <c-r> :w<CR> :!cargo run --release<CR>
autocmd FileType rust inoremap <buffer> <c-r> <esc>:w<CR>:!cargo --release<CR>
autocmd FileType rust setlocal autoindent
autocmd FileType rust setlocal expandtab
autocmd FileType rust setlocal nowrap
" For use with
autocmd FileType rust nmap <F5> <Plug>(lcn-menu)
autocmd FileType rust nmap <silent> gd <Plug>(lcn-definition)
augroup END
" }}}
" Filetype markdown {{{
augroup filetype_markdown
autocmd!
" autocmd FileType markdown inoremap <buffer><expr> <CR> <SID>MarkdownCR()
" autocmd FileType markdown setlocal tabstop=2 softtabstop=2 shiftwidth=2
" autocmd FileType markdown setlocal conceallevel=2
" autocmd FileType markdown setlocal foldlevel=4
augroup END
" Votion {{{
let g:votion_dir = "~/owc"
nnoremap <leader>vo :RgVotion<CR>
nnoremap <leader>vt :RgVotionTitle<CR>
nnoremap <leader>vid :call votion#votion#GrepFiles()<CR>
let votion_dir = get(g:, 'votion_dir', '')
" Configuration for the standard built-in markdown support
let g:markdown_folding = 1
let g:markdown_yaml_head = 1
let g:markdown_fenced_languages = ['python', 'bash', 'rust']
command! -bang -nargs=* RgVotion
\ call fzf#vim#grep(
\ 'rg --column --line-number --no-heading --color=always --smart-case -- '.shellescape(<q-args>) .. ' ' .. votion_dir, 1,
\ fzf#vim#with_preview(), <bang>0)
" Vimwiki configuration
"let g:vimwiki_list = [{'path': '~/owc/garden/', 'syntax': 'markdown'}]
command! -bang -nargs=* RgVotionTitle
\ call fzf#vim#grep(
\ 'rg -i --column --line-number --no-heading --color=always --smart-case -- ^title: ' .. shellescape(<q-args>) .. ' ' .. votion_dir, 1,
\ fzf#vim#with_preview({'options': ['--with-nth', '5..']}), <bang>0)
" }}}
" Statusline {{{
let g:airline_powerline_fonts = 1
@ -299,35 +303,6 @@ function! s:SplitOrMove(direction)
endif
endfunction
" }}}
" votion {{{
nnoremap <leader>vo :RgVotion<CR>
nnoremap <leader>vt :RgVotionTitle<CR>
nnoremap <leader>va :RgVotionTags<CR>
nnoremap <leader>vd :call delete(expand('%')) \| bp\| bd #<CR>
nnoremap <leader>vid :RgVotionId<CR>
command! VotionJournal :py3file ~/.vim/scripts/votion-journal.py
nnoremap <leader>vj :VotionJournal<CR>
command! VotionNote :py3file ~/.vim/scripts/votion-note.py
nnoremap <leader>vn :VotionNote<CR>
command! -bang -nargs=* RgVotion
\ call fzf#vim#grep(
\ 'rg --column --line-number --no-heading --color=always --smart-case -- '.shellescape(<q-args>).' ~/owc', 1,
\ fzf#vim#with_preview(), <bang>0)
command! -bang -nargs=* RgVotionTitle
\ call fzf#vim#grep(
\ 'rg -i --column --line-number --no-heading --color=always --smart-case -- ^title: '.shellescape(<q-args>).' ~/owc', 1,
\ fzf#vim#with_preview({'options': ['--with-nth', '5..']}), <bang>0)
command! -bang -nargs=* RgVotionTags
\ call fzf#vim#grep(
\ 'rg -i --column --line-number --no-heading --color=always --smart-case -- tag [ '.shellescape(<q-args>).' ~/owc', 1,
\ fzf#vim#with_preview(), <bang>0)
command! -bang RgVotionId call fzf#vim#files('~/owc', <bang>0)
" }}}
" fzf {{{
noremap <leader>ob :Buffers<CR>
noremap <leader>of :Files<CR>
@ -357,5 +332,13 @@ call plug#begin('~/.vim/plugged')
Plug 'godlygeek/tabular'
Plug 'felixio@git.felixm.de:felixm/votion.git', {'for': 'markdown'}
" Plug 'flazz/vim-colorschemes'
Plug 'autozimu/LanguageClient-neovim', {
\ 'branch': 'next',
\ 'do': 'bash install.sh',
\ 'for': 'rust',
\ }
call plug#end()
let g:LanguageClient_serverCommands = {
\ 'rust': ['rustup', 'run', 'stable', 'rls', 'clippy'],
\ }
" }}}

View File

@ -20,13 +20,15 @@ alias vi="vim"
alias felixio="ssh felixio@felixm.de"
alias failx="ssh felixio@felixm.de"
alias feh="feh -F -."
alias vn="vim -c VotionNote"
alias vt="vim -c RgVotionTitle"
alias vj="vim -c VotionJournal"
alias fcd='cd "$(fd -t d | fzf)"'
alias ytmp3='yt-dlp --extract-audio --audio-format mp3 '
alias yt-mp3='yt-dlp --extract-audio --audio-format mp3 '
alias private-session='export SAVEHIST=0 && export HISTSIZE=0'
# votion
alias vt="vim -c RgVotionTitle"
alias vn="vim -c \":call votion#votion#Note()\""
alias vj="vim -c \":call votion#votion#Journal()\""
# Set to this to use case-sensitive completion
# CASE_SENSITIVE="true"