Update configs
This commit is contained in:
parent
b7bc259913
commit
d44cd9f549
|
@ -21,7 +21,7 @@ if [[ $external_monitor ]]; then
|
|||
bspc monitor eDP-1 -d 6 7 8 9 0
|
||||
xrandr --output HDMI-1 --primary --mode 1920x1080 --rotate normal --output eDP-1 --mode 1920x1080 --rotate normal --right-of HDMI-1
|
||||
else
|
||||
bspc monitor eDP-1 -d 1 2 3 4 5
|
||||
bspc monitor eDP-1 -d 1 2 3 4 5 6 7 8 9 0
|
||||
xrandr --output eDP-1 --mode 1920x1080 --rotate normal
|
||||
fi
|
||||
|
||||
|
@ -32,6 +32,9 @@ fi
|
|||
|
||||
feh --bg-center $(find ~/wallpapers -type f | grep jpg| shuf -n 1)
|
||||
|
||||
# Transparent
|
||||
compton
|
||||
|
||||
# Other stuff
|
||||
|
||||
# xsetroot -cursor_name left_ptr &
|
||||
|
|
|
@ -93,7 +93,7 @@ port "6600"
|
|||
# troubleshooting. Available setting arguments are "notice", "info", "verbose",
|
||||
# "warning" and "error".
|
||||
#
|
||||
log_level "verbose"
|
||||
log_level "warning"
|
||||
#
|
||||
# Setting "restore_paused" to "yes" puts MPD into pause mode instead
|
||||
# of starting playback after startup.
|
||||
|
|
|
@ -218,36 +218,31 @@ bar-volume-empty-foreground = ${colors.foreground-alt}
|
|||
type = internal/battery
|
||||
battery = BAT0
|
||||
adapter = ADP0
|
||||
full-at = 55
|
||||
full-at = 100
|
||||
interval = 60
|
||||
|
||||
format-charging = <animation-charging> <label-charging>
|
||||
format-charging-underline = #a3be8c
|
||||
|
||||
format-discharging = <animation-discharging> <label-discharging>
|
||||
format-discharging = <ramp-capacity> <label-discharging>
|
||||
format-discharging-underline = ${self.format-charging-underline}
|
||||
|
||||
format-full-prefix = " BAT "
|
||||
format-full-prefix = "BAT "
|
||||
format-full-prefix-foreground = ${colors.foreground-alt}
|
||||
format-full-underline = ${self.format-charging-underline}
|
||||
|
||||
ramp-capacity-0 =
|
||||
ramp-capacity-1 =
|
||||
ramp-capacity-2 =
|
||||
ramp-capacity-foreground = ${colors.foreground-alt}
|
||||
ramp-capacity-0 = "BAT "
|
||||
ramp-capacity-1 = "BAT "
|
||||
ramp-capacity-2 = "BAT "
|
||||
ramp-capacity-foreground = #bf616a
|
||||
|
||||
animation-charging-0 =
|
||||
animation-charging-1 =
|
||||
animation-charging-2 =
|
||||
animation-charging-foreground = ${colors.foreground-alt}
|
||||
animation-charging-0 = "BAT "
|
||||
animation-charging-1 = "BAT "
|
||||
animation-charging-2 = "BAT "
|
||||
animation-charging-3 = "BAT "
|
||||
animation-charging-foreground = #a3be8c
|
||||
animation-charging-framerate = 750
|
||||
|
||||
animation-discharging-0 =
|
||||
animation-discharging-1 =
|
||||
animation-discharging-2 =
|
||||
animation-discharging-foreground = ${colors.foreground-alt}
|
||||
animation-discharging-framerate = 750
|
||||
|
||||
[module/temperature]
|
||||
type = internal/temperature
|
||||
thermal-zone = 0
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
/home/xarvos/dotfiles/.config/polybar/
|
|
@ -3,12 +3,20 @@
|
|||
#
|
||||
|
||||
# terminal emulator
|
||||
super + t
|
||||
super + alt + t
|
||||
terminator
|
||||
|
||||
# Alternative terminal
|
||||
super + t
|
||||
alacritty
|
||||
|
||||
# program launcher
|
||||
super + @space
|
||||
dmenu_run
|
||||
rofi -show run
|
||||
|
||||
# Show current windows
|
||||
alt + Tab
|
||||
rofi -show window
|
||||
|
||||
# Start Firefox
|
||||
super + f
|
||||
|
@ -19,12 +27,26 @@ super + Escape
|
|||
pkill -USR1 -x sxhkd
|
||||
|
||||
# switch keyboard layout
|
||||
ctrl + {1,2}
|
||||
setxkbmap -layout us {_,-variant intl}
|
||||
ctrl + {1,2,3}
|
||||
setxkbmap -layout {us, us -variant intl, vn}
|
||||
|
||||
# Screenshot
|
||||
Print
|
||||
scrot
|
||||
scrot -s -e 'mv $f ~/Desktop/Screenshots'
|
||||
|
||||
# Change volume
|
||||
XF86Audio{Raise,Lower}Volume
|
||||
amixer set Master 5%{+,-}
|
||||
|
||||
XF86AudioMute
|
||||
amixer set Master toggle
|
||||
|
||||
# Music playing
|
||||
XF86Audio{Prev,Next}
|
||||
mpc -q {prev,next}
|
||||
|
||||
XF86AudioPlay
|
||||
mpc toggle
|
||||
|
||||
#
|
||||
# bspwm hotkeys
|
||||
|
@ -62,6 +84,10 @@ super + {t,shift + t,s,f}
|
|||
super + ctrl + {m,x,y,z}
|
||||
bspc node -g {marked,locked,sticky,private}
|
||||
|
||||
# increase/decrease windows gap
|
||||
super + button{4,5}
|
||||
bspc config window_gap $(( $(bspc config window_gap) {-,+} 2 ))
|
||||
|
||||
#
|
||||
# focus/swap
|
||||
#
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
export PATH="$PATH:/opt/mssql-tools/bin"
|
||||
source "$HOME/.cargo/env"
|
||||
xhost +local:
|
||||
setleds -D +num
|
|
@ -49,11 +49,12 @@ parse_git_branch() {
|
|||
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
|
||||
}
|
||||
|
||||
if [ "$color_prompt" = yes ]; then
|
||||
PS1='\[\033[1;32m\]\u@\h:\[\033[1;31m\]\w\[\033[1;33m\]$(parse_git_branch) \[\033[34m\]\n$ \[\033[00m\]'
|
||||
else
|
||||
PS1='\u@\h\w\n\$ '
|
||||
fi
|
||||
# if [ "$color_prompt" = yes ]; then
|
||||
# PS1='\[\033[1;32m\]\u@\h:\[\033[1;31m\]\w\[\033[1;33m\]$(parse_git_branch) \[\033[34m\]\n$ \[\033[00m\]'
|
||||
# else
|
||||
# PS1='\u@\h\w\n\$ '
|
||||
# fi
|
||||
PS1='\[\033[1;32m\]\u@\h:\[\033[1;31m\]\w\[\033[1;33m\]$(parse_git_branch) \[\033[1;34m\]\n$ \[\033[00m\]'
|
||||
unset color_promt force_color_prompt
|
||||
|
||||
alias py='python3'
|
|
@ -0,0 +1,38 @@
|
|||
# Sample .profile for SUSE Linux
|
||||
# rewritten by Christian Steinruecken <cstein@suse.de>
|
||||
#
|
||||
# This file is read each time a login shell is started.
|
||||
# All other interactive shells will only read .bashrc; this is particularly
|
||||
# important for language settings, see below.
|
||||
|
||||
test -z "$PROFILEREAD" && . /etc/profile || true
|
||||
export PATH=$PATH:/usr/local/go/bin
|
||||
|
||||
|
||||
# Most applications support several languages for their output.
|
||||
# To make use of this feature, simply uncomment one of the lines below or
|
||||
# add your own one (see /usr/share/locale/locale.alias for more codes)
|
||||
# This overwrites the system default set in /etc/sysconfig/language
|
||||
# in the variable RC_LANG.
|
||||
#
|
||||
#export LANG=de_DE.UTF-8 # uncomment this line for German output
|
||||
#export LANG=fr_FR.UTF-8 # uncomment this line for French output
|
||||
#export LANG=es_ES.UTF-8 # uncomment this line for Spanish output
|
||||
|
||||
# Some applications read the EDITOR variable to determine your favourite text
|
||||
# editor. So uncomment the line below and enter the editor of your choice :-)
|
||||
#export EDITOR=/usr/bin/vim
|
||||
#export EDITOR=/usr/bin/mcedit
|
||||
|
||||
# For some news readers it makes sense to specify the NEWSSERVER variable here
|
||||
#export NEWSSERVER=your.news.server
|
||||
|
||||
# Some people don't like fortune. If you uncomment the following lines,
|
||||
# you will have a fortune each time you log in ;-)
|
||||
|
||||
#if [ -x /usr/bin/fortune ] ; then
|
||||
# echo
|
||||
# /usr/bin/fortune
|
||||
# echo
|
||||
#fi
|
||||
source "$HOME/.cargo/env"
|
|
@ -1,122 +0,0 @@
|
|||
# ~/.bashrc: executed by bash(1) for non-login shells.
|
||||
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
|
||||
# for examples
|
||||
|
||||
# If not running interactively, don't do anything
|
||||
case $- in
|
||||
*i*) ;;
|
||||
*) return;;
|
||||
esac
|
||||
|
||||
# don't put duplicate lines or lines starting with space in the history.
|
||||
# See bash(1) for more options
|
||||
HISTCONTROL=ignoreboth
|
||||
|
||||
# append to the history file, don't overwrite it
|
||||
shopt -s histappend
|
||||
|
||||
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
|
||||
HISTSIZE=1000
|
||||
HISTFILESIZE=2000
|
||||
|
||||
# check the window size after each command and, if necessary,
|
||||
# update the values of LINES and COLUMNS.
|
||||
shopt -s checkwinsize
|
||||
|
||||
# If set, the pattern "**" used in a pathname expansion context will
|
||||
# match all files and zero or more directories and subdirectories.
|
||||
#shopt -s globstar
|
||||
|
||||
# make less more friendly for non-text input files, see lesspipe(1)
|
||||
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
||||
|
||||
# set variable identifying the chroot you work in (used in the prompt below)
|
||||
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
|
||||
debian_chroot=$(cat /etc/debian_chroot)
|
||||
fi
|
||||
|
||||
# set a fancy prompt (non-color, unless we know we "want" color)
|
||||
case "$TERM" in
|
||||
xterm-color|*-256color) color_prompt=yes;;
|
||||
esac
|
||||
|
||||
# uncomment for a colored prompt, if the terminal has the capability; turned
|
||||
# off by default to not distract the user: the focus in a terminal window
|
||||
# should be on the output of commands, not on the prompt
|
||||
#force_color_prompt=yes
|
||||
|
||||
if [ -n "$force_color_prompt" ]; then
|
||||
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
|
||||
# We have color support; assume it's compliant with Ecma-48
|
||||
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
|
||||
# a case would tend to support setf rather than setaf.)
|
||||
color_prompt=yes
|
||||
else
|
||||
color_prompt=
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$color_prompt" = yes ]; then
|
||||
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
|
||||
else
|
||||
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
|
||||
fi
|
||||
unset color_prompt force_color_prompt
|
||||
|
||||
# If this is an xterm set the title to user@host:dir
|
||||
case "$TERM" in
|
||||
xterm*|rxvt*)
|
||||
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# enable color support of ls and also add handy aliases
|
||||
if [ -x /usr/bin/dircolors ]; then
|
||||
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
||||
alias ls='ls --color=auto'
|
||||
#alias dir='dir --color=auto'
|
||||
#alias vdir='vdir --color=auto'
|
||||
|
||||
#alias grep='grep --color=auto'
|
||||
#alias fgrep='fgrep --color=auto'
|
||||
#alias egrep='egrep --color=auto'
|
||||
fi
|
||||
|
||||
# colored GCC warnings and errors
|
||||
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
|
||||
|
||||
# some more ls aliases
|
||||
#alias ll='ls -l'
|
||||
#alias la='ls -A'
|
||||
#alias l='ls -CF'
|
||||
|
||||
# Alias definitions.
|
||||
# You may want to put all your additions into a separate file like
|
||||
# ~/.bash_aliases, instead of adding them here directly.
|
||||
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
|
||||
|
||||
if [ -f ~/.bash_aliases ]; then
|
||||
. ~/.bash_aliases
|
||||
fi
|
||||
|
||||
# enable programmable completion features (you don't need to enable
|
||||
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
|
||||
# sources /etc/bash.bashrc).
|
||||
if ! shopt -oq posix; then
|
||||
if [ -f /usr/share/bash-completion/bash_completion ]; then
|
||||
. /usr/share/bash-completion/bash_completion
|
||||
elif [ -f /etc/bash_completion ]; then
|
||||
. /etc/bash_completion
|
||||
fi
|
||||
fi
|
||||
|
||||
alias gist='gist-paste'
|
||||
alias python2='python'
|
||||
alias py='python3'
|
||||
alias python='python3'
|
||||
alias pip='pip3'
|
||||
alias zoom='gsettings set org.gnome.desktop.interface text-scaling-factor'
|
||||
|
||||
# to compile run `source ~/.bashrc`
|
|
@ -0,0 +1,31 @@
|
|||
[core]
|
||||
pager = delta
|
||||
|
||||
[delta]
|
||||
line-numbers = true
|
||||
plus-color = "#012800"
|
||||
minus-color = "#340001"
|
||||
side-by-side = true
|
||||
syntax-theme = Dracula
|
||||
|
||||
[interactive]
|
||||
diffFilter = delta --color-only
|
||||
|
||||
[user]
|
||||
name = Ngô Ngọc Đức Huy
|
||||
email = huyngo@disroot.org
|
||||
signingKey = 7ADED7FAF19B44BB
|
||||
[pull]
|
||||
rebase = true
|
||||
[commit]
|
||||
gpgsign = true
|
||||
[init]
|
||||
defaultBranch = main
|
||||
[color]
|
||||
ui = true
|
||||
|
||||
[sendemail]
|
||||
smtpserver = disroot.org
|
||||
smtpuser = huyngo@disroot.org
|
||||
smtpencryption = tls
|
||||
smtpserverport = 587
|
|
@ -0,0 +1,5 @@
|
|||
# Ignore Gradle project-specific cache directory
|
||||
.gradle
|
||||
|
||||
# Ignore Gradle build output directory
|
||||
build
|
|
@ -1,8 +0,0 @@
|
|||
# This is Git's per-user configuration file.
|
||||
[user]
|
||||
# Please adapt and uncomment the following lines:
|
||||
name = Huy Ngo
|
||||
email = duchuy29092000@gmail.com
|
||||
[credential]
|
||||
helper = store --file ~/.my-credentials
|
||||
helper = cache --timeout 30000
|
|
@ -1,12 +1,12 @@
|
|||
let g:netrw_dirhistmax =10
|
||||
let g:netrw_dirhistcnt =1
|
||||
let g:netrw_dirhist_1='/home/xarvos/Quell/MiniGH/app/src/main'
|
||||
let g:netrw_dirhist_0='/home/xarvos/Quell/acanban/src/acanban/templates'
|
||||
let g:netrw_dirhist_9='/home/xarvos/Quell/acanban/src/acanban'
|
||||
let g:netrw_dirhist_8='/home/xarvos/github/acanban/tests'
|
||||
let g:netrw_dirhist_7='/etc/systemd/system'
|
||||
let g:netrw_dirhist_6='/home/xarvos/github/skin-crawler/frontend'
|
||||
let g:netrw_dirhist_5='/home/xarvos/github/skin-crawler/backend'
|
||||
let g:netrw_dirhist_4='/home/xarvos/github/skin-crawler'
|
||||
let g:netrw_dirhist_3='/home/xarvos/Desktop/webDevNotes/labworks/labwork_5/task3/app/Views'
|
||||
let g:netrw_dirhist_2='/home/xarvos/github/ipa_converter/src/main/resources'
|
||||
let g:netrw_dirhistcnt =8
|
||||
let g:netrw_dirhist_8='/home/xarvos/.config/sxhkd'
|
||||
let g:netrw_dirhist_7='/home/xarvos/.vim/ftplugin'
|
||||
let g:netrw_dirhist_6='/home/xarvos/Quell/axuy/axuy/shaders'
|
||||
let g:netrw_dirhist_5='/home/xarvos/Documents/USTH-notes/data_mining'
|
||||
let g:netrw_dirhist_4='/home/xarvos/Quell/my-cv'
|
||||
let g:netrw_dirhist_3='/home/xarvos/.config/sxhkd'
|
||||
let g:netrw_dirhist_2='/home/xarvos/.vim/ftplugin'
|
||||
let g:netrw_dirhist_1='/home/xarvos/Quell/GenWord'
|
||||
let g:netrw_dirhist_0='/home/xarvos/Quell/acanban/docs/source/conclusion'
|
||||
let g:netrw_dirhist_9='/home/xarvos/Quell/acanban/docs/source/result'
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
### (Apr 2015) Important note: mappings were changed!
|
||||
|
||||
As it was suggested on issue [#28](https://github.com/freitass/todo.txt-vim/issues/28) (and as recommended by vim's documentation), all mappings were changed to use `<localleader>` instead of `<leader>`. If you don't have `maplocalleader` set on your environment then yours is probably `\`. For more information on that regard, please take a look at `:h <Localleader>`.
|
||||
|
||||
### (Jan 2016) Note: Overdue date highlight and Python Optional dependency
|
||||
|
||||
A new feature was added to highlight dates in overdue tasks as an Error (as suggested on issue [#44](https://github.com/freitass/todo.txt-vim/issues/44)). It depends on a Python library, however, and as such will only be able to work if your version of Vim was compiled with the `+python` option (as most common versions do).
|
||||
|
||||
If your Vim installation does **not** have Python support, this plugin **will work just fine** but this feature will be disabled.
|
||||
|
||||
### Quick install
|
||||
|
||||
git clone git://github.com/freitass/todo.txt-vim.git
|
||||
cd todo.txt-vim
|
||||
cp -R * ~/.vim
|
||||
|
||||
|
||||
This plugin gives syntax highlighting to [todo.txt](http://todotxt.com/) files. It also defines a few mappings, to help with editing these files:
|
||||
|
||||
Sorting tasks:
|
||||
`<localleader>s` Sort the file
|
||||
`<localleader>s+` Sort the file on +Projects
|
||||
`<localleader>s@` Sort the file on @Contexts
|
||||
`<localleader>sd` Sort the file on dates
|
||||
`<localleader>sdd` Sort the file on due dates
|
||||
|
||||
Edit priority:
|
||||
`<localleader>j` Decrease the priority of the current line
|
||||
`<localleader>k` Increase the priority of the current line
|
||||
`<localleader>a` Add the priority (A) to the current line
|
||||
`<localleader>b` Add the priority (B) to the current line
|
||||
`<localleader>c` Add the priority (C) to the current line
|
||||
|
||||
Date:
|
||||
`<localleader>d` Set current task's creation date to the current date
|
||||
`date<tab>` (Insert mode) Insert the current date
|
||||
|
||||
Mark as done:
|
||||
`<localleader>x` Mark current task as done
|
||||
`<localleader>X` Mark all tasks as done
|
||||
`<localleader>D` Move completed tasks to done.txt
|
||||
|
||||
This plugin detects any text file with the name todo.txt or done.txt with an optional prefix that ends in a period (e.g. second.todo.txt, example.done.txt).
|
||||
|
||||
If you want the help installed, run ":helptags ~/.vim/doc" inside vim after having copied the files.
|
||||
Then you will be able to get the commands help with: `:h todo.txt`.
|
|
@ -804,7 +804,7 @@ function! s:syntax()
|
|||
syn match plugNumber /[0-9]\+[0-9.]*/ contained
|
||||
syn match plugBracket /[[\]]/ contained
|
||||
syn match plugX /x/ contained
|
||||
syn match plugDash /^-/
|
||||
syn match plugDash /^-\{1}\ /
|
||||
syn match plugPlus /^+/
|
||||
syn match plugStar /^*/
|
||||
syn match plugMessage /\(^- \)\@<=.*/
|
||||
|
@ -822,6 +822,7 @@ function! s:syntax()
|
|||
syn match plugError /^x.*/
|
||||
syn region plugDeleted start=/^\~ .*/ end=/^\ze\S/
|
||||
syn match plugH2 /^.*:\n-\+$/
|
||||
syn match plugH2 /^-\{2,}/
|
||||
syn keyword Function PlugInstall PlugStatus PlugUpdate PlugClean
|
||||
hi def link plug1 Title
|
||||
hi def link plug2 Repeat
|
||||
|
@ -934,7 +935,7 @@ function! s:prepare(...)
|
|||
call s:new_window()
|
||||
endif
|
||||
|
||||
nnoremap <silent> <buffer> q :if b:plug_preview==1<bar>pc<bar>endif<bar>bd<cr>
|
||||
nnoremap <silent> <buffer> q :call <SID>close_pane()<cr>
|
||||
if a:0 == 0
|
||||
call s:finish_bindings()
|
||||
endif
|
||||
|
@ -956,6 +957,15 @@ function! s:prepare(...)
|
|||
endif
|
||||
endfunction
|
||||
|
||||
function! s:close_pane()
|
||||
if b:plug_preview == 1
|
||||
pc
|
||||
let b:plug_preview = -1
|
||||
else
|
||||
bd
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:assign_name()
|
||||
" Assign buffer name
|
||||
let prefix = '[Plugins]'
|
||||
|
@ -1077,8 +1087,9 @@ function! s:checkout(spec)
|
|||
let sha = a:spec.commit
|
||||
let output = s:git_revision(a:spec.dir)
|
||||
if !empty(output) && !s:hash_match(sha, s:lines(output)[0])
|
||||
let credential_helper = s:git_version_requirement(2) ? '-c credential.helper= ' : ''
|
||||
let output = s:system(
|
||||
\ 'git fetch --depth 999999 && git checkout '.plug#shellescape(sha).' --', a:spec.dir)
|
||||
\ 'git '.credential_helper.'fetch --depth 999999 && git checkout '.plug#shellescape(sha).' --', a:spec.dir)
|
||||
endif
|
||||
return output
|
||||
endfunction
|
||||
|
@ -1530,7 +1541,7 @@ while 1 " Without TCO, Vim stack is bound to explode
|
|||
let [error, _] = s:git_validate(spec, 0)
|
||||
if empty(error)
|
||||
if pull
|
||||
let cmd = ['git', 'fetch']
|
||||
let cmd = s:git_version_requirement(2) ? ['git', '-c', 'credential.helper=', 'fetch'] : ['git', 'fetch']
|
||||
if has_tag && !empty(globpath(spec.dir, '.git/shallow'))
|
||||
call extend(cmd, ['--depth', '99999999'])
|
||||
endif
|
||||
|
|
|
@ -0,0 +1,123 @@
|
|||
" File: todo.txt.vim
|
||||
" Description: Todo.txt filetype detection
|
||||
" Author: Leandro Freitas <freitass@gmail.com>
|
||||
" License: Vim license
|
||||
" Website: http://github.com/freitass/todo.txt-vim
|
||||
" Version: 0.4
|
||||
|
||||
" Export Context Dictionary for unit testing {{{1
|
||||
function! s:get_SID()
|
||||
return matchstr(expand('<sfile>'), '<SNR>\d\+_')
|
||||
endfunction
|
||||
let s:SID = s:get_SID()
|
||||
delfunction s:get_SID
|
||||
|
||||
function! todo#txt#__context__()
|
||||
return { 'sid': s:SID, 'scope': s: }
|
||||
endfunction
|
||||
|
||||
" Functions {{{1
|
||||
function! s:remove_priority()
|
||||
:s/^(\w)\s\+//ge
|
||||
endfunction
|
||||
|
||||
function! s:get_current_date()
|
||||
return strftime('%Y-%m-%d')
|
||||
endfunction
|
||||
|
||||
function! todo#txt#prepend_date()
|
||||
execute 'normal! I' . s:get_current_date() . ' '
|
||||
endfunction
|
||||
|
||||
function! todo#txt#replace_date()
|
||||
let current_line = getline('.')
|
||||
if (current_line =~ '^\(([a-zA-Z]) \)\?\d\{2,4\}-\d\{2\}-\d\{2\} ') &&
|
||||
\ exists('g:todo_existing_date') && g:todo_existing_date == 'n'
|
||||
return
|
||||
endif
|
||||
execute 's/^\(([a-zA-Z]) \)\?\(\d\{2,4\}-\d\{2\}-\d\{2\} \)\?/\1' . s:get_current_date() . ' /'
|
||||
endfunction
|
||||
|
||||
function! todo#txt#mark_as_done()
|
||||
call s:remove_priority()
|
||||
call todo#txt#prepend_date()
|
||||
execute 'normal! Ix '
|
||||
endfunction
|
||||
|
||||
function! todo#txt#mark_all_as_done()
|
||||
:g!/^x /:call todo#txt#mark_as_done()
|
||||
endfunction
|
||||
|
||||
function! s:append_to_file(file, lines)
|
||||
let l:lines = []
|
||||
|
||||
" Place existing tasks in done.txt at the beggining of the list.
|
||||
if filereadable(a:file)
|
||||
call extend(l:lines, readfile(a:file))
|
||||
endif
|
||||
|
||||
" Append new completed tasks to the list.
|
||||
call extend(l:lines, a:lines)
|
||||
|
||||
" Write to file.
|
||||
call writefile(l:lines, a:file)
|
||||
endfunction
|
||||
|
||||
function! todo#txt#remove_completed()
|
||||
" Check if we can write to done.txt before proceeding.
|
||||
|
||||
let l:target_dir = expand('%:p:h')
|
||||
let l:todo_file = expand('%:p')
|
||||
let l:done_file = substitute(substitute(l:todo_file, 'todo.txt$', 'done.txt', ''), 'Todo.txt$', 'Done.txt', '')
|
||||
if !filewritable(l:done_file) && !filewritable(l:target_dir)
|
||||
echoerr "Can't write to file 'done.txt'"
|
||||
return
|
||||
endif
|
||||
|
||||
let l:completed = []
|
||||
:g/^x /call add(l:completed, getline(line(".")))|d
|
||||
call s:append_to_file(l:done_file, l:completed)
|
||||
endfunction
|
||||
|
||||
function! todo#txt#sort_by_context() range
|
||||
execute a:firstline . "," . a:lastline . "sort /\\(^\\| \\)\\zs@[^[:blank:]]\\+/ r"
|
||||
endfunction
|
||||
|
||||
function! todo#txt#sort_by_project() range
|
||||
execute a:firstline . "," . a:lastline . "sort /\\(^\\| \\)\\zs+[^[:blank:]]\\+/ r"
|
||||
endfunction
|
||||
|
||||
function! todo#txt#sort_by_date() range
|
||||
let l:date_regex = "\\d\\{2,4\\}-\\d\\{2\\}-\\d\\{2\\}"
|
||||
execute a:firstline . "," . a:lastline . "sort /" . l:date_regex . "/ r"
|
||||
execute a:firstline . "," . a:lastline . "g!/" . l:date_regex . "/m" . a:lastline
|
||||
endfunction
|
||||
|
||||
function! todo#txt#sort_by_due_date() range
|
||||
let l:date_regex = "due:\\d\\{2,4\\}-\\d\\{2\\}-\\d\\{2\\}"
|
||||
execute a:firstline . "," . a:lastline . "sort /" . l:date_regex . "/ r"
|
||||
execute a:firstline . "," . a:lastline . "g!/" . l:date_regex . "/m" . a:lastline
|
||||
endfunction
|
||||
|
||||
" Increment and Decrement The Priority
|
||||
:set nf=octal,hex,alpha
|
||||
|
||||
function! todo#txt#prioritize_increase()
|
||||
normal! 0f)h
|
||||
endfunction
|
||||
|
||||
function! todo#txt#prioritize_decrease()
|
||||
normal! 0f)h
|
||||
endfunction
|
||||
|
||||
function! todo#txt#prioritize_add(priority)
|
||||
" Need to figure out how to only do this if the first visible letter in a line is not (
|
||||
:call todo#txt#prioritize_add_action(a:priority)
|
||||
endfunction
|
||||
|
||||
function! todo#txt#prioritize_add_action(priority)
|
||||
execute 's/^\(([a-zA-Z]) \)\?/(' . a:priority . ') /'
|
||||
endfunction
|
||||
|
||||
" Modeline {{{1
|
||||
" vim: ts=8 sw=4 sts=4 et foldenable foldmethod=marker foldcolumn=1
|
|
@ -0,0 +1,68 @@
|
|||
*todo.txt* Vim plugin for Todo.txt files
|
||||
_____ _ _ _ ~
|
||||
|_ _|__ __| | ___ | |___ _| |_ ~
|
||||
| |/ _ \ / _` |/ _ \| __\ \/ / __|~
|
||||
| | (_) | (_| | (_) | |_ > <| |_ ~
|
||||
|_|\___/ \__,_|\___(_)__/_/\_\\__|~
|
||||
|
||||
Reference Manual~
|
||||
|
||||
==============================================================================
|
||||
CONTENTS *todo-contents*
|
||||
|
||||
1. Commands ..................................... |todo-commands|
|
||||
1.1. Sorting tasks ............................ |todo-commands-sorting|
|
||||
1.2. Edit priority ............................ |todo-commands-priority|
|
||||
1.3. Date ..................................... |todo-commands-date|
|
||||
1.4. Mark as done ............................. |todo-commands-done|
|
||||
2. Options ...................................... |todo-options|
|
||||
|
||||
==============================================================================
|
||||
1. Commands *todo-commands*
|
||||
|
||||
1.1 Sorting tasks: *todo-commands-sorting*
|
||||
`<localleader>s` Sort the file
|
||||
`<localleader>s+` Sort the file on +Projects
|
||||
`<localleader>s@` Sort the file on @Contexts
|
||||
`<localleader>sd` Sort the file on dates
|
||||
`<localleader>sdd` Sort the file on due dates (i.e. due:2015-10-25)
|
||||
|
||||
1.2 Edit priority: *todo-commands-priority*
|
||||
`<localleader>j` Decrease the priority of the current line
|
||||
`<localleader>k` Increase the priority of the current line
|
||||
`<localleader>a` Add the priority (A) to the current line
|
||||
`<localleader>b` Add the priority (B) to the current line
|
||||
`<localleader>c` Add the priority (C) to the current line
|
||||
|
||||
1.3 Date: *todo-commands-date*
|
||||
`<localleader>d` Set current task's creation date to the current date
|
||||
`date<tab>` (Insert mode) Insert the current date
|
||||
|
||||
1.4 Mark as done: *todo-commands-done*
|
||||
`<localleader>x` Mark current task as done
|
||||
`<localleader>X` Mark all tasks as done
|
||||
`<localleader>D` Move completed tasks to done.txt
|
||||
|
||||
See :h <localleader> for more information about the commands' prefix.
|
||||
|
||||
==============================================================================
|
||||
2. Options *todo-options*
|
||||
|
||||
*'g:todo_existing_date'*
|
||||
Specify the behavior of date insertion functions when the task already has a
|
||||
date of creation: >
|
||||
let g:todo_existing_date = 'n'
|
||||
<
|
||||
r - replace existing date (default)
|
||||
n - do nothing
|
||||
|
||||
*'g:todo_load_python'*
|
||||
Specify if the plugin should load the python module. Useful if you use Neovim
|
||||
for example or if perhaps you just don't have/want python for vim: >
|
||||
let g:todo_load_python = 1
|
||||
<
|
||||
1 - Load (default)
|
||||
0 - Don't load
|
||||
|
||||
===============================================================================
|
||||
vim:ft=help:et:ts=2:sw=2:sts=2:norl
|
|
@ -0,0 +1,13 @@
|
|||
x 2011-05-30 Create README.markdown to be published in github @doc
|
||||
x 2011-05-30 Implement colorized priorities @syntax
|
||||
x 2011-05-30 Implement filetype detection @ftdetect
|
||||
x 2011-05-30 Sort lines per priority @ftplugin
|
||||
x 2011-05-31 Highlight date, project and context of tasks with no priority @syntax
|
||||
x 2011-05-31 Stop breaking lines automatically @ftplugin
|
||||
x 2011-06-06 Easier date input @ftplugin
|
||||
x 2011-06-06 Implement foldings @ftplugin
|
||||
x 2014-04-27 2011-05-30 Contact main project for reference
|
||||
x 2014-11-01 2011-05-30 Map commands to add, rm, ls, pri, depri etc @ftplugin
|
||||
x 2014-11-01 2011-05-31 Start documentation @doc
|
||||
x 2014-11-01 2011-06-01 Improve syntax file @syntax
|
||||
x 2014-11-01 2011-06-06 Check file syntax @syntax
|
|
@ -0,0 +1,12 @@
|
|||
" File: todo.txt.vim
|
||||
" Description: Todo.txt filetype detection
|
||||
" Author: Leandro Freitas <freitass@gmail.com>
|
||||
" License: Vim license
|
||||
" Website: http://github.com/freitass/todo.txt-vim
|
||||
" Version: 0.1
|
||||
|
||||
autocmd BufNewFile,BufRead [Tt]odo.txt set filetype=todo
|
||||
autocmd BufNewFile,BufRead *.[Tt]odo.txt set filetype=todo
|
||||
autocmd BufNewFile,BufRead [Dd]one.txt set filetype=todo
|
||||
autocmd BufNewFile,BufRead *.[Dd]one.txt set filetype=todo
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1 @@
|
|||
set formatprg=gofmt
|
|
@ -0,0 +1 @@
|
|||
setlocal tabstop=4 shiftwidth=4 softtabstop=4 expandtab
|
|
@ -0,0 +1 @@
|
|||
set formatprg=rustfmt
|
|
@ -0,0 +1,90 @@
|
|||
" File: todo.txt.vim
|
||||
" Description: Todo.txt filetype detection
|
||||
" Author: Leandro Freitas <freitass@gmail.com>
|
||||
" License: Vim license
|
||||
" Website: http://github.com/freitass/todo.txt-vim
|
||||
" Version: 0.4
|
||||
|
||||
" Save context {{{1
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
" General options {{{1
|
||||
" Some options lose their values when window changes. They will be set every
|
||||
" time this script is invocated, which is whenever a file of this type is
|
||||
" created or edited.
|
||||
setlocal textwidth=0
|
||||
setlocal wrapmargin=0
|
||||
|
||||
" Mappings {{{1
|
||||
" Sort tasks {{{2
|
||||
nnoremap <script> <silent> <buffer> <localleader>s :%sort<CR>
|
||||
vnoremap <script> <silent> <buffer> <localleader>s :sort<CR>
|
||||
nnoremap <script> <silent> <buffer> <localleader>s@ :%call todo#txt#sort_by_context()<CR>
|
||||
vnoremap <script> <silent> <buffer> <localleader>s@ :call todo#txt#sort_by_context()<CR>
|
||||
nnoremap <script> <silent> <buffer> <localleader>s+ :%call todo#txt#sort_by_project()<CR>
|
||||
vnoremap <script> <silent> <buffer> <localleader>s+ :call todo#txt#sort_by_project()<CR>
|
||||
nnoremap <script> <silent> <buffer> <localleader>sd :%call todo#txt#sort_by_date()<CR>
|
||||
vnoremap <script> <silent> <buffer> <localleader>sd :call todo#txt#sort_by_date()<CR>
|
||||
nnoremap <script> <silent> <buffer> <localleader>sdd :%call todo#txt#sort_by_due_date()<CR>
|
||||
vnoremap <script> <silent> <buffer> <localleader>sdd :call todo#txt#sort_by_due_date()<CR>
|
||||
|
||||
" Change priority {{{2
|
||||
nnoremap <script> <silent> <buffer> <localleader>j :call todo#txt#prioritize_increase()<CR>
|
||||
vnoremap <script> <silent> <buffer> <localleader>j :call todo#txt#prioritize_increase()<CR>
|
||||
nnoremap <script> <silent> <buffer> <localleader>k :call todo#txt#prioritize_decrease()<CR>
|
||||
vnoremap <script> <silent> <buffer> <localleader>k :call todo#txt#prioritize_decrease()<CR>
|
||||
nnoremap <script> <silent> <buffer> <localleader>a :call todo#txt#prioritize_add('A')<CR>
|
||||
vnoremap <script> <silent> <buffer> <localleader>a :call todo#txt#prioritize_add('A')<CR>
|
||||
nnoremap <script> <silent> <buffer> <localleader>b :call todo#txt#prioritize_add('B')<CR>
|
||||
vnoremap <script> <silent> <buffer> <localleader>b :call todo#txt#prioritize_add('B')<CR>
|
||||
nnoremap <script> <silent> <buffer> <localleader>c :call todo#txt#prioritize_add('C')<CR>
|
||||
vnoremap <script> <silent> <buffer> <localleader>c :call todo#txt#prioritize_add('C')<CR>
|
||||
|
||||
" Insert date {{{2
|
||||
inoremap <script> <silent> <buffer> date<Tab> <C-R>=strftime("%Y-%m-%d")<CR>
|
||||
nnoremap <script> <silent> <buffer> <localleader>d :call todo#txt#replace_date()<CR>
|
||||
vnoremap <script> <silent> <buffer> <localleader>d :call todo#txt#replace_date()<CR>
|
||||
|
||||
" Mark done {{{2
|
||||
nnoremap <script> <silent> <buffer> <localleader>x :call todo#txt#mark_as_done()<CR>
|
||||
vnoremap <script> <silent> <buffer> <localleader>x :call todo#txt#mark_as_done()<CR>
|
||||
|
||||
" Mark all done {{{2
|
||||
nnoremap <script> <silent> <buffer> <localleader>X :call todo#txt#mark_all_as_done()<CR>
|
||||
|
||||
" Remove completed {{{2
|
||||
nnoremap <script> <silent> <buffer> <localleader>D :call todo#txt#remove_completed()<CR>
|
||||
|
||||
" Folding {{{1
|
||||
" Options {{{2
|
||||
setlocal foldmethod=expr
|
||||
setlocal foldexpr=s:todo_fold_level(v:lnum)
|
||||
setlocal foldtext=s:todo_fold_text()
|
||||
|
||||
" s:todo_fold_level(lnum) {{{2
|
||||
function! s:todo_fold_level(lnum)
|
||||
" The match function returns the index of the matching pattern or -1 if
|
||||
" the pattern doesn't match. In this case, we always try to match a
|
||||
" completed task from the beginning of the line so that the matching
|
||||
" function will always return -1 if the pattern doesn't match or 0 if the
|
||||
" pattern matches. Incrementing by one the value returned by the matching
|
||||
" function we will return 1 for the completed tasks (they will be at the
|
||||
" first folding level) while for the other lines 0 will be returned,
|
||||
" indicating that they do not fold.
|
||||
return match(getline(a:lnum),'^[xX]\s.\+$') + 1
|
||||
endfunction
|
||||
|
||||
" s:todo_fold_text() {{{2
|
||||
function! s:todo_fold_text()
|
||||
" The text displayed at the fold is formatted as '+- N Completed tasks'
|
||||
" where N is the number of lines folded.
|
||||
return '+' . v:folddashes . ' '
|
||||
\ . (v:foldend - v:foldstart + 1)
|
||||
\ . ' Completed tasks '
|
||||
endfunction
|
||||
|
||||
" Restore context {{{1
|
||||
let &cpo = s:save_cpo
|
||||
" Modeline {{{1
|
||||
" vim: ts=8 sw=4 sts=4 et foldenable foldmethod=marker foldcolumn=1
|
|
@ -0,0 +1 @@
|
|||
Subproject commit e7154372adc95d637ccd911c2f8601d9ff2eac1f
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 24da62f64e6025be12ad60b16489b561f228e619
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 40a76277e19f47e2e4faebd1dd4aada7a6b5aeb5
|
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
# File: __init__.py
|
||||
# Author: Guilherme Victal <guilherme at victal.eti.br>
|
||||
# Description: Dateregex library entry point
|
||||
# License: Vim license
|
||||
# Website: http://github.com/freitass/todo.txt-vim
|
||||
# Version: 0.1
|
||||
|
||||
from dateregex.after import regex_date_after
|
||||
from dateregex.before import regex_date_before
|
|
@ -0,0 +1,95 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
# File: after.py
|
||||
# Author: Guilherme Victal <guilherme at victal.eti.br>
|
||||
# Description: Generates regexes after a certain date
|
||||
# License: Vim license
|
||||
# Website: http://github.com/freitass/todo.txt-vim
|
||||
# Version: 0.1
|
||||
|
||||
from datetime import date, timedelta, MAXYEAR
|
||||
|
||||
|
||||
def _year_regex_after(year):
|
||||
if int(year) > MAXYEAR:
|
||||
return None
|
||||
|
||||
year_regex = r'(\d+\d{%s}' % len(year)
|
||||
for idx, digit in enumerate(year):
|
||||
if digit != '9':
|
||||
regex = '|' + year[0:idx]
|
||||
regex += '9' if digit == '8' else '[%s-9]' % str(int(digit) + 1)
|
||||
if idx < len(year) - 1:
|
||||
regex += '\d{%s}' % (len(year) - (idx + 1))
|
||||
year_regex += regex
|
||||
|
||||
year_regex += ')'
|
||||
return '-'.join((year_regex, r'\d{2}', r'\d{2}'))
|
||||
|
||||
|
||||
def _month_regex_after(year, month):
|
||||
if month == '12':
|
||||
return None
|
||||
|
||||
digit1, digit2 = month
|
||||
if digit1 == '1':
|
||||
month_regex = r'12' if month == '11' else r'1[12]'
|
||||
else:
|
||||
month_regex = r'1[0-2]'
|
||||
if digit2 != '9':
|
||||
if digit2 == '8':
|
||||
month_regex = r'(' + month_regex + r'|09)'
|
||||
else:
|
||||
month_regex = r'(' + month_regex + r'|0[%s-9])'
|
||||
month_regex = month_regex % str(int(digit2) + 1)
|
||||
return '-'.join((year, month_regex, r'\d{2}'))
|
||||
|
||||
def _day_regex_after(year, month, day):
|
||||
last_month_day = str((date(int(year), (int(month) + 1) % 12, 1) + - date.resolution).day)
|
||||
if day == last_month_day:
|
||||
return None
|
||||
day_regex = r'('
|
||||
digit1, digit2 = day
|
||||
last_digit1, last_digit2 = last_month_day
|
||||
if digit1 == last_digit1:
|
||||
day_regex = last_month_day if int(digit2) == int(last_digit2) - 1 else last_digit1 + r'[%s-%s]' % (str(int(digit2) + 1), last_digit2)
|
||||
else:
|
||||
day_regex = r'('
|
||||
day_regex += last_digit1 if int(digit1) == int(last_digit1) - 1 else r'[%s-%s]' % (str(int(digit1) + 1), last_digit1)
|
||||
day_regex +=r'\d'
|
||||
if digit2 < '9':
|
||||
day_regex += '|' + digit1
|
||||
day_regex += '9' if digit2 == '8' else r'[%s-9]' % str(int(digit2) + 1)
|
||||
|
||||
day_regex += ')'
|
||||
return '-'.join((year, month, day_regex))
|
||||
|
||||
|
||||
def regex_date_after(given_date):
|
||||
year, month, day = given_date.isoformat().split('-')
|
||||
|
||||
year_regex = _year_regex_after(year)
|
||||
month_regex = _month_regex_after(year, month)
|
||||
day_regex = _day_regex_after(year, month, day)
|
||||
|
||||
date_regex = '(' + year_regex if year_regex else '('
|
||||
date_regex += ('|' + month_regex) if month_regex else ''
|
||||
date_regex += ('|' + day_regex) if day_regex else ''
|
||||
date_regex += ')'
|
||||
return date_regex
|
||||
|
||||
|
||||
def __main():
|
||||
import re
|
||||
date_regex = regex_date_after(date(1999,12,31))
|
||||
print(date_regex)
|
||||
pattern = re.compile(date_regex)
|
||||
|
||||
|
||||
d = date.today() + date.resolution
|
||||
assert pattern.match(date.strftime(d, '%Y-%m-%d')) is not None
|
||||
print(date.strftime(d, '%Y-%m-%d') + ' is okay')
|
||||
d += date.resolution
|
||||
|
||||
if __name__ == '__main__':
|
||||
__main()
|
|
@ -0,0 +1,79 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
# File: before.py
|
||||
# Author: Guilherme Victal <guilherme at victal.eti.br>
|
||||
# Description: Generates regexes before a certain date
|
||||
# License: Vim license
|
||||
# Website: http://github.com/freitass/todo.txt-vim
|
||||
# Version: 0.1
|
||||
|
||||
from datetime import date, timedelta, MINYEAR
|
||||
|
||||
def _year_regex_before(year):
|
||||
if int(year) <= MINYEAR:
|
||||
return None
|
||||
year_regex = r'('
|
||||
year_regex += r'\d{1,%s}' % str(len(year) - 1) if len(year) > 1 else ''
|
||||
for idx, digit in enumerate(year):
|
||||
if digit != '0':
|
||||
regex = '|' + year[0:idx]
|
||||
regex += '0' if digit == '1' else '[0-%s]' % str(int(digit) - 1)
|
||||
if idx < len(year) - 1:
|
||||
regex += '\d{%s}' % (len(year) - (idx + 1))
|
||||
year_regex += regex
|
||||
|
||||
year_regex += ')'
|
||||
return '-'.join((year_regex, r'\d{2}', r'\d{2}'))
|
||||
|
||||
def _month_regex_before(year, month):
|
||||
if month == '01':
|
||||
return None
|
||||
|
||||
digit1, digit2 = month
|
||||
if digit1 == '0':
|
||||
month_regex = '01' if month == '02' else r'0[1-%s]' % str(int(digit2) - 1)
|
||||
elif month == '10':
|
||||
month_regex = r'0\d'
|
||||
elif month == '11':
|
||||
month_regex = r'(0\d|10)'
|
||||
else:
|
||||
month_regex = r'(0\d|1[01])'
|
||||
|
||||
return '-'.join((year, month_regex, r'\d{2}'))
|
||||
|
||||
def _day_regex_before(year, month, day):
|
||||
if day == '01':
|
||||
return None
|
||||
last_month_day = str((date(int(year), int(month) % 12 + 1, 1) + - date.resolution).day)
|
||||
last_digit1, last_digit2 = last_month_day
|
||||
|
||||
digit1, digit2 = day
|
||||
if digit1 == '0':
|
||||
day_regex = '01' if day == '02' else r'0[1-%s]' % str(int(digit2) - 1)
|
||||
else:
|
||||
day_regex = r'('
|
||||
day_regex += '0' if digit1 == '1' else r'[0-%s]' % str(int(digit1) - 1)
|
||||
day_regex += r'\d'
|
||||
if digit2 != '0':
|
||||
day_regex += '|'
|
||||
day_regex += digit1
|
||||
day_regex += '0' if digit2 == '1' else r'[0-%s]' % str(int(digit2) - 1)
|
||||
day_regex += ')'
|
||||
|
||||
return '-'.join((year, month, day_regex))
|
||||
|
||||
|
||||
|
||||
|
||||
def regex_date_before(given_date):
|
||||
year, month, day = given_date.isoformat().split('-')
|
||||
|
||||
year_regex = _year_regex_before(year)
|
||||
month_regex = _month_regex_before(year, month)
|
||||
day_regex = _day_regex_before(year, month, day)
|
||||
|
||||
date_regex = '(' + year_regex if year_regex else '('
|
||||
date_regex += ('|' + month_regex) if month_regex else ''
|
||||
date_regex += ('|' + day_regex) if day_regex else ''
|
||||
date_regex += ')'
|
||||
return date_regex
|
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/env python2
|
||||
# -*- coding: utf-8 -*-
|
||||
# File: todo.py
|
||||
# Description: Todo.txt overdue date syntax script
|
||||
# License: Vim license
|
||||
# Website: http://github.com/freitass/todo.txt-vim
|
||||
# Version: 0.1
|
||||
|
||||
import vim
|
||||
import os
|
||||
import sys
|
||||
from datetime import date
|
||||
|
||||
dateregex_dir = os.path.join(vim.eval('s:script_dir'), 'dateregex')
|
||||
if os.path.isdir(dateregex_dir):
|
||||
sys.path.insert(0, dateregex_dir)
|
||||
|
||||
def add_due_date_syntax_highlight():
|
||||
try:
|
||||
from dateregex import regex_date_before
|
||||
except ImportError:
|
||||
print("dateregex module not found. Overdue dates won't be highlighted")
|
||||
return
|
||||
|
||||
regex = regex_date_before(date.today())
|
||||
regex = r'(^|<)due:%s(>|$)' % regex
|
||||
|
||||
vim.command("syntax match OverDueDate '\\v%s'" % regex)
|
||||
vim.command("highlight default link OverDueDate Error")
|
||||
|
||||
add_due_date_syntax_highlight()
|
|
@ -0,0 +1,262 @@
|
|||
|
||||
" Language: SQL with SQLite and other additions.
|
||||
" Maintainer: Jessica K McIntosh AT gmail DOT com
|
||||
" Last Changed: Thu Jan 23 06:00 PM 2014 EST
|
||||
|
||||
" More complete SQL matching with error reporting.
|
||||
" Only matches types inside 'CREATE TABLE ();'.
|
||||
" Highlights functions. Unknown functions are an error.
|
||||
" Based on the SQL syntax files that come with Vim.
|
||||
|
||||
" For version 5.x: Clear all syntax items
|
||||
" For version 6.x: Quit when a syntax file was already loaded
|
||||
if version < 600
|
||||
syntax clear
|
||||
elseif exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
syn case ignore
|
||||
|
||||
" All non-contained SQL syntax.
|
||||
syn cluster sqlALL contains=TOP
|
||||
|
||||
" Various error conditions.
|
||||
"syn match sqlError "\<\w\+(" " Not a known function.
|
||||
syn match sqlError ")" " Lonely closing paren.
|
||||
syn match sqlError ",\(\_\s*[;)]\)\@=" " Comma before a paren or semicolon.
|
||||
syn match sqlError " $" " Space at the end of a line.
|
||||
" Comma before certain words.
|
||||
syn match sqlError ",\_\s*\(\<\(asc\|desc\|exists\|for\|from\)\>\)\@="
|
||||
syn match sqlError ",\_\s*\(\<\(group by\|into\|limit\|order\)\>\)\@="
|
||||
syn match sqlError ",\_\s*\(\<\(table\|using\|where\)\>\)\@="
|
||||
|
||||
" Special words.
|
||||
syn keyword sqlSpecial false null true
|
||||
|
||||
" Keywords
|
||||
syn keyword sqlKeyword access add after aggregate as asc authorization
|
||||
syn keyword sqlKeyword begin by cache cascade check cluster collate
|
||||
syn keyword sqlKeyword collation column compress conflict connect connection
|
||||
syn keyword sqlKeyword constraint current cursor database debug decimal
|
||||
syn keyword sqlKeyword default desc each else elsif escape exception
|
||||
syn keyword sqlKeyword exclusive explain external file for foreign from function
|
||||
syn keyword sqlKeyword group having identified if immediate increment index
|
||||
syn keyword sqlKeyword initial inner into is join key left level loop
|
||||
syn keyword sqlKeyword maxextents mode modify nocompress nowait object of
|
||||
syn keyword sqlKeyword off offline on online option order outer pctfree
|
||||
syn keyword sqlKeyword primary privileges procedure public references
|
||||
syn keyword sqlKeyword referencing release resource return role row rowid
|
||||
syn keyword sqlKeyword rowlabel rownum rows schema session share size
|
||||
syn keyword sqlKeyword start successful synonym then to transaction trigger
|
||||
syn keyword sqlKeyword uid user using validate values view virtual whenever
|
||||
syn keyword sqlKeyword where with
|
||||
syn match sqlKeyword "\<prompt\>"
|
||||
syn match sqlKeyword "\<glob\>"
|
||||
" Do special things with CREATE TABLE ( below.
|
||||
syn match sqlKeyword "\<table\>"
|
||||
|
||||
" SQLite Pragmas - Treat them as keywords.
|
||||
syn keyword sqlKeyword auto_vacuum automatic_index cache_size
|
||||
syn keyword sqlKeyword case_sensitive_like checkpoint_fullfsync
|
||||
syn keyword sqlKeyword collation_list compile_options count_changes
|
||||
syn keyword sqlKeyword database_list default_cache_size
|
||||
syn keyword sqlKeyword empty_result_callbacks encoding foreign_key_list
|
||||
syn keyword sqlKeyword foreign_keys freelist_count full_column_names
|
||||
syn keyword sqlKeyword fullfsync ignore_check_constraints
|
||||
syn keyword sqlKeyword incremental_vacuum index_info index_list
|
||||
syn keyword sqlKeyword integrity_check journal_mode journal_size_limit
|
||||
syn keyword sqlKeyword legacy_file_format locking_mode max_page_count
|
||||
syn keyword sqlKeyword page_count page_size parser_trace quick_check
|
||||
syn keyword sqlKeyword read_uncommitted recursive_triggers
|
||||
syn keyword sqlKeyword reverse_unordered_selects schema_version
|
||||
syn keyword sqlKeyword secure_delete short_column_names synchronous
|
||||
syn keyword sqlKeyword table_info temp_store temp_store_directory
|
||||
syn keyword sqlKeyword user_version vdbe_listing vdbe_trace
|
||||
syn keyword sqlKeyword wal_autocheckpoint wal_checkpoint writable_schema
|
||||
|
||||
" Operators
|
||||
syn keyword sqlOperator all and any between case distinct elif else end
|
||||
syn keyword sqlOperator exit exists if in intersect is like match matches
|
||||
syn keyword sqlOperator minus not or out prior regexp some then union
|
||||
syn keyword sqlOperator unique when
|
||||
syn match sqlOperator "||\|:="
|
||||
|
||||
" Conditionals
|
||||
syn match sqlConditional "=\|<\|>\|+\|-"
|
||||
|
||||
" Unknown functions.
|
||||
syn match sqlUnknownFunc "\<\w\+(\@="
|
||||
|
||||
" Functions - Only valid with a '(' after them.
|
||||
syn match sqlFunction "\<\(abs\|acos\|asin\|atan2\?\|avg\|cardinality\)(\@="
|
||||
syn match sqlFunction "\<\(cast\|changes\|char_length\|character_length\)(\@="
|
||||
syn match sqlFunction "\<\(coalesce\|concat\|cos\|count\|\(date\)\?\(time\)\?\)(\@="
|
||||
syn match sqlFunction "\<\(exp\|filetoblob\|filetoclob\|floor\|glob\|group_concat\)(\@="
|
||||
syn match sqlFunction "\<\(hex\|ifnull\|initcap\|isnull\|julianday\|last_insert_rowid\)(\@="
|
||||
syn match sqlFunction "\<\(length\|log10\|logn\|lower\|lpad\|ltrin\|max\|min\)(\@="
|
||||
syn match sqlFunction "\<\(mod\|nullif\|octet_length\|pow\|quote\|random\)(\@="
|
||||
syn match sqlFunction "\<\(range\|replace\|root\|round\|rpad\|sin\|soundex\)(\@="
|
||||
syn match sqlFunction "\<\(sqrtstdev\|strftime\|substr\|substring\|sum\|sysdate\|tan\)(\@="
|
||||
syn match sqlFunction "\<\(to_char\|to_date\|to_number\|total\|trim\|trunc\|typeof\)(\@="
|
||||
syn match sqlFunction "\<\(upper\|variance\)(\@="
|
||||
|
||||
" Oracle DBMS functions.
|
||||
syn match sqlFunction "\<dbms_\w\+\.\w\+(\@="
|
||||
|
||||
" Oracle Exception Functions.
|
||||
syn match sqlFunction "\<raise_application_error(\@="
|
||||
|
||||
" SQLite Functions
|
||||
syn match sqlFunction "\<\(last_insert_rowid\|load_extension\|randomblob\)(\@="
|
||||
syn match sqlFunction "\<\(sqlite_compileoption_get\|sqlite_compileoption_used\)(\@="
|
||||
syn match sqlFunction "\<\(sqlite_source_id\|sqlite_version\|sqlite_version\)(\@="
|
||||
syn match sqlFunction "\<\(zeroblob\|ltrim\|rtrim\)(\@="
|
||||
|
||||
" SQLite Command Line Client Functions
|
||||
syn match sqlFunction "^\.\w\+"
|
||||
|
||||
" Statements
|
||||
syn keyword sqlStatement alter analyze audit begin comment commit delete
|
||||
syn keyword sqlStatement drop execute explain grant insert lock noaudit
|
||||
syn keyword sqlStatement rename revoke rollback savepoint select
|
||||
syn keyword sqlStatement truncate update vacuum
|
||||
syn match sqlStatement "\<\(replace\|create\)\>"
|
||||
|
||||
" SQLite Statements
|
||||
syn keyword sqlStatement attach detach indexed pragma reindex
|
||||
|
||||
" Types - Only matched inside 'CREATE TABLE ();'.
|
||||
syn keyword sqlType contained bigint bit blob bool boolean byte char
|
||||
syn keyword sqlType contained clob date datetime dec decimal enum
|
||||
syn keyword sqlType contained float int int8 integer interval long
|
||||
syn keyword sqlType contained longblob longtext lvarchar mediumblob
|
||||
syn keyword sqlType contained mediumint mediumtext mlslabel money
|
||||
syn keyword sqlType contained multiset nchar number numeric nvarchar
|
||||
syn keyword sqlType contained raw real rowid serial serial8 set
|
||||
syn keyword sqlType contained smallfloat smallint text time
|
||||
syn keyword sqlType contained timestamp tinyblob tinyint tinytext
|
||||
syn keyword sqlType contained varchar varchar2 varray year
|
||||
syn match sqlType contained "\<\(character\|double\|varying\)\>"
|
||||
syn match sqlType contained "\<character\s\+varying\>"
|
||||
syn match sqlType contained "\<double\s\+precision\>"
|
||||
|
||||
" Oracle Variables
|
||||
syn match sqlVariable "&\a\w\+"
|
||||
syn match sqlVariable ":\w\+"
|
||||
syn match sqlVariable "SQL%\w\+"
|
||||
|
||||
" Strings
|
||||
syn region sqlString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=sqlVariable
|
||||
syn region sqlString start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=sqlVariable
|
||||
syn region sqlString start=+`+ skip=+\\\\\|\\`+ end=+`+ contains=sqlVariable
|
||||
|
||||
" Numbers
|
||||
syn match sqlNumber "-\=\<[0-9]*\>"
|
||||
syn match sqlNumber "-\=\<[0-9]*\.[0-9]*\>"
|
||||
syn match sqlNumber "-\=\<[0-9][0-9]*e[+-]\=[0-9]*\>"
|
||||
syn match sqlNumber "-\=\<[0-9]*\.[0-9]*e[+-]\=[0-9]*\>"
|
||||
syn match sqlNumber "\<0x[abcdef0-9]*\>"
|
||||
|
||||
" Todo
|
||||
syn keyword sqlTodo contained DEBUG FIXME NOTE TODO XXX
|
||||
|
||||
" Comments
|
||||
syn region sqlComment start="/\*" end="\*/" contains=sqlTodo
|
||||
syn match sqlComment "--.*$" contains=sqlTodo
|
||||
syn match sqlComment "rem.*$" contains=sqlTodo
|
||||
|
||||
" Mark correct paren use. Different colors for different purposes.
|
||||
syn region sqlParens transparent matchgroup=sqlParen start="(" end=")"
|
||||
syn match sqlParenEmpty "()"
|
||||
syn region sqlParens transparent matchgroup=sqlParenFunc start="\(\<\w\+\>\)\@<=(" end=")"
|
||||
|
||||
" Highlight types correctly inside create table and procedure statements.
|
||||
" All other SQL is properly highlighted as well.
|
||||
syn region sqlTypeParens contained matchgroup=sqlType start="(" end=")" contains=@sqlALL
|
||||
syn match sqlTypeMatch contained "\(\(^\|[,(]\)\s*\S\+\s\+\)\@<=\w\+\(\s*([^)]\+)\)\?" contains=sqlType,sqlTypeParens
|
||||
syn match sqlTypeMatch contained "\(\(^\|[,(]\)\s*\S\+\s\+\)\@<=character\s\+varying\s*([^)]\+)" contains=sqlType,sqlTypeParens
|
||||
syn region sqlTypeRegion matchgroup=sqlParen start="\(create\s\+table\s\+[^(]\+\s\+\)\@<=(" end=")" contains=@sqlALL,sqlTypeMatch
|
||||
syn region sqlTypeRegion matchgroup=sqlParen start="\(create\s\+\(or\s\+replace\s\+\)\?procedure\s\+[^(]\+\s*\)\@<=(" end=")" contains=@sqlALL,sqlTypeMatch
|
||||
|
||||
" SQL Embedded in a statement.
|
||||
syn region sqlquoteRegion matchgroup=sqlParen start="\(execute\s\+immediate\s*\)\@<=('" end="')" contains=@sqlALL
|
||||
|
||||
" Special Oracle Statements
|
||||
syn match sqlStatement "^\s*\(prompt\|spool\)\>" nextgroup=sqlAnyString
|
||||
syn match sqlStatement "^\s*accept\s\+" nextgroup=sqlAnyVariable
|
||||
syn match sqlStatement "declare\s\+" nextgroup=sqlDeclare
|
||||
syn region sqlDeclare contained matchgroup=sqlVariable start="\a\w\+" end="$" contains=@sqlALL,sqlType
|
||||
syn match sqlOperator "^@" nextgroup=sqlAnyString
|
||||
syn match sqlAnyVariable contained "\a\w\+"
|
||||
syn match sqlAnyString contained ".*" contains=sqlVariable
|
||||
|
||||
syn region sqlSetRegion matchgroup=sqlStatement start="^\s*set\>" matchgroup=NONE end="$" contains=sqlSetOptions,sqlSetValues
|
||||
syn keyword sqlSetOptions contained autorecovery colsep copytypecheck describe escchar flagger
|
||||
syn keyword sqlSetOptions contained instance logsource long null recsep recsepchar
|
||||
syn keyword sqlSetOptions contained
|
||||
syn match sqlSetOptions contained "\<\(app\w*\|array\w*\|auto\w*\|autop\w*\)\>"
|
||||
syn match sqlSetOptions contained "\<\(autot\w*\|blo\w*\|cmds\w*\|con\w*\|copyc\w*\)\>"
|
||||
syn match sqlSetOptions contained "\<\(def\w*\|echo\|editf\w*\|emb\w*\|errorl\w*\|esc\w*\)\>"
|
||||
syn match sqlSetOptions contained "\<\(feed\w*\|flu\w*\|hea\w*\|heads\w*\|lin\w*\)\>"
|
||||
syn match sqlSetOptions contained "\<\(lobof\w*\|longc\w*\|mark\w*\|newp\w*\|numf\w*\)\>"
|
||||
syn match sqlSetOptions contained "\<\(pages\w*\|pau\w*\|serverout\w*\|shift\w*\|show\w*\)\>"
|
||||
syn match sqlSetOptions contained "\<\(sqlbl\w*\|sqlc\w*\|sqlco\w*\|sqln\w*\|sqlpluscompat\w*\)\>"
|
||||
syn match sqlSetOptions contained "\<\(sqlpre\w*\|sqlp\w*\|sqlt\w*\|suf\w*\|tab\)\>"
|
||||
syn match sqlSetOptions contained "\<\(term\w*\|timi\w*\|und\w*\|ver\w*\|wra\w\?\)\>"
|
||||
syn match sqlSetOptions contained "\<\(xquery\s\+\(baseuri\|ordering\|node\|context\)\)\>"
|
||||
syn keyword sqlSetValues contained all body byreference byvalue default
|
||||
syn keyword sqlSetValues contained entry fill head html identifier indent
|
||||
syn keyword sqlSetValues contained linenum local none off on size table truncate
|
||||
syn match sqlSetValues contained "\<\(ea\w*\|wr\w*\|imm\w*\|trace\w*\|expl\w*\|stat\w*\)\>"
|
||||
syn match sqlSetValues contained "\<\(intermed\w*\|pre\w*\|unl\w*\|for\w*\|wra\w*\|wor\w\?\)\>"
|
||||
syn match sqlSetValues contained "\<\(vis\w*\|inv\w*\)\>"
|
||||
syn match sqlSetValues contained "\<\(\(un\)\?ordered\)\>"
|
||||
|
||||
" Stolen from sh.vim.
|
||||
if !exists("sh_minlines")
|
||||
let sh_minlines = 200
|
||||
endif
|
||||
if !exists("sh_maxlines")
|
||||
let sh_maxlines = 2 * sh_minlines
|
||||
endif
|
||||
exec "syn sync minlines=" . sh_minlines . " maxlines=" . sh_maxlines
|
||||
|
||||
" Define the default highlighting.
|
||||
" For version 5.7 and earlier: only when not done already
|
||||
" For version 5.8 and later: only when an item doesn't have highlighting yet
|
||||
if version >= 508 || !exists("did_sql_syn_inits")
|
||||
if version < 508
|
||||
let did_sql_syn_inits = 1
|
||||
command -nargs=+ HiLink hi link <args>
|
||||
else
|
||||
command -nargs=+ HiLink hi def link <args>
|
||||
endif
|
||||
|
||||
HiLink sqlComment Comment
|
||||
HiLink sqlError Error
|
||||
HiLink sqlFunction Function
|
||||
HiLink sqlUnknownFunc Exception
|
||||
HiLink sqlKeyword Special
|
||||
HiLink sqlConditional Conditional
|
||||
HiLink sqlNumber Number
|
||||
HiLink sqlOperator Operator
|
||||
HiLink sqlParen Comment
|
||||
HiLink sqlParenEmpty Operator
|
||||
HiLink sqlParenFunc Function
|
||||
HiLink sqlSpecial Keyword
|
||||
HiLink sqlStatement Statement
|
||||
HiLink sqlString String
|
||||
HiLink sqlTodo Todo
|
||||
HiLink sqlType Type
|
||||
HiLink sqlVariable Identifier
|
||||
|
||||
HiLink sqlAnyString sqlString
|
||||
HiLink sqlAnyVariable sqlVariable
|
||||
HiLink sqlSetOptions Operator
|
||||
HiLink sqlSetValues Special
|
||||
|
||||
delcommand HiLink
|
||||
endif
|
||||
|
||||
let b:current_syntax = "sql"
|
|
@ -0,0 +1,67 @@
|
|||
" File: todo.txt.vim
|
||||
" Description: Todo.txt syntax settings
|
||||
" Author: Leandro Freitas <freitass@gmail.com>
|
||||
" License: Vim license
|
||||
" Website: http://github.com/freitass/todo.txt-vim
|
||||
" Version: 0.3
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
syntax match TodoDone '^[xX]\s.\+$'
|
||||
syntax match TodoPriorityA '^([aA])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate
|
||||
syntax match TodoPriorityB '^([bB])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate
|
||||
syntax match TodoPriorityC '^([cC])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate
|
||||
syntax match TodoPriorityD '^([dD])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate
|
||||
syntax match TodoPriorityE '^([eE])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate
|
||||
syntax match TodoPriorityF '^([fF])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate
|
||||
syntax match TodoPriorityG '^([gG])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate
|
||||
syntax match TodoPriorityH '^([hH])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate
|
||||
syntax match TodoPriorityI '^([iI])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate
|
||||
syntax match TodoPriorityJ '^([jJ])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate
|
||||
syntax match TodoPriorityK '^([kK])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate
|
||||
syntax match TodoPriorityL '^([lL])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate
|
||||
syntax match TodoPriorityM '^([mM])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate
|
||||
syntax match TodoPriorityN '^([nN])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate
|
||||
syntax match TodoPriorityO '^([oO])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate
|
||||
syntax match TodoPriorityP '^([pP])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate
|
||||
syntax match TodoPriorityQ '^([qQ])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate
|
||||
syntax match TodoPriorityR '^([rR])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate
|
||||
syntax match TodoPriorityS '^([sS])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate
|
||||
syntax match TodoPriorityT '^([tT])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate
|
||||
syntax match TodoPriorityU '^([uU])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate
|
||||
syntax match TodoPriorityV '^([vV])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate
|
||||
syntax match TodoPriorityW '^([wW])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate
|
||||
syntax match TodoPriorityX '^([xX])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate
|
||||
syntax match TodoPriorityY '^([yY])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate
|
||||
syntax match TodoPriorityZ '^([zZ])\s.\+$' contains=TodoDate,TodoProject,TodoContext,OverDueDate
|
||||
|
||||
syntax match TodoDate '\d\{2,4\}-\d\{2\}-\d\{2\}' contains=NONE
|
||||
syntax match TodoProject '\(^\|\W\)+[^[:blank:]]\+' contains=NONE
|
||||
syntax match TodoContext '\(^\|\W\)@[^[:blank:]]\+' contains=NONE
|
||||
|
||||
" Other priority colours might be defined by the user
|
||||
highlight default link TodoDone Comment
|
||||
highlight default link TodoPriorityA Constant
|
||||
highlight default link TodoPriorityB Statement
|
||||
highlight default link TodoPriorityC Identifier
|
||||
highlight default link TodoDate PreProc
|
||||
highlight default link TodoProject Special
|
||||
highlight default link TodoContext Special
|
||||
|
||||
if exists('g:todo_load_python') && g:todo_load_python
|
||||
if has('python')
|
||||
let b:curdir = expand('<sfile>:p:h')
|
||||
let s:script_dir = b:curdir . "/python/"
|
||||
execute "pyfile " . s:script_dir. "todo.py"
|
||||
elseif has('python3')
|
||||
let b:curdir = expand('<sfile>:p:h')
|
||||
let s:script_dir = b:curdir . "/python/"
|
||||
execute "py3file " . s:script_dir. "todo.py"
|
||||
else
|
||||
echom "Your version of vim has no python support. Overdue dates won't be highlighted"
|
||||
endif
|
||||
endif
|
||||
|
||||
let b:current_syntax = "todo"
|
|
@ -0,0 +1,28 @@
|
|||
# lorem_ipsum
|
||||
example task
|
||||
# end_lorem_ipsum
|
||||
|
||||
# date_after_priority
|
||||
(A) Call Mom
|
||||
# end_date_after_priority
|
||||
|
||||
# date_after_priority_visual
|
||||
(A) Call Mom
|
||||
(B) Call Dad
|
||||
# end_date_after_priority_visual
|
||||
|
||||
# existing_date_no_priority
|
||||
2014-05-06 example task
|
||||
# end_existing_date_no_priority
|
||||
|
||||
# existing_date_after_priority
|
||||
(A) 2014-05-06 Call Mom
|
||||
# end_existing_date_after_priority
|
||||
|
||||
# existing_date_do_nothing
|
||||
2014-05-06 example task
|
||||
# end_existing_date_do_nothing
|
||||
|
||||
# non_existing_date_do_nothing
|
||||
new todo line
|
||||
# end_non_existing_date_do_nothing
|
|
@ -0,0 +1,84 @@
|
|||
let s:here = expand('<sfile>:p:h')
|
||||
let s:context = todo#txt#__context__()
|
||||
let s:context['data'] = s:here . '/tc_date.todo.txt'
|
||||
let s:tc = unittest#testcase#new('Date', s:context)
|
||||
|
||||
let s:TODAY = strftime("%Y-%m-%d")
|
||||
|
||||
function! s:tc.test_current_date()
|
||||
call self.assert_equal(s:TODAY, self.call('s:get_current_date', []))
|
||||
endfunction
|
||||
|
||||
let s:DATE_INSERTED = [
|
||||
\ s:TODAY . ' example task',
|
||||
\ ]
|
||||
|
||||
let s:DATE_INSERTED_AFTER_PRIORITY = [
|
||||
\ '(A) ' . s:TODAY . ' Call Mom',
|
||||
\ ]
|
||||
|
||||
let s:DATE_INSERTED_AFTER_PRIORITY_VISUAL = [
|
||||
\ '(A) ' . s:TODAY . ' Call Mom',
|
||||
\ '(B) ' . s:TODAY . ' Call Dad',
|
||||
\ ]
|
||||
|
||||
let s:DATE_INSERTED_DO_NOTHING = [
|
||||
\ '2014-05-06 example task',
|
||||
\ ]
|
||||
|
||||
let s:NON_EXISTING_DATE_INSERTED_DO_NOTHING = [
|
||||
\ s:TODAY . ' new todo line',
|
||||
\ ]
|
||||
|
||||
function! s:tc.test_insert_date_normal_mode()
|
||||
call self.data.goto('lorem_ipsum')
|
||||
call todo#txt#replace_date()
|
||||
call self.assert_equal(s:DATE_INSERTED, self.data.get('lorem_ipsum'))
|
||||
endfunction
|
||||
|
||||
function! s:tc.test_insert_date_insert_mode()
|
||||
call self.data.goto('lorem_ipsum')
|
||||
execute 'normal idate '
|
||||
call self.assert_equal(s:DATE_INSERTED, self.data.get('lorem_ipsum'))
|
||||
endfunction
|
||||
|
||||
function! s:tc.test_insert_date_visual_mode()
|
||||
call self.data.visual_execute('call todo#txt#replace_date()', 'lorem_ipsum')
|
||||
call self.assert_equal(s:DATE_INSERTED, self.data.get('lorem_ipsum'))
|
||||
endfunction
|
||||
|
||||
function! s:tc.test_insert_date_after_priority_normal_mode()
|
||||
call self.data.execute('call todo#txt#replace_date()', 'date_after_priority')
|
||||
call self.assert_equal(s:DATE_INSERTED_AFTER_PRIORITY, self.data.get('date_after_priority'))
|
||||
endfunction
|
||||
|
||||
function! s:tc.test_insert_date_after_priority_visual_mode()
|
||||
call self.data.visual_execute('call todo#txt#replace_date()', 'date_after_priority_visual')
|
||||
call self.assert_equal(s:DATE_INSERTED_AFTER_PRIORITY_VISUAL, self.data.get('date_after_priority_visual'))
|
||||
endfunction
|
||||
|
||||
function! s:tc.test_insert_with_existing_date()
|
||||
call self.data.execute('call todo#txt#replace_date()', 'existing_date_no_priority')
|
||||
call self.assert_equal(s:DATE_INSERTED, self.data.get('existing_date_no_priority'))
|
||||
endfunction
|
||||
|
||||
function! s:tc.test_insert_with_existing_date_and_priority()
|
||||
call self.data.execute('call todo#txt#replace_date()', 'existing_date_after_priority')
|
||||
call self.assert_equal(s:DATE_INSERTED_AFTER_PRIORITY, self.data.get('existing_date_after_priority'))
|
||||
endfunction
|
||||
|
||||
function! s:tc.test_insert_with_existing_date_and_priority()
|
||||
let g:todo_existing_date = 'n'
|
||||
call self.data.execute('call todo#txt#replace_date()', 'existing_date_do_nothing')
|
||||
call self.assert_equal(s:DATE_INSERTED_DO_NOTHING, self.data.get('existing_date_do_nothing'))
|
||||
unlet g:todo_existing_date
|
||||
endfunction
|
||||
|
||||
function! s:tc.test_insert_with_existing_date_and_priority()
|
||||
let g:todo_existing_date = 'n'
|
||||
call self.data.execute('call todo#txt#replace_date()', 'non_existing_date_do_nothing')
|
||||
call self.assert_equal(s:NON_EXISTING_DATE_INSERTED_DO_NOTHING, self.data.get('non_existing_date_do_nothing'))
|
||||
unlet g:todo_existing_date
|
||||
endfunction
|
||||
|
||||
unlet s:tc
|
|
@ -0,0 +1,5 @@
|
|||
# lorem_ipsum
|
||||
first task to be marked as done
|
||||
second task to be marked as done
|
||||
2015-05-20 third task to be marked as done
|
||||
# end_lorem_ipsum
|
|
@ -0,0 +1,36 @@
|
|||
let s:here = expand('<sfile>:p:h')
|
||||
let s:context = todo#txt#__context__()
|
||||
let s:context['data'] = s:here . '/tc_mark_as_done.todo.txt'
|
||||
let s:tc = unittest#testcase#new('Mark As Done', s:context)
|
||||
|
||||
let s:TODAY = strftime("%Y-%m-%d")
|
||||
|
||||
let s:FIRST_TASK_DONE = [
|
||||
\ 'x ' . s:TODAY . ' first task to be marked as done',
|
||||
\ 'second task to be marked as done',
|
||||
\ '2015-05-20 third task to be marked as done',
|
||||
\ ]
|
||||
|
||||
let s:ALL_TASKS_DONE = [
|
||||
\ 'x ' . s:TODAY . ' first task to be marked as done',
|
||||
\ 'x ' . s:TODAY . ' second task to be marked as done',
|
||||
\ 'x ' . s:TODAY . ' 2015-05-20 third task to be marked as done',
|
||||
\ ]
|
||||
|
||||
function! s:tc.test_mark_as_done()
|
||||
call self.data.goto('lorem_ipsum')
|
||||
call todo#txt#mark_as_done()
|
||||
call self.assert_equal(s:FIRST_TASK_DONE, self.data.get('lorem_ipsum'))
|
||||
endfunction
|
||||
|
||||
function! s:tc.test_mark_range_as_done()
|
||||
call self.data.execute('call todo#txt#mark_as_done()', 'lorem_ipsum')
|
||||
call self.assert_equal(s:ALL_TASKS_DONE, self.data.get('lorem_ipsum'))
|
||||
endfunction
|
||||
|
||||
function! s:tc.test_mark_selection_as_done()
|
||||
call self.data.visual_execute('call todo#txt#mark_as_done()', 'lorem_ipsum')
|
||||
call self.assert_equal(s:ALL_TASKS_DONE, self.data.get('lorem_ipsum'))
|
||||
endfunction
|
||||
|
||||
unlet s:tc
|
|
@ -0,0 +1,7 @@
|
|||
# insert_priority
|
||||
example task
|
||||
# end_insert_priority
|
||||
|
||||
# replace_priority
|
||||
(A) example task
|
||||
# end_replace_priority
|
|
@ -0,0 +1,28 @@
|
|||
let s:here = expand('<sfile>:p:h')
|
||||
let s:context = todo#txt#__context__()
|
||||
let s:context['data'] = s:here . '/tc_priority.todo.txt'
|
||||
let s:tc = unittest#testcase#new('Priority', s:context)
|
||||
|
||||
let s:TODAY = strftime("%Y-%m-%d")
|
||||
|
||||
let s:PRIORITY_INSERTED = [
|
||||
\ '(A) example task',
|
||||
\ ]
|
||||
|
||||
let s:PRIORITY_REPLACED = [
|
||||
\ '(C) example task',
|
||||
\ ]
|
||||
|
||||
function! s:tc.test_insert_priority()
|
||||
call self.data.goto('insert_priority')
|
||||
call todo#txt#prioritize_add('A')
|
||||
call self.assert_equal(s:PRIORITY_INSERTED, self.data.get('insert_priority'))
|
||||
endfunction
|
||||
|
||||
function! s:tc.test_replace_priority()
|
||||
call self.data.goto('replace_priority')
|
||||
call todo#txt#prioritize_add('C')
|
||||
call self.assert_equal(s:PRIORITY_REPLACED, self.data.get('replace_priority'))
|
||||
endfunction
|
||||
|
||||
unlet s:tc
|
|
@ -0,0 +1,5 @@
|
|||
# lorem_ipsum
|
||||
(B) Linear regression Rnet=Qh@Qle. @cons_emp_model
|
||||
(B) Review key questions. @benchmarking
|
||||
(A) simple model first @cons_emp_model
|
||||
# end_lorem_ipsum
|
|
@ -0,0 +1,18 @@
|
|||
let s:here = expand('<sfile>:p:h')
|
||||
let s:tc = unittest#testcase#new('Sort Context',
|
||||
\ { 'data': s:here . '/tc_sort_context.todo.txt' })
|
||||
|
||||
let s:LEADER = mapleader
|
||||
|
||||
let s:SORTED_TASKS = [
|
||||
\ '(B) Review key questions. @benchmarking',
|
||||
\ '(B) Linear regression Rnet=Qh@Qle. @cons_emp_model',
|
||||
\ '(A) simple model first @cons_emp_model',
|
||||
\ ]
|
||||
|
||||
function! s:tc.test_sort_by_context()
|
||||
call self.data.visual_execute('call todo#txt#sort_by_context()', 'lorem_ipsum')
|
||||
call self.assert_equal(s:SORTED_TASKS, self.data.get('lorem_ipsum'))
|
||||
endfunction
|
||||
|
||||
unlet s:tc
|
|
@ -0,0 +1,12 @@
|
|||
# lorem_ipsum
|
||||
(B) 2013-03-15 2015-03-17
|
||||
(B) 2012-04-16 2015-04-16
|
||||
(A) 2013-03-16 2013-03-10
|
||||
# end_lorem_ipsum
|
||||
# task_with_no_date
|
||||
2013-03-15 task with date
|
||||
task with no date
|
||||
2013-03-15 task with date
|
||||
2013-03-15 task with date
|
||||
task with no date
|
||||
# end_task_with_no_date
|
|
@ -0,0 +1,31 @@
|
|||
let s:here = expand('<sfile>:p:h')
|
||||
let s:tc = unittest#testcase#new('Sort Date',
|
||||
\ { 'data': s:here . '/tc_sort_date.todo.txt' })
|
||||
|
||||
let s:LEADER = mapleader
|
||||
|
||||
let s:SORTED_TASKS = [
|
||||
\ '(B) 2012-04-16 2015-04-16',
|
||||
\ '(B) 2013-03-15 2015-03-17',
|
||||
\ '(A) 2013-03-16 2013-03-10',
|
||||
\ ]
|
||||
|
||||
let s:SORTED_TASKS_WITH_NO_DATE = [
|
||||
\ '2013-03-15 task with date',
|
||||
\ '2013-03-15 task with date',
|
||||
\ '2013-03-15 task with date',
|
||||
\ 'task with no date',
|
||||
\ 'task with no date',
|
||||
\ ]
|
||||
|
||||
function! s:tc.test_sort_by_date()
|
||||
call self.data.visual_execute('call todo#txt#sort_by_date()', 'lorem_ipsum')
|
||||
call self.assert_equal(s:SORTED_TASKS, self.data.get('lorem_ipsum'))
|
||||
endfunction
|
||||
|
||||
function! s:tc.test_sort_by_date_with_tasks_without_date()
|
||||
call self.data.visual_execute('call todo#txt#sort_by_date()', 'task_with_no_date')
|
||||
call self.assert_equal(s:SORTED_TASKS_WITH_NO_DATE, self.data.get('task_with_no_date'))
|
||||
endfunction
|
||||
|
||||
unlet s:tc
|
|
@ -0,0 +1,5 @@
|
|||
# lorem_ipsum
|
||||
(B) Linear regression Rnet=Qh+Qle. +cons_emp_model
|
||||
(B) Review key questions. +benchmarking
|
||||
(A) simple model first +cons_emp_model
|
||||
# end_lorem_ipsum
|
|
@ -0,0 +1,18 @@
|
|||
let s:here = expand('<sfile>:p:h')
|
||||
let s:tc = unittest#testcase#new('Sort Project',
|
||||
\ { 'data': s:here . '/tc_sort_project.todo.txt' })
|
||||
|
||||
let s:LEADER = mapleader
|
||||
|
||||
let s:SORTED_TASKS = [
|
||||
\ '(B) Review key questions. +benchmarking',
|
||||
\ '(B) Linear regression Rnet=Qh+Qle. +cons_emp_model',
|
||||
\ '(A) simple model first +cons_emp_model',
|
||||
\ ]
|
||||
|
||||
function! s:tc.test_sort_by_project()
|
||||
call self.data.visual_execute('call todo#txt#sort_by_project()', 'lorem_ipsum')
|
||||
call self.assert_equal(s:SORTED_TASKS, self.data.get('lorem_ipsum'))
|
||||
endfunction
|
||||
|
||||
unlet s:tc
|
|
@ -0,0 +1 @@
|
|||
2014-11-01 Find a way to import text into markdown and vim doc @doc
|
23
vim/.vimrc
23
vim/.vimrc
|
@ -1,10 +1,33 @@
|
|||
filetype plugin indent on
|
||||
syntax on
|
||||
set autoindent
|
||||
set smartindent
|
||||
set number
|
||||
set relativenumber
|
||||
set keymap=vietnamese-telex imdisable iminsert=0 imsearch=-1
|
||||
set dictionary=/usr/share/dict/american
|
||||
|
||||
" packadd! dracula
|
||||
" syntax enable
|
||||
" colorscheme dracula
|
||||
|
||||
autocmd BufEnter * colorscheme koehler
|
||||
autocmd BufEnter *.md colorscheme delek
|
||||
autocmd FileType rst setlocal shiftwidth=3
|
||||
|
||||
call plug#begin()
|
||||
Plug 'lervag/vimtex'
|
||||
Plug 'chrisbra/csv.vim'
|
||||
call plug#end()
|
||||
|
||||
" For minted
|
||||
let g:vimtex_compiler_latexmk = {
|
||||
\ 'options' : [
|
||||
\ '-pdf',
|
||||
\ '-shell-escape',
|
||||
\ '-verbose',
|
||||
\ '-file-line-error',
|
||||
\ '-synctex=1',
|
||||
\ '-interaction=nonstopmode',
|
||||
\ ],
|
||||
\}
|
||||
|
|
Loading…
Reference in New Issue