Compare commits
43 commits
54381c1f0c
...
888cdf0997
Author | SHA1 | Date | |
---|---|---|---|
![]() |
888cdf0997 | ||
![]() |
a43b588a31 | ||
![]() |
a6cb69e14d | ||
![]() |
34ede8a130 | ||
![]() |
e5cc0fee69 | ||
![]() |
3c0a1de6b3 | ||
![]() |
fa0d7ff175 | ||
![]() |
6a1e21edd6 | ||
![]() |
9ffcf69aa8 | ||
![]() |
84d637e039 | ||
![]() |
df3a95a0a0 | ||
![]() |
7fa0a59b74 | ||
![]() |
a5d1c7c2e5 | ||
![]() |
3547ce5840 | ||
![]() |
327369d4eb | ||
![]() |
450acd25d3 | ||
![]() |
1426bceb39 | ||
![]() |
cee8b5a21e | ||
![]() |
196fe7fe5c | ||
![]() |
dfbd85f366 | ||
![]() |
61b1bbaf0e | ||
![]() |
8534eab109 | ||
![]() |
edb0f0774c | ||
![]() |
2598b15d21 | ||
![]() |
95da0d61e8 | ||
![]() |
e7154d9e16 | ||
![]() |
9729640018 | ||
![]() |
995ac9fece | ||
![]() |
1c9e85dbdf | ||
![]() |
c3d53fecd0 | ||
![]() |
53f2c3e035 | ||
![]() |
753572bb43 | ||
![]() |
b4415e5abf | ||
![]() |
2590494861 | ||
![]() |
90bcbedbee | ||
![]() |
1c025b6f4a | ||
![]() |
20d213ff10 | ||
![]() |
32c1b02ebe | ||
![]() |
1caefe331e | ||
![]() |
f96777c213 | ||
![]() |
89f5804513 | ||
![]() |
353d99146d | ||
![]() |
553158db13 |
9
.bash_profile
Normal file
|
@ -0,0 +1,9 @@
|
|||
#
|
||||
# ~/.bash_profile
|
||||
#
|
||||
|
||||
|
||||
[[ -f ~/.bashrc ]] && . ~/.bashrc
|
||||
|
||||
# [ -z "$DISPLAY" ] &&
|
||||
[ `tty` = '/dev/tty1' ] && exec dbus-run-session Hyprland
|
53
.bashrc
Normal file
|
@ -0,0 +1,53 @@
|
|||
# ~/.bashrc
|
||||
# If not running interactively, don't do anything
|
||||
[[ $- != *i* ]] && return
|
||||
# alias ls='ls --color=auto'
|
||||
export EDITOR=vim
|
||||
set -o vi
|
||||
alias phone="sudo jmtpfs -o allow_other ~/fleshic"
|
||||
alias lh="last | head"
|
||||
alias nano=vim
|
||||
alias VIM="vim -u ~/.vim/essential.vim"
|
||||
alias ed="ed -p '> ' -v"
|
||||
alias ultitex="cd ~/.vim/UltiSnips/tex"
|
||||
alias ulti="cd ~/.vim/UltiSnips"
|
||||
export PATH="$HOME/.local/bin:$HOME/bin:$PATH"
|
||||
export HISTCONTROL=ignorespace
|
||||
export HISTSIZE=10000
|
||||
export QT_QPA_PLATFORM=wayland
|
||||
export QT_QPA_PLATFORM=xcb
|
||||
export QT_QPA_PLATFORMTHEME=qt5ct
|
||||
export GOPATH="$HOME/.local/go"
|
||||
export PATH="$GOPATH/bin:$PATH"
|
||||
export GOPATH="$GOPATH:$HOME/projects/working/go"
|
||||
export GOPROXY="direct"
|
||||
export CLASSPATH=".:/usr/share/java/antlr-complete.jar:$CLASSPATH"
|
||||
export PATH="$HOME/.cargo/bin/:$PATH"
|
||||
export GEM_HOME=$(gem env user_gemhome)
|
||||
export PATH="$GEM_HOME/bin:$PATH"
|
||||
export PATH="$HOME/down/pkgs/flutter/bin:$PATH"
|
||||
export MOZ_ENABLE_WAYLAND=1
|
||||
osc7_cwd() {
|
||||
local strlen=${#PWD}
|
||||
local encoded=""
|
||||
local pos c o
|
||||
for (( pos=0; pos<strlen; pos++ )); do
|
||||
c=${PWD:$pos:1}
|
||||
case "$c" in
|
||||
[-/:_.!\'\(\)~[:alnum:]] ) o="${c}" ;;
|
||||
* ) printf -v o '%%%02X' "'${c}" ;;
|
||||
esac
|
||||
encoded+="${o}"
|
||||
done
|
||||
printf '\e]7;file://%s%s\e\\' "${HOSTNAME}" "${encoded}"
|
||||
PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }osc7_cwd
|
||||
alias ranger=". ranger"
|
||||
alias r="ranger"
|
||||
alias tremc="tremc -X"
|
||||
alias mount-user="mount -o umask=000"
|
||||
alias ida="QT_QPA_PLATFORM=xcb ida64"
|
||||
alias binaryninja="/opt/binaryninja-free/binaryninja"
|
||||
|
||||
export BORG_REPO=/run/media/kappa/Transcend
|
||||
|
||||
eval "$(rbenv init -)"
|
3
.config/MangoHud/.github/README.md
vendored
|
@ -1,3 +0,0 @@
|
|||
<div align="center">
|
||||
<a href=""><img src="./title.png"></a>
|
||||
</div>
|
BIN
.config/MangoHud/.github/title.png
vendored
Before Width: | Height: | Size: 24 KiB |
|
@ -1,358 +0,0 @@
|
|||
### MangoHud configuration file
|
||||
### Uncomment any options you wish to enable. Default options are left uncommented
|
||||
### Use some_parameter=0 to disable a parameter (only works with on/off parameters)
|
||||
### Everything below can be used / overridden with the environment variable MANGOHUD_CONFIG instead
|
||||
|
||||
################ INFORMATIONAL #################
|
||||
## prints possible options on stdout
|
||||
# help
|
||||
|
||||
################ PERFORMANCE #################
|
||||
|
||||
### Limit the application FPS. Comma-separated list of one or more FPS values (e.g. 0,30,60). 0 means unlimited (unless VSynced)
|
||||
# fps_limit=0
|
||||
|
||||
### early = wait before present, late = wait after present
|
||||
# fps_limit_method=
|
||||
|
||||
### VSync [0-3] 0 = adaptive; 1 = off; 2 = mailbox; 3 = on
|
||||
# vsync=-1
|
||||
|
||||
### OpenGL VSync [0-N] 0 = off; >=1 = wait for N v-blanks, N > 1 acts as a FPS limiter (FPS = display refresh rate / N)
|
||||
# gl_vsync=-2
|
||||
|
||||
### Mip-map LoD bias. Negative values will increase texture sharpness (and aliasing)
|
||||
## Positive values will increase texture blurriness (-16 to 16)
|
||||
# picmip=-17
|
||||
|
||||
### Anisotropic filtering level. Improves sharpness of textures viewed at an angle (0 to 16)
|
||||
# af=-1
|
||||
|
||||
### Force bicubic filtering
|
||||
# bicubic
|
||||
|
||||
### Force trilinear filtering
|
||||
# trilinear
|
||||
|
||||
### Disable linear texture filtering. Makes textures look blocky
|
||||
# retro
|
||||
|
||||
################### VISUAL ###################
|
||||
|
||||
### Legacy layout
|
||||
# legacy_layout=0
|
||||
|
||||
### pre defined presets
|
||||
# -1 = default
|
||||
# 0 = no display
|
||||
# 1 = fps only
|
||||
# 2 = horizontal view
|
||||
# 3 = extended
|
||||
# 4 = high detailed information
|
||||
# preset=-1
|
||||
|
||||
### Enable most of the toggleable parameters (currently excludes `histogram`)
|
||||
# full
|
||||
|
||||
### Show FPS only. ***Not meant to be used with other display params***
|
||||
# fps_only
|
||||
|
||||
### Display custom centered text, useful for a header
|
||||
# custom_text_center=
|
||||
|
||||
### Display the current system time
|
||||
# time
|
||||
## removes the time label
|
||||
# time_no_label
|
||||
|
||||
### Time formatting examples
|
||||
## %H:%M
|
||||
## [ %T %F ]
|
||||
## %X # locally formatted time, because of limited glyph range, missing characters may show as '?' (e.g. Japanese)
|
||||
# time_format="%T"
|
||||
|
||||
### Display MangoHud version
|
||||
# version
|
||||
|
||||
### Display the current GPU information
|
||||
## Note: gpu_mem_clock and gpu_mem_temp also need "vram" to be enabled
|
||||
gpu_stats
|
||||
gpu_temp
|
||||
# gpu_junction_temp
|
||||
# gpu_core_clock
|
||||
# gpu_mem_temp
|
||||
# gpu_mem_clock
|
||||
# gpu_power
|
||||
# gpu_text=
|
||||
# gpu_load_change
|
||||
# gpu_load_value=60,90
|
||||
# gpu_load_color=39F900,FDFD09,B22222
|
||||
## GPU fan in rpm on AMD, FAN in percent on NVIDIA
|
||||
# gpu_fan
|
||||
## gpu_voltage only works on AMD GPUs
|
||||
# gpu_voltage
|
||||
|
||||
### Display the current CPU information
|
||||
cpu_stats
|
||||
cpu_temp
|
||||
# cpu_power
|
||||
# cpu_text=
|
||||
# cpu_mhz
|
||||
# cpu_load_change
|
||||
# cpu_load_value=60,90
|
||||
# cpu_load_color=39F900,FDFD09,B22222
|
||||
|
||||
### Display the current CPU load & frequency for each core
|
||||
# core_load
|
||||
# core_load_change
|
||||
|
||||
### Display IO read and write for the app (not system)
|
||||
# io_read
|
||||
# io_write
|
||||
|
||||
### Display system vram / ram / swap space usage
|
||||
# vram
|
||||
# ram
|
||||
# swap
|
||||
|
||||
### Display per process memory usage
|
||||
## Show resident memory and other types, if enabled
|
||||
# procmem
|
||||
# procmem_shared
|
||||
# procmem_virt
|
||||
|
||||
### Display battery information
|
||||
# battery
|
||||
# battery_icon
|
||||
# device_battery=gamepad,mouse
|
||||
# device_battery_icon
|
||||
# battery_watt
|
||||
# battery_time
|
||||
|
||||
### Display FPS and frametime
|
||||
fps
|
||||
# fps_sampling_period=500
|
||||
# fps_color_change
|
||||
# fps_value=30,60
|
||||
# fps_color=B22222,FDFD09,39F900
|
||||
frametime
|
||||
# frame_count
|
||||
## fps_metrics takes a list of decimal values or the value avg
|
||||
# fps_metrics=avg,0.01
|
||||
|
||||
### Display GPU throttling status based on Power, current, temp or "other"
|
||||
## Only shows if throttling is currently happening
|
||||
throttling_status
|
||||
## Same as throttling_status but displays throttling on the frametime graph
|
||||
#throttling_status_graph
|
||||
|
||||
### Display miscellaneous information
|
||||
# engine_version
|
||||
# engine_short_names
|
||||
# gpu_name
|
||||
# vulkan_driver
|
||||
# wine
|
||||
# exec_name
|
||||
# winesync
|
||||
|
||||
### Display loaded MangoHud architecture
|
||||
# arch
|
||||
|
||||
### Display the frametime line graph
|
||||
frame_timing
|
||||
# histogram
|
||||
|
||||
### Display GameMode / vkBasalt running status
|
||||
# gamemode
|
||||
# vkbasalt
|
||||
|
||||
### Gamescope related options
|
||||
## Display the status of FSR (only works in gamescope)
|
||||
# fsr
|
||||
## Hides the sharpness info for the `fsr` option (only available in gamescope)
|
||||
# hide_fsr_sharpness
|
||||
## Shows the graph of gamescope app frametimes and latency (only on gamescope obviously)
|
||||
# debug
|
||||
## Display the status of HDR (only works in gamescope)
|
||||
# hdr
|
||||
## Display the current refresh rate (only works in gamescope)
|
||||
# refresh_rate
|
||||
|
||||
|
||||
### graphs displays one or more graphs that you chose
|
||||
## seperated by ",", available graphs are
|
||||
## gpu_load,cpu_load,gpu_core_clock,gpu_mem_clock,vram,ram,cpu_temp,gpu_temp
|
||||
# graphs=
|
||||
|
||||
### mangoapp related options
|
||||
## Enables mangoapp to be displayed above the Steam UI
|
||||
# mangoapp_steam
|
||||
|
||||
### Steam Deck options
|
||||
## Shows the Steam Deck fan rpm
|
||||
# fan
|
||||
|
||||
### Display current FPS limit
|
||||
# show_fps_limit
|
||||
|
||||
### Display the current resolution
|
||||
# resolution
|
||||
|
||||
### Display custom text
|
||||
# custom_text=
|
||||
### Display output of Bash command in next column
|
||||
# exec=
|
||||
|
||||
### Display media player metadata
|
||||
# media_player
|
||||
## for example spotify
|
||||
# media_player_name=
|
||||
## Format metadata, lines are delimited by ; (wip)
|
||||
## example: {title};{artist};{album}
|
||||
## example: Track:;{title};By:;{artist};From:;{album}
|
||||
# media_player_format=title,artist,album
|
||||
|
||||
### Network interface throughput
|
||||
# network
|
||||
## Network can take arguments but it's not required.
|
||||
## without arguments it shows all interfaces
|
||||
## arguments set which interfaces will be displayed
|
||||
# network=eth0,wlo1
|
||||
|
||||
|
||||
### Change the hud font size
|
||||
font_size=22
|
||||
# font_scale=1.0
|
||||
# font_size_text=24
|
||||
# font_scale_media_player=0.55
|
||||
# no_small_font
|
||||
|
||||
### Change default font (set location to TTF/OTF file)
|
||||
## Set font for the whole hud
|
||||
font_file=/usr/share/fonts/MapleMono-NF-unhinted/MapleMono-NF-Regular.ttf
|
||||
|
||||
## Set font only for text like media player metadata
|
||||
# font_file_text=
|
||||
|
||||
## Set font glyph ranges. Defaults to Latin-only. Don't forget to set font_file/font_file_text to font that supports these
|
||||
## Probably don't enable all at once because of memory usage and hardware limits concerns
|
||||
## If you experience crashes or text is just squares, reduce glyph range or reduce font size
|
||||
# font_glyph_ranges=korean,chinese,chinese_simplified,japanese,cyrillic,thai,vietnamese,latin_ext_a,latin_ext_b
|
||||
|
||||
### Outline text
|
||||
text_outline
|
||||
# text_outline_color = 000000
|
||||
# text_outline_thickness = 1.5
|
||||
|
||||
### Change the hud position
|
||||
position=top-right
|
||||
|
||||
### Change the corner roundness
|
||||
round_corners=10
|
||||
|
||||
### Remove margins around MangoHud
|
||||
# hud_no_margin
|
||||
|
||||
### Display compact version of MangoHud
|
||||
# hud_compact
|
||||
|
||||
### Display MangoHud in a horizontal position
|
||||
# horizontal
|
||||
# horizontal_stretch
|
||||
|
||||
### Disable / hide the hud by default
|
||||
no_display
|
||||
|
||||
### Hud position offset
|
||||
# offset_x=0
|
||||
# offset_y=0
|
||||
|
||||
### Hud dimensions
|
||||
# width=0
|
||||
# height=140
|
||||
# table_columns=3
|
||||
# cellpadding_y=-0.085
|
||||
|
||||
### Hud transparency / alpha
|
||||
# background_alpha=0.5
|
||||
# alpha=1.0
|
||||
|
||||
### FCAT overlay
|
||||
### This enables an FCAT overlay to perform frametime analysis on the final image stream.
|
||||
### Enable the overlay
|
||||
# fcat
|
||||
### Set the width of the FCAT overlay.
|
||||
### 24 is a performance optimization on AMD GPUs that should not have adverse effects on nVidia GPUs.
|
||||
### A minimum of 20 pixels is recommended by nVidia.
|
||||
# fcat_overlay_width=24
|
||||
### Set the screen edge, this can be useful for special displays that don't update from top edge to bottom. This goes from 0 (left side) to 3 (top edge), counter-clockwise.
|
||||
# fcat_screen_edge=0
|
||||
|
||||
### Color customization
|
||||
text_color=cad3f5
|
||||
gpu_color=a6da95
|
||||
cpu_color=8aadf4
|
||||
# vram_color=AD64C1
|
||||
# ram_color=C26693
|
||||
engine_color=ed8796
|
||||
# io_color=A491D3
|
||||
frametime_color=eed49f
|
||||
background_color=181926
|
||||
# media_player_color=FFFFFF
|
||||
# wine_color=EB5B5B
|
||||
# battery_color=FF9078
|
||||
|
||||
### Specify GPU with PCI bus ID for AMDGPU and NVML stats
|
||||
### Set to 'domain:bus:slot.function'
|
||||
# pci_dev=0:0a:0.0
|
||||
|
||||
### Blacklist
|
||||
# blacklist=
|
||||
|
||||
### Control over socket
|
||||
### Enable and set socket name, '%p' is replaced with process id
|
||||
## example: mangohud
|
||||
## example: mangohud-%p
|
||||
# control = -1
|
||||
|
||||
################ WORKAROUNDS #################
|
||||
### Options starting with "gl_*" are for OpenGL
|
||||
### Specify what to use for getting display size. Options are "viewport", "scissorbox" or disabled. Defaults to using glXQueryDrawable
|
||||
# gl_size_query=viewport
|
||||
|
||||
### (Re)bind given framebuffer before MangoHud gets drawn. Helps with Crusader Kings III
|
||||
# gl_bind_framebuffer=0
|
||||
|
||||
### Don't swap origin if using GL_UPPER_LEFT. Helps with Ryujinx
|
||||
# gl_dont_flip=1
|
||||
|
||||
################ INTERACTION #################
|
||||
|
||||
### Change toggle keybinds for the hud & logging
|
||||
toggle_hud=Shift_L+F12
|
||||
# toggle_hud_position=Shift_R+F11
|
||||
# toggle_fps_limit=Shift_L+F1
|
||||
# toggle_logging=Shift_L+F2
|
||||
# reload_cfg=Shift_L+F4
|
||||
# upload_log=Shift_L+F3
|
||||
|
||||
#################### LOG #####################
|
||||
### Automatically start the log after X seconds
|
||||
# autostart_log=
|
||||
### Set amount of time in seconds that the logging will run for
|
||||
# log_duration=
|
||||
### Change the default log interval, 0 is default
|
||||
# log_interval=0
|
||||
### Set location of the output files (required for logging)
|
||||
# output_folder=/home/<USERNAME>/mangologs
|
||||
### Permit uploading logs directly to FlightlessMango.com
|
||||
## set to 1 to enable
|
||||
# permit_upload=0
|
||||
### Define a '+'-separated list of percentiles shown in the benchmark results
|
||||
### Use "AVG" to get a mean average. Default percentiles are 97+AVG+1+0.1
|
||||
## example: ['97', 'AVG', '1', '0.1']
|
||||
# benchmark_percentiles=97,AVG
|
||||
## Adds more headers and information such as versioning to the log. This format is not supported on flightlessmango.com (yet)
|
||||
# log_versioning
|
||||
## Enable automatic uploads of logs to flightlessmango.com
|
||||
# upload_logs
|
|
@ -1126,4 +1126,6 @@
|
|||
],
|
||||
"editor.matchBrackets": "never",
|
||||
"workbench.statusBar.visible": false
|
||||
"dart.flutterSdkPath": "/home/kappa/down/pkgs/flutter",
|
||||
"dart.flutterCustomEmulators": []
|
||||
}
|
||||
|
|
|
@ -68,3 +68,4 @@ SETUVAR fish_pager_color_selected_completion:\x1d
|
|||
SETUVAR fish_pager_color_selected_description:\x1d
|
||||
SETUVAR fish_pager_color_selected_prefix:\x1d
|
||||
SETUVAR fish_user_paths:/home/matt/\x2elocal/share/pnpm\x1e/home/matt/\x2elocal/share/nvim/mason/bin\x1e/home/matt/\x2eyarn/bin\x1e/home/matt/\x2elocal/share/npm/bin\x1e/home/matt/\x2elocal/share/bob/nvim\x2dbin\x1e/home/matt/\x2elocal/share/bun/bin\x1e/usr/lib/go/bin\x1e/usr/lib/rustup/bin\x1e/sbin\x1e/bin\x1e/usr/sbin\x1e/usr/bin\x1e/usr/local/sbin\x1e/usr/local/bin\x1e/home/matt/\x2elocal/share/cargo/bin\x1e/home/matt/\x2elocal/share/go/bin\x1e/home/matt/\x2elocal/bin/color\x2dscripts\x1e/home/matt/\x2elocal/bin
|
||||
SETUVAR fish_user_paths:/home/kappa/bin\x1e/home/kappa/\x2elocal/share/nvim/mason/bin\x1e/home/kappa/\x2elocal/share/go/bin\x1e/home/kappa/\x2elocal/bin/color\x2dscripts\x1e/home/kappa/\x2elocal/bin\x1e/home/matt/\x2elocal/share/pnpm\x1e/home/matt/\x2elocal/share/nvim/mason/bin\x1e/home/matt/\x2eyarn/bin\x1e/home/matt/\x2elocal/share/npm/bin\x1e/home/matt/\x2elocal/share/bob/nvim\x2dbin\x1e/home/matt/\x2elocal/share/bun/bin\x1e/usr/lib/go/bin\x1e/usr/lib/rustup/bin\x1e/sbin\x1e/bin\x1e/usr/sbin\x1e/usr/bin\x1e/usr/local/sbin\x1e/usr/local/bin\x1e/home/matt/\x2elocal/share/cargo/bin\x1e/home/matt/\x2elocal/share/go/bin\x1e/home/matt/\x2elocal/bin/color\x2dscripts\x1e/home/matt/\x2elocal/bin
|
||||
|
|
|
@ -57,10 +57,13 @@ fish_add_path $XDG_DATA_HOME/bob/nvim-bin
|
|||
fish_add_path $XDG_DATA_HOME/npm/bin
|
||||
fish_add_path $XDG_DATA_HOME/nvim/mason/bin
|
||||
fish_add_path $HOME/.yarn/bin
|
||||
fish_add_path $HOME/bin
|
||||
fish_add_path $XDG_DATA_HOME/pnpm
|
||||
|
||||
eval "$(rbenv init -)"
|
||||
|
||||
# Editor
|
||||
set -xg EDITOR nvim
|
||||
set -xg EDITOR vim
|
||||
set -xg VISUAL $EDITOR
|
||||
set -xg SUDO_EDITOR $EDITOR
|
||||
|
||||
|
|
3
.config/ghostty/.github/README.md
vendored
|
@ -1,3 +0,0 @@
|
|||
<div align="center">
|
||||
<a href=""><img src="./title.png"></a>
|
||||
</div>
|
|
@ -26,7 +26,7 @@
|
|||
helper = libsecret
|
||||
|
||||
[core]
|
||||
editor = nvim
|
||||
editor = vim
|
||||
pager = delta
|
||||
excludesfile = ~/.config/git/ignore
|
||||
|
||||
|
@ -42,7 +42,7 @@
|
|||
line-numbers = true
|
||||
|
||||
[merge]
|
||||
tool = nvimdiff
|
||||
tool = vimdiff
|
||||
conflictstyle = diff3
|
||||
|
||||
[diff]
|
||||
|
@ -53,7 +53,7 @@
|
|||
|
||||
[commit]
|
||||
template = ~/.config/git/gitmessage
|
||||
gpgsign = true
|
||||
# gpgsign = true
|
||||
|
||||
[gpg]
|
||||
program = /sbin/gpg
|
||||
|
|
|
@ -118,26 +118,26 @@ bind = $mainMod, 8, workspace, r~8
|
|||
bind = $mainMod, 9, workspace, r~9
|
||||
|
||||
## Moving Windows to other Workspaces
|
||||
bind = $mainMod SHIFT, 1, movetoworkspace, r~1
|
||||
bind = $mainMod SHIFT, 2, movetoworkspace, r~2
|
||||
bind = $mainMod SHIFT, 3, movetoworkspace, r~3
|
||||
bind = $mainMod SHIFT, 4, movetoworkspace, r~4
|
||||
bind = $mainMod SHIFT, 5, movetoworkspace, r~5
|
||||
bind = $mainMod SHIFT, 6, movetoworkspace, r~6
|
||||
bind = $mainMod SHIFT, 7, movetoworkspace, r~7
|
||||
bind = $mainMod SHIFT, 8, movetoworkspace, r~8
|
||||
bind = $mainMod SHIFT, 9, movetoworkspace, r~9
|
||||
bind = $mainMod SHIFT, 1, movetoworkspacesilent, r~1
|
||||
bind = $mainMod SHIFT, 2, movetoworkspacesilent, r~2
|
||||
bind = $mainMod SHIFT, 3, movetoworkspacesilent, r~3
|
||||
bind = $mainMod SHIFT, 4, movetoworkspacesilent, r~4
|
||||
bind = $mainMod SHIFT, 5, movetoworkspacesilent, r~5
|
||||
bind = $mainMod SHIFT, 6, movetoworkspacesilent, r~6
|
||||
bind = $mainMod SHIFT, 7, movetoworkspacesilent, r~7
|
||||
bind = $mainMod SHIFT, 8, movetoworkspacesilent, r~8
|
||||
bind = $mainMod SHIFT, 9, movetoworkspacesilent, r~9
|
||||
|
||||
## Moving Windows to other Workspaces (Silent)
|
||||
bind = $mainMod ALT, 1, movetoworkspacesilent, r~1
|
||||
bind = $mainMod ALT, 2, movetoworkspacesilent, r~2
|
||||
bind = $mainMod ALT, 3, movetoworkspacesilent, r~3
|
||||
bind = $mainMod ALT, 4, movetoworkspacesilent, r~4
|
||||
bind = $mainMod ALT, 5, movetoworkspacesilent, r~5
|
||||
bind = $mainMod ALT, 6, movetoworkspacesilent, r~6
|
||||
bind = $mainMod ALT, 7, movetoworkspacesilent, r~7
|
||||
bind = $mainMod ALT, 8, movetoworkspacesilent, r~8
|
||||
bind = $mainMod ALT, 9, movetoworkspacesilent, r~9
|
||||
bind = $mainMod ALT, 1, movetoworkspace, r~1
|
||||
bind = $mainMod ALT, 2, movetoworkspace, r~2
|
||||
bind = $mainMod ALT, 3, movetoworkspace, r~3
|
||||
bind = $mainMod ALT, 4, movetoworkspace, r~4
|
||||
bind = $mainMod ALT, 5, movetoworkspace, r~5
|
||||
bind = $mainMod ALT, 6, movetoworkspace, r~6
|
||||
bind = $mainMod ALT, 7, movetoworkspace, r~7
|
||||
bind = $mainMod ALT, 8, movetoworkspace, r~8
|
||||
bind = $mainMod ALT, 9, movetoworkspace, r~9
|
||||
|
||||
## Moving to other Workspace with Mouse Control
|
||||
bind = $mainMod, mouse_down, workspace, m-1
|
||||
|
|
|
@ -12,11 +12,11 @@ $notifications-menu-toggle = $notifications-menu -t
|
|||
$notifications-menu-disturb = $notifications-menu -d
|
||||
$notifications-menu-reload = $notifications-menu -R && $notifications-menu -rs
|
||||
|
||||
$browser = zen-browser
|
||||
$browser = librewolf
|
||||
$notetaking-app = obsidian
|
||||
$terminal = ghostty --gtk-single-instance=true
|
||||
$office-suite = libreoffice
|
||||
$editor = $terminal nvim
|
||||
$editor = $terminal vim
|
||||
$alter-editor = vscodium
|
||||
$file-manager = yazi
|
||||
$file-manager = ranger
|
||||
$alter-file-manager = nemo
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
input {
|
||||
kb_layout = us, es
|
||||
# kb_variant = colemak_dh
|
||||
kb_options = compose:rctrl, level3:ralt_switch, grp:win_space_toggle, caps:escape
|
||||
kb_layout=us,rs,rs,de
|
||||
kb_variant=,latinyz,yz,qwerty
|
||||
kb_options=caps:swapescape,grp:alt_shift_toggle
|
||||
|
||||
follow_mouse = 1
|
||||
numlock_by_default = true
|
||||
repeat_rate=50
|
||||
repeat_delay=300
|
||||
|
||||
touchpad {
|
||||
natural_scroll = yes
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# Main Monitor
|
||||
monitor=DP-1, 2560x1080@74.99, 0x1080,1.0
|
||||
monitor=eDP-1, preferred, auto, 1
|
||||
|
||||
# Second Monitor
|
||||
monitor=DP-3, 2560x1080@74.99, 0x0,1.0
|
||||
monitor=HDMI-A-1, preferred, auto,1.0
|
||||
|
||||
# Third Monitor
|
||||
monitor=HDMI-A-1, 1920x1080@74.97, 2560x300,1.0
|
||||
|
|
|
@ -1,32 +1,32 @@
|
|||
# Main Monitor
|
||||
workspace = 1, monitor:DP-1, default:true
|
||||
workspace = 2, monitor:DP-1
|
||||
workspace = 3, monitor:DP-1
|
||||
workspace = 4, monitor:DP-1
|
||||
workspace = 5, monitor:DP-1
|
||||
workspace = 6, monitor:DP-1
|
||||
workspace = 7, monitor:DP-1, rounding:false, decorate:false, gapsin:0, gapsout:0, border:false, decorate:false # Gaming Workspace
|
||||
workspace = 8, monitor:DP-1
|
||||
workspace = 9, monitor:DP-1
|
||||
workspace = 1, monitor:eDP-1, default:true
|
||||
workspace = 2, monitor:eDP-1
|
||||
workspace = 3, monitor:eDP-1
|
||||
workspace = 4, monitor:eDP-1
|
||||
workspace = 5, monitor:eDP-1
|
||||
workspace = 6, monitor:eDP-1
|
||||
workspace = 7, monitor:eDP-1, rounding:false, decorate:false, gapsin:0, gapsout:0, border:false, decorate:false # Gaming Workspace
|
||||
workspace = 8, monitor:eDP-1
|
||||
workspace = 9, monitor:eDP-1
|
||||
|
||||
# Second Monitor
|
||||
workspace = 10, monitor:DP-3, default:true
|
||||
workspace = 11, monitor:DP-3
|
||||
workspace = 12, monitor:DP-3
|
||||
workspace = 13, monitor:DP-3
|
||||
workspace = 14, monitor:DP-3
|
||||
workspace = 15, monitor:DP-3
|
||||
workspace = 16, monitor:DP-3
|
||||
workspace = 17, monitor:DP-3
|
||||
workspace = 18, monitor:DP-3
|
||||
workspace = 10, monitor:HDMI-A-1, default:true
|
||||
workspace = 11, monitor:HDMI-A-1
|
||||
workspace = 12, monitor:HDMI-A-1
|
||||
workspace = 13, monitor:HDMI-A-1
|
||||
workspace = 14, monitor:HDMI-A-1
|
||||
workspace = 15, monitor:HDMI-A-1
|
||||
workspace = 16, monitor:HDMI-A-1
|
||||
workspace = 17, monitor:HDMI-A-1
|
||||
workspace = 18, monitor:HDMI-A-1
|
||||
|
||||
# Third Monitor
|
||||
workspace = 19, monitor:HDMI-A-1, default:true
|
||||
workspace = 20, monitor:HDMI-A-1
|
||||
workspace = 21, monitor:HDMI-A-1
|
||||
workspace = 22, monitor:HDMI-A-1
|
||||
workspace = 23, monitor:HDMI-A-1
|
||||
workspace = 24, monitor:HDMI-A-1
|
||||
workspace = 25, monitor:HDMI-A-1
|
||||
workspace = 26, monitor:HDMI-A-1
|
||||
workspace = 27, monitor:HDMI-A-1
|
||||
workspace = 19, monitor:HDMI-A-2, default:true
|
||||
workspace = 20, monitor:HDMI-A-2
|
||||
workspace = 21, monitor:HDMI-A-2
|
||||
workspace = 22, monitor:HDMI-A-2
|
||||
workspace = 23, monitor:HDMI-A-2
|
||||
workspace = 24, monitor:HDMI-A-2
|
||||
workspace = 25, monitor:HDMI-A-2
|
||||
workspace = 26, monitor:HDMI-A-2
|
||||
workspace = 27, monitor:HDMI-A-2
|
||||
|
|
|
@ -24,3 +24,10 @@ command = "nm-connection-editor"
|
|||
animation = "fromRight"
|
||||
margin = 20
|
||||
lazy = true
|
||||
|
||||
[wallpapers]
|
||||
path = "~/.config/hypr/theme/walls/"
|
||||
interval = 1440 # change every day
|
||||
command = "swww img --transition-bezier 0.5,1.19,.8,.4 --transition-type wipe --transition-duration 2 --transition-fps 75 \"[file]\" && notify-send 'Wallpaper Changed' -i \"[file]\" --app-name=Wallpaper"
|
||||
clear_command = "swww clear"
|
||||
extensions = ["jpg", "png", "gif", "jpeg"]
|
||||
|
|
|
@ -4,6 +4,6 @@
|
|||
feishin &
|
||||
|
||||
# Terminal Apps
|
||||
# kitty --class btop btop &
|
||||
# kitty --class nvtop nvtop &
|
||||
kitty --class btop btop &
|
||||
kitty --class radeontop radeontop &
|
||||
ghostty --gtk-single-instance=true --quit-after-last-window-closed=false --initial-window=false &
|
||||
|
|
|
@ -29,11 +29,23 @@ wl-paste --watch cliphist store &
|
|||
/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 &
|
||||
|
||||
# Audio
|
||||
pipewire &
|
||||
wireplumber &
|
||||
pipewire-pulse &
|
||||
easyeffects --gapplication-service &
|
||||
|
||||
libinput-gestures &
|
||||
|
||||
# Random Wallpaper
|
||||
"$HOME"/.config/hypr/scripts/random_wallpaper &
|
||||
|
||||
# Screen sharing and portals
|
||||
"$HOME"/.config/hypr/scripts/portal &
|
||||
# xwaylandvideobridge & # Off when using Vesktop instead of Discord
|
||||
|
||||
# Audio
|
||||
pipewire &
|
||||
wireplumber &
|
||||
pipewire-pulse &
|
||||
|
||||
libinput-gestures &
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
# Base Rules
|
||||
$center-float-large = class:^(center-float-large)$|^(.*qimgv.*)$|^(.*mpv.*)$
|
||||
windowrule = float, $center-float-large
|
||||
windowrule = size 70% 70%, $center-float-large
|
||||
windowrule = center 1, $center-float-large
|
||||
|
||||
$center-float = class:^(center-float)$
|
||||
$center-float-title = title:^(.*Open Folder.*)$|^(.*Open File.*)$|^(.*Save File.*)$|^(.*Save Folder.*)$|^(.*Save Image.*)$|^(.*Save As.*)$|^(.*Open As.*)$
|
||||
windowrule = float, $center-float
|
||||
|
@ -105,11 +100,6 @@ windowrule = noblur, $videobridge
|
|||
windowrule = noinitialfocus, $videobridge
|
||||
windowrule = maxsize 1 1, $videobridge
|
||||
|
||||
$zathura = class:^(.*zathura.*)$
|
||||
windowrule = float, $zathura
|
||||
windowrule = size 35% 90%, $zathura
|
||||
windowrule = center 1, $zathura
|
||||
|
||||
$scrcpy = class:^(.*scrcpy.*)$
|
||||
windowrule = center 1, $scrcpy
|
||||
windowrule = float, $scrcpy
|
||||
|
|
3
.config/ludusavi/.github/README.md
vendored
|
@ -1,3 +0,0 @@
|
|||
<div align="center">
|
||||
<a href=""><img src="./title.png"></a>
|
||||
</div>
|
BIN
.config/ludusavi/.github/title.png
vendored
Before Width: | Height: | Size: 21 KiB |
|
@ -1,80 +0,0 @@
|
|||
---
|
||||
runtime:
|
||||
threads: ~
|
||||
release:
|
||||
check: true
|
||||
manifest:
|
||||
enable: false
|
||||
secondary:
|
||||
- url: "https://cdn.losbroxas.org/manifest.yaml"
|
||||
enable: true
|
||||
language: en-US
|
||||
theme: dark
|
||||
roots:
|
||||
- store: steam
|
||||
path: ~/.local/share/Steam
|
||||
- store: heroic
|
||||
path: ~/.config/heroic
|
||||
- store: steam
|
||||
path: ~/games/SteamLibrary
|
||||
- store: other
|
||||
path: ~/.local/share/dolphin-emu
|
||||
- store: other
|
||||
path: ~/.config/Ryujinx
|
||||
redirects: []
|
||||
backup:
|
||||
path: ~/games/gamesaves
|
||||
ignoredGames: []
|
||||
filter:
|
||||
excludeStoreScreenshots: false
|
||||
cloud:
|
||||
exclude: false
|
||||
epic: false
|
||||
gog: false
|
||||
origin: false
|
||||
steam: false
|
||||
uplay: false
|
||||
ignoredPaths: []
|
||||
ignoredRegistry: []
|
||||
toggledPaths: {}
|
||||
toggledRegistry: {}
|
||||
sort:
|
||||
key: status
|
||||
reversed: false
|
||||
retention:
|
||||
full: 1
|
||||
differential: 0
|
||||
format:
|
||||
chosen: zip
|
||||
zip:
|
||||
compression: deflate
|
||||
compression:
|
||||
deflate:
|
||||
level: 6
|
||||
bzip2:
|
||||
level: 6
|
||||
zstd:
|
||||
level: 10
|
||||
onlyConstructive: false
|
||||
restore:
|
||||
path: ~/games/gamesaves
|
||||
ignoredGames: []
|
||||
toggledPaths: {}
|
||||
toggledRegistry: {}
|
||||
sort:
|
||||
key: status
|
||||
reversed: false
|
||||
reverseRedirects: false
|
||||
scan:
|
||||
showDeselectedGames: true
|
||||
showUnchangedGames: true
|
||||
showUnscannedGames: true
|
||||
cloud:
|
||||
remote: ~
|
||||
path: ludusavi-backup
|
||||
synchronize: true
|
||||
apps:
|
||||
rclone:
|
||||
path: /usr/bin/rclone
|
||||
arguments: "--fast-list --ignore-checksum"
|
||||
customGames: []
|
|
@ -1,66 +0,0 @@
|
|||
# Progress
|
||||
# 60 seconds
|
||||
CTRL+SHIFT+l seek 60
|
||||
CTRL+SHIFT+l seek -60
|
||||
CTRL+SHIFT+RIGHT seek 60
|
||||
CTRL+SHIFT+LEFT seek -60
|
||||
|
||||
# 30 seconds
|
||||
SHIFT+l seek 30
|
||||
SHIFT+h seek -30
|
||||
SHIFT+RIGHT seek 30
|
||||
SHIFT+LEFT seek -30
|
||||
|
||||
# 10 seconds
|
||||
CTRL+l seek 10
|
||||
CTRL+h seek -10
|
||||
CTRL+RIGHT seek 10
|
||||
CTRL+LEFT seek -10
|
||||
|
||||
# 5 seconds
|
||||
l seek 5
|
||||
h seek -5
|
||||
RIGHT seek 5
|
||||
LEFT seek -5
|
||||
|
||||
# 2 seconds
|
||||
ALT+l seek 2
|
||||
ALT+h seek -2
|
||||
ALT+RIGHT seek 2
|
||||
ALT+LEFT seek -2
|
||||
|
||||
# Disables all normal mouse scrolls
|
||||
WHEEL_LEFT ignore
|
||||
WHEEL_RIGHT ignore
|
||||
|
||||
|
||||
# Audio
|
||||
# 100%
|
||||
CTRL+SHIFT+k add volume 100
|
||||
CTRL+SHIFT+j add volume -100
|
||||
CTRL+SHIFT+UP add volume 100
|
||||
CTRL+SHIFT+DOWN add volume -100
|
||||
|
||||
# 50%
|
||||
SHIFT+k add volume 50
|
||||
SHIFT+j add volume -50
|
||||
SHIFT+UP add volume 50
|
||||
SHIFT+DOWN add volume -50
|
||||
|
||||
# 25%
|
||||
CTRL+k add volume 25
|
||||
CTRL+j add volume -25
|
||||
CTRL+UP add volume 25
|
||||
CTRL+DOWN add volume -25
|
||||
|
||||
# 10%
|
||||
k add volume 10
|
||||
j add volume -10
|
||||
UP add volume 10
|
||||
DOWN add volume -10
|
||||
|
||||
# 5%
|
||||
ALT+k add volume 5
|
||||
ALT+j add volume -5
|
||||
ALT+UP add volume 5
|
||||
ALT+DOWN add volume -5
|
|
@ -3,6 +3,7 @@
|
|||
#vo=gpu
|
||||
# Can cause performance problems with some GPU drivers and GPUs.
|
||||
#profile=gpu-hq
|
||||
gpu-context=wayland
|
||||
|
||||
# ===== REMOVE THE ABOVE FOUR LINES AND RESAVE IF YOU ENCOUNTER PLAYBACK ISSUES AFTER =====
|
||||
|
||||
|
@ -19,14 +20,17 @@ osd-color='#cad3f5'
|
|||
osd-shadow-color='#24273a'
|
||||
|
||||
# Screenshots
|
||||
screenshot-directory='~/Imagenes/Capturas/PC'
|
||||
screenshot-directory='~'
|
||||
screenshot-template='mpv-%f-%p'
|
||||
|
||||
# Enables best HW decoder; turn off for software decoding
|
||||
hwdec=auto
|
||||
|
||||
# IPC
|
||||
input-ipc-server=/tmp/mpv-socket
|
||||
|
||||
# Keeps open the window after a video is finished
|
||||
keep-open
|
||||
# keep-open
|
||||
|
||||
border=no # hides the window title bar
|
||||
msg-color=yes # color log messages on terminal
|
||||
|
@ -55,6 +59,10 @@ profile-restore=copy-equal
|
|||
|
||||
# Sets volume to 100%.
|
||||
volume=100
|
||||
# Sets maximum volume to 200%.
|
||||
volume-max=200
|
||||
# Audio language: German
|
||||
alang=ger
|
||||
|
||||
# Normalizes audio
|
||||
# af-add='dynaudnorm=g=5:f=250:r=0.9:p=0.5'
|
||||
|
@ -79,6 +87,8 @@ deband-grain=48 # dynamic grain: set to "0" if using the static grain shader
|
|||
|
||||
# ===== Subtitles =====
|
||||
blend-subtitles=yes
|
||||
sub-auto=fuzzy
|
||||
slang=ger
|
||||
|
||||
# ===== Motion Interpolation =====
|
||||
override-display-fps=75
|
||||
|
@ -288,3 +298,4 @@ profile=protocol.http
|
|||
profile-restore=copy-equal # Sets the profile restore method to "copy if equal"
|
||||
profile-desc=ytdl
|
||||
profile=protocol.http
|
||||
ytdl-raw-options=ignore-config=,sub-format=de,write-sub=
|
||||
|
|
BIN
.config/mpv/mpv_websocket
Executable file
2
.config/mpv/scripts-opts/console.conf
Normal file
|
@ -0,0 +1,2 @@
|
|||
font_size=38
|
||||
scale=3
|
455
.config/mpv/scripts/animecards_v35_modified.lua
Normal file
|
@ -0,0 +1,455 @@
|
|||
------------- Instructions -------------
|
||||
-- -- Video Demonstration: https://www.youtube.com/watch?v=M4t7HYS73ZQ
|
||||
-- IF USING WEBSOCKET (RECOMMENDED)
|
||||
-- -- Install the mpv_webscoket extension: https://github.com/kuroahna/mpv_websocket
|
||||
-- -- Open a LOCAL copy of https://github.com/Renji-XD/texthooker-ui
|
||||
-- -- Configure the script (if you're not using the Lapis note format)
|
||||
-- IF USING CLIPBOARD INSERTER (NOT RECOMMENDED)
|
||||
-- -- Install the clipboard inserter plugin: https://github.com/laplus-sadness/lap-clipboard-inserter
|
||||
-- -- Open the texthooker UI, enable the plugin and enable clipboard pasting: https://github.com/Renji-XD/texthooker-ui
|
||||
-- BOTH
|
||||
-- -- Wait for an unknown word and create the card with Yomichan.
|
||||
-- -- Select all the subtitle lines you wish to add to the card and copy with Ctrl + c.
|
||||
-- -- Press Ctrl + v in MPV to add the lines, their Audio and the currently paused image to the back of the card.
|
||||
---------------------------------------
|
||||
|
||||
------------- Credits -------------
|
||||
-- Credits and copyright go to Anacreon DJT: https://anacreondjt.gitlab.io/
|
||||
------------------------------------
|
||||
|
||||
------------- Original Credits (Outdated) -------------
|
||||
-- This script was made by users of 4chan's Daily Japanese Thread (DJT) on /jp/
|
||||
-- More information can be found here http://animecards.site/
|
||||
-- Message @Anacreon with bug reports and feature requests on Discord (https://animecards.site/discord/) or 4chan (https://boards.4channel.org/jp/#s=djt)
|
||||
--
|
||||
-- If you like this work please consider subscribing on Patreon!
|
||||
-- https://www.patreon.com/Quizmaster
|
||||
------------------------------------
|
||||
|
||||
local utils = require 'mp.utils'
|
||||
local msg = require 'mp.msg'
|
||||
|
||||
------------- User Config -------------
|
||||
-- Set these to match your field names in Anki
|
||||
local FRONT_FIELD = "Vocab"
|
||||
local SENTENCE_AUDIO_FIELD = "SentAudio"
|
||||
local SENTENCE_FIELD = "INVALID" -- the sentence is better taken care of by yomitan itself.
|
||||
local IMAGE_FIELD = "Image"
|
||||
-- Optional padding and fade settings in seconds.
|
||||
-- Padding grabs extra audio around your selected subs.
|
||||
-- Fade does a volume fade effect at the beginning and end of the resulting audio.
|
||||
local AUDIO_CLIP_FADE = 0.2
|
||||
local AUDIO_CLIP_PADDING = 0.75
|
||||
-- Optional play sentence audio automatically after card update
|
||||
local AUTOPLAY_AUDIO = false
|
||||
-- Optional screenshot image format. Valid options: "webp" or "png"
|
||||
-- Change to "png" if you plan to view cards on iOS or Mac.
|
||||
local IMAGE_FORMAT = "png"
|
||||
-- Optional set to true if you want your volume in mpv to affect Anki card volume.
|
||||
local USE_MPV_VOLUME = false
|
||||
-- Set to true if you want writing to clipboard to be enabled by default.
|
||||
-- The more modern and recommended alternative is to use the websocket.
|
||||
local ENABLE_SUBS_TO_CLIP = false
|
||||
|
||||
---------------------------------------
|
||||
|
||||
------------- Internal Variables -------------
|
||||
local subs = {}
|
||||
local debug_mode = true
|
||||
local use_powershell_clipboard = nil
|
||||
local prefix = ""
|
||||
---------------------------------------
|
||||
|
||||
|
||||
------------- Setup -------------
|
||||
if unpack ~= nil then table.unpack = unpack end
|
||||
|
||||
local o = {}
|
||||
-- Possible platforms: windows, linux, macos
|
||||
local platform = mp.get_property_native("platform")
|
||||
if platform == "darwin" then
|
||||
platform = "macos"
|
||||
end
|
||||
|
||||
local display_server
|
||||
if os.getenv("WAYLAND_DISPLAY") then
|
||||
display_server = 'wayland'
|
||||
elseif platform == 'linux' then
|
||||
display_server = 'xorg'
|
||||
else
|
||||
display_server = ""
|
||||
end
|
||||
|
||||
local function dlog(...)
|
||||
if debug_mode then
|
||||
print(...)
|
||||
end
|
||||
end
|
||||
|
||||
local function verfiy_libmp3lame()
|
||||
local encoderlist = mp.get_property("encoder-list")
|
||||
if not encoderlist or not string.find(encoderlist, "libmp3lame") then
|
||||
mp.osd_message("Error: libmp3lame encoder not found. Audio export will not work.\nPlease use a build of mpv with libmp3lame support.", 10)
|
||||
msg.error("Error: libmp3lame encoder not found. MP3 audio export will not work.")
|
||||
else
|
||||
dlog("libmp3lame encoder found.")
|
||||
end
|
||||
end
|
||||
|
||||
mp.register_event("file-loaded", verfiy_libmp3lame)
|
||||
|
||||
dlog("Detected Platform: " .. platform)
|
||||
dlog("Detected display server: " .. display_server)
|
||||
|
||||
---------------------------------------
|
||||
-- Handle requests to AnkiConnect
|
||||
local function anki_connect(action, params)
|
||||
local request = utils.format_json({action=action, params=params, version=6})
|
||||
local args = {'curl', '-s', 'localhost:8765', '-X', 'POST', '-d', request}
|
||||
|
||||
dlog("AnkiConnect request: " .. request)
|
||||
|
||||
local result = utils.subprocess({ args = args, cancellable = false, capture_stderr = true })
|
||||
|
||||
if result.status ~= 0 then
|
||||
msg.error("Curl command failed with status: " .. tostring(result.status))
|
||||
msg.error("Stderr: " .. (result.stderr or "none"))
|
||||
return nil
|
||||
end
|
||||
|
||||
if not result.stdout or result.stdout == "" then
|
||||
msg.error("Empty response from AnkiConnect")
|
||||
return nil
|
||||
end
|
||||
|
||||
dlog("AnkiConnect response: " .. result.stdout)
|
||||
|
||||
local success, parsed_result = pcall(function() return utils.parse_json(result.stdout) end)
|
||||
if not success or not parsed_result then
|
||||
msg.error("Failed to parse JSON response: " .. (result.stdout or "empty"))
|
||||
return nil
|
||||
end
|
||||
|
||||
return parsed_result
|
||||
end
|
||||
|
||||
-- Get media directory path from AnkiConnect
|
||||
local function set_media_dir()
|
||||
local media_dir_response = anki_connect('getMediaDirPath')
|
||||
if not media_dir_response then
|
||||
msg.error("Failed to communicate with AnkiConnect. Is Anki running and do you have AnkiConnect installed?")
|
||||
mp.osd_message("Error: Failed to communicate with AnkiConnect. Is Anki running and do you have AnkiConnect installed?", 5)
|
||||
return
|
||||
elseif media_dir_response["error"] then
|
||||
msg.error("AnkiConnect error: " .. tostring(media_dir_response["error"]))
|
||||
mp.osd_message("AnkiConnect error: " .. tostring(media_dir_response["error"]), 5)
|
||||
return
|
||||
elseif media_dir_response["result"] then
|
||||
prefix = media_dir_response["result"]
|
||||
dlog("Got media directory path from AnkiConnect: " .. prefix)
|
||||
else
|
||||
msg.error("Unexpected response format from AnkiConnect")
|
||||
mp.osd_message("Error: Unexpected response from AnkiConnect", 5)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
local function clean(s)
|
||||
for _, ws in ipairs({'%s', ' ', '', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '', ' ', ' ', ' ', '', ''}) do
|
||||
s = s:gsub(ws..'+', "")
|
||||
end
|
||||
return s
|
||||
end
|
||||
|
||||
local function get_name(s, e)
|
||||
return mp.get_property("filename"):gsub('%W','').. tostring(s) .. tostring(e)
|
||||
end
|
||||
|
||||
local function get_clipboard()
|
||||
local res
|
||||
if platform == 'windows' then
|
||||
res = utils.subprocess({ args = {
|
||||
'powershell', '-NoProfile', '-Command', [[& {
|
||||
Trap {
|
||||
Write-Error -ErrorRecord $_
|
||||
Exit 1
|
||||
}
|
||||
$clip = ""
|
||||
if (Get-Command "Get-Clipboard" -errorAction SilentlyContinue) {
|
||||
$clip = Get-Clipboard -Raw -Format Text -TextFormatType UnicodeText
|
||||
} else {
|
||||
Add-Type -AssemblyName PresentationCore
|
||||
$clip = [Windows.Clipboard]::GetText()
|
||||
}
|
||||
$clip = $clip -Replace "`r",""
|
||||
$u8clip = [System.Text.Encoding]::UTF8.GetBytes($clip)
|
||||
[Console]::OpenStandardOutput().Write($u8clip, 0, $u8clip.Length)
|
||||
}]]
|
||||
} })
|
||||
elseif platform == 'macos' then
|
||||
return io.popen('LANG=en_US.UTF-8 pbpaste'):read("*a")
|
||||
else -- platform == 'linux'
|
||||
if display_server == 'wayland' then
|
||||
res = utils.subprocess({ args = {
|
||||
'wl-paste'
|
||||
} })
|
||||
else -- display_server == 'xorg'
|
||||
res = utils.subprocess({ args = {
|
||||
'xclip', '-selection', 'clipboard', '-out'
|
||||
} })
|
||||
end
|
||||
end
|
||||
if not res.error then
|
||||
return res.stdout
|
||||
end
|
||||
end
|
||||
|
||||
local function powershell_set_clipboard(text)
|
||||
utils.subprocess({ args = {
|
||||
'powershell', '-NoProfile', '-Command', [[Set-Clipboard -Value @"]] .. "\n" .. text .. "\n" .. [["@]]
|
||||
}})
|
||||
end
|
||||
|
||||
local function cmd_set_clipboard(text)
|
||||
local cmd = 'echo ' .. text .. ' | clip';
|
||||
mp.command("run cmd /D /C " .. cmd);
|
||||
end
|
||||
|
||||
local function determine_clip_type()
|
||||
powershell_set_clipboard([[Anacreon様]])
|
||||
use_powershell_clipboard = get_clipboard() == [[Anacreon様]]
|
||||
end
|
||||
|
||||
local function linux_set_clipboard(text)
|
||||
if display_server == 'wayland' then
|
||||
os.execute('wl-copy <<EOF\n' .. text .. '\nEOF\n')
|
||||
else -- display_server == 'xorg'
|
||||
os.execute('xclip -selection clipboard <<EOF\n' .. text .. '\nEOF\n')
|
||||
end
|
||||
end
|
||||
|
||||
local function macos_set_clipboard(text)
|
||||
os.execute('export LANG=en_US.UTF-8; cat <<EOF | pbcopy\n' .. text .. '\nEOF\n')
|
||||
end
|
||||
|
||||
local function record_sub(_, text)
|
||||
if text and mp.get_property_number('sub-start') and mp.get_property_number('sub-end') then
|
||||
local sub_delay = mp.get_property_native("sub-delay")
|
||||
local audio_delay = mp.get_property_native("audio-delay")
|
||||
local newtext = clean(text)
|
||||
if newtext == '' then
|
||||
return
|
||||
end
|
||||
|
||||
subs[newtext] = { mp.get_property_number('sub-start') + sub_delay - audio_delay, mp.get_property_number('sub-end') + sub_delay - audio_delay }
|
||||
dlog(string.format("%s -> %s : %s", subs[newtext][1], subs[newtext][2], newtext))
|
||||
if ENABLE_SUBS_TO_CLIP then
|
||||
-- Remove newlines from text before sending it to clipboard.
|
||||
-- This way pressing control+v without copying from texthooker page
|
||||
-- will always give last line.
|
||||
text = string.gsub(text, "[\n\r]+", " ")
|
||||
if platform == 'windows' then
|
||||
if use_powershell_clipboard == nil then
|
||||
determine_clip_type()
|
||||
end
|
||||
if use_powershell_clipboard then
|
||||
powershell_set_clipboard(text)
|
||||
else
|
||||
cmd_set_clipboard(text)
|
||||
end
|
||||
elseif platform == 'macos' then
|
||||
macos_set_clipboard(text)
|
||||
else
|
||||
linux_set_clipboard(text)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function create_audio(s, e)
|
||||
|
||||
if s == nil or e == nil then
|
||||
return
|
||||
end
|
||||
|
||||
local name = get_name(s, e)
|
||||
local destination = utils.join_path(prefix, name .. '.mp3')
|
||||
s = s - AUDIO_CLIP_PADDING
|
||||
local t = e - s + AUDIO_CLIP_PADDING
|
||||
local source = mp.get_property("path")
|
||||
local aid = mp.get_property("aid")
|
||||
|
||||
local tracks_count = mp.get_property_number("track-list/count")
|
||||
for i = 1, tracks_count do
|
||||
local track_type = mp.get_property(string.format("track-list/%d/type", i))
|
||||
local track_selected = mp.get_property(string.format("track-list/%d/selected", i))
|
||||
if track_type == "audio" and track_selected == "yes" then
|
||||
if mp.get_property(string.format("track-list/%d/external-filename", i), o) ~= o then
|
||||
source = mp.get_property(string.format("track-list/%d/external-filename", i))
|
||||
aid = 'auto'
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local cmd = {
|
||||
'run',
|
||||
'mpv',
|
||||
source,
|
||||
'--loop-file=no',
|
||||
'--video=no',
|
||||
'--no-ocopy-metadata',
|
||||
'--no-sub',
|
||||
'--audio-channels=1',
|
||||
string.format('--start=%.3f', s),
|
||||
string.format('--length=%.3f', t),
|
||||
string.format('--aid=%s', aid),
|
||||
string.format('--volume=%s', USE_MPV_VOLUME and mp.get_property('volume') or '100'),
|
||||
string.format("--af-append=afade=t=in:curve=ipar:st=%.3f:d=%.3f", s, AUDIO_CLIP_FADE),
|
||||
string.format("--af-append=afade=t=out:curve=ipar:st=%.3f:d=%.3f", s + t - AUDIO_CLIP_FADE, AUDIO_CLIP_FADE),
|
||||
string.format('-o=%s', destination)
|
||||
}
|
||||
mp.commandv(table.unpack(cmd))
|
||||
dlog(utils.to_string(cmd))
|
||||
end
|
||||
|
||||
local function create_screenshot(s, e)
|
||||
local source = mp.get_property("path")
|
||||
local img = utils.join_path(prefix, get_name(s,e) .. '.' .. IMAGE_FORMAT)
|
||||
|
||||
local cmd = {
|
||||
'run',
|
||||
'mpv',
|
||||
source,
|
||||
'--loop-file=no',
|
||||
'--audio=no',
|
||||
'--no-ocopy-metadata',
|
||||
'--no-sub',
|
||||
'--frames=1',
|
||||
}
|
||||
if IMAGE_FORMAT == 'webp' then
|
||||
table.insert(cmd, '--ovc=libwebp')
|
||||
table.insert(cmd, '--ovcopts-add=lossless=0')
|
||||
table.insert(cmd, '--ovcopts-add=compression_level=6')
|
||||
table.insert(cmd, '--ovcopts-add=preset=drawing')
|
||||
elseif IMAGE_FORMAT == 'png' then
|
||||
table.insert(cmd, '--vf-add=format=rgb24')
|
||||
end
|
||||
table.insert(cmd, '--vf-add=scale=480*iw*sar/ih:480')
|
||||
table.insert(cmd, string.format('--start=%.3f', mp.get_property_number("time-pos")))
|
||||
table.insert(cmd, string.format('-o=%s', img))
|
||||
mp.commandv(table.unpack(cmd))
|
||||
dlog(utils.to_string(cmd))
|
||||
end
|
||||
|
||||
|
||||
|
||||
local function add_to_last_added(ifield, afield, tfield)
|
||||
local added_notes = anki_connect('findNotes', {query='added:1'})["result"]
|
||||
table.sort(added_notes)
|
||||
local noteid = added_notes[#added_notes]
|
||||
local note = anki_connect('notesInfo', {notes={noteid}})
|
||||
|
||||
if note ~= nil then
|
||||
local word = note["result"][1]["fields"][FRONT_FIELD]["value"]
|
||||
local new_fields = {
|
||||
[SENTENCE_AUDIO_FIELD]=afield,
|
||||
[SENTENCE_FIELD]=tfield,
|
||||
[IMAGE_FIELD]=ifield
|
||||
}
|
||||
|
||||
anki_connect('updateNoteFields', {
|
||||
note={
|
||||
id=noteid,
|
||||
fields=new_fields
|
||||
}
|
||||
})
|
||||
|
||||
mp.osd_message("Updated note: " .. word, 3)
|
||||
msg.info("Updated note: " .. word)
|
||||
end
|
||||
end
|
||||
|
||||
local function get_extract()
|
||||
local lines = get_clipboard()
|
||||
local e = 0
|
||||
local s = 0
|
||||
for line in lines:gmatch("[^\r\n]+") do
|
||||
line = clean(line)
|
||||
dlog(line)
|
||||
if subs[line]~= nil then
|
||||
if subs[line][1] ~= nil and subs[line][2] ~= nil then
|
||||
if s == 0 then
|
||||
s = subs[line][1]
|
||||
else
|
||||
s = math.min(s, subs[line][1])
|
||||
end
|
||||
e = math.max(e, subs[line][2])
|
||||
end
|
||||
else
|
||||
mp.osd_message("ERR! Line not found: " .. line, 3)
|
||||
return
|
||||
end
|
||||
end
|
||||
dlog(string.format('s=%d, e=%d', s, e))
|
||||
if e ~= 0 then
|
||||
create_screenshot(s, e)
|
||||
create_audio(s, e)
|
||||
local ifield = '<img src='.. get_name(s,e) ..'.' .. IMAGE_FORMAT .. '>'
|
||||
local afield = "[sound:".. get_name(s,e) .. ".mp3]"
|
||||
local tfield = string.gsub(string.gsub(lines,"\n+", "<br />"), "\r", "")
|
||||
add_to_last_added(ifield, afield, tfield)
|
||||
if AUTOPLAY_AUDIO then
|
||||
local name = get_name(s, e)
|
||||
local audio = utils.join_path(prefix, name .. '.mp3')
|
||||
local cmd = {'run', 'mpv', audio, '--loop-file=no', '--load-scripts=no'}
|
||||
mp.commandv(table.unpack(cmd))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function ex()
|
||||
|
||||
if not prefix or prefix == "" then
|
||||
set_media_dir()
|
||||
end
|
||||
|
||||
if debug_mode then
|
||||
get_extract()
|
||||
else
|
||||
pcall(get_extract)
|
||||
end
|
||||
end
|
||||
|
||||
local function rec(...)
|
||||
if debug_mode then
|
||||
record_sub(...)
|
||||
else
|
||||
pcall(record_sub, ...)
|
||||
end
|
||||
end
|
||||
|
||||
local function toggle_sub_to_clipboard()
|
||||
ENABLE_SUBS_TO_CLIP = not ENABLE_SUBS_TO_CLIP
|
||||
mp.osd_message("Clipboard inserter " .. (ENABLE_SUBS_TO_CLIP and "activated" or "deactived"), 3)
|
||||
end
|
||||
|
||||
local function toggle_debug_mode()
|
||||
debug_mode = not debug_mode
|
||||
mp.osd_message("Debug mode " .. (debug_mode and "activated" or "deactived"), 3)
|
||||
end
|
||||
|
||||
local function clear_subs(_)
|
||||
subs = {}
|
||||
end
|
||||
|
||||
mp.observe_property("sub-text", 'string', rec)
|
||||
mp.observe_property("filename", "string", clear_subs)
|
||||
|
||||
mp.add_key_binding("ctrl+v", "update-anki-card", ex)
|
||||
mp.add_key_binding("ctrl+t", "toggle-clipboard-insertion", toggle_sub_to_clipboard)
|
||||
mp.add_key_binding("ctrl+d", "toggle-debug-mode", toggle_debug_mode)
|
||||
mp.add_key_binding("ctrl+V", ex)
|
||||
mp.add_key_binding("ctrl+T", toggle_sub_to_clipboard)
|
||||
mp.add_key_binding("ctrl+D", toggle_debug_mode)
|
83
.config/mpv/scripts/run_websocket_server.lua
Normal file
|
@ -0,0 +1,83 @@
|
|||
-- mpv_websocket
|
||||
-- https://github.com/kuroahna/mpv_websocket
|
||||
|
||||
local utils = require("mp.utils")
|
||||
|
||||
local platform = mp.get_property_native("platform")
|
||||
|
||||
local config_file_path = mp.find_config_file("mpv.conf")
|
||||
local config_folder_path, config_file = utils.split_path(config_file_path)
|
||||
local mpv_websocket_path =
|
||||
utils.join_path(config_folder_path, platform == "windows" and "mpv_websocket.exe" or "mpv_websocket")
|
||||
local initialised_websocket
|
||||
|
||||
local _, err = utils.file_info(config_file_path)
|
||||
if err then
|
||||
error("failed to open mpv config file `" .. config_file_path .. "`")
|
||||
end
|
||||
|
||||
local _, err = utils.file_info(mpv_websocket_path)
|
||||
if err then
|
||||
error("failed to open mpv_websocket")
|
||||
end
|
||||
|
||||
local function find_mpv_socket(config_file_path)
|
||||
local file = io.open(config_file_path, "r")
|
||||
if file == nil then
|
||||
error("failed to read mpv config file `" .. config_file_path .. "`")
|
||||
end
|
||||
|
||||
local mpv_socket
|
||||
for line in file:lines() do
|
||||
mpv_socket = line:match("^input%-ipc%-server%s*=%s*(%g+)%s*")
|
||||
if mpv_socket then
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
file:close()
|
||||
|
||||
if not mpv_socket then
|
||||
error("input-ipc-server option does not exist in `" .. config_file_path .. "`")
|
||||
end
|
||||
|
||||
return mpv_socket
|
||||
end
|
||||
|
||||
local mpv_socket = find_mpv_socket(config_file_path)
|
||||
if platform == "windows" then
|
||||
mpv_socket = "\\\\.\\pipe" .. mpv_socket:gsub("/", "\\")
|
||||
end
|
||||
|
||||
local function start_websocket()
|
||||
initialised_websocket = mp.command_native_async({
|
||||
name = "subprocess",
|
||||
playback_only = false,
|
||||
capture_stdout = true,
|
||||
capture_stderr = true,
|
||||
args = {
|
||||
mpv_websocket_path,
|
||||
"-m",
|
||||
mpv_socket,
|
||||
"-w",
|
||||
"6677",
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
local function end_websocket()
|
||||
mp.abort_async_command(initialised_websocket)
|
||||
initialised_websocket = nil
|
||||
end
|
||||
|
||||
local function toggle_websocket()
|
||||
local paused = mp.get_property_bool("pause")
|
||||
if initialised_websocket and paused then
|
||||
end_websocket()
|
||||
elseif not initialised_websocket and not paused then
|
||||
start_websocket()
|
||||
end
|
||||
end
|
||||
|
||||
mp.register_script_message("togglewebsocket", toggle_websocket)
|
||||
start_websocket()
|
757
.config/mpv/scripts/user-input.lua
Normal file
|
@ -0,0 +1,757 @@
|
|||
local mp = require 'mp'
|
||||
local msg = require 'mp.msg'
|
||||
local utils = require 'mp.utils'
|
||||
local options = require 'mp.options'
|
||||
|
||||
-- Default options
|
||||
local opts = {
|
||||
-- All drawing is scaled by this value, including the text borders and the
|
||||
-- cursor. Change it if you have a high-DPI display.
|
||||
scale = 1,
|
||||
-- Set the font used for the REPL and the console. This probably doesn't
|
||||
-- have to be a monospaced font.
|
||||
font = "",
|
||||
-- Set the font size used for the REPL and the console. This will be
|
||||
-- multiplied by "scale."
|
||||
font_size = 16,
|
||||
}
|
||||
|
||||
options.read_options(opts, "user_input")
|
||||
|
||||
local API_VERSION = "0.1.0"
|
||||
local API_MAJOR_MINOR = API_VERSION:match("%d+%.%d+")
|
||||
|
||||
local co = nil
|
||||
local queue = {}
|
||||
local active_ids = {}
|
||||
local histories = {}
|
||||
local request = nil
|
||||
|
||||
local line = ''
|
||||
|
||||
|
||||
--[[
|
||||
The below code is a modified implementation of text input from mpv's console.lua:
|
||||
https://github.com/mpv-player/mpv/blob/7ca14d646c7e405f3fb1e44600e2a67fc4607238/player/lua/console.lua
|
||||
|
||||
Modifications:
|
||||
removed support for log messages, sending commands, tab complete, help commands
|
||||
removed update timer
|
||||
Changed esc key to call handle_esc function
|
||||
handle_esc and handle_enter now resume the main coroutine with a response table
|
||||
made history specific to request ids
|
||||
localised all functions - reordered some to fit
|
||||
keybindings use new names
|
||||
]]--
|
||||
|
||||
------------------------------START ORIGINAL MPV CODE-----------------------------------
|
||||
----------------------------------------------------------------------------------------
|
||||
----------------------------------------------------------------------------------------
|
||||
----------------------------------------------------------------------------------------
|
||||
----------------------------------------------------------------------------------------
|
||||
|
||||
-- Copyright (C) 2019 the mpv developers
|
||||
--
|
||||
-- Permission to use, copy, modify, and/or distribute this software for any
|
||||
-- purpose with or without fee is hereby granted, provided that the above
|
||||
-- copyright notice and this permission notice appear in all copies.
|
||||
--
|
||||
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
-- SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
-- OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
-- CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
local assdraw = require 'mp.assdraw'
|
||||
|
||||
local function detect_platform()
|
||||
local o = {}
|
||||
-- Kind of a dumb way of detecting the platform but whatever
|
||||
if mp.get_property_native('options/vo-mmcss-profile', o) ~= o then
|
||||
return 'windows'
|
||||
elseif mp.get_property_native('options/macos-force-dedicated-gpu', o) ~= o then
|
||||
return 'macos'
|
||||
elseif os.getenv('WAYLAND_DISPLAY') then
|
||||
return 'wayland'
|
||||
end
|
||||
return 'x11'
|
||||
end
|
||||
|
||||
-- Pick a better default font for Windows and macOS
|
||||
local platform = detect_platform()
|
||||
if platform == 'windows' then
|
||||
opts.font = 'Consolas'
|
||||
elseif platform == 'macos' then
|
||||
opts.font = 'Menlo'
|
||||
else
|
||||
opts.font = 'monospace'
|
||||
end
|
||||
|
||||
local repl_active = false
|
||||
local insert_mode = false
|
||||
local cursor = 1
|
||||
local key_bindings = {}
|
||||
local global_margin_y = 0
|
||||
|
||||
-- Escape a string for verbatim display on the OSD
|
||||
local function ass_escape(str)
|
||||
-- There is no escape for '\' in ASS (I think?) but '\' is used verbatim if
|
||||
-- it isn't followed by a recognised character, so add a zero-width
|
||||
-- non-breaking space
|
||||
str = str:gsub('\\', '\\\239\187\191')
|
||||
str = str:gsub('{', '\\{')
|
||||
str = str:gsub('}', '\\}')
|
||||
-- Precede newlines with a ZWNBSP to prevent ASS's weird collapsing of
|
||||
-- consecutive newlines
|
||||
str = str:gsub('\n', '\239\187\191\\N')
|
||||
-- Turn leading spaces into hard spaces to prevent ASS from stripping them
|
||||
str = str:gsub('\\N ', '\\N\\h')
|
||||
str = str:gsub('^ ', '\\h')
|
||||
return str
|
||||
end
|
||||
|
||||
-- Render the REPL and console as an ASS OSD
|
||||
local function update()
|
||||
local dpi_scale = mp.get_property_native("display-hidpi-scale", 1.0)
|
||||
|
||||
dpi_scale = dpi_scale * opts.scale
|
||||
|
||||
local screenx, screeny, aspect = mp.get_osd_size()
|
||||
screenx = screenx / dpi_scale
|
||||
screeny = screeny / dpi_scale
|
||||
|
||||
-- Clear the OSD if the REPL is not active
|
||||
if not repl_active then
|
||||
mp.set_osd_ass(screenx, screeny, '')
|
||||
return
|
||||
end
|
||||
|
||||
local ass = assdraw.ass_new()
|
||||
local style = '{\\r' ..
|
||||
'\\1a&H00&\\3a&H00&\\4a&H99&' ..
|
||||
'\\1c&Heeeeee&\\3c&H111111&\\4c&H000000&' ..
|
||||
'\\fn' .. opts.font .. '\\fs' .. opts.font_size ..
|
||||
'\\bord1\\xshad0\\yshad1\\fsp0\\q1}'
|
||||
|
||||
local queue_style = '{\\r' ..
|
||||
'\\1a&H00&\\3a&H00&\\4a&H99&' ..
|
||||
'\\1c&Heeeeee&\\3c&H111111&\\4c&H000000&' ..
|
||||
'\\fn' .. opts.font .. '\\fs' .. opts.font_size .. '\\c&H66ccff&' ..
|
||||
'\\bord1\\xshad0\\yshad1\\fsp0\\q1}'
|
||||
|
||||
-- Create the cursor glyph as an ASS drawing. ASS will draw the cursor
|
||||
-- inline with the surrounding text, but it sets the advance to the width
|
||||
-- of the drawing. So the cursor doesn't affect layout too much, make it as
|
||||
-- thin as possible and make it appear to be 1px wide by giving it 0.5px
|
||||
-- horizontal borders.
|
||||
local cheight = opts.font_size * 8
|
||||
local cglyph = '{\\r' ..
|
||||
'\\1a&H44&\\3a&H44&\\4a&H99&' ..
|
||||
'\\1c&Heeeeee&\\3c&Heeeeee&\\4c&H000000&' ..
|
||||
'\\xbord0.5\\ybord0\\xshad0\\yshad1\\p4\\pbo24}' ..
|
||||
'm 0 0 l 1 0 l 1 ' .. cheight .. ' l 0 ' .. cheight ..
|
||||
'{\\p0}'
|
||||
local before_cur = ass_escape(line:sub(1, cursor - 1))
|
||||
local after_cur = ass_escape(line:sub(cursor))
|
||||
|
||||
ass:new_event()
|
||||
ass:an(1)
|
||||
ass:pos(2, screeny - 2 - global_margin_y * screeny)
|
||||
|
||||
if (#queue == 2) then ass:append(queue_style .. string.format("There is 1 more request queued\\N"))
|
||||
elseif (#queue > 2) then ass:append(queue_style .. string.format("There are %d more requests queued\\N", #queue-1)) end
|
||||
ass:append(style .. request.text .. '\\N')
|
||||
ass:append('> ' .. before_cur)
|
||||
ass:append(cglyph)
|
||||
ass:append(style .. after_cur)
|
||||
|
||||
-- Redraw the cursor with the REPL text invisible. This will make the
|
||||
-- cursor appear in front of the text.
|
||||
ass:new_event()
|
||||
ass:an(1)
|
||||
ass:pos(2, screeny - 2)
|
||||
ass:append(style .. '{\\alpha&HFF&}> ' .. before_cur)
|
||||
ass:append(cglyph)
|
||||
ass:append(style .. '{\\alpha&HFF&}' .. after_cur)
|
||||
|
||||
mp.set_osd_ass(screenx, screeny, ass.text)
|
||||
end
|
||||
|
||||
-- Naive helper function to find the next UTF-8 character in 'str' after 'pos'
|
||||
-- by skipping continuation bytes. Assumes 'str' contains valid UTF-8.
|
||||
local function next_utf8(str, pos)
|
||||
if pos > str:len() then return pos end
|
||||
repeat
|
||||
pos = pos + 1
|
||||
until pos > str:len() or str:byte(pos) < 0x80 or str:byte(pos) > 0xbf
|
||||
return pos
|
||||
end
|
||||
|
||||
-- As above, but finds the previous UTF-8 charcter in 'str' before 'pos'
|
||||
local function prev_utf8(str, pos)
|
||||
if pos <= 1 then return pos end
|
||||
repeat
|
||||
pos = pos - 1
|
||||
until pos <= 1 or str:byte(pos) < 0x80 or str:byte(pos) > 0xbf
|
||||
return pos
|
||||
end
|
||||
|
||||
-- Insert a character at the current cursor position (any_unicode)
|
||||
local function handle_char_input(c)
|
||||
if insert_mode then
|
||||
line = line:sub(1, cursor - 1) .. c .. line:sub(next_utf8(line, cursor))
|
||||
else
|
||||
line = line:sub(1, cursor - 1) .. c .. line:sub(cursor)
|
||||
end
|
||||
cursor = cursor + #c
|
||||
update()
|
||||
end
|
||||
|
||||
-- Remove the character behind the cursor (Backspace)
|
||||
local function handle_backspace()
|
||||
if cursor <= 1 then return end
|
||||
local prev = prev_utf8(line, cursor)
|
||||
line = line:sub(1, prev - 1) .. line:sub(cursor)
|
||||
cursor = prev
|
||||
update()
|
||||
end
|
||||
|
||||
-- Remove the character in front of the cursor (Del)
|
||||
local function handle_del()
|
||||
if cursor > line:len() then return end
|
||||
line = line:sub(1, cursor - 1) .. line:sub(next_utf8(line, cursor))
|
||||
update()
|
||||
end
|
||||
|
||||
-- Toggle insert mode (Ins)
|
||||
local function handle_ins()
|
||||
insert_mode = not insert_mode
|
||||
end
|
||||
|
||||
-- Move the cursor to the next character (Right)
|
||||
local function next_char(amount)
|
||||
cursor = next_utf8(line, cursor)
|
||||
update()
|
||||
end
|
||||
|
||||
-- Move the cursor to the previous character (Left)
|
||||
local function prev_char(amount)
|
||||
cursor = prev_utf8(line, cursor)
|
||||
update()
|
||||
end
|
||||
|
||||
-- Clear the current line (Ctrl+C)
|
||||
local function clear()
|
||||
line = ''
|
||||
cursor = 1
|
||||
insert_mode = false
|
||||
request.history.pos = #request.history.list + 1
|
||||
update()
|
||||
end
|
||||
|
||||
-- Close the REPL if the current line is empty, otherwise do nothing (Ctrl+D)
|
||||
local function maybe_exit()
|
||||
if line == '' then
|
||||
else
|
||||
handle_del()
|
||||
end
|
||||
end
|
||||
|
||||
local function handle_esc()
|
||||
coroutine.resume(co, {
|
||||
line = nil,
|
||||
err = "exited"
|
||||
})
|
||||
end
|
||||
|
||||
-- Run the current command and clear the line (Enter)
|
||||
local function handle_enter()
|
||||
if request.history.list[#request.history.list] ~= line and line ~= "" then
|
||||
request.history.list[#request.history.list + 1] = line
|
||||
end
|
||||
coroutine.resume(co, {
|
||||
line = line
|
||||
})
|
||||
end
|
||||
|
||||
-- Go to the specified position in the command history
|
||||
local function go_history(new_pos)
|
||||
local old_pos = request.history.pos
|
||||
request.history.pos = new_pos
|
||||
|
||||
-- Restrict the position to a legal value
|
||||
if request.history.pos > #request.history.list + 1 then
|
||||
request.history.pos = #request.history.list + 1
|
||||
elseif request.history.pos < 1 then
|
||||
request.history.pos = 1
|
||||
end
|
||||
|
||||
-- Do nothing if the history position didn't actually change
|
||||
if request.history.pos == old_pos then
|
||||
return
|
||||
end
|
||||
|
||||
-- If the user was editing a non-history line, save it as the last history
|
||||
-- entry. This makes it much less frustrating to accidentally hit Up/Down
|
||||
-- while editing a line.
|
||||
if old_pos == #request.history.list + 1 and line ~= '' and request.history.list[#request.history.list] ~= line then
|
||||
request.history.list[#request.history.list + 1] = line
|
||||
end
|
||||
|
||||
-- Now show the history line (or a blank line for #history + 1)
|
||||
if request.history.pos <= #request.history.list then
|
||||
line = request.history.list[request.history.pos]
|
||||
else
|
||||
line = ''
|
||||
end
|
||||
cursor = line:len() + 1
|
||||
insert_mode = false
|
||||
update()
|
||||
end
|
||||
|
||||
-- Go to the specified relative position in the command history (Up, Down)
|
||||
local function move_history(amount)
|
||||
go_history(request.history.pos + amount)
|
||||
end
|
||||
|
||||
-- Go to the first command in the command history (PgUp)
|
||||
local function handle_pgup()
|
||||
go_history(1)
|
||||
end
|
||||
|
||||
-- Stop browsing history and start editing a blank line (PgDown)
|
||||
local function handle_pgdown()
|
||||
go_history(#request.history.list + 1)
|
||||
end
|
||||
|
||||
-- Move to the start of the current word, or if already at the start, the start
|
||||
-- of the previous word. (Ctrl+Left)
|
||||
local function prev_word()
|
||||
-- This is basically the same as next_word() but backwards, so reverse the
|
||||
-- string in order to do a "backwards" find. This wouldn't be as annoying
|
||||
-- to do if Lua didn't insist on 1-based indexing.
|
||||
cursor = line:len() - select(2, line:reverse():find('%s*[^%s]*', line:len() - cursor + 2)) + 1
|
||||
update()
|
||||
end
|
||||
|
||||
-- Move to the end of the current word, or if already at the end, the end of
|
||||
-- the next word. (Ctrl+Right)
|
||||
local function next_word()
|
||||
cursor = select(2, line:find('%s*[^%s]*', cursor)) + 1
|
||||
update()
|
||||
end
|
||||
|
||||
-- Move the cursor to the beginning of the line (HOME)
|
||||
local function go_home()
|
||||
cursor = 1
|
||||
update()
|
||||
end
|
||||
|
||||
-- Move the cursor to the end of the line (END)
|
||||
local function go_end()
|
||||
cursor = line:len() + 1
|
||||
update()
|
||||
end
|
||||
|
||||
-- Delete from the cursor to the beginning of the word (Ctrl+Backspace)
|
||||
local function del_word()
|
||||
local before_cur = line:sub(1, cursor - 1)
|
||||
local after_cur = line:sub(cursor)
|
||||
|
||||
before_cur = before_cur:gsub('[^%s]+%s*$', '', 1)
|
||||
line = before_cur .. after_cur
|
||||
cursor = before_cur:len() + 1
|
||||
update()
|
||||
end
|
||||
|
||||
-- Delete from the cursor to the end of the word (Ctrl+Del)
|
||||
local function del_next_word()
|
||||
if cursor > line:len() then return end
|
||||
|
||||
local before_cur = line:sub(1, cursor - 1)
|
||||
local after_cur = line:sub(cursor)
|
||||
|
||||
after_cur = after_cur:gsub('^%s*[^%s]+', '', 1)
|
||||
line = before_cur .. after_cur
|
||||
update()
|
||||
end
|
||||
|
||||
-- Delete from the cursor to the end of the line (Ctrl+K)
|
||||
local function del_to_eol()
|
||||
line = line:sub(1, cursor - 1)
|
||||
update()
|
||||
end
|
||||
|
||||
-- Delete from the cursor back to the start of the line (Ctrl+U)
|
||||
local function del_to_start()
|
||||
line = line:sub(cursor)
|
||||
cursor = 1
|
||||
update()
|
||||
end
|
||||
|
||||
-- Returns a string of UTF-8 text from the clipboard (or the primary selection)
|
||||
local function get_clipboard(clip)
|
||||
if platform == 'x11' then
|
||||
local res = utils.subprocess({
|
||||
args = { 'xclip', '-selection', clip and 'clipboard' or 'primary', '-out' },
|
||||
playback_only = false,
|
||||
})
|
||||
if not res.error then
|
||||
return res.stdout
|
||||
end
|
||||
elseif platform == 'wayland' then
|
||||
local res = utils.subprocess({
|
||||
args = { 'wl-paste', clip and '-n' or '-np' },
|
||||
playback_only = false,
|
||||
})
|
||||
if not res.error then
|
||||
return res.stdout
|
||||
end
|
||||
elseif platform == 'windows' then
|
||||
local res = utils.subprocess({
|
||||
args = { 'powershell', '-NoProfile', '-Command', [[& {
|
||||
Trap {
|
||||
Write-Error -ErrorRecord $_
|
||||
Exit 1
|
||||
}
|
||||
|
||||
$clip = ""
|
||||
if (Get-Command "Get-Clipboard" -errorAction SilentlyContinue) {
|
||||
$clip = Get-Clipboard -Raw -Format Text -TextFormatType UnicodeText
|
||||
} else {
|
||||
Add-Type -AssemblyName PresentationCore
|
||||
$clip = [Windows.Clipboard]::GetText()
|
||||
}
|
||||
|
||||
$clip = $clip -Replace "`r",""
|
||||
$u8clip = [System.Text.Encoding]::UTF8.GetBytes($clip)
|
||||
[Console]::OpenStandardOutput().Write($u8clip, 0, $u8clip.Length)
|
||||
}]] },
|
||||
playback_only = false,
|
||||
})
|
||||
if not res.error then
|
||||
return res.stdout
|
||||
end
|
||||
elseif platform == 'macos' then
|
||||
local res = utils.subprocess({
|
||||
args = { 'pbpaste' },
|
||||
playback_only = false,
|
||||
})
|
||||
if not res.error then
|
||||
return res.stdout
|
||||
end
|
||||
end
|
||||
return ''
|
||||
end
|
||||
|
||||
-- Paste text from the window-system's clipboard. 'clip' determines whether the
|
||||
-- clipboard or the primary selection buffer is used (on X11 and Wayland only.)
|
||||
local function paste(clip)
|
||||
local text = get_clipboard(clip)
|
||||
local before_cur = line:sub(1, cursor - 1)
|
||||
local after_cur = line:sub(cursor)
|
||||
line = before_cur .. text .. after_cur
|
||||
cursor = cursor + text:len()
|
||||
update()
|
||||
end
|
||||
|
||||
-- List of input bindings. This is a weird mashup between common GUI text-input
|
||||
-- bindings and readline bindings.
|
||||
local function get_bindings()
|
||||
local bindings = {
|
||||
{ 'esc', handle_esc },
|
||||
{ 'enter', handle_enter },
|
||||
{ 'kp_enter', handle_enter },
|
||||
{ 'shift+enter', function() handle_char_input('\n') end },
|
||||
{ 'ctrl+j', handle_enter },
|
||||
{ 'ctrl+m', handle_enter },
|
||||
{ 'bs', handle_backspace },
|
||||
{ 'shift+bs', handle_backspace },
|
||||
{ 'ctrl+h', handle_backspace },
|
||||
{ 'del', handle_del },
|
||||
{ 'shift+del', handle_del },
|
||||
{ 'ins', handle_ins },
|
||||
{ 'shift+ins', function() paste(false) end },
|
||||
{ 'mbtn_mid', function() paste(false) end },
|
||||
{ 'left', function() prev_char() end },
|
||||
{ 'ctrl+b', function() prev_char() end },
|
||||
{ 'right', function() next_char() end },
|
||||
{ 'ctrl+f', function() next_char() end },
|
||||
{ 'up', function() move_history(-1) end },
|
||||
{ 'ctrl+p', function() move_history(-1) end },
|
||||
{ 'wheel_up', function() move_history(-1) end },
|
||||
{ 'down', function() move_history(1) end },
|
||||
{ 'ctrl+n', function() move_history(1) end },
|
||||
{ 'wheel_down', function() move_history(1) end },
|
||||
{ 'wheel_left', function() end },
|
||||
{ 'wheel_right', function() end },
|
||||
{ 'ctrl+left', prev_word },
|
||||
{ 'alt+b', prev_word },
|
||||
{ 'ctrl+right', next_word },
|
||||
{ 'alt+f', next_word },
|
||||
{ 'ctrl+a', go_home },
|
||||
{ 'home', go_home },
|
||||
{ 'ctrl+e', go_end },
|
||||
{ 'end', go_end },
|
||||
{ 'pgup', handle_pgup },
|
||||
{ 'pgdwn', handle_pgdown },
|
||||
{ 'ctrl+c', clear },
|
||||
{ 'ctrl+d', maybe_exit },
|
||||
{ 'ctrl+k', del_to_eol },
|
||||
{ 'ctrl+u', del_to_start },
|
||||
{ 'ctrl+v', function() paste(true) end },
|
||||
{ 'meta+v', function() paste(true) end },
|
||||
{ 'ctrl+bs', del_word },
|
||||
{ 'ctrl+w', del_word },
|
||||
{ 'ctrl+del', del_next_word },
|
||||
{ 'alt+d', del_next_word },
|
||||
{ 'kp_dec', function() handle_char_input('.') end },
|
||||
}
|
||||
|
||||
for i = 0, 9 do
|
||||
bindings[#bindings + 1] =
|
||||
{'kp' .. i, function() handle_char_input('' .. i) end}
|
||||
end
|
||||
|
||||
return bindings
|
||||
end
|
||||
|
||||
local function text_input(info)
|
||||
if info.key_text and (info.event == "press" or info.event == "down"
|
||||
or info.event == "repeat")
|
||||
then
|
||||
handle_char_input(info.key_text)
|
||||
end
|
||||
end
|
||||
|
||||
local function define_key_bindings()
|
||||
if #key_bindings > 0 then
|
||||
return
|
||||
end
|
||||
for _, bind in ipairs(get_bindings()) do
|
||||
-- Generate arbitrary name for removing the bindings later.
|
||||
local name = "_userinput_" .. bind[1]
|
||||
key_bindings[#key_bindings + 1] = name
|
||||
mp.add_forced_key_binding(bind[1], name, bind[2], {repeatable = true})
|
||||
end
|
||||
mp.add_forced_key_binding("any_unicode", "_userinput_text", text_input,
|
||||
{repeatable = true, complex = true})
|
||||
key_bindings[#key_bindings + 1] = "_userinput_text"
|
||||
end
|
||||
|
||||
local function undefine_key_bindings()
|
||||
for _, name in ipairs(key_bindings) do
|
||||
mp.remove_key_binding(name)
|
||||
end
|
||||
key_bindings = {}
|
||||
end
|
||||
|
||||
-- Set the REPL visibility ("enable", Esc)
|
||||
local function set_active(active)
|
||||
if active == repl_active then return end
|
||||
if active then
|
||||
repl_active = true
|
||||
insert_mode = false
|
||||
define_key_bindings()
|
||||
else
|
||||
clear()
|
||||
repl_active = false
|
||||
undefine_key_bindings()
|
||||
collectgarbage()
|
||||
end
|
||||
update()
|
||||
end
|
||||
|
||||
|
||||
mp.observe_property("user-data/osc/margins", "native", function(_, val)
|
||||
if val then
|
||||
global_margins = val
|
||||
else
|
||||
global_margins = { t = 0, b = 0 }
|
||||
end
|
||||
update()
|
||||
end)
|
||||
|
||||
-- Redraw the REPL when the OSD size changes. This is needed because the
|
||||
-- PlayRes of the OSD will need to be adjusted.
|
||||
mp.observe_property('osd-width', 'native', update)
|
||||
mp.observe_property('osd-height', 'native', update)
|
||||
mp.observe_property('display-hidpi-scale', 'native', update)
|
||||
|
||||
----------------------------------------------------------------------------------------
|
||||
----------------------------------------------------------------------------------------
|
||||
----------------------------------------------------------------------------------------
|
||||
-------------------------------END ORIGINAL MPV CODE------------------------------------
|
||||
|
||||
--[[
|
||||
sends a response to the original script in the form of a json string
|
||||
it is expected that all requests get a response, if the input is nil then err should say why
|
||||
current error codes are:
|
||||
exited the user closed the input instead of pressing Enter
|
||||
already_queued a request with the specified id was already in the queue
|
||||
cancelled a script cancelled the request
|
||||
replace replaced by another request
|
||||
]]
|
||||
local function send_response(res)
|
||||
if res.source then
|
||||
mp.commandv("script-message-to", res.source, res.response, (utils.format_json(res)))
|
||||
else
|
||||
mp.commandv("script-message", res.response, (utils.format_json(res)))
|
||||
end
|
||||
end
|
||||
|
||||
-- push new request onto the queue
|
||||
-- if a request with the same id already exists and the queueable flag is not enabled then
|
||||
-- a nil result will be returned to the function
|
||||
function push_request(req)
|
||||
if active_ids[req.id] then
|
||||
if req.replace then
|
||||
for i, q_req in ipairs(queue) do
|
||||
if q_req.id == req.id then
|
||||
send_response{ err = "replaced", response = q_req.response, source = q_req.source }
|
||||
queue[i] = req
|
||||
if i == 1 then request = req end
|
||||
end
|
||||
end
|
||||
update()
|
||||
return
|
||||
end
|
||||
|
||||
if not req.queueable then
|
||||
send_response{ err = "already_queued", response = req.response, source = req.source }
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
table.insert(queue, req)
|
||||
active_ids[req.id] = (active_ids[req.id] or 0) + 1
|
||||
if #queue == 1 then coroutine.resume(co) end
|
||||
update()
|
||||
end
|
||||
|
||||
-- safely removes an item from the queue and updates the set of active requests
|
||||
function remove_request(index)
|
||||
local req = table.remove(queue, index)
|
||||
active_ids[req.id] = active_ids[req.id] - 1
|
||||
|
||||
if active_ids[req.id] == 0 then active_ids[req.id] = nil end
|
||||
return req
|
||||
end
|
||||
|
||||
--an infinite loop that moves through the request queue
|
||||
--uses a coroutine to handle asynchronous operations
|
||||
local function driver()
|
||||
while (true) do
|
||||
while queue[1] do
|
||||
request = queue[1]
|
||||
line = request.default_input
|
||||
cursor = request.cursor_pos
|
||||
|
||||
if repl_active then update()
|
||||
else set_active(true) end
|
||||
|
||||
res = coroutine.yield()
|
||||
if res then
|
||||
res.source, res.response = request.source, request.response
|
||||
send_response(res)
|
||||
remove_request(1)
|
||||
end
|
||||
end
|
||||
|
||||
set_active(false)
|
||||
coroutine.yield()
|
||||
end
|
||||
end
|
||||
|
||||
co = coroutine.create(driver)
|
||||
|
||||
--cancels any input request that returns true for the given predicate function
|
||||
local function cancel_input_request(pred)
|
||||
for i = #queue, 1, -1 do
|
||||
if pred(i) then
|
||||
req = remove_request(i)
|
||||
send_response{ err = "cancelled", response = req.response, source = req.source }
|
||||
|
||||
--if we're removing the first item then that means the coroutine is waiting for a response
|
||||
--we will need to tell the coroutine to resume, upon which it will move to the next request
|
||||
--if there is something in the buffer then save it to the history before erasing it
|
||||
if i == 1 then
|
||||
local old_line = line
|
||||
if old_line ~= "" then table.insert(histories[req.id].list, old_line) end
|
||||
clear()
|
||||
coroutine.resume(co)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
mp.register_script_message("cancel-user-input/uid", function(uid)
|
||||
cancel_input_request(function(i) return queue[i].response == uid end)
|
||||
end)
|
||||
|
||||
-- removes all requests with the specified id from the queue
|
||||
mp.register_script_message("cancel-user-input/id", function(id)
|
||||
cancel_input_request(function(i) return queue[i].id == id end)
|
||||
end)
|
||||
|
||||
-- ensures a request has the correct fields and is correctly formatted
|
||||
local function format_request_fields(req)
|
||||
assert(req.version, "input requests require an API version string")
|
||||
if not string.find(req.version, API_MAJOR_MINOR, 1, true) then
|
||||
error(("input request has invalid version: expected %s.x, got %s"):format(API_MAJOR_MINOR, req.version))
|
||||
end
|
||||
|
||||
assert(req.response, "input requests require a response string")
|
||||
assert(req.id, "input requests require an id string")
|
||||
|
||||
req.text = ass_escape(req.request_text or "")
|
||||
req.default_input = req.default_input or ""
|
||||
req.cursor_pos = tonumber(req.cursor_pos) or 1
|
||||
req.id = req.id or "mpv"
|
||||
|
||||
if req.cursor_pos ~= 1 then
|
||||
if req.cursor_pos < 1 then req.cursor_pos = 1
|
||||
elseif req.cursor_pos > #req.default_input then req.cursor_pos = #req.default_input + 1 end
|
||||
end
|
||||
|
||||
if not histories[req.id] then histories[req.id] = {pos = 1, list = {}} end
|
||||
req.history = histories[req.id]
|
||||
return req
|
||||
end
|
||||
|
||||
-- updates the fields of a specific request
|
||||
mp.register_script_message("update-user-input/uid", function(uid, req_opts)
|
||||
req_opts = utils.parse_json(req_opts)
|
||||
req_opts.response = uid
|
||||
for i, req in ipairs(queue) do
|
||||
if req.response == uid then
|
||||
local success, result = pcall(format_request_fields, req_opts)
|
||||
if not success then return msg.error(result) end
|
||||
|
||||
queue[i] = result
|
||||
if i == 1 then request = queue[1] end
|
||||
update()
|
||||
return
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
--the function that parses the input requests
|
||||
local function input_request(req)
|
||||
req = format_request_fields(req)
|
||||
push_request(req)
|
||||
end
|
||||
|
||||
-- script message to recieve input requests, get-user-input.lua acts as an interface to call this script message
|
||||
mp.register_script_message("request-user-input", function(req)
|
||||
msg.debug(req)
|
||||
req = utils.parse_json(req)
|
||||
local success, err = pcall(input_request, req)
|
||||
if not success then
|
||||
send_response{ err = err, response = req.response, source = req.source}
|
||||
msg.error(err)
|
||||
end
|
||||
end)
|
||||
|
2734
.config/mpv/scripts/webm.lua
Normal file
|
@ -672,4 +672,3 @@ may consider it more useful to permit linking proprietary applications with
|
|||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
|
74
.config/mpv/scripts/webtorrent-hook/README.org
Normal file
|
@ -0,0 +1,74 @@
|
|||
* About
|
||||
This plugin allows mpv to stream magnet links (and any other torrent identifier [[https://github.com/webtorrent/webtorrent-cli][webtorrent-cli]] handles) directly. It will automatically remove videos after they are finished playing (by default) and will set the title to be the name of the video.
|
||||
|
||||
This script will detect =magnet:= links, torrent files/urls ending in =torrent=, and info hashes. You can also explicitly prefix the identifier with =webtorrent://= to let this plugin know the path/url is a torrent (e.g. you could do this to play a torrent file that didn't end in =torrent=)
|
||||
|
||||
* Comparison with using ~webtorrent --mpv~
|
||||
One benefit is consistency of syntax (e.g. if you have a shell command or keybinding to call ~mpv <clipboard>~, you don't need to handle torrents differently).
|
||||
|
||||
This script also provides more functionality and options. For example, it can automatically delete downloaded files, and it can remember and jump to the last video you played in a torrent file with multiple videos. See the settings heading below for more information.
|
||||
|
||||
Another reason you might want to use this script is that you can start mpv with a playlist of multiple magnet links or add magnet links to the playlist of an already open mpv window (e.g. using one of the scripts that allow appending a link from the clipboard to the playlist such as [[https://github.com/Eisa01/mpv-scripts#smartcopypaste-ii-script][SmartCopyPaste-II]]).
|
||||
|
||||
By using this script, you can also see mpv output (which is hidden when calling ~webtorrent~ directly). On the other hand, you won't be able to see both the normal ~webtorrent~ output and mpv's output at the same time. By default, this script will print the download speed while waiting for the video to load (see the information on the =webtorrent_verbosity= setting below for more options).
|
||||
|
||||
* Requirements
|
||||
- [[https://github.com/webtorrent/webtorrent-cli][webtorrent-cli]]
|
||||
- on linux (or maybe similar)
|
||||
- basic shell utilities (bash, awk, grep, nohup, tail)
|
||||
- [[https://github.com/stedolan/jq][jq]]
|
||||
- [[https://github.com/benibela/xidel][xidel]]
|
||||
|
||||
Webtorrent-cli does not currently provide a way to get a json list of files which is why jq and xidel are required.
|
||||
|
||||
* Installation Instructions
|
||||
Clone this repo into the mpv scripts directory (e.g. =git clone <url> ~/.config/mpv/scripts/webtorrent-hook=). You must put this whole directory in the scripts directory not just the lua file.
|
||||
|
||||
* Comparison with Peerflix-hook
|
||||
Peerflix is unmaintained, and webtorrent is supposedly significantly faster.
|
||||
|
||||
Peerflix's output is not parseable, so the peerflix version of this script had to do a bunch of extra work with ~lsof~ to figure out the location of video files, the title of video files, and the process id of peerflix (in order to kill it). This script is a lot cleaner by comparison (though it could be better if webtorrent had a way to give [[https://github.com/webtorrent/webtorrent-cli/issues/132][more script-friendly output]]).
|
||||
|
||||
This script also has a lot more functionality than the peerflix version (e.g support for torrents containing multiple media files).
|
||||
|
||||
* Comparison With Btfs-stream
|
||||
Webtorrent has parseable output but is still not very script friendly. [[https://github.com/noctuid/mpv-btfs-stream][mpv-btfs-stream]] is cleaner and simpler by comparison and does not rely on parsing output. The advantage of webtorrent over btfs is that webtorrent is much faster. Functionally, I am not aware of any downsides of using webtorrent-hook instead of btfs-stream though. See [[https://github.com/noctuid/mpv-btfs-hook#comparison-with-mpv-webtorrent-hook][here]] for a full comparison.
|
||||
|
||||
* Comparison with webtorrent-mpv-hook
|
||||
There is a similarly named plugin [[https://github.com/mrxdst/webtorrent-mpv-hook][webtorrent-mpv-hook]] which directly uses the webtorrent library instead of webtorrent-cli.
|
||||
|
||||
Here are advantages of the other plugin:
|
||||
- it directly uses the webtorrent library, which simplifies how the code works somewhat
|
||||
- it has a much prettier speed/progress display while you are waiting for the torrent to start
|
||||
|
||||
Here are missing features of the other plugin:
|
||||
- it has no option to delete files after exiting mpv
|
||||
- it has no option to continue seeding after exiting mpv
|
||||
- it does not remember the last file played for previously played torrents (it will always start at the first file)
|
||||
- it does not work correctly with scripts that allow pasting a path/url into the playlist (it only supports one webtorrent instance; this plugin supports an arbitrary number of webtorrent-cli instances)
|
||||
|
||||
* Configuration
|
||||
In =~/.config/mpv/script-opts/webtorrent-hook.conf=, you can change the following settings:
|
||||
- =close_webtorrent= - whether to close webtorrent after unloading the video; if =no=, keep seeding (default: =yes=)
|
||||
- =remove_files= - whether to remove the video file from disk after unloading; =yes= only has an effect if =close_webtorrent= is also =yes= (default: =yes=)
|
||||
- =download_directory= - directory to download videos to; the script will run mpv's =expand-path= command on the string first so that mpv path abbreviations such as =~/= and =~~/= can be used (default: =/tmp/webtorrent-hook=)
|
||||
- =webtorrent_flags= - json array of extra flags to pass to webtorrent (default: []; flags always used: =webtorrent --port 0 --out <download_directory> --keep-streaming=; keep-streaming is always passed, and =close_webtorrent= determines whether or not to stop webtorrent)
|
||||
- =show_speed= - whether to continuously output webtorrent-cli's download speed line; the output stops once the video is loaded to prevent clobbering mpv's output (default: =yes=)
|
||||
- =remember_last_played= - whether to store the last played video in a title and start at it in the future (default: =yes=)
|
||||
- =remember_directory= - directory to store last played information in; make this something outside of =/tmp= if you want it to be remembered after computer reboot (default: =/tmp/webtorrent-hook-last-played=)
|
||||
|
||||
If you set =close_webtorrent= to =no=, you will have to manually kill the =WebTorrent= processes yourself when you want to stop seeding (~pgrep WebTorrent~ should show all processes).
|
||||
|
||||
Here is an example configuration file:
|
||||
#+begin_src conf-unix
|
||||
close_webtorrent=yes
|
||||
remove_files=yes
|
||||
# change download directory
|
||||
download_directory=~/tmp/webtorrent-hook
|
||||
# do not use --out, --keep-streaming, --port or most other flags (should be
|
||||
# obvious; don't use --quiet, --mpv, etc.)
|
||||
webtorrent_flags=["--blocklist", "<blocklist url>"]
|
||||
show_speed=no
|
||||
remember_last_played=yes
|
||||
remember_directory=~/tmp/webtorrent-remember
|
||||
#+end_src
|
249
.config/mpv/scripts/webtorrent-hook/main.lua
Normal file
|
@ -0,0 +1,249 @@
|
|||
-- TODO start webtorrent instance immediately when pasting into playlist instead
|
||||
-- of waiting for load?
|
||||
-- TODO what happens with --prefetch-playlist?
|
||||
|
||||
local settings = {
|
||||
close_webtorrent = true,
|
||||
remove_files = true,
|
||||
download_directory = "/tmp/webtorrent-hook",
|
||||
webtorrent_flags = [[]],
|
||||
show_speed = true,
|
||||
remember_last_played = true,
|
||||
remember_directory = "/tmp/webtorrent-hook-last-played"
|
||||
}
|
||||
|
||||
(require "mp.options").read_options(settings, "webtorrent-hook")
|
||||
|
||||
local utils = require "mp.utils";
|
||||
|
||||
local webtorrent_instances = {}
|
||||
local webtorrent_files = {}
|
||||
local script_dir = mp.get_script_directory()
|
||||
local printer_pid = nil
|
||||
|
||||
-- * Helpers
|
||||
-- http://lua-users.org/wiki/StringRecipes
|
||||
function ends_with(str, ending)
|
||||
return ending == "" or str:sub(-#ending) == ending
|
||||
end
|
||||
|
||||
function read_file(file)
|
||||
local fh = assert(io.open(file, "rb"))
|
||||
local contents = fh:read("*all")
|
||||
fh:close()
|
||||
return contents
|
||||
end
|
||||
|
||||
function write_file(file, text)
|
||||
local fh = io.open(file, "w")
|
||||
fh:write(text)
|
||||
fh:close()
|
||||
end
|
||||
|
||||
function is_handled_url(url, load_failed)
|
||||
if load_failed then
|
||||
-- info hash
|
||||
return (load_failed and string.match(url, "%w+"))
|
||||
else
|
||||
return (url:find("magnet:") == 1 or url:find("peerflix://") == 1
|
||||
or url:find("webtorrent://") == 1 or ends_with(url, "torrent"))
|
||||
end
|
||||
end
|
||||
|
||||
function load_file_after_current(url, option_table, num_entries)
|
||||
mp.command_native({
|
||||
"loadfile", url, "append", -1, option_table
|
||||
})
|
||||
local index = mp.get_property("playlist-pos")
|
||||
mp.command_native({
|
||||
"playlist-move",
|
||||
mp.get_property("playlist-count") - 1,
|
||||
index + 1 + num_entries
|
||||
})
|
||||
end
|
||||
|
||||
-- * Store Last Played Files
|
||||
function file_info_hash(filename)
|
||||
return webtorrent_files[filename]
|
||||
end
|
||||
|
||||
function get_remember_file_path(info_hash)
|
||||
return utils.join_path(settings.remember_directory, info_hash)
|
||||
end
|
||||
|
||||
function maybe_store_last_played_torrent_file(_)
|
||||
if settings.remember_last_played then
|
||||
mp.commandv("run", "mkdir", "-p", settings.remember_directory)
|
||||
local filename = mp.get_property("media-title")
|
||||
local info_hash = file_info_hash(filename)
|
||||
if info_hash ~= nil then
|
||||
local remember_file = get_remember_file_path(info_hash)
|
||||
write_file(remember_file, filename)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
mp.register_event("file-loaded", maybe_store_last_played_torrent_file)
|
||||
|
||||
function get_last_played_filename_for_torrent(info_hash)
|
||||
local remember_file = get_remember_file_path(info_hash)
|
||||
if utils.file_info(remember_file) then
|
||||
return read_file(remember_file)
|
||||
end
|
||||
end
|
||||
|
||||
-- * Play Torrents
|
||||
function load_webtorrent_files(info_hash, webtorrent_info)
|
||||
local first = true
|
||||
local found_last_played = false
|
||||
local last_played_filename = ""
|
||||
if settings.remember_last_played then
|
||||
last_played_filename = get_last_played_filename_for_torrent(info_hash)
|
||||
end
|
||||
local should_remember = settings.remember_last_played
|
||||
and last_played_filename
|
||||
local file_index = 0
|
||||
local file_play_index = 0
|
||||
for _, file in pairs(webtorrent_info["files"]) do
|
||||
local title = file["title"]
|
||||
webtorrent_files[title] = info_hash
|
||||
local option_table = {}
|
||||
-- TODO is it actually necessary to set force-media-title for sub
|
||||
-- plugins? it seems to be correctly set by default for what I've
|
||||
-- tried
|
||||
option_table["force-media-title"] = title
|
||||
local url = file["url"]
|
||||
if first then
|
||||
load_file_after_current(url, option_table, 0)
|
||||
mp.command_native({"playlist-remove", mp.get_property("playlist-pos")})
|
||||
else
|
||||
load_file_after_current(url, option_table,
|
||||
file_index - (file_play_index + 1))
|
||||
if should_remember and not found_last_played then
|
||||
file_play_index = file_play_index + 1
|
||||
mp.set_property("playlist-pos", mp.get_property("playlist-pos") + 1)
|
||||
if title == last_played_filename then
|
||||
found_last_played = true
|
||||
end
|
||||
end
|
||||
end
|
||||
file_index = file_index + 1
|
||||
first = false
|
||||
end
|
||||
end
|
||||
|
||||
function maybe_kill_printer()
|
||||
if printer_pid then
|
||||
mp.commandv("run", "kill", printer_pid)
|
||||
printer_pid = nil
|
||||
end
|
||||
end
|
||||
|
||||
mp.register_event("file-loaded", maybe_kill_printer)
|
||||
|
||||
function start_speed_printer(out_dir)
|
||||
if utils.file_info(utils.join_path(out_dir, "webtorrent-output")) then
|
||||
local speed_printer_path =
|
||||
utils.join_path(script_dir, "webtorrent-speed-printer.sh")
|
||||
os.execute(speed_printer_path .. ' "' .. out_dir .. '"')
|
||||
printer_pid = read_file(utils.join_path(out_dir, "printer.pid"))
|
||||
end
|
||||
end
|
||||
|
||||
function start_webtorrent(url, torrent_info)
|
||||
local base_dir = mp.command_native({
|
||||
"expand-path", settings.download_directory
|
||||
})
|
||||
local info_hash = torrent_info["infoHash"]
|
||||
local out_dir = utils.join_path(base_dir, info_hash)
|
||||
|
||||
local wrapper_path =
|
||||
utils.join_path(script_dir, "webtorrent-wrap.sh")
|
||||
local webtorrent_args = {wrapper_path, out_dir, url}
|
||||
local flags = utils.parse_json(settings.webtorrent_flags)
|
||||
if flags ~= nil then
|
||||
for _, flag in pairs(flags) do
|
||||
table.insert(webtorrent_args, flag)
|
||||
end
|
||||
end
|
||||
mp.msg.info("Waiting for webtorrent server")
|
||||
local webtorrent_result = mp.command_native({
|
||||
name = "subprocess",
|
||||
playback_only = false,
|
||||
capture_stdout = true,
|
||||
args = webtorrent_args
|
||||
})
|
||||
if webtorrent_result.status == 0 then
|
||||
mp.msg.info("Webtorrent server is up")
|
||||
local webtorrent_info = utils.parse_json(webtorrent_result.stdout)
|
||||
local pid = webtorrent_info["pid"]
|
||||
mp.msg.debug(webtorrent_info)
|
||||
local name = "Unknown name"
|
||||
if torrent_info["name"] ~= nil then
|
||||
name = torrent_info["name"]
|
||||
end
|
||||
table.insert(webtorrent_instances,
|
||||
{download_dir=out_dir,pid=pid,name=name})
|
||||
|
||||
if settings.show_speed then
|
||||
start_speed_printer(out_dir)
|
||||
end
|
||||
|
||||
load_webtorrent_files(info_hash, webtorrent_info)
|
||||
else
|
||||
mp.msg.info("Failed to start webtorrent")
|
||||
end
|
||||
end
|
||||
|
||||
-- check if the url is a torrent and play it if it is
|
||||
function maybe_play_torrent(load_failed)
|
||||
local url = mp.get_property("stream-open-filename")
|
||||
if is_handled_url(url, load_failed) then
|
||||
if url:find("webtorrent://") == 1 then
|
||||
url = url:sub(14)
|
||||
end
|
||||
if url:find("peerflix://") == 1 then
|
||||
url = url:sub(12)
|
||||
end
|
||||
|
||||
local torrent_info_command = mp.command_native({
|
||||
name = "subprocess",
|
||||
playback_only = false,
|
||||
capture_stdout = true,
|
||||
args = {"webtorrent", "info", url},
|
||||
})
|
||||
if torrent_info_command.status == 0 then
|
||||
local torrent_info = utils.parse_json(torrent_info_command.stdout)
|
||||
local info_hash = torrent_info["infoHash"]
|
||||
if info_hash ~= nil then
|
||||
start_webtorrent(url, torrent_info)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function check_if_torrent_on_load()
|
||||
maybe_play_torrent(false)
|
||||
end
|
||||
|
||||
function check_if_torrent_on_load_fail()
|
||||
maybe_play_torrent(true)
|
||||
end
|
||||
|
||||
function webtorrent_cleanup()
|
||||
if settings.close_webtorrent then
|
||||
for _, instance in pairs(webtorrent_instances) do
|
||||
mp.msg.verbose("Killing WebTorrent pid " .. instance.pid)
|
||||
mp.commandv("run", "kill", instance.pid)
|
||||
if settings.remove_files then
|
||||
mp.msg.verbose("Removing files for torrent " .. instance.name)
|
||||
mp.commandv("run", "rm", "-r", instance.download_dir)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
mp.add_hook("on_load", 50, check_if_torrent_on_load)
|
||||
mp.add_hook("on_load_fail", 50, check_if_torrent_on_load_fail)
|
||||
|
||||
mp.register_event("shutdown", webtorrent_cleanup)
|
9
.config/mpv/scripts/webtorrent-hook/webtorrent-speed-printer.sh
Executable file
|
@ -0,0 +1,9 @@
|
|||
#!/usr/bin/env bash
|
||||
out_dir=$1
|
||||
output_file="$out_dir"/webtorrent-output
|
||||
printer_pid_file="$out_dir"/printer.pid
|
||||
|
||||
tail -f "$output_file" \
|
||||
| awk '/Speed:/ { printf ("\r%s%s%s", "\033[1;31m", $0, "\033[0m "); }' \
|
||||
>&2 &
|
||||
echo -n $! > "$printer_pid_file"
|
46
.config/mpv/scripts/webtorrent-hook/webtorrent-wrap.sh
Executable file
|
@ -0,0 +1,46 @@
|
|||
#!/usr/bin/env bash
|
||||
out_dir=$1
|
||||
shift
|
||||
mkdir -p "$out_dir"
|
||||
|
||||
# using file over pipe so multiple processes can read from it and because >(tee
|
||||
# "$pipe" "$second-pipe-or file") ends up blocking mpv
|
||||
webtorrent_output_file="$out_dir"/webtorrent-output
|
||||
nohup webtorrent download "$@" --port 0 --out "$out_dir" --keep-seeding \
|
||||
&> "$webtorrent_output_file" &
|
||||
pid=$!
|
||||
|
||||
cleanup() {
|
||||
if (( $? == 1 )); then
|
||||
# kill webtorrent if exit with error
|
||||
kill $pid
|
||||
fi
|
||||
}
|
||||
# shellcheck disable=SC2064
|
||||
trap cleanup EXIT
|
||||
|
||||
url=$(tail -f "$webtorrent_output_file" \
|
||||
| awk '/Server running at: ?/ {gsub(/Server running at: ?/, ""); print $1; exit}')
|
||||
|
||||
base_url=$(echo "$url" | grep --extended-regexp --only-matching \
|
||||
'http://localhost:[0-9]+')
|
||||
webtorrent_hash=$(echo "$url" | grep --extended-regexp --only-matching \
|
||||
'webtorrent/[0-9a-f]+')
|
||||
|
||||
# Get json of files
|
||||
webtorrent_results=$(xidel --silent --extract "//a/@href" "$base_url/$webtorrent_hash" |
|
||||
jq --null-input --raw-input "
|
||||
{
|
||||
pid: $pid,
|
||||
files: [inputs | select(length>0)] | map({title: . | sub(\"/$webtorrent_hash/\"; \"\"), url: (\"$base_url\" + .)})
|
||||
}
|
||||
")
|
||||
|
||||
# Uncomment for debugging info
|
||||
# echo "$webtorrent_results" > ~/webtorrent-wrap.log
|
||||
# echo "URL - $url" >> ~/webtorrent-wrap.log
|
||||
# echo "WEBTORRENT_HASH - $webtorrent_hash" >> ~/webtorrent-wrap.log
|
||||
# echo "BASE_URL - $base_url" >> ~/webtorrent-wrap.log
|
||||
|
||||
# Print results
|
||||
echo "$webtorrent_results"
|
62
.config/ranger/commands.py
Normal file
|
@ -0,0 +1,62 @@
|
|||
# This is a sample commands.py. You can add your own commands here.
|
||||
#
|
||||
# Please refer to commands_full.py for all the default commands and a complete
|
||||
# documentation. Do NOT add them all here, or you may end up with defunct
|
||||
# commands when upgrading ranger.
|
||||
|
||||
# A simple command for demonstration purposes follows.
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
|
||||
# You can import any python module as needed.
|
||||
import os
|
||||
|
||||
# You always need to import ranger.api.commands here to get the Command class:
|
||||
from ranger.api.commands import Command
|
||||
|
||||
|
||||
# Any class that is a subclass of "Command" will be integrated into ranger as a
|
||||
# command. Try typing ":my_edit<ENTER>" in ranger!
|
||||
class my_edit(Command):
|
||||
# The so-called doc-string of the class will be visible in the built-in
|
||||
# help that is accessible by typing "?c" inside ranger.
|
||||
""":my_edit <filename>
|
||||
|
||||
A sample command for demonstration purposes that opens a file in an editor.
|
||||
"""
|
||||
|
||||
# The execute method is called when you run this command in ranger.
|
||||
def execute(self):
|
||||
# self.arg(1) is the first (space-separated) argument to the function.
|
||||
# This way you can write ":my_edit somefilename<ENTER>".
|
||||
if self.arg(1):
|
||||
# self.rest(1) contains self.arg(1) and everything that follows
|
||||
target_filename = self.rest(1)
|
||||
else:
|
||||
# self.fm is a ranger.core.filemanager.FileManager object and gives
|
||||
# you access to internals of ranger.
|
||||
# self.fm.thisfile is a ranger.container.file.File object and is a
|
||||
# reference to the currently selected file.
|
||||
target_filename = self.fm.thisfile.path
|
||||
|
||||
# This is a generic function to print text in ranger.
|
||||
self.fm.notify("Let's edit the file " + target_filename + "!")
|
||||
|
||||
# Using bad=True in fm.notify allows you to print error messages:
|
||||
if not os.path.exists(target_filename):
|
||||
self.fm.notify("The given file does not exist!", bad=True)
|
||||
return
|
||||
|
||||
# This executes a function from ranger.core.acitons, a module with a
|
||||
# variety of subroutines that can help you construct commands.
|
||||
# Check out the source, or run "pydoc ranger.core.actions" for a list.
|
||||
self.fm.edit_file(target_filename)
|
||||
|
||||
# The tab method is called when you press tab, and should return a list of
|
||||
# suggestions that the user will tab through.
|
||||
# tabnum is 1 for <TAB> and -1 for <S-TAB> by default
|
||||
def tab(self, tabnum):
|
||||
# This is a generic tab-completion function that iterates through the
|
||||
# content of the current directory.
|
||||
return self._tab_directory_content()
|
1993
.config/ranger/commands_full.py
Normal file
759
.config/ranger/rc.conf
Normal file
|
@ -0,0 +1,759 @@
|
|||
# ===================================================================
|
||||
# This file contains the default startup commands for ranger.
|
||||
# To change them, it is recommended to create either /etc/ranger/rc.conf
|
||||
# (system-wide) or ~/.config/ranger/rc.conf (per user) and add your custom
|
||||
# commands there.
|
||||
#
|
||||
# If you copy this whole file there, you may want to set the environment
|
||||
# variable RANGER_LOAD_DEFAULT_RC to FALSE to avoid loading it twice.
|
||||
#
|
||||
# The purpose of this file is mainly to define keybindings and settings.
|
||||
# For running more complex python code, please create a plugin in "plugins/" or
|
||||
# a command in "commands.py".
|
||||
#
|
||||
# Each line is a command that will be run before the user interface
|
||||
# is initialized. As a result, you can not use commands which rely
|
||||
# on the UI such as :delete or :mark.
|
||||
# ===================================================================
|
||||
|
||||
# ===================================================================
|
||||
# == Options
|
||||
# ===================================================================
|
||||
|
||||
# Which viewmode should be used? Possible values are:
|
||||
# miller: Use miller columns which show multiple levels of the hierarchy
|
||||
# multipane: Midnight-commander like multipane view showing all tabs next
|
||||
# to each other
|
||||
set viewmode miller
|
||||
#set viewmode multipane
|
||||
|
||||
# How many columns are there, and what are their relative widths?
|
||||
set column_ratios 1,3,4
|
||||
|
||||
# Which files should be hidden? (regular expression)
|
||||
set hidden_filter ^\.|\.(?:pyc|pyo|bak|swp)$|^lost\+found$|^__(py)?cache__$
|
||||
|
||||
# Show hidden files? You can toggle this by typing 'zh'
|
||||
set show_hidden false
|
||||
|
||||
# Ask for a confirmation when running the "delete" command?
|
||||
# Valid values are "always", "never", "multiple" (default)
|
||||
# With "multiple", ranger will ask only if you delete multiple files at once.
|
||||
set confirm_on_delete multiple
|
||||
|
||||
# Use non-default path for file preview script?
|
||||
# ranger ships with scope.sh, a script that calls external programs (see
|
||||
# README.md for dependencies) to preview images, archives, etc.
|
||||
#set preview_script ~/.config/ranger/scope.sh
|
||||
|
||||
# Use the external preview script or display simple plain text or image previews?
|
||||
set use_preview_script true
|
||||
|
||||
# Automatically count files in the directory, even before entering them?
|
||||
set automatically_count_files true
|
||||
|
||||
# Open all images in this directory when running certain image viewers
|
||||
# like feh or sxiv? You can still open selected files by marking them.
|
||||
set open_all_images true
|
||||
|
||||
# Be aware of version control systems and display information.
|
||||
set vcs_aware false
|
||||
|
||||
# State of the four backends git, hg, bzr, svn. The possible states are
|
||||
# disabled, local (only show local info), enabled (show local and remote
|
||||
# information).
|
||||
set vcs_backend_git enabled
|
||||
set vcs_backend_hg disabled
|
||||
set vcs_backend_bzr disabled
|
||||
set vcs_backend_svn disabled
|
||||
|
||||
# Truncate the long commit messages to this length when shown in the statusbar.
|
||||
set vcs_msg_length 50
|
||||
|
||||
# Use one of the supported image preview protocols
|
||||
set preview_images true
|
||||
|
||||
# Set the preview image method. Supported methods:
|
||||
#
|
||||
# * w3m (default):
|
||||
# Preview images in full color with the external command "w3mimgpreview"?
|
||||
# This requires the console web browser "w3m" and a supported terminal.
|
||||
# It has been successfully tested with "xterm" and "urxvt" without tmux.
|
||||
#
|
||||
# * iterm2:
|
||||
# Preview images in full color using iTerm2 image previews
|
||||
# (http://iterm2.com/images.html). This requires using iTerm2 compiled
|
||||
# with image preview support.
|
||||
#
|
||||
# This feature relies on the dimensions of the terminal's font. By default, a
|
||||
# width of 8 and height of 11 are used. To use other values, set the options
|
||||
# iterm2_font_width and iterm2_font_height to the desired values.
|
||||
#
|
||||
# * terminology:
|
||||
# Previews images in full color in the terminology terminal emulator.
|
||||
# Supports a wide variety of formats, even vector graphics like svg.
|
||||
#
|
||||
# * urxvt:
|
||||
# Preview images in full color using urxvt image backgrounds. This
|
||||
# requires using urxvt compiled with pixbuf support.
|
||||
#
|
||||
# * urxvt-full:
|
||||
# The same as urxvt but utilizing not only the preview pane but the
|
||||
# whole terminal window.
|
||||
#
|
||||
# * kitty:
|
||||
# Preview images in full color using kitty image protocol.
|
||||
# Requires python PIL or pillow library.
|
||||
# If ranger does not share the local filesystem with kitty
|
||||
# the transfer method is changed to encode the whole image;
|
||||
# while slower, this allows remote previews,
|
||||
# for example during an ssh session.
|
||||
# Tmux is unsupported.
|
||||
#
|
||||
# * ueberzug:
|
||||
# Preview images in full color with the external command "ueberzug".
|
||||
# Images are shown by using a child window.
|
||||
# Only for users who run X11 in GNU/Linux.
|
||||
set preview_images_method kitty
|
||||
|
||||
# Delay in seconds before displaying an image with the w3m method.
|
||||
# Increase it in case of experiencing display corruption.
|
||||
set w3m_delay 0.02
|
||||
|
||||
# Manually adjust the w3mimg offset when using a terminal which needs this
|
||||
set w3m_offset 0
|
||||
|
||||
# Default iTerm2 font size (see: preview_images_method: iterm2)
|
||||
set iterm2_font_width 8
|
||||
set iterm2_font_height 11
|
||||
|
||||
# Use a unicode "..." character to mark cut-off filenames?
|
||||
set unicode_ellipsis false
|
||||
|
||||
# BIDI support - try to properly display file names in RTL languages (Hebrew, Arabic).
|
||||
# Requires the python-bidi pip package
|
||||
set bidi_support false
|
||||
|
||||
# Show dotfiles in the bookmark preview box?
|
||||
set show_hidden_bookmarks true
|
||||
|
||||
# Which colorscheme to use? These colorschemes are available by default:
|
||||
# default, jungle, snow, solarized
|
||||
set colorscheme default
|
||||
|
||||
# Preview files on the rightmost column?
|
||||
# And collapse (shrink) the last column if there is nothing to preview?
|
||||
set preview_files true
|
||||
set preview_directories true
|
||||
set collapse_preview true
|
||||
|
||||
# Wrap long lines in plain text previews?
|
||||
set wrap_plaintext_previews false
|
||||
|
||||
# Save the console history on exit?
|
||||
set save_console_history true
|
||||
|
||||
# Draw the status bar on top of the browser window (default: bottom)
|
||||
set status_bar_on_top false
|
||||
|
||||
# Draw a progress bar in the status bar which displays the average state of all
|
||||
# currently running tasks which support progress bars?
|
||||
set draw_progress_bar_in_status_bar true
|
||||
|
||||
# Draw borders around columns? (separators, outline, both, or none)
|
||||
# Separators are vertical lines between columns.
|
||||
# Outline draws a box around all the columns.
|
||||
# Both combines the two.
|
||||
set draw_borders none
|
||||
|
||||
# Display the directory name in tabs?
|
||||
set dirname_in_tabs false
|
||||
|
||||
# Enable the mouse support?
|
||||
set mouse_enabled true
|
||||
|
||||
# Display the file size in the main column or status bar?
|
||||
set display_size_in_main_column true
|
||||
set display_size_in_status_bar true
|
||||
|
||||
# Display the free disk space in the status bar?
|
||||
set display_free_space_in_status_bar true
|
||||
|
||||
# Display files tags in all columns or only in main column?
|
||||
set display_tags_in_all_columns true
|
||||
|
||||
# Set a title for the window? Updates both `WM_NAME` and `WM_ICON_NAME`
|
||||
set update_title false
|
||||
|
||||
# Set the tmux/screen window-name to "ranger"?
|
||||
set update_tmux_title true
|
||||
|
||||
# Shorten the title if it gets long? The number defines how many
|
||||
# directories are displayed at once, 0 turns off this feature.
|
||||
set shorten_title 3
|
||||
|
||||
# Show hostname in titlebar?
|
||||
set hostname_in_titlebar true
|
||||
|
||||
# Abbreviate $HOME with ~ in the titlebar (first line) of ranger?
|
||||
set tilde_in_titlebar false
|
||||
|
||||
# How many directory-changes or console-commands should be kept in history?
|
||||
set max_history_size 20
|
||||
set max_console_history_size 50
|
||||
|
||||
# Try to keep so much space between the top/bottom border when scrolling:
|
||||
set scroll_offset 8
|
||||
|
||||
# Flush the input after each key hit? (Noticeable when ranger lags)
|
||||
set flushinput true
|
||||
|
||||
# Padding on the right when there's no preview?
|
||||
# This allows you to click into the space to run the file.
|
||||
set padding_right true
|
||||
|
||||
# Save bookmarks (used with mX and `X) instantly?
|
||||
# This helps to synchronize bookmarks between multiple ranger
|
||||
# instances but leads to *slight* performance loss.
|
||||
# When false, bookmarks are saved when ranger is exited.
|
||||
set autosave_bookmarks true
|
||||
|
||||
# Save the "`" bookmark to disk. This can be used to switch to the last
|
||||
# directory by typing "``".
|
||||
set save_backtick_bookmark true
|
||||
|
||||
# You can display the "real" cumulative size of directories by using the
|
||||
# command :get_cumulative_size or typing "dc". The size is expensive to
|
||||
# calculate and will not be updated automatically. You can choose
|
||||
# to update it automatically though by turning on this option:
|
||||
set autoupdate_cumulative_size false
|
||||
|
||||
# Turning this on makes sense for screen readers:
|
||||
set show_cursor false
|
||||
|
||||
# One of: size, natural, basename, atime, ctime, mtime, type, random
|
||||
set sort natural
|
||||
|
||||
# Additional sorting options
|
||||
set sort_reverse false
|
||||
set sort_case_insensitive true
|
||||
set sort_directories_first true
|
||||
set sort_unicode false
|
||||
|
||||
# Enable this if key combinations with the Alt Key don't work for you.
|
||||
# (Especially on xterm)
|
||||
set xterm_alt_key false
|
||||
|
||||
# Whether to include bookmarks in cd command
|
||||
set cd_bookmarks true
|
||||
|
||||
# Changes case sensitivity for the cd command tab completion
|
||||
set cd_tab_case sensitive
|
||||
|
||||
# Use fuzzy tab completion with the "cd" command. For example,
|
||||
# ":cd /u/lo/b<tab>" expands to ":cd /usr/local/bin".
|
||||
set cd_tab_fuzzy false
|
||||
|
||||
# Avoid previewing files larger than this size, in bytes. Use a value of 0 to
|
||||
# disable this feature.
|
||||
set preview_max_size 0
|
||||
|
||||
# The key hint lists up to this size have their sublists expanded.
|
||||
# Otherwise the submaps are replaced with "...".
|
||||
set hint_collapse_threshold 10
|
||||
|
||||
# Add the highlighted file to the path in the titlebar
|
||||
set show_selection_in_titlebar true
|
||||
|
||||
# The delay that ranger idly waits for user input, in milliseconds, with a
|
||||
# resolution of 100ms. Lower delay reduces lag between directory updates but
|
||||
# increases CPU load.
|
||||
set idle_delay 2000
|
||||
|
||||
# When the metadata manager module looks for metadata, should it only look for
|
||||
# a ".metadata.json" file in the current directory, or do a deep search and
|
||||
# check all directories above the current one as well?
|
||||
set metadata_deep_search false
|
||||
|
||||
# Clear all existing filters when leaving a directory
|
||||
set clear_filters_on_dir_change false
|
||||
|
||||
# Disable displaying line numbers in main column.
|
||||
# Possible values: false, absolute, relative.
|
||||
set line_numbers false
|
||||
|
||||
# When line_numbers=relative show the absolute line number in the
|
||||
# current line.
|
||||
set relative_current_zero false
|
||||
|
||||
# Start line numbers from 1 instead of 0
|
||||
set one_indexed false
|
||||
|
||||
# Save tabs on exit
|
||||
set save_tabs_on_exit false
|
||||
|
||||
# Enable scroll wrapping - moving down while on the last item will wrap around to
|
||||
# the top and vice versa.
|
||||
set wrap_scroll false
|
||||
|
||||
# Set the global_inode_type_filter to nothing. Possible options: d, f and l for
|
||||
# directories, files and symlinks respectively.
|
||||
set global_inode_type_filter
|
||||
|
||||
# This setting allows to freeze the list of files to save I/O bandwidth. It
|
||||
# should be 'false' during start-up, but you can toggle it by pressing F.
|
||||
set freeze_files false
|
||||
|
||||
# Print file sizes in bytes instead of the default human-readable format.
|
||||
set size_in_bytes false
|
||||
|
||||
# Warn at startup if RANGER_LEVEL env var is greater than 0, in other words
|
||||
# give a warning when you nest ranger in a subshell started by ranger.
|
||||
# Special value "error" makes the warning more visible.
|
||||
set nested_ranger_warning true
|
||||
|
||||
# ===================================================================
|
||||
# == Local Options
|
||||
# ===================================================================
|
||||
# You can set local options that only affect a single directory.
|
||||
|
||||
# Examples:
|
||||
# setlocal path=~/downloads sort mtime
|
||||
|
||||
# ===================================================================
|
||||
# == Command Aliases in the Console
|
||||
# ===================================================================
|
||||
|
||||
alias e edit
|
||||
alias q quit
|
||||
alias q! quit!
|
||||
alias qa quitall
|
||||
alias qa! quitall!
|
||||
alias qall quitall
|
||||
alias qall! quitall!
|
||||
alias setl setlocal
|
||||
|
||||
alias filter scout -prts
|
||||
alias find scout -aets
|
||||
alias mark scout -mr
|
||||
alias unmark scout -Mr
|
||||
alias search scout -rs
|
||||
alias search_inc scout -rts
|
||||
alias travel scout -aefklst
|
||||
|
||||
# ===================================================================
|
||||
# == Define keys for the browser
|
||||
# ===================================================================
|
||||
|
||||
# Basic
|
||||
map Q quitall
|
||||
map q quit
|
||||
copymap q ZZ ZQ
|
||||
|
||||
map R reload_cwd
|
||||
map F set freeze_files!
|
||||
map <C-r> reset
|
||||
map <C-l> redraw_window
|
||||
map <C-c> abort
|
||||
map <esc> change_mode normal
|
||||
map ~ set viewmode!
|
||||
|
||||
map i display_file
|
||||
map <A-j> scroll_preview 1
|
||||
map <A-k> scroll_preview -1
|
||||
map ? help
|
||||
map W display_log
|
||||
map w taskview_open
|
||||
map S shell $SHELL
|
||||
|
||||
map : console
|
||||
map ; console
|
||||
map ! console shell%space
|
||||
map @ console -p6 shell %%s
|
||||
map # console shell -p%space
|
||||
map s console shell%space
|
||||
map r chain draw_possible_programs; console open_with%space
|
||||
map f console find%space
|
||||
map cd console cd%space
|
||||
|
||||
map <C-p> chain console; eval fm.ui.console.history_move(-1)
|
||||
|
||||
# Change the line mode
|
||||
map Mf linemode filename
|
||||
map Mi linemode fileinfo
|
||||
map Mm linemode mtime
|
||||
map Mh linemode humanreadablemtime
|
||||
map Mp linemode permissions
|
||||
map Ms linemode sizemtime
|
||||
map MH linemode sizehumanreadablemtime
|
||||
map Mt linemode metatitle
|
||||
|
||||
# Tagging / Marking
|
||||
map t tag_toggle
|
||||
map ut tag_remove
|
||||
map "<any> tag_toggle tag=%any
|
||||
map <Space> mark_files toggle=True
|
||||
map v mark_files all=True toggle=True
|
||||
map uv mark_files all=True val=False
|
||||
map V toggle_visual_mode
|
||||
map uV toggle_visual_mode reverse=True
|
||||
|
||||
# For the nostalgics: Midnight Commander bindings
|
||||
map <F1> help
|
||||
map <F2> rename_append
|
||||
map <F3> display_file
|
||||
map <F4> edit
|
||||
map <F5> copy
|
||||
map <F6> cut
|
||||
map <F7> console mkdir%space
|
||||
map <F8> console delete
|
||||
#map <F8> console trash
|
||||
map <F10> exit
|
||||
|
||||
# In case you work on a keyboard with dvorak layout
|
||||
map <UP> move up=1
|
||||
map <DOWN> move down=1
|
||||
map <LEFT> move left=1
|
||||
map <RIGHT> move right=1
|
||||
map <HOME> move to=0
|
||||
map <END> move to=-1
|
||||
map <PAGEDOWN> move down=1 pages=True
|
||||
map <PAGEUP> move up=1 pages=True
|
||||
map <CR> move right=1
|
||||
#map <DELETE> console delete
|
||||
map <INSERT> console touch%space
|
||||
|
||||
# VIM-like
|
||||
copymap <UP> k
|
||||
copymap <DOWN> j
|
||||
copymap <LEFT> h
|
||||
copymap <RIGHT> l
|
||||
copymap <HOME> gg
|
||||
copymap <END> G
|
||||
copymap <PAGEDOWN> <C-F>
|
||||
copymap <PAGEUP> <C-B>
|
||||
|
||||
map J move down=0.5 pages=True
|
||||
map K move up=0.5 pages=True
|
||||
copymap J <C-D>
|
||||
copymap K <C-U>
|
||||
|
||||
# Jumping around
|
||||
map H history_go -1
|
||||
map L history_go 1
|
||||
map ] move_parent 1
|
||||
map [ move_parent -1
|
||||
map } traverse
|
||||
map { traverse_backwards
|
||||
map ) jump_non
|
||||
|
||||
map gh cd ~
|
||||
map ge cd /etc
|
||||
map gu cd /usr
|
||||
map gd cd /dev
|
||||
map gl cd -r .
|
||||
map gL cd -r %f
|
||||
map go cd /opt
|
||||
map gv cd /var
|
||||
map gm cd /media
|
||||
map gi eval fm.cd('/run/media/' + os.getenv('USER'))
|
||||
map gM cd /mnt
|
||||
map gs cd /srv
|
||||
map gp cd /tmp
|
||||
map gr cd /
|
||||
map gR eval fm.cd(ranger.RANGERDIR)
|
||||
map g/ cd /
|
||||
map g? cd /usr/share/doc/ranger
|
||||
|
||||
# External Programs
|
||||
map E edit
|
||||
map du shell -p du --max-depth=1 -h --apparent-size
|
||||
map dU shell -p du --max-depth=1 -h --apparent-size | sort -rh
|
||||
map yp yank path
|
||||
map yd yank dir
|
||||
map yn yank name
|
||||
map y. yank name_without_extension
|
||||
|
||||
# Filesystem Operations
|
||||
map = chmod
|
||||
|
||||
map cw console rename%space
|
||||
map a rename_append
|
||||
map A eval fm.open_console('rename ' + fm.thisfile.relative_path.replace("%", "%%"))
|
||||
map I eval fm.open_console('rename ' + fm.thisfile.relative_path.replace("%", "%%"), position=7)
|
||||
|
||||
map pp paste
|
||||
map po paste overwrite=True
|
||||
map pP paste append=True
|
||||
map pO paste overwrite=True append=True
|
||||
map pl paste_symlink relative=False
|
||||
map pL paste_symlink relative=True
|
||||
map phl paste_hardlink
|
||||
map pht paste_hardlinked_subtree
|
||||
map pd console paste dest=
|
||||
map p`<any> paste dest=%any_path
|
||||
map p'<any> paste dest=%any_path
|
||||
|
||||
map dD console delete
|
||||
map DD console trash
|
||||
|
||||
map dd cut
|
||||
map ud uncut
|
||||
map da cut mode=add
|
||||
map dr cut mode=remove
|
||||
map dt cut mode=toggle
|
||||
|
||||
map yy copy
|
||||
map uy uncut
|
||||
map ya copy mode=add
|
||||
map yr copy mode=remove
|
||||
map yt copy mode=toggle
|
||||
|
||||
# Temporary workarounds
|
||||
map dgg eval fm.cut(dirarg=dict(to=0), narg=quantifier)
|
||||
map dG eval fm.cut(dirarg=dict(to=-1), narg=quantifier)
|
||||
map dj eval fm.cut(dirarg=dict(down=1), narg=quantifier)
|
||||
map dk eval fm.cut(dirarg=dict(up=1), narg=quantifier)
|
||||
map ygg eval fm.copy(dirarg=dict(to=0), narg=quantifier)
|
||||
map yG eval fm.copy(dirarg=dict(to=-1), narg=quantifier)
|
||||
map yj eval fm.copy(dirarg=dict(down=1), narg=quantifier)
|
||||
map yk eval fm.copy(dirarg=dict(up=1), narg=quantifier)
|
||||
|
||||
# Searching
|
||||
map / console search%space
|
||||
map n search_next
|
||||
map N search_next forward=False
|
||||
map ct search_next order=tag
|
||||
map cs search_next order=size
|
||||
map ci search_next order=mimetype
|
||||
map cc search_next order=ctime
|
||||
map cm search_next order=mtime
|
||||
map ca search_next order=atime
|
||||
|
||||
# Tabs
|
||||
map <C-n> tab_new
|
||||
map <C-w> tab_close
|
||||
map <TAB> tab_move 1
|
||||
map <S-TAB> tab_move -1
|
||||
map <A-Right> tab_move 1
|
||||
map <A-Left> tab_move -1
|
||||
map gt tab_move 1
|
||||
map gT tab_move -1
|
||||
map gn tab_new
|
||||
map gc tab_close
|
||||
map uq tab_restore
|
||||
map <a-1> tab_open 1
|
||||
map <a-2> tab_open 2
|
||||
map <a-3> tab_open 3
|
||||
map <a-4> tab_open 4
|
||||
map <a-5> tab_open 5
|
||||
map <a-6> tab_open 6
|
||||
map <a-7> tab_open 7
|
||||
map <a-8> tab_open 8
|
||||
map <a-9> tab_open 9
|
||||
map <a-r> tab_shift 1
|
||||
map <a-l> tab_shift -1
|
||||
|
||||
# Sorting
|
||||
map or set sort_reverse!
|
||||
map oz set sort=random
|
||||
map os chain set sort=size; set sort_reverse=False
|
||||
map ob chain set sort=basename; set sort_reverse=False
|
||||
map on chain set sort=natural; set sort_reverse=False
|
||||
map om chain set sort=mtime; set sort_reverse=False
|
||||
map oc chain set sort=ctime; set sort_reverse=False
|
||||
map oa chain set sort=atime; set sort_reverse=False
|
||||
map ot chain set sort=type; set sort_reverse=False
|
||||
map oe chain set sort=extension; set sort_reverse=False
|
||||
|
||||
map oS chain set sort=size; set sort_reverse=True
|
||||
map oB chain set sort=basename; set sort_reverse=True
|
||||
map oN chain set sort=natural; set sort_reverse=True
|
||||
map oM chain set sort=mtime; set sort_reverse=True
|
||||
map oC chain set sort=ctime; set sort_reverse=True
|
||||
map oA chain set sort=atime; set sort_reverse=True
|
||||
map oT chain set sort=type; set sort_reverse=True
|
||||
map oE chain set sort=extension; set sort_reverse=True
|
||||
|
||||
map dc get_cumulative_size
|
||||
|
||||
# Settings
|
||||
map zc set collapse_preview!
|
||||
map zd set sort_directories_first!
|
||||
map zh set show_hidden!
|
||||
map <C-h> set show_hidden!
|
||||
copymap <C-h> <backspace>
|
||||
copymap <backspace> <backspace2>
|
||||
map zI set flushinput!
|
||||
map zi set preview_images!
|
||||
map zm set mouse_enabled!
|
||||
map zp set preview_files!
|
||||
map zP set preview_directories!
|
||||
map zs set sort_case_insensitive!
|
||||
map zu set autoupdate_cumulative_size!
|
||||
map zv set use_preview_script!
|
||||
map zf console filter%space
|
||||
copymap zf zz
|
||||
|
||||
# Filter stack
|
||||
map .d filter_stack add type d
|
||||
map .f filter_stack add type f
|
||||
map .l filter_stack add type l
|
||||
map .m console filter_stack add mime%space
|
||||
map .n console filter_stack add name%space
|
||||
map .# console filter_stack add hash%space
|
||||
map ." filter_stack add duplicate
|
||||
map .' filter_stack add unique
|
||||
map .| filter_stack add or
|
||||
map .& filter_stack add and
|
||||
map .! filter_stack add not
|
||||
map .r filter_stack rotate
|
||||
map .c filter_stack clear
|
||||
map .* filter_stack decompose
|
||||
map .p filter_stack pop
|
||||
map .. filter_stack show
|
||||
|
||||
# Bookmarks
|
||||
map `<any> enter_bookmark %any
|
||||
map '<any> enter_bookmark %any
|
||||
map m<any> set_bookmark %any
|
||||
map um<any> unset_bookmark %any
|
||||
|
||||
map m<bg> draw_bookmarks
|
||||
copymap m<bg> um<bg> `<bg> '<bg>
|
||||
|
||||
# Generate all the chmod bindings with some python help:
|
||||
eval for arg in "rwxXst": cmd("map +u{0} shell -f chmod u+{0} %s".format(arg))
|
||||
eval for arg in "rwxXst": cmd("map +g{0} shell -f chmod g+{0} %s".format(arg))
|
||||
eval for arg in "rwxXst": cmd("map +o{0} shell -f chmod o+{0} %s".format(arg))
|
||||
eval for arg in "rwxXst": cmd("map +a{0} shell -f chmod a+{0} %s".format(arg))
|
||||
eval for arg in "rwxXst": cmd("map +{0} shell -f chmod u+{0} %s".format(arg))
|
||||
|
||||
eval for arg in "rwxXst": cmd("map -u{0} shell -f chmod u-{0} %s".format(arg))
|
||||
eval for arg in "rwxXst": cmd("map -g{0} shell -f chmod g-{0} %s".format(arg))
|
||||
eval for arg in "rwxXst": cmd("map -o{0} shell -f chmod o-{0} %s".format(arg))
|
||||
eval for arg in "rwxXst": cmd("map -a{0} shell -f chmod a-{0} %s".format(arg))
|
||||
eval for arg in "rwxXst": cmd("map -{0} shell -f chmod u-{0} %s".format(arg))
|
||||
|
||||
# ===================================================================
|
||||
# == Define keys for the console
|
||||
# ===================================================================
|
||||
# Note: Unmapped keys are passed directly to the console.
|
||||
|
||||
# Basic
|
||||
cmap <tab> eval fm.ui.console.tab()
|
||||
cmap <s-tab> eval fm.ui.console.tab(-1)
|
||||
cmap <ESC> eval fm.ui.console.close()
|
||||
cmap <CR> eval fm.ui.console.execute()
|
||||
cmap <C-l> redraw_window
|
||||
|
||||
copycmap <ESC> <C-c>
|
||||
copycmap <CR> <C-j>
|
||||
|
||||
# Move around
|
||||
cmap <up> eval fm.ui.console.history_move(-1)
|
||||
cmap <down> eval fm.ui.console.history_move(1)
|
||||
cmap <left> eval fm.ui.console.move(left=1)
|
||||
cmap <right> eval fm.ui.console.move(right=1)
|
||||
cmap <home> eval fm.ui.console.move(right=0, absolute=True)
|
||||
cmap <end> eval fm.ui.console.move(right=-1, absolute=True)
|
||||
cmap <a-b> eval fm.ui.console.move_word(left=1)
|
||||
cmap <a-f> eval fm.ui.console.move_word(right=1)
|
||||
|
||||
copycmap <a-b> <a-left>
|
||||
copycmap <a-f> <a-right>
|
||||
|
||||
# Line Editing
|
||||
cmap <backspace> eval fm.ui.console.delete(-1)
|
||||
cmap <delete> eval fm.ui.console.delete(0)
|
||||
cmap <C-w> eval fm.ui.console.delete_word()
|
||||
cmap <A-d> eval fm.ui.console.delete_word(backward=False)
|
||||
cmap <C-k> eval fm.ui.console.delete_rest(1)
|
||||
cmap <C-u> eval fm.ui.console.delete_rest(-1)
|
||||
cmap <C-y> eval fm.ui.console.paste()
|
||||
|
||||
# And of course the emacs way
|
||||
copycmap <ESC> <C-g>
|
||||
copycmap <up> <C-p>
|
||||
copycmap <down> <C-n>
|
||||
copycmap <left> <C-b>
|
||||
copycmap <right> <C-f>
|
||||
copycmap <home> <C-a>
|
||||
copycmap <end> <C-e>
|
||||
copycmap <delete> <C-d>
|
||||
copycmap <backspace> <C-h>
|
||||
|
||||
# Note: There are multiple ways to express backspaces. <backspace> (code 263)
|
||||
# and <backspace2> (code 127). To be sure, use both.
|
||||
copycmap <backspace> <backspace2>
|
||||
|
||||
# This special expression allows typing in numerals:
|
||||
cmap <allow_quantifiers> false
|
||||
|
||||
# ===================================================================
|
||||
# == Pager Keybindings
|
||||
# ===================================================================
|
||||
|
||||
# Movement
|
||||
pmap <down> pager_move down=1
|
||||
pmap <up> pager_move up=1
|
||||
pmap <left> pager_move left=4
|
||||
pmap <right> pager_move right=4
|
||||
pmap <home> pager_move to=0
|
||||
pmap <end> pager_move to=-1
|
||||
pmap <pagedown> pager_move down=1.0 pages=True
|
||||
pmap <pageup> pager_move up=1.0 pages=True
|
||||
pmap <C-d> pager_move down=0.5 pages=True
|
||||
pmap <C-u> pager_move up=0.5 pages=True
|
||||
|
||||
copypmap <UP> k <C-p>
|
||||
copypmap <DOWN> j <C-n> <CR>
|
||||
copypmap <LEFT> h
|
||||
copypmap <RIGHT> l
|
||||
copypmap <HOME> g
|
||||
copypmap <END> G
|
||||
copypmap <C-d> d
|
||||
copypmap <C-u> u
|
||||
copypmap <PAGEDOWN> n f <C-F> <Space>
|
||||
copypmap <PAGEUP> p b <C-B>
|
||||
|
||||
# Basic
|
||||
pmap <C-l> redraw_window
|
||||
pmap <ESC> pager_close
|
||||
copypmap <ESC> q Q i <F3>
|
||||
pmap E edit_file
|
||||
|
||||
# ===================================================================
|
||||
# == Taskview Keybindings
|
||||
# ===================================================================
|
||||
|
||||
# Movement
|
||||
tmap <up> taskview_move up=1
|
||||
tmap <down> taskview_move down=1
|
||||
tmap <home> taskview_move to=0
|
||||
tmap <end> taskview_move to=-1
|
||||
tmap <pagedown> taskview_move down=1.0 pages=True
|
||||
tmap <pageup> taskview_move up=1.0 pages=True
|
||||
tmap <C-d> taskview_move down=0.5 pages=True
|
||||
tmap <C-u> taskview_move up=0.5 pages=True
|
||||
|
||||
copytmap <UP> k <C-p>
|
||||
copytmap <DOWN> j <C-n> <CR>
|
||||
copytmap <HOME> g
|
||||
copytmap <END> G
|
||||
copytmap <C-u> u
|
||||
copytmap <PAGEDOWN> n f <C-F> <Space>
|
||||
copytmap <PAGEUP> p b <C-B>
|
||||
|
||||
# Changing priority and deleting tasks
|
||||
tmap J eval -q fm.ui.taskview.task_move(-1)
|
||||
tmap K eval -q fm.ui.taskview.task_move(0)
|
||||
tmap dd eval -q fm.ui.taskview.task_remove()
|
||||
tmap <pagedown> eval -q fm.ui.taskview.task_move(-1)
|
||||
tmap <pageup> eval -q fm.ui.taskview.task_move(0)
|
||||
tmap <delete> eval -q fm.ui.taskview.task_remove()
|
||||
|
||||
# Basic
|
||||
tmap <C-l> redraw_window
|
||||
tmap <ESC> taskview_close
|
||||
copytmap <ESC> q Q w <C-c>
|
285
.config/ranger/rifle.conf
Normal file
|
@ -0,0 +1,285 @@
|
|||
# vim: ft=cfg
|
||||
#
|
||||
# This is the configuration file of "rifle", ranger's file executor/opener.
|
||||
# Each line consists of conditions and a command. For each line the conditions
|
||||
# are checked and if they are met, the respective command is run.
|
||||
#
|
||||
# Syntax:
|
||||
# <condition1> , <condition2> , ... = command
|
||||
#
|
||||
# The command can contain these environment variables:
|
||||
# $1-$9 | The n-th selected file
|
||||
# $@ | All selected files
|
||||
#
|
||||
# If you use the special command "ask", rifle will ask you what program to run.
|
||||
#
|
||||
# Prefixing a condition with "!" will negate its result.
|
||||
# These conditions are currently supported:
|
||||
# match <regexp> | The regexp matches $1
|
||||
# ext <regexp> | The regexp matches the extension of $1
|
||||
# mime <regexp> | The regexp matches the mime type of $1
|
||||
# name <regexp> | The regexp matches the basename of $1
|
||||
# path <regexp> | The regexp matches the absolute path of $1
|
||||
# has <program> | The program is installed (i.e. located in $PATH)
|
||||
# env <variable> | The environment variable "variable" is non-empty
|
||||
# file | $1 is a file
|
||||
# directory | $1 is a directory
|
||||
# number <n> | change the number of this command to n
|
||||
# terminal | stdin, stderr and stdout are connected to a terminal
|
||||
# X | A graphical environment is available (darwin, Xorg, or Wayland)
|
||||
#
|
||||
# There are also pseudo-conditions which have a "side effect":
|
||||
# flag <flags> | Change how the program is run. See below.
|
||||
# label <label> | Assign a label or name to the command so it can
|
||||
# | be started with :open_with <label> in ranger
|
||||
# | or `rifle -p <label>` in the standalone executable.
|
||||
# else | Always true.
|
||||
#
|
||||
# Flags are single characters which slightly transform the command:
|
||||
# f | Fork the program, make it run in the background.
|
||||
# | New command = setsid $command >& /dev/null &
|
||||
# r | Execute the command with root permissions
|
||||
# | New command = sudo $command
|
||||
# t | Run the program in a new terminal. If $TERMCMD is not defined,
|
||||
# | rifle will attempt to extract it from $TERM.
|
||||
# | New command = $TERMCMD -e $command
|
||||
# Note: The "New command" serves only as an illustration, the exact
|
||||
# implementation may differ.
|
||||
# Note: When using rifle in ranger, there is an additional flag "c" for
|
||||
# only running the current file even if you have marked multiple files.
|
||||
|
||||
#-------------------------------------------
|
||||
# Websites
|
||||
#-------------------------------------------
|
||||
# Rarely installed browsers get higher priority; It is assumed that if you
|
||||
# install a rare browser, you probably use it. Firefox/konqueror/w3m on the
|
||||
# other hand are often only installed as fallback browsers.
|
||||
ext x?html?, has surf, X, flag f = surf -- file://"$1"
|
||||
ext x?html?, has vimprobable, X, flag f = vimprobable -- "$@"
|
||||
ext x?html?, has vimprobable2, X, flag f = vimprobable2 -- "$@"
|
||||
ext x?html?, has qutebrowser, X, flag f = qutebrowser -- "$@"
|
||||
ext x?html?, has dwb, X, flag f = dwb -- "$@"
|
||||
ext x?html?, has jumanji, X, flag f = jumanji -- "$@"
|
||||
ext x?html?, has luakit, X, flag f = luakit -- "$@"
|
||||
ext x?html?, has uzbl, X, flag f = uzbl -- "$@"
|
||||
ext x?html?, has uzbl-tabbed, X, flag f = uzbl-tabbed -- "$@"
|
||||
ext x?html?, has uzbl-browser, X, flag f = uzbl-browser -- "$@"
|
||||
ext x?html?, has uzbl-core, X, flag f = uzbl-core -- "$@"
|
||||
ext x?html?, has midori, X, flag f = midori -- "$@"
|
||||
ext x?html?, has opera, X, flag f = opera -- "$@"
|
||||
ext x?html?, has firefox, X, flag f = firefox -- "$@"
|
||||
ext x?html?, has seamonkey, X, flag f = seamonkey -- "$@"
|
||||
ext x?html?, has iceweasel, X, flag f = iceweasel -- "$@"
|
||||
ext x?html?, has chromium-browser, X, flag f = chromium-browser -- "$@"
|
||||
ext x?html?, has chromium, X, flag f = chromium -- "$@"
|
||||
ext x?html?, has google-chrome, X, flag f = google-chrome -- "$@"
|
||||
ext x?html?, has epiphany, X, flag f = epiphany -- "$@"
|
||||
ext x?html?, has konqueror, X, flag f = konqueror -- "$@"
|
||||
ext x?html?, has elinks, terminal = elinks "$@"
|
||||
ext x?html?, has links2, terminal = links2 "$@"
|
||||
ext x?html?, has links, terminal = links "$@"
|
||||
ext x?html?, has lynx, terminal = lynx -- "$@"
|
||||
ext x?html?, has w3m, terminal = w3m "$@"
|
||||
|
||||
#-------------------------------------------
|
||||
# Misc
|
||||
#-------------------------------------------
|
||||
# Define the "editor" for text files as first action
|
||||
mime ^text, label editor = ${VISUAL:-$EDITOR} -- "$@"
|
||||
mime ^text, label pager = "$PAGER" -- "$@"
|
||||
!mime ^text, label editor, ext xml|json|csv|tex|py|pl|rb|js|sh|php = ${VISUAL:-$EDITOR} -- "$@"
|
||||
!mime ^text, label pager, ext xml|json|csv|tex|py|pl|rb|js|sh|php = "$PAGER" -- "$@"
|
||||
|
||||
ext 1 = man "$1"
|
||||
ext s[wmf]c, has zsnes, X = zsnes "$1"
|
||||
ext s[wmf]c, has snes9x-gtk,X = snes9x-gtk "$1"
|
||||
ext nes, has fceux, X = fceux "$1"
|
||||
ext exe = wine "$1"
|
||||
name ^[mM]akefile$ = make
|
||||
|
||||
#--------------------------------------------
|
||||
# Scripts
|
||||
#-------------------------------------------
|
||||
ext py = python -- "$1"
|
||||
ext pl = perl -- "$1"
|
||||
ext rb = ruby -- "$1"
|
||||
ext js = node -- "$1"
|
||||
ext sh = sh -- "$1"
|
||||
ext php = php -- "$1"
|
||||
|
||||
#--------------------------------------------
|
||||
# Audio without X
|
||||
#-------------------------------------------
|
||||
mime ^audio|ogg$, terminal, has mpv = mpv -- "$@"
|
||||
mime ^audio|ogg$, terminal, has mplayer2 = mplayer2 -- "$@"
|
||||
mime ^audio|ogg$, terminal, has mplayer = mplayer -- "$@"
|
||||
ext midi?, terminal, has wildmidi = wildmidi -- "$@"
|
||||
|
||||
#--------------------------------------------
|
||||
# Video/Audio with a GUI
|
||||
#-------------------------------------------
|
||||
mime ^video|audio, has gmplayer, X, flag f = gmplayer -- "$@"
|
||||
mime ^video|audio, has smplayer, X, flag f = smplayer "$@"
|
||||
mime ^video, has mpv, X, flag f = mpv -- "$@"
|
||||
mime ^video, has mpv, X, flag f = mpv --fs -- "$@"
|
||||
mime ^video, has mplayer2, X, flag f = mplayer2 -- "$@"
|
||||
mime ^video, has mplayer2, X, flag f = mplayer2 -fs -- "$@"
|
||||
mime ^video, has mplayer, X, flag f = mplayer -- "$@"
|
||||
mime ^video, has mplayer, X, flag f = mplayer -fs -- "$@"
|
||||
mime ^video|audio, has vlc, X, flag f = vlc -- "$@"
|
||||
mime ^video|audio, has totem, X, flag f = totem -- "$@"
|
||||
mime ^video|audio, has totem, X, flag f = totem --fullscreen -- "$@"
|
||||
|
||||
#--------------------------------------------
|
||||
# Video without X
|
||||
#-------------------------------------------
|
||||
mime ^video, terminal, !X, has mpv = mpv -- "$@"
|
||||
mime ^video, terminal, !X, has mplayer2 = mplayer2 -- "$@"
|
||||
mime ^video, terminal, !X, has mplayer = mplayer -- "$@"
|
||||
|
||||
#-------------------------------------------
|
||||
# Documents
|
||||
#-------------------------------------------
|
||||
ext pdf, has llpp, X, flag f = llpp "$@"
|
||||
ext pdf, has zathura, X, flag f = zathura -- "$@"
|
||||
ext pdf, has mupdf, X, flag f = mupdf "$@"
|
||||
ext pdf, has mupdf-x11,X, flag f = mupdf-x11 "$@"
|
||||
ext pdf, has apvlv, X, flag f = apvlv -- "$@"
|
||||
ext pdf, has xpdf, X, flag f = xpdf -- "$@"
|
||||
ext pdf, has evince, X, flag f = evince -- "$@"
|
||||
ext pdf, has atril, X, flag f = atril -- "$@"
|
||||
ext pdf, has okular, X, flag f = okular -- "$@"
|
||||
ext pdf, has epdfview, X, flag f = epdfview -- "$@"
|
||||
ext pdf, has qpdfview, X, flag f = qpdfview "$@"
|
||||
ext pdf, has open, X, flag f = open "$@"
|
||||
|
||||
ext docx?, has catdoc, terminal = catdoc -- "$@" | "$PAGER"
|
||||
|
||||
ext sxc|xlsx?|xlt|xlw|gnm|gnumeric, has gnumeric, X, flag f = gnumeric -- "$@"
|
||||
ext sxc|xlsx?|xlt|xlw|gnm|gnumeric, has kspread, X, flag f = kspread -- "$@"
|
||||
ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has libreoffice, X, flag f = libreoffice "$@"
|
||||
ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has soffice, X, flag f = soffice "$@"
|
||||
ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has ooffice, X, flag f = ooffice "$@"
|
||||
|
||||
ext djvu, has zathura,X, flag f = zathura -- "$@"
|
||||
ext djvu, has evince, X, flag f = evince -- "$@"
|
||||
ext djvu, has atril, X, flag f = atril -- "$@"
|
||||
ext djvu, has djview, X, flag f = djview -- "$@"
|
||||
|
||||
ext epub, has ebook-viewer, X, flag f = ebook-viewer -- "$@"
|
||||
ext epub, has zathura, X, flag f = zathura -- "$@"
|
||||
ext epub, has mupdf, X, flag f = mupdf -- "$@"
|
||||
ext mobi, has ebook-viewer, X, flag f = ebook-viewer -- "$@"
|
||||
|
||||
ext cbr, has zathura, X, flag f = zathura -- "$@"
|
||||
ext cbz, has zathura, X, flag f = zathura -- "$@"
|
||||
|
||||
#-------------------------------------------
|
||||
# Images
|
||||
#-------------------------------------------
|
||||
mime ^image/svg, has inkscape, X, flag f = inkscape -- "$@"
|
||||
mime ^image/svg, has display, X, flag f = display -- "$@"
|
||||
|
||||
mime ^image, has qimgv, X, flag f = qimgv -- "$@"
|
||||
mime ^image, has imv, X, flag f = imv -- "$@"
|
||||
mime ^image, has pqiv, X, flag f = pqiv -- "$@"
|
||||
mime ^image, has sxiv, X, flag f = sxiv -- "$@"
|
||||
mime ^image, has feh, X, flag f = feh -- "$@"
|
||||
mime ^image, has mirage, X, flag f = mirage -- "$@"
|
||||
mime ^image, has ristretto, X, flag f = ristretto "$@"
|
||||
mime ^image, has eog, X, flag f = eog -- "$@"
|
||||
mime ^image, has eom, X, flag f = eom -- "$@"
|
||||
mime ^image, has nomacs, X, flag f = nomacs -- "$@"
|
||||
mime ^image, has geeqie, X, flag f = geeqie -- "$@"
|
||||
mime ^image, has gpicview, X, flag f = gpicview -- "$@"
|
||||
mime ^image, has gwenview, X, flag f = gwenview -- "$@"
|
||||
mime ^image, has gimp, X, flag f = gimp -- "$@"
|
||||
ext xcf, X, flag f = gimp -- "$@"
|
||||
|
||||
#-------------------------------------------
|
||||
# Archives
|
||||
#-------------------------------------------
|
||||
|
||||
# avoid password prompt by providing empty password
|
||||
ext 7z, has 7z = 7z -p l "$@" | "$PAGER"
|
||||
# This requires atool
|
||||
ext ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has atool = atool --list --each -- "$@" | "$PAGER"
|
||||
ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has atool = atool --list --each -- "$@" | "$PAGER"
|
||||
ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has atool = atool --extract --each -- "$@"
|
||||
ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has atool = atool --extract --each -- "$@"
|
||||
|
||||
# Listing and extracting archives without atool:
|
||||
ext tar|gz|bz2|xz, has tar = tar vvtf "$1" | "$PAGER"
|
||||
ext tar|gz|bz2|xz, has tar = for file in "$@"; do tar vvxf "$file"; done
|
||||
ext bz2, has bzip2 = for file in "$@"; do bzip2 -dk "$file"; done
|
||||
ext zip, has unzip = unzip -l "$1" | less
|
||||
ext zip, has unzip = for file in "$@"; do unzip -d "${file%.*}" "$file"; done
|
||||
ext ace, has unace = unace l "$1" | less
|
||||
ext ace, has unace = for file in "$@"; do unace e "$file"; done
|
||||
ext rar, has unrar = unrar l "$1" | less
|
||||
ext rar, has unrar = for file in "$@"; do unrar x "$file"; done
|
||||
|
||||
#-------------------------------------------
|
||||
# Fonts
|
||||
#-------------------------------------------
|
||||
mime ^font, has fontforge, X, flag f = fontforge "$@"
|
||||
|
||||
#-------------------------------------------
|
||||
# Flag t fallback terminals
|
||||
#-------------------------------------------
|
||||
# Rarely installed terminal emulators get higher priority; It is assumed that
|
||||
# if you install a rare terminal emulator, you probably use it.
|
||||
# gnome-terminal/konsole/xterm on the other hand are often installed as part of
|
||||
# a desktop environment or as fallback terminal emulators.
|
||||
mime ^ranger/x-terminal-emulator, has terminology = terminology -e "$@"
|
||||
mime ^ranger/x-terminal-emulator, has kitty = kitty -- "$@"
|
||||
mime ^ranger/x-terminal-emulator, has alacritty = alacritty -e "$@"
|
||||
mime ^ranger/x-terminal-emulator, has sakura = sakura -e "$@"
|
||||
mime ^ranger/x-terminal-emulator, has lilyterm = lilyterm -e "$@"
|
||||
#mime ^ranger/x-terminal-emulator, has cool-retro-term = cool-retro-term -e "$@"
|
||||
mime ^ranger/x-terminal-emulator, has termite = termite -x '"$@"'
|
||||
#mime ^ranger/x-terminal-emulator, has yakuake = yakuake -e "$@"
|
||||
mime ^ranger/x-terminal-emulator, has guake = guake -ne "$@"
|
||||
mime ^ranger/x-terminal-emulator, has tilda = tilda -c "$@"
|
||||
mime ^ranger/x-terminal-emulator, has st = st -e "$@"
|
||||
mime ^ranger/x-terminal-emulator, has terminator = terminator -x "$@"
|
||||
mime ^ranger/x-terminal-emulator, has urxvt = urxvt -e "$@"
|
||||
mime ^ranger/x-terminal-emulator, has pantheon-terminal = pantheon-terminal -e "$@"
|
||||
mime ^ranger/x-terminal-emulator, has lxterminal = lxterminal -e "$@"
|
||||
mime ^ranger/x-terminal-emulator, has mate-terminal = mate-terminal -x "$@"
|
||||
mime ^ranger/x-terminal-emulator, has xfce4-terminal = xfce4-terminal -x "$@"
|
||||
mime ^ranger/x-terminal-emulator, has konsole = konsole -e "$@"
|
||||
mime ^ranger/x-terminal-emulator, has gnome-terminal = gnome-terminal -- "$@"
|
||||
mime ^ranger/x-terminal-emulator, has xterm = xterm -e "$@"
|
||||
|
||||
#-------------------------------------------
|
||||
# Misc
|
||||
#-------------------------------------------
|
||||
label wallpaper, number 11, mime ^image, has feh, X = feh --bg-scale "$1"
|
||||
label wallpaper, number 12, mime ^image, has feh, X = feh --bg-tile "$1"
|
||||
label wallpaper, number 13, mime ^image, has feh, X = feh --bg-center "$1"
|
||||
label wallpaper, number 14, mime ^image, has feh, X = feh --bg-fill "$1"
|
||||
|
||||
#-------------------------------------------
|
||||
# Generic file openers
|
||||
#-------------------------------------------
|
||||
label open, has xdg-open = xdg-open -- "$@"
|
||||
label open, has open = open -- "$@"
|
||||
|
||||
# Define the editor for non-text files + pager as last action
|
||||
!mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = ask
|
||||
label editor, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = ${VISUAL:-$EDITOR} -- "$@"
|
||||
label pager, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = "$PAGER" -- "$@"
|
||||
|
||||
|
||||
######################################################################
|
||||
# The actions below are left so low down in this file on purpose, so #
|
||||
# they are never triggered accidentally. #
|
||||
######################################################################
|
||||
|
||||
# Execute a file as program/script.
|
||||
mime application/x-executable = "$1"
|
||||
|
||||
# Move the file to trash using trash-cli.
|
||||
label trash, has trash-put = trash-put -- "$@"
|
||||
label trash = mkdir -p -- ${XDG_DATA_DIR:-$HOME/.ranger}/ranger-trash; mv -- "$@" ${XDG_DATA_DIR:-$HOME/.ranger}/ranger-trash
|
477
.config/ranger/scope.sh
Executable file
|
@ -0,0 +1,477 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -o noclobber -o noglob -o nounset -o pipefail
|
||||
IFS=$'\n'
|
||||
|
||||
## If the option `use_preview_script` is set to `true`,
|
||||
## then this script will be called and its output will be displayed in ranger.
|
||||
## ANSI color codes are supported.
|
||||
## STDIN is disabled, so interactive scripts won't work properly
|
||||
|
||||
## This script is considered a configuration file and must be updated manually.
|
||||
## It will be left untouched if you upgrade ranger.
|
||||
|
||||
## Because of some automated testing we do on the script #'s for comments need
|
||||
## to be doubled up. Code that is commented out, because it's an alternative for
|
||||
## example, gets only one #.
|
||||
|
||||
## Meanings of exit codes:
|
||||
## code | meaning | action of ranger
|
||||
## -----+------------+-------------------------------------------
|
||||
## 0 | success | Display stdout as preview
|
||||
## 1 | no preview | Display no preview at all
|
||||
## 2 | plain text | Display the plain content of the file
|
||||
## 3 | fix width | Don't reload when width changes
|
||||
## 4 | fix height | Don't reload when height changes
|
||||
## 5 | fix both | Don't ever reload
|
||||
## 6 | image | Display the image `$IMAGE_CACHE_PATH` points to as an image preview
|
||||
## 7 | image | Display the file directly as an image
|
||||
|
||||
## Script arguments
|
||||
FILE_PATH="${1}" # Full path of the highlighted file
|
||||
PV_WIDTH="${2}" # Width of the preview pane (number of fitting characters)
|
||||
## shellcheck disable=SC2034 # PV_HEIGHT is provided for convenience and unused
|
||||
PV_HEIGHT="${3}" # Height of the preview pane (number of fitting characters)
|
||||
IMAGE_CACHE_PATH="${4}" # Full path that should be used to cache image preview
|
||||
PV_IMAGE_ENABLED="${5}" # 'True' if image previews are enabled, 'False' otherwise.
|
||||
|
||||
FILE_EXTENSION="${FILE_PATH##*.}"
|
||||
FILE_EXTENSION_LOWER="$(printf "%s" "${FILE_EXTENSION}" | tr '[:upper:]' '[:lower:]')"
|
||||
|
||||
## Settings
|
||||
HIGHLIGHT_SIZE_MAX=262143 # 256KiB
|
||||
HIGHLIGHT_TABWIDTH="${HIGHLIGHT_TABWIDTH:-8}"
|
||||
HIGHLIGHT_STYLE="${HIGHLIGHT_STYLE:-pablo}"
|
||||
HIGHLIGHT_OPTIONS="--replace-tabs=${HIGHLIGHT_TABWIDTH} --style=${HIGHLIGHT_STYLE} ${HIGHLIGHT_OPTIONS:-}"
|
||||
PYGMENTIZE_STYLE="${PYGMENTIZE_STYLE:-autumn}"
|
||||
BAT_STYLE="${BAT_STYLE:-plain}"
|
||||
OPENSCAD_IMGSIZE="${RNGR_OPENSCAD_IMGSIZE:-1000,1000}"
|
||||
OPENSCAD_COLORSCHEME="${RNGR_OPENSCAD_COLORSCHEME:-Tomorrow Night}"
|
||||
SQLITE_TABLE_LIMIT=20 # Display only the top <limit> tables in database, set to 0 for no exhaustive preview (only the sqlite_master table is displayed).
|
||||
SQLITE_ROW_LIMIT=5 # Display only the first and the last (<limit> - 1) records in each table, set to 0 for no limits.
|
||||
|
||||
handle_extension() {
|
||||
case "${FILE_EXTENSION_LOWER}" in
|
||||
## Archive
|
||||
a|ace|alz|arc|arj|bz|bz2|cab|cpio|deb|gz|jar|lha|lz|lzh|lzma|lzo|\
|
||||
rpm|rz|t7z|tar|tbz|tbz2|tgz|tlz|txz|tZ|tzo|war|xpi|xz|Z|zip)
|
||||
atool --list -- "${FILE_PATH}" && exit 5
|
||||
bsdtar --list --file "${FILE_PATH}" && exit 5
|
||||
exit 1;;
|
||||
rar)
|
||||
## Avoid password prompt by providing empty password
|
||||
unrar lt -p- -- "${FILE_PATH}" && exit 5
|
||||
exit 1;;
|
||||
7z)
|
||||
## Avoid password prompt by providing empty password
|
||||
7z l -p -- "${FILE_PATH}" && exit 5
|
||||
exit 1;;
|
||||
|
||||
## PDF
|
||||
# pdf)
|
||||
# ## Preview as text conversion
|
||||
# pdftotext -l 10 -nopgbrk -q -- "${FILE_PATH}" - | \
|
||||
# fmt -w "${PV_WIDTH}" && exit 5
|
||||
# mutool draw -F txt -i -- "${FILE_PATH}" 1-10 | \
|
||||
# fmt -w "${PV_WIDTH}" && exit 5
|
||||
# exiftool "${FILE_PATH}" && exit 5
|
||||
# exit 1;;
|
||||
|
||||
## BitTorrent
|
||||
torrent)
|
||||
transmission-show -- "${FILE_PATH}" && exit 5
|
||||
exit 1;;
|
||||
|
||||
## OpenDocument
|
||||
odt|sxw)
|
||||
## Preview as text conversion
|
||||
odt2txt "${FILE_PATH}" && exit 5
|
||||
## Preview as markdown conversion
|
||||
pandoc -s -t markdown -- "${FILE_PATH}" && exit 5
|
||||
exit 1;;
|
||||
ods|odp)
|
||||
## Preview as text conversion (unsupported by pandoc for markdown)
|
||||
odt2txt "${FILE_PATH}" && exit 5
|
||||
exit 1;;
|
||||
|
||||
## XLSX
|
||||
xlsx)
|
||||
## Preview as csv conversion
|
||||
## Uses: https://github.com/dilshod/xlsx2csv
|
||||
xlsx2csv -- "${FILE_PATH}" && exit 5
|
||||
exit 1;;
|
||||
|
||||
## HTML
|
||||
htm|html|xhtml)
|
||||
## Preview as text conversion
|
||||
w3m -dump "${FILE_PATH}" && exit 5
|
||||
lynx -dump -- "${FILE_PATH}" && exit 5
|
||||
elinks -dump "${FILE_PATH}" && exit 5
|
||||
pandoc -s -t markdown -- "${FILE_PATH}" && exit 5
|
||||
;;
|
||||
|
||||
## JSON
|
||||
json)
|
||||
jq --color-output . "${FILE_PATH}" && exit 5
|
||||
python -m json.tool -- "${FILE_PATH}" && exit 5
|
||||
;;
|
||||
|
||||
## Jupyter Notebooks
|
||||
ipynb)
|
||||
jupyter nbconvert --to markdown "${FILE_PATH}" --stdout | env COLORTERM=8bit bat --color=always --style=plain --language=markdown && exit 5
|
||||
jupyter nbconvert --to markdown "${FILE_PATH}" --stdout && exit 5
|
||||
jq --color-output . "${FILE_PATH}" && exit 5
|
||||
python -m json.tool -- "${FILE_PATH}" && exit 5
|
||||
;;
|
||||
|
||||
## Direct Stream Digital/Transfer (DSDIFF) and wavpack aren't detected
|
||||
## by file(1).
|
||||
dff|dsf|wv|wvc)
|
||||
mediainfo "${FILE_PATH}" && exit 5
|
||||
exiftool "${FILE_PATH}" && exit 5
|
||||
;; # Continue with next handler on failure
|
||||
esac
|
||||
}
|
||||
|
||||
handle_image() {
|
||||
## Size of the preview if there are multiple options or it has to be
|
||||
## rendered from vector graphics. If the conversion program allows
|
||||
## specifying only one dimension while keeping the aspect ratio, the width
|
||||
## will be used.
|
||||
local DEFAULT_SIZE="1920x1080"
|
||||
|
||||
local mimetype="${1}"
|
||||
case "${mimetype}" in
|
||||
## SVG
|
||||
image/svg+xml|image/svg)
|
||||
rsvg-convert --keep-aspect-ratio --width "${DEFAULT_SIZE%x*}" "${FILE_PATH}" -o "${IMAGE_CACHE_PATH}.png" \
|
||||
&& mv "${IMAGE_CACHE_PATH}.png" "${IMAGE_CACHE_PATH}" \
|
||||
&& exit 6
|
||||
exit 1;;
|
||||
|
||||
## DjVu
|
||||
image/vnd.djvu)
|
||||
ddjvu -format=tiff -quality=90 -page=1 -size="${DEFAULT_SIZE}" \
|
||||
- "${IMAGE_CACHE_PATH}" < "${FILE_PATH}" \
|
||||
&& exit 6 || exit 1;;
|
||||
|
||||
## Image
|
||||
image/*)
|
||||
local orientation
|
||||
orientation="$( identify -format '%[EXIF:Orientation]\n' -- "${FILE_PATH}" )"
|
||||
## If orientation data is present and the image actually
|
||||
## needs rotating ("1" means no rotation)...
|
||||
if [[ -n "$orientation" && "$orientation" != 1 ]]; then
|
||||
## ...auto-rotate the image according to the EXIF data.
|
||||
convert -- "${FILE_PATH}" -auto-orient "${IMAGE_CACHE_PATH}" && exit 6
|
||||
fi
|
||||
|
||||
## `w3mimgdisplay` will be called for all images (unless overridden
|
||||
## as above), but might fail for unsupported types.
|
||||
exit 7;;
|
||||
|
||||
## Video
|
||||
# video/*)
|
||||
# # Get embedded thumbnail
|
||||
# ffmpeg -i "${FILE_PATH}" -map 0:v -map -0:V -c copy "${IMAGE_CACHE_PATH}" && exit 6
|
||||
# # Get frame 10% into video
|
||||
# ffmpegthumbnailer -i "${FILE_PATH}" -o "${IMAGE_CACHE_PATH}" -s 0 && exit 6
|
||||
# exit 1;;
|
||||
|
||||
## Audio
|
||||
# audio/*)
|
||||
# # Get embedded thumbnail
|
||||
# ffmpeg -i "${FILE_PATH}" -map 0:v -map -0:V -c copy \
|
||||
# "${IMAGE_CACHE_PATH}" && exit 6;;
|
||||
|
||||
## PDF
|
||||
application/pdf)
|
||||
pdftoppm -f 1 -l 1 \
|
||||
-scale-to-x "${DEFAULT_SIZE%x*}" \
|
||||
-scale-to-y -1 \
|
||||
-singlefile \
|
||||
-jpeg -tiffcompression jpeg \
|
||||
-- "${FILE_PATH}" "${IMAGE_CACHE_PATH%.*}" \
|
||||
&& exit 6 || exit 1;;
|
||||
|
||||
|
||||
## ePub, MOBI, FB2 (using Calibre)
|
||||
# application/epub+zip|application/x-mobipocket-ebook|\
|
||||
# application/x-fictionbook+xml)
|
||||
# # ePub (using https://github.com/marianosimone/epub-thumbnailer)
|
||||
# epub-thumbnailer "${FILE_PATH}" "${IMAGE_CACHE_PATH}" \
|
||||
# "${DEFAULT_SIZE%x*}" && exit 6
|
||||
# ebook-meta --get-cover="${IMAGE_CACHE_PATH}" -- "${FILE_PATH}" \
|
||||
# >/dev/null && exit 6
|
||||
# exit 1;;
|
||||
|
||||
## Font
|
||||
application/font*|application/*opentype)
|
||||
preview_png="/tmp/$(basename "${IMAGE_CACHE_PATH%.*}").png"
|
||||
if fontimage -o "${preview_png}" \
|
||||
--pixelsize "120" \
|
||||
--fontname \
|
||||
--pixelsize "80" \
|
||||
--text " ABCDEFGHIJKLMNOPQRSTUVWXYZ " \
|
||||
--text " abcdefghijklmnopqrstuvwxyz " \
|
||||
--text " 0123456789.:,;(*!?') ff fl fi ffi ffl " \
|
||||
--text " The quick brown fox jumps over the lazy dog. " \
|
||||
"${FILE_PATH}";
|
||||
then
|
||||
convert -- "${preview_png}" "${IMAGE_CACHE_PATH}" \
|
||||
&& rm "${preview_png}" \
|
||||
&& exit 6
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
## Preview archives using the first image inside.
|
||||
## (Very useful for comic book collections for example.)
|
||||
# application/zip|application/x-rar|application/x-7z-compressed|\
|
||||
# application/x-xz|application/x-bzip2|application/x-gzip|application/x-tar)
|
||||
# local fn=""; local fe=""
|
||||
# local zip=""; local rar=""; local tar=""; local bsd=""
|
||||
# case "${mimetype}" in
|
||||
# application/zip) zip=1 ;;
|
||||
# application/x-rar) rar=1 ;;
|
||||
# application/x-7z-compressed) ;;
|
||||
# *) tar=1 ;;
|
||||
# esac
|
||||
# { [ "$tar" ] && fn=$(tar --list --file "${FILE_PATH}"); } || \
|
||||
# { fn=$(bsdtar --list --file "${FILE_PATH}") && bsd=1 && tar=""; } || \
|
||||
# { [ "$rar" ] && fn=$(unrar lb -p- -- "${FILE_PATH}"); } || \
|
||||
# { [ "$zip" ] && fn=$(zipinfo -1 -- "${FILE_PATH}"); } || return
|
||||
#
|
||||
# fn=$(echo "$fn" | python -c "from __future__ import print_function; \
|
||||
# import sys; import mimetypes as m; \
|
||||
# [ print(l, end='') for l in sys.stdin if \
|
||||
# (m.guess_type(l[:-1])[0] or '').startswith('image/') ]" |\
|
||||
# sort -V | head -n 1)
|
||||
# [ "$fn" = "" ] && return
|
||||
# [ "$bsd" ] && fn=$(printf '%b' "$fn")
|
||||
#
|
||||
# [ "$tar" ] && tar --extract --to-stdout \
|
||||
# --file "${FILE_PATH}" -- "$fn" > "${IMAGE_CACHE_PATH}" && exit 6
|
||||
# fe=$(echo -n "$fn" | sed 's/[][*?\]/\\\0/g')
|
||||
# [ "$bsd" ] && bsdtar --extract --to-stdout \
|
||||
# --file "${FILE_PATH}" -- "$fe" > "${IMAGE_CACHE_PATH}" && exit 6
|
||||
# [ "$bsd" ] || [ "$tar" ] && rm -- "${IMAGE_CACHE_PATH}"
|
||||
# [ "$rar" ] && unrar p -p- -inul -- "${FILE_PATH}" "$fn" > \
|
||||
# "${IMAGE_CACHE_PATH}" && exit 6
|
||||
# [ "$zip" ] && unzip -pP "" -- "${FILE_PATH}" "$fe" > \
|
||||
# "${IMAGE_CACHE_PATH}" && exit 6
|
||||
# [ "$rar" ] || [ "$zip" ] && rm -- "${IMAGE_CACHE_PATH}"
|
||||
# ;;
|
||||
esac
|
||||
|
||||
# openscad_image() {
|
||||
# TMPPNG="$(mktemp -t XXXXXX.png)"
|
||||
# openscad --colorscheme="${OPENSCAD_COLORSCHEME}" \
|
||||
# --imgsize="${OPENSCAD_IMGSIZE/x/,}" \
|
||||
# -o "${TMPPNG}" "${1}"
|
||||
# mv "${TMPPNG}" "${IMAGE_CACHE_PATH}"
|
||||
# }
|
||||
|
||||
case "${FILE_EXTENSION_LOWER}" in
|
||||
## 3D models
|
||||
## OpenSCAD only supports png image output, and ${IMAGE_CACHE_PATH}
|
||||
## is hardcoded as jpeg. So we make a tempfile.png and just
|
||||
## move/rename it to jpg. This works because image libraries are
|
||||
## smart enough to handle it.
|
||||
# csg|scad)
|
||||
# openscad_image "${FILE_PATH}" && exit 6
|
||||
# ;;
|
||||
# 3mf|amf|dxf|off|stl)
|
||||
# openscad_image <(echo "import(\"${FILE_PATH}\");") && exit 6
|
||||
# ;;
|
||||
drawio)
|
||||
draw.io -x "${FILE_PATH}" -o "${IMAGE_CACHE_PATH}" \
|
||||
--width "${DEFAULT_SIZE%x*}" && exit 6
|
||||
exit 1;;
|
||||
esac
|
||||
}
|
||||
|
||||
handle_mime() {
|
||||
local mimetype="${1}"
|
||||
case "${mimetype}" in
|
||||
## RTF and DOC
|
||||
text/rtf|*msword)
|
||||
## Preview as text conversion
|
||||
## note: catdoc does not always work for .doc files
|
||||
## catdoc: http://www.wagner.pp.ru/~vitus/software/catdoc/
|
||||
catdoc -- "${FILE_PATH}" && exit 5
|
||||
exit 1;;
|
||||
|
||||
## DOCX, ePub, FB2 (using markdown)
|
||||
## You might want to remove "|epub" and/or "|fb2" below if you have
|
||||
## uncommented other methods to preview those formats
|
||||
*wordprocessingml.document|*/epub+zip|*/x-fictionbook+xml)
|
||||
## Preview as markdown conversion
|
||||
pandoc -s -t markdown -- "${FILE_PATH}" && exit 5
|
||||
exit 1;;
|
||||
|
||||
## E-mails
|
||||
message/rfc822)
|
||||
## Parsing performed by mu: https://github.com/djcb/mu
|
||||
mu view -- "${FILE_PATH}" && exit 5
|
||||
exit 1;;
|
||||
|
||||
## XLS
|
||||
*ms-excel)
|
||||
## Preview as csv conversion
|
||||
## xls2csv comes with catdoc:
|
||||
## http://www.wagner.pp.ru/~vitus/software/catdoc/
|
||||
xls2csv -- "${FILE_PATH}" && exit 5
|
||||
exit 1;;
|
||||
|
||||
## SQLite
|
||||
*sqlite3)
|
||||
## Preview as text conversion
|
||||
sqlite_tables="$( sqlite3 "file:${FILE_PATH}?mode=ro" '.tables' )" \
|
||||
|| exit 1
|
||||
[ -z "${sqlite_tables}" ] &&
|
||||
{ echo "Empty SQLite database." && exit 5; }
|
||||
sqlite_show_query() {
|
||||
sqlite-utils query "${FILE_PATH}" "${1}" --table --fmt fancy_grid \
|
||||
|| sqlite3 "file:${FILE_PATH}?mode=ro" "${1}" -header -column
|
||||
}
|
||||
## Display basic table information
|
||||
sqlite_rowcount_query="$(
|
||||
sqlite3 "file:${FILE_PATH}?mode=ro" -noheader \
|
||||
'SELECT group_concat(
|
||||
"SELECT """ || name || """ AS tblname,
|
||||
count(*) AS rowcount
|
||||
FROM " || name,
|
||||
" UNION ALL "
|
||||
)
|
||||
FROM sqlite_master
|
||||
WHERE type="table" AND name NOT LIKE "sqlite_%";'
|
||||
)"
|
||||
sqlite_show_query \
|
||||
"SELECT tblname AS 'table', rowcount AS 'count',
|
||||
(
|
||||
SELECT '(' || group_concat(name, ', ') || ')'
|
||||
FROM pragma_table_info(tblname)
|
||||
) AS 'columns',
|
||||
(
|
||||
SELECT '(' || group_concat(
|
||||
upper(type) || (
|
||||
CASE WHEN pk > 0 THEN ' PRIMARY KEY' ELSE '' END
|
||||
),
|
||||
', '
|
||||
) || ')'
|
||||
FROM pragma_table_info(tblname)
|
||||
) AS 'types'
|
||||
FROM (${sqlite_rowcount_query});"
|
||||
if [ "${SQLITE_TABLE_LIMIT}" -gt 0 ] &&
|
||||
[ "${SQLITE_ROW_LIMIT}" -ge 0 ]; then
|
||||
## Do exhaustive preview
|
||||
echo && printf '>%.0s' $( seq "${PV_WIDTH}" ) && echo
|
||||
sqlite3 "file:${FILE_PATH}?mode=ro" -noheader \
|
||||
"SELECT name FROM sqlite_master
|
||||
WHERE type='table' AND name NOT LIKE 'sqlite_%'
|
||||
LIMIT ${SQLITE_TABLE_LIMIT};" |
|
||||
while read -r sqlite_table; do
|
||||
sqlite_rowcount="$(
|
||||
sqlite3 "file:${FILE_PATH}?mode=ro" -noheader \
|
||||
"SELECT count(*) FROM ${sqlite_table}"
|
||||
)"
|
||||
echo
|
||||
if [ "${SQLITE_ROW_LIMIT}" -gt 0 ] &&
|
||||
[ "${SQLITE_ROW_LIMIT}" \
|
||||
-lt "${sqlite_rowcount}" ]; then
|
||||
echo "${sqlite_table} [${SQLITE_ROW_LIMIT} of ${sqlite_rowcount}]:"
|
||||
sqlite_ellipsis_query="$(
|
||||
sqlite3 "file:${FILE_PATH}?mode=ro" -noheader \
|
||||
"SELECT 'SELECT ' || group_concat(
|
||||
'''...''', ', '
|
||||
)
|
||||
FROM pragma_table_info(
|
||||
'${sqlite_table}'
|
||||
);"
|
||||
)"
|
||||
sqlite_show_query \
|
||||
"SELECT * FROM (
|
||||
SELECT * FROM ${sqlite_table} LIMIT 1
|
||||
)
|
||||
UNION ALL ${sqlite_ellipsis_query} UNION ALL
|
||||
SELECT * FROM (
|
||||
SELECT * FROM ${sqlite_table}
|
||||
LIMIT (${SQLITE_ROW_LIMIT} - 1)
|
||||
OFFSET (
|
||||
${sqlite_rowcount}
|
||||
- (${SQLITE_ROW_LIMIT} - 1)
|
||||
)
|
||||
);"
|
||||
else
|
||||
echo "${sqlite_table} [${sqlite_rowcount}]:"
|
||||
sqlite_show_query "SELECT * FROM ${sqlite_table};"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
exit 5;;
|
||||
|
||||
## Text
|
||||
text/* | */xml)
|
||||
## Syntax highlight
|
||||
if [[ "$( stat --printf='%s' -- "${FILE_PATH}" )" -gt "${HIGHLIGHT_SIZE_MAX}" ]]; then
|
||||
exit 2
|
||||
fi
|
||||
if [[ "$( tput colors )" -ge 256 ]]; then
|
||||
local pygmentize_format='terminal256'
|
||||
local highlight_format='xterm256'
|
||||
else
|
||||
local pygmentize_format='terminal'
|
||||
local highlight_format='ansi'
|
||||
fi
|
||||
env HIGHLIGHT_OPTIONS="${HIGHLIGHT_OPTIONS}" highlight \
|
||||
--out-format="${highlight_format}" \
|
||||
--force -- "${FILE_PATH}" && exit 5
|
||||
env COLORTERM=8bit bat --color=always --style="${BAT_STYLE}" \
|
||||
-- "${FILE_PATH}" && exit 5
|
||||
pygmentize -f "${pygmentize_format}" -O "style=${PYGMENTIZE_STYLE}"\
|
||||
-- "${FILE_PATH}" && exit 5
|
||||
exit 2;;
|
||||
|
||||
## DjVu
|
||||
image/vnd.djvu)
|
||||
## Preview as text conversion (requires djvulibre)
|
||||
djvutxt "${FILE_PATH}" | fmt -w "${PV_WIDTH}" && exit 5
|
||||
exiftool "${FILE_PATH}" && exit 5
|
||||
exit 1;;
|
||||
|
||||
## Image
|
||||
image/*)
|
||||
## Preview as text conversion
|
||||
# img2txt --gamma=0.6 --width="${PV_WIDTH}" -- "${FILE_PATH}" && exit 4
|
||||
exiftool "${FILE_PATH}" && exit 5
|
||||
exit 1;;
|
||||
|
||||
## Video and audio
|
||||
video/* | audio/*)
|
||||
mediainfo "${FILE_PATH}" && exit 5
|
||||
exiftool "${FILE_PATH}" && exit 5
|
||||
exit 1;;
|
||||
|
||||
## ELF files (executables and shared objects)
|
||||
application/x-executable | application/x-pie-executable | application/x-sharedlib)
|
||||
readelf -WCa "${FILE_PATH}" && exit 5
|
||||
exit 1;;
|
||||
esac
|
||||
}
|
||||
|
||||
handle_fallback() {
|
||||
echo '----- File Type Classification -----' && file --dereference --brief -- "${FILE_PATH}" && exit 5
|
||||
}
|
||||
|
||||
|
||||
MIMETYPE="$( file --dereference --brief --mime-type -- "${FILE_PATH}" )"
|
||||
if [[ "${PV_IMAGE_ENABLED}" == 'True' ]]; then
|
||||
handle_image "${MIMETYPE}"
|
||||
fi
|
||||
handle_extension
|
||||
handle_mime "${MIMETYPE}"
|
||||
handle_fallback
|
||||
|
||||
exit 1
|
|
@ -5,12 +5,11 @@
|
|||
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
|
||||
# absolute path. No other format is supported.
|
||||
#
|
||||
XDG_DESKTOP_DIR="$HOME/desktop"
|
||||
XDG_DOCUMENTS_DIR="$HOME/documents"
|
||||
XDG_DOWNLOAD_DIR="$HOME/downloads"
|
||||
XDG_MUSIC_DIR="$HOME/music"
|
||||
XDG_PICTURES_DIR="$HOME/pictures"
|
||||
XDG_PUBLICSHARE_DIR="$HOME/"
|
||||
XDG_TEMPLATES_DIR="$HOME/"
|
||||
XDG_VIDEOS_DIR="$HOME/videos"
|
||||
XDG_GAMES_DIR="$HOME/games"
|
||||
XDG_DESKTOP_DIR="$HOME/Desktop"
|
||||
XDG_DOWNLOAD_DIR="$HOME/down"
|
||||
XDG_TEMPLATES_DIR="$HOME/Templates"
|
||||
XDG_PUBLICSHARE_DIR="$HOME/Public"
|
||||
XDG_DOCUMENTS_DIR="$HOME/docs"
|
||||
XDG_MUSIC_DIR="$HOME/Music"
|
||||
XDG_PICTURES_DIR="$HOME/media/pics"
|
||||
XDG_VIDEOS_DIR="$HOME/media/vids"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"include": [
|
||||
"~/.config/waybar/modules/battery.jsonc",
|
||||
"~/.config/waybar/modules/custom-wf-recorder.jsonc",
|
||||
"~/.config/waybar/modules/custom-updates.jsonc",
|
||||
"~/.config/waybar/modules/custom-music.jsonc",
|
||||
|
@ -8,6 +9,7 @@
|
|||
"~/.config/waybar/modules/custom-weather.jsonc",
|
||||
"~/.config/waybar/modules/hyprland-language.jsonc",
|
||||
"~/.config/waybar/modules/hyprland-workspaces.jsonc",
|
||||
"~/.config/waybar/modules/network.jsonc",
|
||||
"~/.config/waybar/modules/clock-1.jsonc",
|
||||
"~/.config/waybar/modules/pulseaudio.jsonc",
|
||||
],
|
||||
|
@ -19,6 +21,8 @@
|
|||
],
|
||||
"modules-center": ["custom/music"],
|
||||
"modules-right": [
|
||||
"network",
|
||||
"battery",
|
||||
"custom/updates",
|
||||
"hyprland/language",
|
||||
"custom/weather",
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"include": "~/.config/waybar/bars/bar-1.jsonc",
|
||||
"height": 48,
|
||||
"layer": "top",
|
||||
"output": "DP-1",
|
||||
"output": "eDP-1",
|
||||
"mode": "dock",
|
||||
"exclusive": true,
|
||||
"passtrough": false,
|
||||
|
@ -11,26 +11,11 @@
|
|||
"margin-top": 5,
|
||||
"margin-left": 5,
|
||||
"margin-bottom": 0,
|
||||
"margin-right": 5,
|
||||
"margin-right": 10,
|
||||
},
|
||||
{
|
||||
"include": "~/.config/waybar/bars/bar-2.jsonc",
|
||||
"height": 48,
|
||||
"position": "bottom",
|
||||
"layer": "top",
|
||||
"output": "DP-3",
|
||||
"mode": "dock",
|
||||
"exclusive": true,
|
||||
"passtrough": false,
|
||||
"gtk-layer-shell": true,
|
||||
"margin-top": 0,
|
||||
"margin-left": 5,
|
||||
"margin-bottom": 5,
|
||||
"margin-right": 5,
|
||||
},
|
||||
{
|
||||
"include": "~/.config/waybar/bars/bar-3.jsonc",
|
||||
"height": 48,
|
||||
"layer": "top",
|
||||
"output": "HDMI-A-1",
|
||||
"mode": "dock",
|
||||
|
@ -40,6 +25,6 @@
|
|||
"margin-top": 5,
|
||||
"margin-left": 5,
|
||||
"margin-bottom": 0,
|
||||
"margin-right": 5,
|
||||
"margin-right": 10,
|
||||
},
|
||||
]
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
"hyprland/language": {
|
||||
"format": "{}",
|
||||
"format-en": " US",
|
||||
"format-es": " ES",
|
||||
"on-click": "hyprctl switchxkblayout evision-usb-device next",
|
||||
// "format-ser-latinyz": " RS (Lat)",
|
||||
// "format-ser-yz": " RS (Cyr)",
|
||||
"format-de-qwerty": " DE (QWERTY)",
|
||||
"on-click": "hyprctl switchxkblayout at-translated-set-2-keyboard next",
|
||||
},
|
||||
}
|
||||
|
|
2
.gdbinit
Normal file
|
@ -0,0 +1,2 @@
|
|||
source ~/.gef-.py
|
||||
set debuginfod enabled on
|
206
.gef.rc
Normal file
|
@ -0,0 +1,206 @@
|
|||
[assemble]
|
||||
default_architecture = X86
|
||||
default_mode = 64
|
||||
|
||||
[capstone-disassemble]
|
||||
use-capstone = False
|
||||
|
||||
[context]
|
||||
clear_screen = False
|
||||
enable = True
|
||||
grow_stack_down = False
|
||||
ignore_registers =
|
||||
layout = legend regs stack code args source memory threads trace extra syscall_args libc_function_args libc_function_args syscall_args
|
||||
libc_args = True
|
||||
libc_args_path = /home/kappa/.config/gef-extras/glibc-function-args
|
||||
nb_lines_backtrace = 10
|
||||
nb_lines_backtrace_before = 2
|
||||
nb_lines_code = 6
|
||||
nb_lines_code_prev = 3
|
||||
nb_lines_stack = 8
|
||||
nb_lines_threads = -1
|
||||
peek_calls = True
|
||||
peek_ret = True
|
||||
redirect =
|
||||
show_opcodes_size = 0
|
||||
show_registers_raw = False
|
||||
show_source_code_variable_values = True
|
||||
show_stack_raw = False
|
||||
|
||||
[dereference]
|
||||
max_recursion = 7
|
||||
|
||||
[entry-break]
|
||||
entrypoint_symbols = main _main __libc_start_main __uClibc_main start _start
|
||||
|
||||
[ftrace]
|
||||
output = /dev/stderr
|
||||
|
||||
[gef]
|
||||
autosave_breakpoints_file =
|
||||
bruteforce_main_arena = True
|
||||
buffer = True
|
||||
debug = False
|
||||
disable_color = False
|
||||
extra_plugins_dir = /home/kappa/.config/gef-extras/scripts
|
||||
follow_child = True
|
||||
main_arena_offset =
|
||||
readline_compat = False
|
||||
show_deprecation_warnings = True
|
||||
tempdir = /tmp/gef
|
||||
use-windbg-prompt = False
|
||||
|
||||
[got]
|
||||
function_not_resolved = yellow
|
||||
function_resolved = green
|
||||
|
||||
[heap-analysis-helper]
|
||||
check_double_free = True
|
||||
check_free_null = False
|
||||
check_heap_overlap = True
|
||||
check_uaf = True
|
||||
check_weird_free = True
|
||||
|
||||
[heap-chunks]
|
||||
peek_nb_byte = 16
|
||||
|
||||
[hexdump]
|
||||
always_show_ascii = False
|
||||
|
||||
[highlight]
|
||||
regex = False
|
||||
|
||||
[ida-rpyc]
|
||||
host = 127.0.0.1
|
||||
port = 18812
|
||||
sync_cursor = False
|
||||
|
||||
[pattern]
|
||||
length = 1024
|
||||
|
||||
[pcustom]
|
||||
max_depth = 4
|
||||
struct_path = /home/kappa/.config/gef-extras/structs
|
||||
structure_name = bold blue
|
||||
structure_size = green
|
||||
structure_type = bold red
|
||||
|
||||
[print-format]
|
||||
max_size_preview = 10
|
||||
|
||||
[process-search]
|
||||
ps_command = /usr/bin/ps auxww
|
||||
|
||||
[retdec]
|
||||
path = /tmp/gef
|
||||
retdec_path =
|
||||
theme = default
|
||||
|
||||
[rpyc-remote]
|
||||
host = 0.0.0.0
|
||||
port = 12345
|
||||
|
||||
[search-pattern]
|
||||
max_size_preview = 10
|
||||
nr_pages_chunk = 1024
|
||||
|
||||
[syscall-args]
|
||||
path = /home/kappa/.config/gef-extras/syscall-tables
|
||||
|
||||
[theme]
|
||||
address_code = red
|
||||
address_heap = green
|
||||
address_stack = pink
|
||||
context_title_line = gray
|
||||
context_title_message = cyan
|
||||
default_title_line = gray
|
||||
default_title_message = cyan
|
||||
dereference_base_address = cyan
|
||||
dereference_code = gray
|
||||
dereference_register_value = bold blue
|
||||
dereference_string = yellow
|
||||
disassemble_current_instruction = green
|
||||
old_context = gray
|
||||
registers_register_name = blue
|
||||
registers_value_changed = bold red
|
||||
source_current_line = green
|
||||
table_heading = blue
|
||||
|
||||
[trace-run]
|
||||
max_tracing_recursion = 1
|
||||
tracefile_prefix = ./gef-trace-
|
||||
|
||||
[unicorn-emulate]
|
||||
show_disassembly = False
|
||||
verbose = False
|
||||
|
||||
[vereference]
|
||||
max_recursion = 7
|
||||
|
||||
[aliases]
|
||||
r = run
|
||||
ctx = context
|
||||
telescope = dereference
|
||||
flags = edit-flags
|
||||
start = entry-break
|
||||
fmtstr-helper = format-string-helper
|
||||
hl = highlight
|
||||
highlight set = highlight add
|
||||
hla = highlight add
|
||||
hlc = highlight clear
|
||||
highlight ls = highlight list
|
||||
hll = highlight list
|
||||
highlight delete = highlight remove
|
||||
highlight del = highlight remove
|
||||
highlight unset = highlight remove
|
||||
highlight rm = highlight remove
|
||||
hlr = highlight remove
|
||||
nb = name-break
|
||||
pattern offset = pattern search
|
||||
pf = print-format
|
||||
ps = process-search
|
||||
status = process-status
|
||||
lookup = scan
|
||||
grep = search-pattern
|
||||
xref = search-pattern
|
||||
sc-get = shellcode get
|
||||
sc-search = shellcode search
|
||||
screen-setup = tmux-setup
|
||||
da = display/s
|
||||
dt = pcustom
|
||||
dq = hexdump qword
|
||||
dd = hexdump dword
|
||||
dw = hexdump word
|
||||
db = hexdump byte
|
||||
eq = patch qword
|
||||
ed = patch dword
|
||||
ew = patch word
|
||||
eb = patch byte
|
||||
ea = patch string
|
||||
dps = dereference
|
||||
bp = break
|
||||
bl = info breakpoints
|
||||
bd = disable breakpoints
|
||||
bc = delete breakpoints
|
||||
be = enable breakpoints
|
||||
tbp = tbreak
|
||||
s = grep
|
||||
pa = advance
|
||||
t = stepi
|
||||
kp = info stack
|
||||
uf = disassemble
|
||||
asm = assemble
|
||||
stack-view = current-stack-frame
|
||||
perror = error
|
||||
skeleton = exploit-template
|
||||
ida-rpyc bp = ida-rpyc breakpoints
|
||||
ida-rpyc bl = ida-rpyc breakpoints list
|
||||
ida-rpyc cmt = ida-rpyc comments
|
||||
ida-rpyc hl = ida-rpyc highlight
|
||||
ida-rpyc goto = ida-rpyc jump
|
||||
decompile = retdec
|
||||
mprotect = set-permission
|
||||
emulate = unicorn-emulate
|
||||
v8 = vereference
|
||||
heap-view = visualize-libc-heap-chunks
|
||||
|
23
.gitconfig
Normal file
|
@ -0,0 +1,23 @@
|
|||
[user]
|
||||
name = Petar Kapriš
|
||||
email = kayprish@bonsai.cool
|
||||
[sendemail]
|
||||
smtpServer = mail.bonsai.cool
|
||||
from = petarkapris@firemail.cc
|
||||
smtpUser = kayprish.bonsai.cool
|
||||
smtpencryption = tls
|
||||
smtpserverport = 587
|
||||
suppresscc = self
|
||||
chainreplyto = false
|
||||
|
||||
[init]
|
||||
defaultBranch = master
|
||||
|
||||
[core]
|
||||
editor = vim
|
||||
[color "status"]
|
||||
branch = magenta
|
||||
untracked = cyan
|
||||
unmerged = yellow
|
||||
[alias]
|
||||
staash = stash --all
|
1
.github/CODEOWNERS
vendored
|
@ -1 +0,0 @@
|
|||
* @Matt-FTW
|
74
.github/CODE_OF_CONDUCT.md
vendored
|
@ -1,74 +0,0 @@
|
|||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and maintainers pledge to making participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age, body
|
||||
size, disability, ethnicity, gender identity and expression, level of experience,
|
||||
nationality, personal appearance, race, religion, or sexual identity and
|
||||
orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
|
||||
- Using welcoming and inclusive language
|
||||
- Being respectful of differing viewpoints and experiences
|
||||
- Gracefully accepting constructive criticism
|
||||
- Focusing on what is best for the community
|
||||
- Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
- The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
advances
|
||||
- Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
- Public or private harassment
|
||||
- Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
- Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable
|
||||
behavior and are expected to take appropriate and fair corrective action in
|
||||
response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces
|
||||
when an individual is representing the project or its community. Examples of
|
||||
representing a project or community include using an official project e-mail
|
||||
address, posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event. Representation of a project may be
|
||||
further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at sergio.lac@pm.me All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||
available at [https://contributor-covenant.org/version/1/4][version]
|
||||
|
||||
[homepage]: https://contributor-covenant.org
|
||||
[version]: https://contributor-covenant.org/version/1/4/
|
159
.github/COMMIT_MESSAGE_GUIDELINES.md
vendored
|
@ -1,159 +0,0 @@
|
|||
# Commit Message Guidelines
|
||||
|
||||
A good commit message should be descriptive and provide context about the changes made. This makes it easier to understand and review the changes in the future.
|
||||
|
||||
The specification used to write human-readable commits is [Conventional Commits](https://conventionalcommits.org).
|
||||
|
||||
Here are some guidelines for writing descriptive commit messages:
|
||||
|
||||
- Start with a short summary of the changes made in the commit.
|
||||
|
||||
- Use imperative mood for the summary, as if you're giving a command. For example, "Add feature" instead of "Added feature".
|
||||
|
||||
- Provide additional details in the commit message body, if necessary. This could include the reason for the change, the impact of the change, or any dependencies that were introduced or removed.
|
||||
|
||||
- Keep the message within 72 characters per line to ensure that it's easy to read in Git log output.
|
||||
|
||||
Examples of good commit messages:
|
||||
|
||||
- "Add authentication feature for user login"
|
||||
- "Fix bug causing application to crash on startup"
|
||||
- "Update documentation for API endpoints"
|
||||
|
||||
Remember, writing descriptive commit messages can save time and frustration in the future, and help others understand the changes made to the codebase.
|
||||
|
||||
## Commit Message Types
|
||||
|
||||
Here's a more comprehensive list of commit types that you can use:
|
||||
|
||||
`feat`: Adding a new feature to the project
|
||||
|
||||
```markdown
|
||||
feat: Add multi-image upload support
|
||||
```
|
||||
|
||||
`fix`: Fixing a bug or issue in the project
|
||||
|
||||
```markdown
|
||||
fix: Fix bug causing application to crash on startup
|
||||
```
|
||||
|
||||
`docs`: Updating documentation in the project
|
||||
|
||||
```markdown
|
||||
docs: Update documentation for API endpoints
|
||||
```
|
||||
|
||||
`style`: Making cosmetic or style changes to the project (such as changing colors or formatting code)
|
||||
|
||||
```markdown
|
||||
style: Update colors and formatting
|
||||
```
|
||||
|
||||
`refactor`: Making code changes that don't affect the behavior of the project, but improve its quality or maintainability
|
||||
|
||||
```markdown
|
||||
refactor: Remove unused code
|
||||
```
|
||||
|
||||
`test`: Adding or modifying tests for the project
|
||||
|
||||
```markdown
|
||||
test: Add tests for new feature
|
||||
```
|
||||
|
||||
`chore`: Making changes to the project that don't fit into any other category, such as updating dependencies or configuring the build system
|
||||
|
||||
```markdown
|
||||
chore: Update dependencies
|
||||
```
|
||||
|
||||
`perf`: Improving performance of the project
|
||||
|
||||
```markdown
|
||||
perf: Improve performance of image processing
|
||||
```
|
||||
|
||||
`security`: Addressing security issues in the project
|
||||
|
||||
```markdown
|
||||
security: Update dependencies to address security issues
|
||||
```
|
||||
|
||||
`merge`: Merging branches in the project
|
||||
|
||||
```markdown
|
||||
merge: Merge branch 'feature/branch-name' into develop
|
||||
```
|
||||
|
||||
`revert`: Reverting a previous commit
|
||||
|
||||
```markdown
|
||||
revert: Revert "Add feature"
|
||||
```
|
||||
|
||||
`build`: Making changes to the build system or dependencies of the project
|
||||
|
||||
```markdown
|
||||
build: Update dependencies
|
||||
```
|
||||
|
||||
`ci`: Making changes to the continuous integration (CI) system for the project
|
||||
|
||||
```markdown
|
||||
ci: Update CI configuration
|
||||
```
|
||||
|
||||
`config`: Making changes to configuration files for the project
|
||||
|
||||
```markdown
|
||||
config: Update configuration files
|
||||
```
|
||||
|
||||
`deploy`: Making changes to the deployment process for the project
|
||||
|
||||
```markdown
|
||||
deploy: Update deployment scripts
|
||||
```
|
||||
|
||||
`init`: Creating or initializing a new repository or project
|
||||
|
||||
```markdown
|
||||
init: Initialize project
|
||||
```
|
||||
|
||||
`move`: Moving files or directories within the project
|
||||
|
||||
```markdown
|
||||
move: Move files to new directory
|
||||
```
|
||||
|
||||
`rename`: Renaming files or directories within the project
|
||||
|
||||
```markdown
|
||||
rename: Rename files
|
||||
```
|
||||
|
||||
`remove`: Removing files or directories from the project
|
||||
|
||||
```markdown
|
||||
remove: Remove files
|
||||
```
|
||||
|
||||
`update`: Updating code, dependencies, or other components of the project
|
||||
|
||||
```markdown
|
||||
update: Update code
|
||||
```
|
||||
|
||||
These are just some examples, and you can create your own custom commit types as well. However, it's important to use them consistently and write clear, descriptive commit messages to make it easy for others to understand the changes you've made.
|
||||
|
||||
Emojis are also allowed, always following the commit guidelines mention before.
|
||||
|
||||
**Important:** If you are planning to use a custom commit message type other than the ones listed above, make sure to add it to this list so that others can understand it as well. Create a pull request to add it to this file.
|
||||
|
||||
## Tools
|
||||
|
||||
I recommend using [Commitizen](https://github.com/commitizen/cz-cli) in combination of an adapter such as [cz-git](https://github.com/Zhengqbbb/cz-git) for generating premade, customized and human-readable commit messages.
|
||||
|
||||
If you wanna take a look, you have my config file for Commitizen [right here](../.czrc).
|
68
.github/CONTRIBUTING.md
vendored
|
@ -1,68 +0,0 @@
|
|||
# Contributing to Community Standards
|
||||
|
||||
Thank you for your interest in contributing to Community Standards! We welcome any contributions, including bug fixes, feature enhancements, documentation improvements, and other general improvements.
|
||||
|
||||
## Getting Started
|
||||
|
||||
1. Fork this repository to your GitHub account. This will create a copy of this repository in your account. You can make changes to this copy without affecting the original repository.
|
||||
- For fork this repository, click the **Fork** button in the top right corner of this page or click [here](https://github.com/Matt-FTW/dotfiles/fork).
|
||||
2. Clone your forked repository to your local machine.
|
||||
|
||||
- Use the following command to clone your forked repository to your local machine.
|
||||
|
||||
```bash
|
||||
git clone https://github.com/Matt-FTW/dotfiles.git
|
||||
```
|
||||
|
||||
3. Create a new branch for your changes.
|
||||
|
||||
- For example, to create a new branch named `your-branch-name`, use the following command.
|
||||
|
||||
```bash
|
||||
git checkout -b your-branch-name
|
||||
```
|
||||
|
||||
4. Make your changes and commit them with a descriptive commit message.
|
||||
|
||||
- For example, to commit your changes, use the following command and make sure to follow the [commit message guidelines](./COMMIT_MESSAGE_GUIDELINES.md).
|
||||
|
||||
```bash
|
||||
git commit -m "feat: add a new feature"
|
||||
```
|
||||
|
||||
5. Push your changes to your forked repository.
|
||||
|
||||
- For example, to push your changes to your forked repository, use the following command.
|
||||
|
||||
```bash
|
||||
git push origin your-branch-name
|
||||
```
|
||||
|
||||
6. Submit a **pull request** to the upstream repository.
|
||||
- For example, to create a pull request, use the following steps.
|
||||
1. Go to your forked repository.
|
||||
2. Click the **Compare & pull request** button next to your `your-branch-name` branch.
|
||||
3. Add a title and description for your pull request.
|
||||
4. Click **Create pull request** and remember to add the relevant labels with using the [pull request template](./PULL_REQUEST_TEMPLATE.md).
|
||||
|
||||
## Guidelines
|
||||
|
||||
- Follow the code style of the project.
|
||||
- Update the **documentation** if necessary.
|
||||
- Add tests if applicable.
|
||||
- Make sure all tests pass before submitting your changes.
|
||||
- Keep your pull request focused and avoid including unrelated changes.
|
||||
- Remember to follow the given files before submitting your changes.
|
||||
- [bug_report.yml](./ISSUE_TEMPLATE/bug_report.yml) - Use this template to create a report to help us improve.
|
||||
- [feature_request.yml](./ISSUE_TEMPLATE/feature_request.yml) - Use this template to suggest a feature for this project.
|
||||
- [documentation_update.yml](./ISSUE_TEMPLATE/documentation_update.yml) - Use this template to propose a change to the documentation.
|
||||
- [custom.md](./ISSUE_TEMPLATE/custom.md) - Use this template to submit a custom issue.
|
||||
- [PULL_REQUEST_TEMPLATE.md](./PULL_REQUEST_TEMPLATE.md) - Use this template to submit a pull request.
|
||||
- [COMMIT_MESSAGE_GUIDELINES.md](./COMMIT_MESSAGE_GUIDELINES.md) - Read this file to learn about the commit message guidelines.
|
||||
- [CONTRIBUTING.md](./CONTRIBUTING.md) - Read this file to learn about the contributing guidelines.
|
||||
- [LICENSE](../LICENSE) - Read this file to learn about the license.
|
||||
- [README.md](./README.md) - Read this file to learn about the project.
|
||||
|
||||
## Contact
|
||||
|
||||
If you have any questions, feel free to contact via [GitHub Discussions](https://github.com/Matt-FTW/dotfiles/discussions) or via email at sergio.lac@pm.me
|
25
.github/FAQ.md
vendored
|
@ -1,25 +0,0 @@
|
|||
# Frequently Asked Questions
|
||||
|
||||
## Does your dotfiles have an automatic installation? If not, are you planning on doing it?
|
||||
|
||||
No, I dont have any and im not planning on doing it. The main reason is the hasle that is to maintain an install script.
|
||||
|
||||
The automatic scripts are also "mainly" used without even checking on the code itself, which I think is pretty risky and should be avoided.
|
||||
|
||||
I feel like that way you dont also learn how to install the config which in some cases leds to not understanding what you're doing.
|
||||
|
||||
Sorry about it!
|
||||
|
||||
Even then, the installation steps are pretty easy and straightforward so everybody should be able to do follow them. If not, then that is a mistake on my part :)
|
||||
|
||||
## Are you planning on documenting the keybindings?
|
||||
|
||||
Nop. I dont feel it is neccesary because at some applications they can be seen on the help menu or just by looking at the config file.
|
||||
|
||||
Maybe at some point I'll update my [keyb config](../.config/keyb/) so that the important bindings will be available there.
|
||||
|
||||
## Are custom themes something you'd introduce in the future?
|
||||
|
||||
Maybe. At least for me, I'm not going to use them. I like to stick to one theme only; in this case Catppuccin Macchiato.
|
||||
|
||||
But I understand that a lot of people like it, so if I have the time and the effort I'll do it; but it will take a lot of time to implement tho ;)
|
3
.github/FUNDING.yml
vendored
|
@ -1,3 +0,0 @@
|
|||
github: Matt-FTW
|
||||
custom: ["https://www.buymeacoffee.com/matt_ftw"]
|
||||
ko_fi: matt_ftw
|
39
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
|
@ -1,39 +0,0 @@
|
|||
name: "🐛 Bug Report"
|
||||
description: Create a bug/issue report
|
||||
title: "🐛 Bug: "
|
||||
labels: [bug]
|
||||
body:
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Did you check existing issues?
|
||||
description: Make sure you checked all of the below before submitting an issue to avoid duplicates
|
||||
options:
|
||||
- label: I have searched the existing issues of the repo
|
||||
required: true
|
||||
- label: I have searched the existing issues of used programs related to this issue
|
||||
required: true
|
||||
- label: I have read the [FAQ](https://github.com/Matt-FTW/dotfiles/blob/main/.github/FAQ.md)
|
||||
required: true
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: "Description of the bug"
|
||||
description: A clear and concise description of what the bug is.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: screenshot
|
||||
attributes:
|
||||
label: "Screenshots"
|
||||
description: If needed, add screenshots to help explain your problem.
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: environment
|
||||
attributes:
|
||||
label: "Environment"
|
||||
description: Please add any relevant information about your environment.
|
||||
value: |
|
||||
Linux Distro, Linux Version, Hyprland Version...
|
||||
validations:
|
||||
required: true
|
5
.github/ISSUE_TEMPLATE/config.yml
vendored
|
@ -1,5 +0,0 @@
|
|||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Ask a question
|
||||
url: https://github.com/Matt-FTW/dotfiles/discussions/new/choose
|
||||
about: Use Github discussions instead
|
40
.github/ISSUE_TEMPLATE/documentation_update.yml
vendored
|
@ -1,40 +0,0 @@
|
|||
name: "📚 Documentation Update"
|
||||
description: Suggest a new change in the repo documentation
|
||||
title: "📚 Docs: "
|
||||
labels: [documentation]
|
||||
body:
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Did you check existing doc request?
|
||||
description: Make sure you checked all of the below before submitting a request to avoid duplicates
|
||||
options:
|
||||
- label: I have searched the existing requests of the repo
|
||||
required: true
|
||||
- label: I have searched the existing requests of used programs related to this request
|
||||
required: true
|
||||
- label: I have read the [FAQ](https://github.com/Matt-FTW/dotfiles/blob/main/.github/FAQ.md)
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Description of the request
|
||||
description: A clear description of the documentation update.
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
attributes:
|
||||
label: Current Documentation
|
||||
description: Provide a link to the current documentation or describe where it can be found.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Proposed Documentation
|
||||
description: Provide a clear description of the updated documentation.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Additional Context
|
||||
description: Add any other information about the documentation update here. For example, you might include links to similar documentation in other projects, or screenshots or diagrams to help explain your idea.
|
||||
validations:
|
||||
required: false
|
40
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
|
@ -1,40 +0,0 @@
|
|||
name: "💡 Feature Request"
|
||||
description: Suggest a new feature request
|
||||
title: "💡 Feature: "
|
||||
labels: [enhancement]
|
||||
body:
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Did you check existing feature request?
|
||||
description: Make sure you checked all of the below before submitting a request to avoid duplicates
|
||||
options:
|
||||
- label: I have searched the existing requests of the repo
|
||||
required: true
|
||||
- label: I have searched the existing requests of used programs related to this request
|
||||
required: true
|
||||
- label: I have read the [FAQ](https://github.com/Matt-FTW/dotfiles/blob/main/.github/FAQ.md)
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Is your feature request related to a problem? Please describe.
|
||||
description: A clear description of what the problem is.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Describe the solution you'd like
|
||||
description: A clear description of what you want to happen.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Describe alternatives you've considered
|
||||
description: A clear description of any alternative solutions or features you've considered. Here you can include pull request links if needed.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Additional Context
|
||||
description: Add any other context or screenshots about the feature request here. Here you can include issue links if needed.
|
||||
validations:
|
||||
required: false
|
34
.github/PULL_REQUEST_TEMPLATE.md
vendored
|
@ -1,34 +0,0 @@
|
|||
## 🌿 Description
|
||||
|
||||
<!-- Include a summary of the changes -->
|
||||
|
||||
## 📝 Type of change
|
||||
|
||||
<!-- Please put an `x` in the boxes that apply -->
|
||||
|
||||
- [ ] **Bug fix** (non-breaking change which fixes an issue)
|
||||
- [ ] **New feature** (non-breaking change which adds functionality)
|
||||
- [ ] **Breaking change** (fix or feature that would cause existing functionality to not work as expected)
|
||||
- [ ] **Documentation update** (non-breaking change; modified files are limited to the documentations)
|
||||
- [ ] **Technical debt** (a code change that does not fix a bug or add a feature but makes something clearer)
|
||||
- [ ] **Other** (provide details below)
|
||||
|
||||
## 🔎 Checklist
|
||||
|
||||
<!-- Please put an `x` in the boxes that apply -->
|
||||
|
||||
- [ ] I have read the [CONTRIBUTING](./CONTRIBUTING.md) document.
|
||||
- [ ] My code follows the code style of this project.
|
||||
- [ ] My commit message follows the [commit guidelines](./COMMIT_MESSAGE_GUIDELINES.md).
|
||||
- [ ] My change requires a change to the documentation.
|
||||
- [ ] I have updated the documentation accordingly.
|
||||
- [ ] I have added necessary comments/documentation to my code.
|
||||
- [ ] I have tested my code locally and it works as expected.
|
||||
|
||||
## 📸 Screenshots
|
||||
|
||||
<!-- If appropriate -->
|
||||
|
||||
## ✏️ Additional context
|
||||
|
||||
<!-- Add any other context about the pull request here -->
|
38
.github/README.md
vendored
|
@ -1,38 +0,0 @@
|
|||
<div align="center">
|
||||
<a href="#"><img src="./assets/category-images/dotfiles-title.png"></a>
|
||||
</div>
|
||||
|
||||
<div align="center">
|
||||
|
||||
<img src="https://raw.githubusercontent.com/catppuccin/catppuccin/main/assets/palette/macchiato.png" width="90%"/><br>
|
||||
|
||||
</div>
|
||||
|
||||
<div align="center">
|
||||
|
||||
<a href="https://dotfiles-docs.vercel.app/getting-started/about.html"><img width="190px" src="https://raw.githubusercontent.com/Matt-FTW/dotfiles/main/.github/assets/category-images/dotfiles-about.png"></a>
|
||||
<a href="https://dotfiles-docs.vercel.app/getting-started/installation.html"><img width="190px" src="https://raw.githubusercontent.com/Matt-FTW/dotfiles/main/.github/assets/category-images/dotfiles-setup.png"></a>
|
||||
<a href="https://dotfiles-docs.vercel.app/getting-started/gallery.html"><img width="190px" src="https://raw.githubusercontent.com/Matt-FTW/dotfiles/main/.github/assets/category-images/dotfiles-gallery.png"></a>
|
||||
<a href="https://dotfiles-docs.vercel.app/other/credits.html"><img width="190px" src="https://raw.githubusercontent.com/Matt-FTW/dotfiles/main/.github/assets/category-images/dotfiles-credits.png"></a>
|
||||
|
||||
</div>
|
||||
|
||||
<div align="center">
|
||||
|
||||
<img src="./assets/showcase.png">
|
||||
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div align="center">
|
||||
<a href="https://github.com/Matt-FTW/dotfiles/stargazers"><img alt="Stargazers" src="https://img.shields.io/github/stars/Matt-FTW/dotfiles?style=for-the-badge&logo=starship&color=C9CBFF&logoColor=D9E0EE&labelColor=302D41"></a>
|
||||
<a href="https://github.com/Matt-FTW/dotfiles/issues"><img alt="Forks" src="https://img.shields.io/github/issues/Matt-FTW/dotfiles?style=for-the-badge&logo=gitbook&color=B5E8E0&logoColor=D9E0EE&labelColor=302D41"></a>
|
||||
<a href="https://github.com/Matt-FTW/dotfiles/commits/main/"><img alt="Commit Activity" src="https://img.shields.io/github/commit-activity/m/Matt-FTW/dotfiles/main?style=for-the-badge&logo=github&color=F2CDCD&logoColor=D9E0EE&labelColor=302D41"/></a>
|
||||
<a href="https://github.com/Matt-FTW/dotfiles"><img alt="Size" src="https://img.shields.io/github/repo-size/Matt-FTW/dotfiles?style=for-the-badge&logo=discord&color=DDB6F2&logoColor=D9E0EE&labelColor=302D41"></a>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
> [!NOTE]
|
||||
> All the information about the Dotfiles is on the documentation website: https://dotfiles-docs.vercel.app/
|
11
.github/SECURITY.md
vendored
|
@ -1,11 +0,0 @@
|
|||
# Security Policy
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
If you discover a security issue, please report it by sending an
|
||||
email to sergio.lac@pm.me
|
||||
|
||||
This will allow us to assess the risk, and make a fix available before we add a
|
||||
bug report to the GitHub repository.
|
||||
|
||||
Thanks for helping make webpack safe for everyone.
|
BIN
.github/assets/category-images/dotfiles-about.png
vendored
Before Width: | Height: | Size: 20 KiB |
BIN
.github/assets/category-images/dotfiles-credits.png
vendored
Before Width: | Height: | Size: 23 KiB |
BIN
.github/assets/category-images/dotfiles-gallery.png
vendored
Before Width: | Height: | Size: 24 KiB |
BIN
.github/assets/category-images/dotfiles-setup.png
vendored
Before Width: | Height: | Size: 19 KiB |
BIN
.github/assets/category-images/dotfiles-title.png
vendored
Before Width: | Height: | Size: 39 KiB |
BIN
.github/assets/showcase.png
vendored
Before Width: | Height: | Size: 3.5 MiB |
|
@ -1,7 +1,7 @@
|
|||
default-cache-ttl 21600 # 6 hours
|
||||
max-cache-ttl 64800 # 18 hours
|
||||
|
||||
pinentry-program /usr/bin/pinentry-gnome3
|
||||
pinentry-program /usr/bin/pinentry-qt
|
||||
|
||||
# SSH
|
||||
enable-ssh-support
|
||||
|
|
8
.sbclrc
Normal file
|
@ -0,0 +1,8 @@
|
|||
|
||||
;;; The following lines added by ql:add-to-init-file:
|
||||
#-quicklisp
|
||||
(let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp"
|
||||
(user-homedir-pathname))))
|
||||
(when (probe-file quicklisp-init)
|
||||
(load quicklisp-init)))
|
||||
|
17
.vim/UltiSnips/README
Normal file
|
@ -0,0 +1,17 @@
|
|||
This directory contains the snippets for UltiSnips.
|
||||
https://github.com/sirver/ultisnips
|
||||
|
||||
Standing On The Shoulders of Giants
|
||||
===================================
|
||||
|
||||
The snippets have been collected from various other project which I want to
|
||||
express my gratitude for. My main source for inspiration where the following
|
||||
two projects:
|
||||
|
||||
TextMate: http://svn.textmate.org/trunk/Bundles/
|
||||
SnipMate: http://code.google.com/p/snipmate/
|
||||
|
||||
UltiSnips has seen contributions by many individuals. Those contributions have
|
||||
been merged into this collection seamlessly and without further comments.
|
||||
|
||||
-- vim:ft=rst:nospell:
|
282
.vim/UltiSnips/ada.snippets
Normal file
|
@ -0,0 +1,282 @@
|
|||
priority -50
|
||||
|
||||
global !p
|
||||
|
||||
def ada_case(word):
|
||||
out = word[0].upper()
|
||||
for i in range(1, len(word)):
|
||||
if word[i] == '-':
|
||||
out = out + '.'
|
||||
elif word[i - 1] == '_' or word[i - 1] == '-':
|
||||
out = out + word[i].upper()
|
||||
else:
|
||||
out = out + word[i]
|
||||
return out
|
||||
|
||||
endglobal
|
||||
|
||||
snippet wi "with"
|
||||
with $1;$0
|
||||
endsnippet
|
||||
|
||||
snippet pac "package"
|
||||
package ${1:`!p snip.rv = ada_case(snip.basename)`} is
|
||||
$0
|
||||
end $1;
|
||||
endsnippet
|
||||
|
||||
snippet pacb "package body"
|
||||
package body ${1:`!p snip.rv = ada_case(snip.basename)`} is
|
||||
$0
|
||||
end $1;
|
||||
endsnippet
|
||||
|
||||
snippet ent "entry ... when"
|
||||
entry $1($2) when $3 is
|
||||
begin
|
||||
$0
|
||||
end $1;
|
||||
endsnippet
|
||||
|
||||
snippet task "task"
|
||||
task $1 is
|
||||
entry $0
|
||||
end $1;
|
||||
endsnippet
|
||||
|
||||
snippet taskb "task body"
|
||||
task body $1 is
|
||||
$2
|
||||
begin
|
||||
$0
|
||||
end $1;
|
||||
endsnippet
|
||||
|
||||
snippet acc "accept"
|
||||
accept $1($2) do
|
||||
$0
|
||||
end $1;
|
||||
endsnippet
|
||||
|
||||
snippet prot "protected type"
|
||||
protected type $1($2) is
|
||||
$0
|
||||
end $1;
|
||||
endsnippet
|
||||
|
||||
snippet prob "protected body"
|
||||
protected body $1 is
|
||||
$2
|
||||
begin
|
||||
$0
|
||||
end $1;
|
||||
endsnippet
|
||||
|
||||
snippet gen "generic type"
|
||||
generic
|
||||
type $1 is $2;$0
|
||||
endsnippet
|
||||
|
||||
snippet ty "type"
|
||||
type $1 is $2;$0
|
||||
endsnippet
|
||||
|
||||
snippet tyd "type with default value"
|
||||
type $1 is $2
|
||||
with Default_Value => $3;$0
|
||||
endsnippet
|
||||
|
||||
snippet subty "subtype"
|
||||
subtype $1 is $2;$0
|
||||
endsnippet
|
||||
|
||||
snippet dec "declare block"
|
||||
declare
|
||||
$1
|
||||
begin
|
||||
$0
|
||||
end;
|
||||
endsnippet
|
||||
|
||||
snippet decn "declare named block"
|
||||
$1:
|
||||
declare
|
||||
$2
|
||||
begin
|
||||
$0
|
||||
end $1;
|
||||
endsnippet
|
||||
|
||||
snippet ifex "if expression"
|
||||
if $1 then $2 else $0
|
||||
endsnippet
|
||||
|
||||
snippet casex "case expression"
|
||||
case $1 is
|
||||
when $2 => $3,$0
|
||||
endsnippet
|
||||
|
||||
snippet fora "for all"
|
||||
for all $1 ${2:in} $3 => $0
|
||||
endsnippet
|
||||
|
||||
snippet fors "for some"
|
||||
for some $1 ${2:in} $3 => $0
|
||||
endsnippet
|
||||
|
||||
snippet if "if"
|
||||
if $1 then
|
||||
$0
|
||||
end if;
|
||||
endsnippet
|
||||
|
||||
snippet ife "if ... else"
|
||||
if $1 then
|
||||
$2
|
||||
else
|
||||
$0
|
||||
end if;
|
||||
endsnippet
|
||||
|
||||
snippet el "else"
|
||||
else
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet eif "elsif"
|
||||
elsif $1 then
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet wh "while"
|
||||
while $1 loop
|
||||
$0
|
||||
end loop;
|
||||
endsnippet
|
||||
|
||||
snippet nwh "named while"
|
||||
$1:
|
||||
while $2 loop
|
||||
$0
|
||||
end loop $1;
|
||||
endsnippet
|
||||
|
||||
snippet for "for"
|
||||
for ${1:I} in $2 loop
|
||||
$0
|
||||
end loop;
|
||||
endsnippet
|
||||
|
||||
snippet fore "for each"
|
||||
for $1 of $2 loop
|
||||
$0
|
||||
end loop;
|
||||
endsnippet
|
||||
|
||||
snippet nfor "named for"
|
||||
$1:
|
||||
for ${2:I} in $3 loop
|
||||
$0
|
||||
end loop $1;
|
||||
endsnippet
|
||||
|
||||
snippet nfore "named for each"
|
||||
$1:
|
||||
for $2 of $3 loop
|
||||
$0
|
||||
end loop $1;
|
||||
endsnippet
|
||||
|
||||
snippet proc "procedure"
|
||||
procedure $1($2) is
|
||||
$3
|
||||
begin
|
||||
$0
|
||||
end $1;
|
||||
endsnippet
|
||||
|
||||
snippet procd "procedure declaration"
|
||||
procedure $1;$0
|
||||
endsnippet
|
||||
|
||||
snippet fun "function"
|
||||
function $1($2) return $3 is
|
||||
$4
|
||||
begin
|
||||
$0
|
||||
end $1;
|
||||
endsnippet
|
||||
|
||||
snippet fune "expression function"
|
||||
function $1 return $2 is
|
||||
($3);$0
|
||||
endsnippet
|
||||
|
||||
snippet fund "function declaration"
|
||||
function $1 return $2;$0
|
||||
endsnippet
|
||||
|
||||
snippet ret "extended return"
|
||||
return $1 do
|
||||
$0
|
||||
end return;
|
||||
endsnippet
|
||||
|
||||
snippet rec "record"
|
||||
record
|
||||
$0
|
||||
end record;
|
||||
endsnippet
|
||||
|
||||
snippet case "case"
|
||||
case $1 is
|
||||
when $2 => $3;$0
|
||||
end case;
|
||||
endsnippet
|
||||
|
||||
snippet whe "when"
|
||||
when $1 => $2;$0
|
||||
endsnippet
|
||||
|
||||
snippet wheo "when others"
|
||||
when others => $1;$0
|
||||
endsnippet
|
||||
|
||||
snippet lo "loop"
|
||||
loop
|
||||
$0
|
||||
end loop;
|
||||
endsnippet
|
||||
|
||||
snippet nlo "named loop"
|
||||
$1:
|
||||
loop
|
||||
$0
|
||||
end loop $1;
|
||||
endsnippet
|
||||
|
||||
snippet ex "exit when"
|
||||
exit when $1;$0
|
||||
endsnippet
|
||||
|
||||
snippet put "Ada.Text_IO.Put"
|
||||
Ada.Text_IO.Put($1);$0
|
||||
endsnippet
|
||||
|
||||
snippet putl "Ada.Text_IO.Put_Line"
|
||||
Ada.Text_IO.Put_Line($1);$0
|
||||
endsnippet
|
||||
|
||||
snippet get "Ada.Text_IO.Get"
|
||||
Ada.Text_IO.Get($1);$0
|
||||
endsnippet
|
||||
|
||||
snippet getl "Ada.Text_IO.Get_Line"
|
||||
Ada.Text_IO.Get_Line($1);$0
|
||||
endsnippet
|
||||
|
||||
snippet newline "Ada.Text_IO.New_Line"
|
||||
Ada.Text_IO.New_Line(${1:1});$0
|
||||
endsnippet
|
||||
|
||||
# vim:ft=snippets:
|
130
.vim/UltiSnips/all.snippets
Normal file
|
@ -0,0 +1,130 @@
|
|||
# This file contains snippets that are always defined. I personally
|
||||
# have snippets for signatures and often needed texts
|
||||
|
||||
# sligthly lower priority than everything else since specialized versions
|
||||
# should overwrite. The user needs to adjust her priority in her snippets to
|
||||
# ~-55 so that other filetypes will still overwrite.
|
||||
priority -60
|
||||
|
||||
##############
|
||||
# NICE BOXES #
|
||||
##############
|
||||
global !p
|
||||
from vimsnippets import foldmarker, make_box, get_comment_format
|
||||
LOREM = """
|
||||
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod \
|
||||
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At \
|
||||
vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, \
|
||||
no sea takimata sanctus est Lorem ipsum dolor sit amet.
|
||||
"""
|
||||
endglobal
|
||||
|
||||
snippet box "A nice box with the current comment symbol" b
|
||||
`!p
|
||||
box = make_box(len(t[1]))
|
||||
snip.rv = box[0]
|
||||
snip += box[1]
|
||||
`${1:${VISUAL:content}}`!p
|
||||
box = make_box(len(t[1]))
|
||||
snip.rv = box[2]
|
||||
snip += box[3]`
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet bbox "A nice box over the full width" b
|
||||
`!p
|
||||
if not snip.c:
|
||||
width = int(vim.eval("&textwidth - (virtcol('.') == 1 ? 0 : virtcol('.'))")) or 71
|
||||
box = make_box(len(t[1]), width)
|
||||
snip.rv = box[0]
|
||||
snip += box[1]
|
||||
`${1:${VISUAL:content}}`!p
|
||||
box = make_box(len(t[1]), width)
|
||||
snip.rv = box[2]
|
||||
snip += box[3]`
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet fold "Insert a vim fold marker" b
|
||||
`!p snip.rv = get_comment_format()[0]` ${1:Fold description} `!p snip.rv = foldmarker()[0]`${2:1} `!p snip.rv = get_comment_format()[2]`
|
||||
endsnippet
|
||||
|
||||
snippet foldc "Insert a vim fold close marker" b
|
||||
`!p snip.rv = get_comment_format()[0]` ${2:1}`!p snip.rv = foldmarker()[1]` `!p snip.rv = get_comment_format()[2]`
|
||||
endsnippet
|
||||
|
||||
snippet foldp "Insert a vim fold marker pair" b
|
||||
`!p snip.rv = get_comment_format()[0]` ${1:Fold description} `!p snip.rv = foldmarker()[0]` `!p snip.rv = get_comment_format()[2]`
|
||||
${2:${VISUAL:Content}}
|
||||
`!p snip.rv = get_comment_format()[0]` `!p snip.rv = foldmarker()[1]` $1 `!p snip.rv = get_comment_format()[2]`
|
||||
endsnippet
|
||||
|
||||
##########################
|
||||
# LOREM IPSUM GENERATORS #
|
||||
##########################
|
||||
snippet "lorem(([1-4])?[0-9])?" "Lorem Ipsum" r
|
||||
`!p snip.rv = " ".join(LOREM.split()[:int(match.group(1))]) if match.group(1) else LOREM`
|
||||
endsnippet
|
||||
|
||||
##########################
|
||||
# VIM MODELINE GENERATOR #
|
||||
##########################
|
||||
# See advice on `:help 'tabstop'` for why these values are set. Uses second
|
||||
# modeline form ('set') to work in languages with comment terminators
|
||||
# (/* like C */).
|
||||
snippet modeline "Vim modeline"
|
||||
vim`!v ':set '. (&expandtab ? printf('et sw=%i ts=%i', &sw, &ts) : printf('noet sts=%i sw=%i ts=%i', &sts, &sw, &ts)) . (&tw ? ' tw='. &tw : '') . ':'`
|
||||
endsnippet
|
||||
|
||||
#########
|
||||
# DATES #
|
||||
#########
|
||||
snippet date "YYYY-MM-DD" w
|
||||
`!v strftime("%Y-%m-%d")`
|
||||
endsnippet
|
||||
|
||||
snippet ddate "Month DD, YYYY" w
|
||||
`!v strftime("%b %d, %Y")`
|
||||
endsnippet
|
||||
|
||||
snippet diso "ISO format datetime" w
|
||||
`!v strftime("%Y-%m-%d %H:%M:%S%z")`
|
||||
endsnippet
|
||||
|
||||
snippet time "hh:mm" w
|
||||
`!v strftime("%H:%M")`
|
||||
endsnippet
|
||||
|
||||
snippet datetime "YYYY-MM-DD hh:mm" w
|
||||
`!v strftime("%Y-%m-%d %H:%M")`
|
||||
endsnippet
|
||||
|
||||
snippet todo "TODO comment" bw
|
||||
`!p snip.rv=get_comment_format()[0]` ${2:TODO}: $0${3: <${4:`!v strftime('%d-%m-%y')`}${5:, `!v g:snips_author`}>} `!p snip.rv=get_comment_format()[2]`
|
||||
endsnippet
|
||||
|
||||
##########
|
||||
# Misc #
|
||||
##########
|
||||
snippet uuid "Random UUID" w
|
||||
`!p if not snip.c: import uuid; snip.rv = str(uuid.uuid4())`
|
||||
endsnippet
|
||||
|
||||
snippet COPYRIGHT "Copyright Notice" bA
|
||||
Copyright ${1:YEAR} ${2:FIRSTNAME-LASTNAME}
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
endsnippet
|
||||
|
||||
# vim:ft=snippets:
|
52
.vim/UltiSnips/bib.snippets
Normal file
|
@ -0,0 +1,52 @@
|
|||
priority -50
|
||||
|
||||
snippet online "Online resource" b
|
||||
@online{${1:name},
|
||||
author={${2:author}},
|
||||
title={${3:title}},
|
||||
date={${4:date}},
|
||||
url={${5:url}}
|
||||
}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet article "Article reference" b
|
||||
@article{${1:name},
|
||||
author={${2:author}},
|
||||
title={${3:title}},
|
||||
journaltitle={${4:journal}},
|
||||
volume={${5:NN}},
|
||||
number={${6:NN}},
|
||||
year={${7:YYYY}},
|
||||
pages={${8:NN}--${9:NN}}
|
||||
}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet book "Book reference" b
|
||||
@book{${1:name},
|
||||
author={${2:author}},
|
||||
title={${3:title}},
|
||||
subtitle={${4:subtitle}},
|
||||
year={${5:YYYY}},
|
||||
location={${6:somewhere}},
|
||||
publisher={${7:publisher}},
|
||||
pages={${8:NN}--${9:NN}}
|
||||
}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet inb "In Book reference" b
|
||||
@inbook{${1:name},
|
||||
author={${2:author}},
|
||||
title={${3:title}},
|
||||
subtitle={${4:subtitle}},
|
||||
booktitle={${5:book}},
|
||||
editor={${6:editor}},
|
||||
year={${7:YYYY}},
|
||||
location={${8:somewhere}},
|
||||
publisher={${9:publisher}},
|
||||
pages={${10:NN}--${11:NN}}
|
||||
}
|
||||
$0
|
||||
endsnippet
|
29
.vim/UltiSnips/bindzone.snippets
Normal file
|
@ -0,0 +1,29 @@
|
|||
priority -50
|
||||
|
||||
global !p
|
||||
def newsoa():
|
||||
import datetime
|
||||
now = datetime.datetime.now()
|
||||
# return standard SOA formatted serial for today
|
||||
return now.strftime("%Y%m%d00")
|
||||
endglobal
|
||||
|
||||
snippet zone "Bootstrap a new Bind zonefile" b
|
||||
$TTL 86400
|
||||
@ IN SOA ${1:example.net}. ${2:hostmaster.$1}.(
|
||||
`!p snip.rv = newsoa()`; serial
|
||||
21600; refresh every 6 hours
|
||||
3600; retry after one hour
|
||||
604800; expire after a week
|
||||
86400 ); minimum TTL of 1 day
|
||||
|
||||
IN NS ns01.$1.
|
||||
IN MX 10 mail.$1.
|
||||
|
||||
ns01.$1 IN A
|
||||
mail.$1 IN A
|
||||
endsnippet
|
||||
|
||||
snippet A "Insert A Record" b
|
||||
${1:hostname} IN A ${2:ip}
|
||||
endsnippet
|
139
.vim/UltiSnips/blade.snippets
Normal file
|
@ -0,0 +1,139 @@
|
|||
priority -50
|
||||
|
||||
extends html
|
||||
|
||||
# We want to overwrite everything in parent ft.
|
||||
priority -49
|
||||
|
||||
snippet break "@break"
|
||||
@break
|
||||
endsnippet
|
||||
|
||||
snippet component "@component directive"
|
||||
@component('$1')
|
||||
${2:${VISUAL}}
|
||||
@endcomponent
|
||||
endsnippet
|
||||
|
||||
snippet each "@each directive"
|
||||
@each('$1', $$2, '$3')
|
||||
endsnippet
|
||||
|
||||
snippet else "@else directive"
|
||||
@else
|
||||
endsnippet
|
||||
|
||||
snippet eif "@else if directive"
|
||||
@else if ($1)
|
||||
${2:${VISUAL}}
|
||||
endsnippet
|
||||
|
||||
snippet for "@for directive"
|
||||
@for ($1)
|
||||
${2:${VISUAL}}
|
||||
@endfor
|
||||
endsnippet
|
||||
|
||||
snippet foreach "@foreach directive"
|
||||
@foreach ($$1 as $$2)
|
||||
${3:${VISUAL}}
|
||||
@endforeach
|
||||
endsnippet
|
||||
|
||||
snippet extends "@extends directive"
|
||||
@extends('$1')
|
||||
endsnippet
|
||||
|
||||
snippet if "@if directive"
|
||||
@if ($1)
|
||||
${2:${VISUAL}}
|
||||
@endif
|
||||
endsnippet
|
||||
|
||||
snippet ife "@if @else structure"
|
||||
@if ($1)
|
||||
${2:${VISUAL}}
|
||||
@else
|
||||
${3:${VISUAL}}
|
||||
@endif
|
||||
endsnippet
|
||||
|
||||
snippet include "@include directive"
|
||||
@include('$1')
|
||||
endsnippet
|
||||
|
||||
snippet includeIf "@includeIf directive"
|
||||
@includeIf('$1')
|
||||
endsnippet
|
||||
|
||||
snippet isset "@isset directive"
|
||||
@isset
|
||||
${1:${VISUAL}}
|
||||
@endisset
|
||||
endsnippet
|
||||
|
||||
snippet inject "@inject directive"
|
||||
@inject('$1', '$2')
|
||||
endsnippet
|
||||
|
||||
snippet lang "@lang directive" i
|
||||
@lang('$1')
|
||||
endsnippet
|
||||
|
||||
snippet php "@php directive"
|
||||
@php
|
||||
${1:${VISUAL}}
|
||||
@endphp
|
||||
endsnippet
|
||||
|
||||
snippet push "@push directive"
|
||||
@push('$1')
|
||||
${2:${VISUAL}}
|
||||
@endpush
|
||||
endsnippet
|
||||
|
||||
snippet section "@section directive"
|
||||
@section('$1')
|
||||
endsnippet
|
||||
|
||||
snippet show "@show directive"
|
||||
@show
|
||||
endsnippet
|
||||
|
||||
snippet slot "@slot directive"
|
||||
@slot('$1')
|
||||
${2:${VISUAL}}
|
||||
@endslot
|
||||
endsnippet
|
||||
|
||||
snippet unless "@unless directive"
|
||||
@unless
|
||||
${1:${VISUAL}}
|
||||
@endunless
|
||||
endsnippet
|
||||
|
||||
snippet verbatim "@verbatim directive"
|
||||
@verbatim
|
||||
${0:$VISUAL}
|
||||
@endverbatim
|
||||
endsnippet
|
||||
|
||||
snippet wh "@while directive"
|
||||
@while ($1)
|
||||
${2:${VISUAL}}
|
||||
@endwhile
|
||||
endsnippet
|
||||
|
||||
snippet yield "@yield directive"
|
||||
@yield('$1')
|
||||
endsnippet
|
||||
|
||||
snippet { "{{ }} statement." i
|
||||
{{ $1 }}
|
||||
endsnippet
|
||||
|
||||
snippet {! "{!! !!} statement" i
|
||||
{!! $1 !!}
|
||||
endsnippet
|
||||
|
||||
# vim:ft=snippets:
|
186
.vim/UltiSnips/c.snippets
Normal file
|
@ -0,0 +1,186 @@
|
|||
###########################################################################
|
||||
# TextMate Snippets #
|
||||
###########################################################################
|
||||
# --------------
|
||||
# Functions
|
||||
# --------------
|
||||
global !p
|
||||
def printf_expand_args(snip):
|
||||
"""
|
||||
This will look how many placeholders printf has and adds the separated commas
|
||||
at the end.
|
||||
"""
|
||||
|
||||
# now add so many "," as much as the amount of placeholders
|
||||
amount_placeholders = snip.tabstops[1].current_text.count("%")
|
||||
|
||||
output = ""
|
||||
|
||||
# Add the amount of tabstops
|
||||
for placeholder_index in range(3, amount_placeholders + 3):
|
||||
output += f", ${placeholder_index}"
|
||||
|
||||
# convert them into tabstops
|
||||
snip.expand_anon(output)
|
||||
|
||||
endglobal
|
||||
|
||||
# ==============
|
||||
# Snippets
|
||||
# ==============
|
||||
priority -50
|
||||
|
||||
snippet def "#define ..."
|
||||
#define $1
|
||||
endsnippet
|
||||
|
||||
snippet #ifndef "#ifndef ... #define ... #endif"
|
||||
#ifndef ${1/([A-Za-z0-9_]+).*/$1/}
|
||||
#define ${1:SYMBOL} ${2:value}
|
||||
#endif /* ifndef $1 */
|
||||
endsnippet
|
||||
|
||||
snippet #if "#if #endif" b
|
||||
#if ${1:0}
|
||||
${VISUAL}$0
|
||||
#endif
|
||||
endsnippet
|
||||
|
||||
snippet mark "#pragma mark (mark)"
|
||||
#if 0
|
||||
${1:#pragma mark -
|
||||
}#pragma mark $2
|
||||
#endif
|
||||
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet main "main() (main)"
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
${VISUAL}$0
|
||||
return 0;
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet for "for loop (for)"
|
||||
for (${2:i} = 0; $2 < ${1:count}; ${3:++$2}) {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet fori "for int loop (fori)"
|
||||
for (${4:int} ${2:i} = 0; $2 < ${1:count}; ${3:++$2}) {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet fora "for-loop" b
|
||||
for (${1:var}; ${2:condition}; `!p
|
||||
if len(t[1]) > 0:
|
||||
snip.rv = t[1].split('=')[0].split()[-1]
|
||||
`++) {
|
||||
|
||||
$0
|
||||
} /* for ($1; $2; `!p if len(t[1]) > 0: snip.rv = t[1].split('=')[0].split()[-1]`++) */
|
||||
endsnippet
|
||||
|
||||
snippet once "Include header once only guard"
|
||||
#ifndef ${1:`!p
|
||||
if not snip.c:
|
||||
import random, string
|
||||
name = re.sub(r'[^A-Za-z0-9]+','_', snip.fn).upper()
|
||||
rand = ''.join(random.sample(string.ascii_letters+string.digits, 8))
|
||||
snip.rv = ('%s_%s' % (name,rand)).upper()
|
||||
else:
|
||||
snip.rv = snip.c`}
|
||||
#define $1
|
||||
|
||||
${VISUAL}$0
|
||||
|
||||
#endif /* end of include guard: $1 */
|
||||
endsnippet
|
||||
|
||||
snippet fprintf "fprintf ..."
|
||||
fprintf(${1:stderr}, "${2:%s}\n"${2/([^%]|%%)*(%.)?.*/(?2:, :\);)/}$3${2/([^%]|%%)*(%.)?.*/(?2:\);)/}
|
||||
endsnippet
|
||||
|
||||
snippet eli "else if .. (eli)"
|
||||
else if (${1:/* condition */}) {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
post_jump "printf_expand_args(snip)"
|
||||
snippet "printf" "printf with auto-expand args" wr
|
||||
printf("$1\n"$2);
|
||||
endsnippet
|
||||
|
||||
snippet st "struct"
|
||||
struct ${1:`!p snip.rv = (snip.basename or "name") + "_t"`} {
|
||||
${0:/* data */}
|
||||
};
|
||||
endsnippet
|
||||
|
||||
snippet fun "function" b
|
||||
${1:void} ${2:function_name}($3)
|
||||
{
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet fund "function declaration" b
|
||||
${1:void} ${2:function_name}($3);
|
||||
endsnippet
|
||||
|
||||
global !p
|
||||
def split_line(text):
|
||||
import textwrap
|
||||
lines = textwrap.wrap(text, 78 - 19)
|
||||
output = list()
|
||||
for line in lines:
|
||||
output.append('*' + ' '*19 + line)
|
||||
snip_line = snip.tabstops[4].end[0]
|
||||
snip.buffer.append(output, snip_line + 1)
|
||||
del snip.buffer[snip_line]
|
||||
|
||||
def get_args(arglist):
|
||||
args = [arg.strip() for arg in arglist.split(',') if arg]
|
||||
return args
|
||||
endglobal
|
||||
|
||||
post_jump "if snip.tabstop == 0 : split_line(snip.tabstops[4].current_text)"
|
||||
snippet head "File Header" b
|
||||
/******************************************************************************
|
||||
* File: `!p snip.rv = fn`
|
||||
*
|
||||
* Author: ${2}
|
||||
* Created: `date +%m/%d/%y`
|
||||
* Description: ${4:${VISUAL}}
|
||||
*****************************************************************************/
|
||||
${0}
|
||||
endsnippet
|
||||
|
||||
post_jump "if snip.tabstop == 0 : split_line(snip.tabstops[4].current_text)"
|
||||
snippet func "Function Header"
|
||||
/******************************************************************************
|
||||
* Function: $1
|
||||
* Description: ${4:${VISUAL}}
|
||||
* Where:`!p
|
||||
snip.rv = ""
|
||||
snip >> 2
|
||||
|
||||
args = get_args(t[2])
|
||||
if args:
|
||||
for arg in args:
|
||||
snip.rv += '\n' + '*' + ' '*19 + arg + ' - TODO'
|
||||
snip << 2
|
||||
`
|
||||
* Return: $5
|
||||
* Error: $6
|
||||
*****************************************************************************/
|
||||
${1}($2){
|
||||
${0}
|
||||
}
|
||||
endsnippet
|
||||
# vim:ft=snippets:
|
166
.vim/UltiSnips/coffee-jasmine.snippets
Normal file
|
@ -0,0 +1,166 @@
|
|||
#
|
||||
# CoffeeScript versions -- adapted from the JS TextMate bundle + additions
|
||||
# for some jasmine-jquery matchers
|
||||
#
|
||||
priority -50
|
||||
|
||||
extends coffee
|
||||
|
||||
priority -49
|
||||
|
||||
snippet des "Describe (coffee)" b
|
||||
describe '${1:description}', ->
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet it "it (coffee)" b
|
||||
it '${1:description}', ->
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet bef "before each (coffee)" b
|
||||
beforeEach ->
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet aft "after each (coffee)" b
|
||||
afterEach ->
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet any "any (coffee)" b
|
||||
jasmine.any($1)
|
||||
endsnippet
|
||||
|
||||
snippet ru "runs (coffee)" b
|
||||
runs ->
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet wa "waits (coffee)" b
|
||||
waits($1)
|
||||
endsnippet
|
||||
|
||||
snippet ex "expect (coffee)" b
|
||||
expect(${1:target})$0
|
||||
endsnippet
|
||||
|
||||
snippet ee "expect to equal (coffee)" b
|
||||
expect(${1:target}).toEqual(${2:value})
|
||||
endsnippet
|
||||
|
||||
snippet em "expect to match (coffee)" b
|
||||
expect(${1:target}).toMatch(${2:pattern})
|
||||
endsnippet
|
||||
|
||||
snippet eha "expect to have attribute (coffee)" b
|
||||
expect(${1:target}).toHaveAttr('${2:attr}'${3:, '${4:value}'})
|
||||
endsnippet
|
||||
|
||||
snippet et "expect to be truthy (coffee)" b
|
||||
expect(${1:target}).toBeTruthy()
|
||||
endsnippet
|
||||
|
||||
snippet ef "expect to be falsy (coffee)" b
|
||||
expect(${1:target}).toBeFalsy()
|
||||
endsnippet
|
||||
|
||||
snippet ed "expect to be defined (coffee)" b
|
||||
expect(${1:target}).toBeDefined()
|
||||
endsnippet
|
||||
|
||||
snippet en "expect to be null (coffee)" b
|
||||
expect(${1:target}).toBeNull()
|
||||
endsnippet
|
||||
|
||||
snippet ec "expect to contain (coffee)" b
|
||||
expect(${1:target}).toContain(${2:value})
|
||||
endsnippet
|
||||
|
||||
snippet ev "expect to be visible (coffee)" b
|
||||
expect(${1:target}).toBeVisible()
|
||||
endsnippet
|
||||
|
||||
snippet eh "expect to be hidden (coffee)" b
|
||||
expect(${1:target}).toBeHidden()
|
||||
endsnippet
|
||||
|
||||
snippet notx "expect not (coffee)" b
|
||||
expect(${1:target}).not$0
|
||||
endsnippet
|
||||
|
||||
snippet note "expect not to equal (coffee)" b
|
||||
expect(${1:target}).not.toEqual(${2:value})
|
||||
endsnippet
|
||||
|
||||
snippet notm "expect not to match (coffee)" b
|
||||
expect(${1:target}).not.toMatch(${2:pattern})
|
||||
endsnippet
|
||||
|
||||
snippet notha "expect to not have attribute (coffee)" b
|
||||
expect(${1:target}).not.toHaveAttr('${2:attr}'${3:, '${4:value}'})
|
||||
endsnippet
|
||||
|
||||
snippet nott "expect not to be truthy (coffee)" b
|
||||
expect(${1:target}).not.toBeTruthy()
|
||||
endsnippet
|
||||
|
||||
snippet notf "expect not to be falsy (coffee)" b
|
||||
expect(${1:target}).not.toBeFalsy()
|
||||
endsnippet
|
||||
|
||||
snippet notd "expect not to be defined (coffee)" b
|
||||
expect(${1:target}).not.toBeDefined()
|
||||
endsnippet
|
||||
|
||||
snippet notn "expect not to be null (coffee)" b
|
||||
expect(${1:target}).not.toBeNull()
|
||||
endsnippet
|
||||
|
||||
snippet notc "expect not to contain (coffee)" b
|
||||
expect(${1:target}).not.toContain(${2:value})
|
||||
endsnippet
|
||||
|
||||
snippet notv "expect not to be visible (coffee)" b
|
||||
expect(${1:target}).not.toBeVisible()
|
||||
endsnippet
|
||||
|
||||
snippet noth "expect not to be hidden (coffee)" b
|
||||
expect(${1:target}).not.toBeHidden()
|
||||
endsnippet
|
||||
|
||||
snippet s "spy on (coffee)" b
|
||||
spyOn(${1:object}, "${2:method}")$0
|
||||
endsnippet
|
||||
|
||||
snippet sr "spy on and return (coffee)" b
|
||||
spyOn(${1:object}, "${2:method}").andReturn(${3:arguments})
|
||||
endsnippet
|
||||
|
||||
snippet st "spy on and throw (coffee)" b
|
||||
spyOn(${1:object}, "${2:method}").andThrow(${3:exception})
|
||||
endsnippet
|
||||
|
||||
snippet sct "spy on and call through (coffee)" b
|
||||
spyOn(${1:object}, "${2:method}").andCallThrough()
|
||||
endsnippet
|
||||
|
||||
snippet scf "spy on and call fake (coffee)" b
|
||||
spyOn(${1:object}, "${2:method}").andCallFake(${3:function})
|
||||
endsnippet
|
||||
|
||||
snippet esc "expect was called (coffee)" b
|
||||
expect(${1:target}).wasCalled()
|
||||
endsnippet
|
||||
|
||||
snippet escw "expect was called with (coffee)" b
|
||||
expect(${1:target}).wasCalledWith(${2:arguments})
|
||||
endsnippet
|
||||
|
||||
snippet notsc "expect was not called (coffee)" b
|
||||
expect(${1:target}).wasNotCalled()
|
||||
endsnippet
|
||||
|
||||
snippet noscw "expect was not called with (coffee)" b
|
||||
expect(${1:target}).wasNotCalledWith(${2:arguments})
|
||||
endsnippet
|
80
.vim/UltiSnips/coffee-react.snippets
Normal file
|
@ -0,0 +1,80 @@
|
|||
#
|
||||
# CoffeeScript versions -- adapted from coffee-jasmine
|
||||
# for some ReactJS matchers.
|
||||
#
|
||||
priority -50
|
||||
|
||||
extends coffee
|
||||
|
||||
priority -49
|
||||
|
||||
snippet createClass "React define Class" b
|
||||
${1:classname}Class = React.createClass
|
||||
displayName: "$1"
|
||||
render: ->
|
||||
$2
|
||||
$1 = React.createFactory($1)
|
||||
endsnippet
|
||||
|
||||
snippet PropTypes "React define propTypes" b
|
||||
propTypes: ->
|
||||
${1:myVar}: React.PropTypes.${2:type}${3:.isRequired}
|
||||
endsnippet
|
||||
|
||||
snippet propType "React propType (key/value)" b
|
||||
${1:myVar}: React.PropTypes.${2:type}${3:.isRequired}
|
||||
$4
|
||||
endsnippet
|
||||
|
||||
snippet setState "React setState" b
|
||||
@setState
|
||||
${1:myvar}: ${2:myvalue}
|
||||
$3
|
||||
endsnippet
|
||||
|
||||
snippet getInitialState "React define getInitialState" b
|
||||
getInitialState: ->
|
||||
${1:myvar}: ${2:myvalue}
|
||||
$3
|
||||
endsnippet
|
||||
|
||||
snippet getDefaultProps "React define getDefaultProps" b
|
||||
getDefaultProps: ->
|
||||
${1:myvar}: ${2:myvalue}
|
||||
$3
|
||||
endsnippet
|
||||
|
||||
snippet componentWillMount "React define componentWillMount" b
|
||||
componentWillMount: ->
|
||||
$1
|
||||
endsnippet
|
||||
|
||||
snippet componentDidMount "React define componentDidMount" b
|
||||
componentDidMount: ->
|
||||
$1
|
||||
endsnippet
|
||||
|
||||
snippet componentWillReceiveProps "React define componentWillReceiveProps" b
|
||||
componentWillReceiveProps: (nextProps) ->
|
||||
$1
|
||||
endsnippet
|
||||
|
||||
snippet shouldComponentUpdate "React define shouldComponentUpdate" b
|
||||
shouldComponentUpdate: (nextProps, nextState) ->
|
||||
$1
|
||||
endsnippet
|
||||
|
||||
snippet componentWillUpdate "React define componentWillUpdate" b
|
||||
componentWillUpdate: (nextProps, nextState) ->
|
||||
$1
|
||||
endsnippet
|
||||
|
||||
snippet componentDidUpdate "React define componentDidUpdate" b
|
||||
componentDidUpdate: (prevProps, prevState) ->
|
||||
$1
|
||||
endsnippet
|
||||
|
||||
snippet componentWillUnmount "React define componentWillUnmount" b
|
||||
componentWillUnmount: ->
|
||||
$1
|
||||
endsnippet
|
100
.vim/UltiSnips/coffee.snippets
Normal file
|
@ -0,0 +1,100 @@
|
|||
priority -50
|
||||
|
||||
snippet fun "Function" b
|
||||
${1:name} = `!p snip.rv = "(" if t[2] else ""`${2:args}`!p snip.rv = ") " if t[2] else ""`->
|
||||
${0:# body...}
|
||||
endsnippet
|
||||
|
||||
snippet bfun "Function (bound)" i
|
||||
`!p snip.rv = "(" if t[1] else ""`${1:args}`!p snip.rv = ") " if t[1] else ""`=>`!p snip.rv = " " if t[2] and not t[2].startswith("\n") else ""`${2:expr}
|
||||
endsnippet
|
||||
|
||||
snippet if "If" b
|
||||
if ${1:condition}
|
||||
${0:# body...}
|
||||
endsnippet
|
||||
|
||||
snippet ife "If .. Else" b
|
||||
if ${1:condition}
|
||||
${2:# body...}
|
||||
else
|
||||
${3:# body...}
|
||||
endsnippet
|
||||
|
||||
snippet elif "Else if" b
|
||||
else if ${1:condition}
|
||||
${0:# body...}
|
||||
endsnippet
|
||||
|
||||
snippet ifte "Ternary if" b
|
||||
if ${1:condition} then ${2:value} else ${3:other}
|
||||
endsnippet
|
||||
|
||||
snippet unl "Unless" b
|
||||
${1:action} unless ${2:condition}
|
||||
endsnippet
|
||||
|
||||
snippet fora "Array Comprehension" b
|
||||
for ${1:name} in ${2:array}
|
||||
${0:# body...}
|
||||
endsnippet
|
||||
|
||||
snippet foro "Object Comprehension" b
|
||||
for ${1:key}, ${2:value} of ${3:Object}
|
||||
${0:# body...}
|
||||
endsnippet
|
||||
|
||||
snippet forr "Range Comprehension (inclusive)" b
|
||||
for ${1:name} in [${2:start}..${3:finish}]`!p snip.rv = " by " if t[4] else ""`${4:step}
|
||||
${0:# body...}
|
||||
endsnippet
|
||||
|
||||
snippet forrex "Range Comprehension (exclusive)" b
|
||||
for ${1:name} in [${2:start}...${3:finish}]`!p snip.rv = " by " if t[4] else ""`${4:step}
|
||||
${0:# body...}
|
||||
endsnippet
|
||||
|
||||
snippet swi "Switch" b
|
||||
switch ${1:object}
|
||||
when ${2:value}
|
||||
${3:# body...}
|
||||
else
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet swit "Switch when .. then" b
|
||||
switch ${1:object}
|
||||
when ${2:condition}`!p snip.rv = " then " if t[3] else ""`${3:value}
|
||||
else`!p snip.rv = " " if t[4] and not t[4].startswith("\n") else ""`${4:value}
|
||||
endsnippet
|
||||
|
||||
snippet cla "Class" b
|
||||
class ${1:ClassName}`!p snip.rv = " extends " if t[2] else ""`${2:Ancestor}
|
||||
|
||||
${3:constructor:`!p snip.rv = " (" if t[4] else ""`${4:args}`!p snip.rv = ")" if t[4] else ""` ->
|
||||
${5:# body...}}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet try "Try .. Catch" b
|
||||
try
|
||||
$1
|
||||
catch ${2:error}
|
||||
$3
|
||||
endsnippet
|
||||
|
||||
snippet req "Require" b
|
||||
${1/^'?(\w+)'?$/\L$1\E/} = require(${1:'${2:sys}'})
|
||||
endsnippet
|
||||
|
||||
snippet # "Interpolated Code" i
|
||||
#{$1}$0
|
||||
endsnippet
|
||||
|
||||
snippet log "Log" b
|
||||
console.log ${1:"${2:msg}"}
|
||||
endsnippet
|
||||
|
||||
snippet kv "Key:value for object" b
|
||||
${1:key}:${2:value}
|
||||
endsnippet
|
200
.vim/UltiSnips/cpp.snippets
Normal file
|
@ -0,0 +1,200 @@
|
|||
priority -50
|
||||
|
||||
extends c
|
||||
|
||||
# We want to overwrite everything in parent ft.
|
||||
priority -49
|
||||
###########################################################################
|
||||
# Global functions #
|
||||
###########################################################################
|
||||
|
||||
global !p
|
||||
|
||||
def write_docstring_args(arglist, snip):
|
||||
args = str(arglist).split(',')
|
||||
|
||||
if len(args) > 1:
|
||||
c = 0
|
||||
for arg in args:
|
||||
if c == 0:
|
||||
snip.rv += arg
|
||||
c = 1
|
||||
else:
|
||||
snip += '* : %s' % arg.strip()
|
||||
else:
|
||||
snip.rv = args[0]
|
||||
|
||||
|
||||
endglobal
|
||||
|
||||
###########################################################################
|
||||
# TextMate Snippets #
|
||||
###########################################################################
|
||||
snippet ponce "#pragma once include guard"
|
||||
#pragma once
|
||||
|
||||
endsnippet
|
||||
|
||||
snippet main
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
${0}
|
||||
return 0;
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet forc "general for loop (for)"
|
||||
for (${6:auto} ${1:i} = ${2:v.begin()}; `!p import re; snip.rv = re.split("[^\w]",t[1])[-1]` ${4:!=} ${3:`!p m = re.search(r'^(?:(.*)(\.|->)begin\(\)|((?:std|boost)::)?begin\((.*)\))$', t[2]); snip.rv = (((m.group(3) if m.group(3) else "") + "end(" + m.group(4) + ")") if m.group(4) else (m.group(1) + m.group(2) + "end()")) if m else ""`}; ${5:++`!p snip.rv = t[1].split(" ")[-1]`}) {
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet beginend "$1.begin(), $1.end() (beginend)"
|
||||
${1:v}${1/^.*?(-)?(>)?$/(?2::(?1:>:.))/}begin(), $1${1/^.*?(-)?(>)?$/(?2::(?1:>:.))/}end()
|
||||
endsnippet
|
||||
|
||||
snippet cl "class .. (class)"
|
||||
class ${1:`!p snip.rv = snip.basename or "name"`}
|
||||
{
|
||||
public:
|
||||
${1/(\w+).*/$1/} (${2:arguments});
|
||||
virtual ~${1/(\w+).*/$1/} ();
|
||||
|
||||
private:
|
||||
${0:/* data */}
|
||||
};
|
||||
endsnippet
|
||||
|
||||
snippet ns "namespace .. (namespace)"
|
||||
namespace${1/.+/ /m}${1:`!p snip.rv = snip.basename or "name"`}
|
||||
{
|
||||
${VISUAL}$0
|
||||
}${1/.+/ \/* /m}$1${1/.+/ *\/ /m}
|
||||
endsnippet
|
||||
|
||||
snippet nsa "namespace alias"
|
||||
namespace ${1:alias} = ${2:namespace};
|
||||
endsnippet
|
||||
|
||||
snippet using "using directive/using declaration/type alias"
|
||||
using ${1:namespace}`!p snip.rv = ' ' if t[1] == 'namespace' else ' = ' if t[1] != '' else ''`${2:name};
|
||||
endsnippet
|
||||
|
||||
snippet readfile "read file (readF)"
|
||||
std::vector<char> v;
|
||||
if (FILE *fp = fopen(${1:"filename"}, "r"))
|
||||
{
|
||||
char buf[1024];
|
||||
while(size_t len = fread(buf, 1, sizeof(buf), fp))
|
||||
v.insert(v.end(), buf, buf + len);
|
||||
fclose(fp);
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet map "std::map (map)"
|
||||
std::map<${1:key}, ${2:value}> map$0;
|
||||
endsnippet
|
||||
|
||||
snippet vector "std::vector (v)"
|
||||
std::vector<${1:char}> v$0;
|
||||
endsnippet
|
||||
|
||||
snippet tp "template <typename ..> (template)"
|
||||
template <typename ${1:_InputIter}>
|
||||
endsnippet
|
||||
|
||||
snippet cla "An entire .h generator" b
|
||||
#ifndef ${2:`!v substitute(vim_snippets#Filename('$1_H','ClassName'),'.*','\U&\E','')`}
|
||||
#define $2
|
||||
|
||||
class ${1:`!v substitute(substitute(vim_snippets#Filename('$1','ClassName'),'^.','\u&',''), '_\(\w\)', '\u\1', 'g')`}
|
||||
{
|
||||
private:
|
||||
$3
|
||||
|
||||
public:
|
||||
$1();
|
||||
virtual ~$1();
|
||||
};
|
||||
|
||||
#endif /* $2 */
|
||||
endsnippet
|
||||
|
||||
|
||||
snippet fnc "Basic c++ doxygen function template" b
|
||||
/**
|
||||
* @brief: ${4:brief}
|
||||
*
|
||||
* @param: `!p write_docstring_args(t[3],snip)`
|
||||
*
|
||||
* @return: `!p snip.rv = t[1]`
|
||||
*/
|
||||
${1:ReturnType} ${2:FunctionName}(${3:param})
|
||||
{
|
||||
${0:FunctionBody}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet boost_test "Boost test module" b
|
||||
#define BOOST_TEST_MODULE ${1:TestModuleName}
|
||||
#include <boost/test/included/unit_test.hpp>
|
||||
|
||||
BOOST_AUTO_TEST_CASE(${2:TestCaseName})
|
||||
{
|
||||
${0:TestDefinition}
|
||||
}
|
||||
|
||||
endsnippet
|
||||
|
||||
snippet boost_suite "Boost test suite module" b
|
||||
#define BOOST_TEST_MODULE ${1:TestModuleName}
|
||||
#include <boost/test/included/unit_test.hpp>
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(${2:SuiteName})
|
||||
|
||||
BOOST_AUTO_TEST_CASE(${3:TestCaseName})
|
||||
{
|
||||
${0:TestDefinition}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
endsnippet
|
||||
snippet boost_test_fixture "Boost test module with fixture" b
|
||||
#define BOOST_TEST_MODULE ${1:TestModuleName}
|
||||
#include <boost/test/included/unit_test.hpp>
|
||||
|
||||
struct ${2:FixtureName} {
|
||||
$2() {}
|
||||
virtual ~$2() {}
|
||||
/* define members here */
|
||||
};
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE(${3:SuiteName}, $2)
|
||||
{
|
||||
${0:TestDefinition}
|
||||
}
|
||||
|
||||
endsnippet
|
||||
|
||||
snippet boost_suite_fixture "Boost test suite with fixture" b
|
||||
#define BOOST_TEST_MODULE ${1:TestModuleName}
|
||||
#include <boost/test/included/unit_test.hpp>
|
||||
|
||||
struct ${2:FixtureName} {
|
||||
$2() {}
|
||||
virtual ~$2() {}
|
||||
/* define members here */
|
||||
};
|
||||
|
||||
BOOST_FIXTURE_TEST_SUITE(${3:SuiteName}, $2)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(${4:TestCaseName})
|
||||
{
|
||||
${0:TestDefinition}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
endsnippet
|
||||
# vim:ft=snippets:
|
13
.vim/UltiSnips/crystal.snippets
Normal file
|
@ -0,0 +1,13 @@
|
|||
priority -50
|
||||
|
||||
snippet "\b(de)?f" "def <name>..." r
|
||||
def ${1:method_name}${2:(${3:*args})}
|
||||
$0
|
||||
end
|
||||
endsnippet
|
||||
|
||||
snippet "\b(pde)?f" "private def <name>..." r
|
||||
private def ${1:method_name}${2:(${3:*args})}
|
||||
$0
|
||||
end
|
||||
endsnippet
|
385
.vim/UltiSnips/cs.snippets
Normal file
|
@ -0,0 +1,385 @@
|
|||
#######################################################################
|
||||
# C# Snippets for UltiSnips #
|
||||
#######################################################################
|
||||
|
||||
priority -50
|
||||
|
||||
#########################
|
||||
# classes and structs #
|
||||
#########################
|
||||
|
||||
snippet namespace "namespace" b
|
||||
namespace ${1:MyNamespace}
|
||||
{
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet class "class" w
|
||||
${1:public} class ${2:`!p snip.rv = snip.basename`}
|
||||
{
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet struct "struct" w
|
||||
struct ${1:`!p snip.rv = snip.basename`}
|
||||
{
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet interface "interface" w
|
||||
interface I${1:`!p snip.rv = snip.basename`}
|
||||
{
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet enum "enumeration" b
|
||||
enum ${1:MyEnum} { ${2:Item} };
|
||||
endsnippet
|
||||
|
||||
|
||||
############
|
||||
# Main() #
|
||||
############
|
||||
|
||||
snippet sim "static int main" b
|
||||
static int Main(string[] args)
|
||||
{
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet svm "static void main" b
|
||||
static void Main(string[] args)
|
||||
{
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
|
||||
################
|
||||
# properties #
|
||||
################
|
||||
|
||||
snippet prop "Simple property declaration" b
|
||||
public ${1:int} ${2:MyProperty} { get; set; }
|
||||
endsnippet
|
||||
|
||||
snippet propfull "Full property declaration" b
|
||||
private ${1:int} ${2:_myProperty};
|
||||
|
||||
public $1 ${3:MyProperty}
|
||||
{
|
||||
get { return $2; }
|
||||
set { $2 = value; }
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet propg "Property with a private setter" b
|
||||
public ${1:int} ${2:MyProperty} { get; private set; }
|
||||
endsnippet
|
||||
|
||||
|
||||
############
|
||||
# blocks #
|
||||
############
|
||||
|
||||
snippet #if "#if #endif" b
|
||||
#if ${1:DEBUG}
|
||||
${VISUAL}$0
|
||||
#endif
|
||||
endsnippet
|
||||
|
||||
snippet #region "#region #endregion" b
|
||||
#region ${1:Region}
|
||||
${VISUAL}$0
|
||||
#endregion
|
||||
endsnippet
|
||||
|
||||
|
||||
###########
|
||||
# loops #
|
||||
###########
|
||||
|
||||
snippet for "for loop" b
|
||||
for (int ${1:i} = 0; $1 < ${2:10}; $1++)
|
||||
{
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet forr "for loop (reverse)" b
|
||||
for (int ${1:i} = ${2:10}; $1 >= 0; $1--)
|
||||
{
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet foreach "foreach loop" b
|
||||
foreach (${3:var} ${2:item} in ${1:items})
|
||||
{
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet while "while loop" b
|
||||
while (${1:true})
|
||||
{
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet do "do loop" b
|
||||
do
|
||||
{
|
||||
${VISUAL}$0
|
||||
} while (${1:true});
|
||||
endsnippet
|
||||
|
||||
|
||||
###############
|
||||
# branching #
|
||||
###############
|
||||
|
||||
snippet if "if statement" b
|
||||
if ($1)
|
||||
{
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet ife "if else statement" b
|
||||
if ($1)
|
||||
{
|
||||
${VISUAL}$0
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet elif "else if" b
|
||||
else if ($1)
|
||||
{
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet elseif "else if" b
|
||||
else if ($1)
|
||||
{
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet ifnn "if not null" b
|
||||
if ($1 != null)
|
||||
{
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet switch "switch statement" b
|
||||
switch (${1:statement})
|
||||
{
|
||||
case ${2:value}:
|
||||
break;
|
||||
|
||||
default:
|
||||
$0break;
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet case "case" b
|
||||
case ${1:value}:
|
||||
$2
|
||||
break;
|
||||
endsnippet
|
||||
|
||||
|
||||
##############
|
||||
# wrappers #
|
||||
##############
|
||||
|
||||
snippet using "using statement" b
|
||||
using (${1:resource})
|
||||
{
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet unchecked "unchecked block" b
|
||||
unchecked
|
||||
{
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet checked "checked block" b
|
||||
checked
|
||||
{
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet unsafe "unsafe" b
|
||||
unsafe
|
||||
{
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
|
||||
########################
|
||||
# exception handling #
|
||||
########################
|
||||
|
||||
snippet try "try catch block" b
|
||||
try
|
||||
{
|
||||
${VISUAL}$0
|
||||
}
|
||||
catch (${1:Exception} ${2:e})
|
||||
{
|
||||
throw;
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet tryf "try finally block" b
|
||||
try
|
||||
{
|
||||
${VISUAL}$0
|
||||
}
|
||||
finally
|
||||
{
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet throw "throw"
|
||||
throw new $1Exception("$2");
|
||||
endsnippet
|
||||
|
||||
|
||||
##########
|
||||
# LINQ #
|
||||
##########
|
||||
|
||||
snippet from "LINQ syntax" b
|
||||
var ${1:seq} =
|
||||
from ${2:item1} in ${3:items1}
|
||||
join ${4:item2} in ${5:items2} on $2.${6:prop1} equals $4.${7:prop2}
|
||||
select ${8:$2.prop3}
|
||||
where ${9:clause}
|
||||
endsnippet
|
||||
|
||||
|
||||
############################
|
||||
# feedback and debugging #
|
||||
############################
|
||||
|
||||
snippet da "Debug.Assert" b
|
||||
Debug.Assert(${1:true});
|
||||
endsnippet
|
||||
|
||||
snippet cw "Console.WriteLine" b
|
||||
Console.WriteLine("$1");
|
||||
endsnippet
|
||||
|
||||
snippet cr "Console.ReadLine" b
|
||||
Console.ReadLine();
|
||||
endsnippet
|
||||
|
||||
# as you first type comma-separated parameters on the right, {n} values appear in the format string
|
||||
snippet cwp "Console.WriteLine with parameters" b
|
||||
Console.WriteLine("${2:`!p
|
||||
snip.rv = ' '.join(['{' + str(i) + '}' for i in range(t[1].count(','))])
|
||||
`}"${1:, something});
|
||||
endsnippet
|
||||
|
||||
snippet mbox "Message box" b
|
||||
MessageBox.Show("${1:message}");
|
||||
endsnippet
|
||||
|
||||
|
||||
#############
|
||||
# methods #
|
||||
#############
|
||||
|
||||
snippet equals "Equality for a type" b
|
||||
public override bool Equals(object obj) => Equals(obj as ${1:TYPE});
|
||||
|
||||
public bool Equals($1 other) // IEquatable<$1>
|
||||
{
|
||||
if (object.ReferenceEquals(other, null))
|
||||
return false;
|
||||
if (object.ReferenceEquals(this, other))
|
||||
return true;
|
||||
if (this.GetType() != other.GetType())
|
||||
return false;
|
||||
$0
|
||||
return base.Equals(other);
|
||||
}
|
||||
|
||||
public override int GetHashCode() => base.GetHashCode();
|
||||
|
||||
public static bool operator ==($1 x, $1 y) =>
|
||||
(object.ReferenceEquals(x, null) && object.ReferenceEquals(y, null))
|
||||
|| (!object.ReferenceEquals(x, null) && x.Equals(y));
|
||||
|
||||
public static bool operator !=($1 x, $1 y) => !(x == y);
|
||||
|
||||
endsnippet
|
||||
|
||||
snippet mth "Method" b
|
||||
${1:public} ${2:void} ${3:MyMethod}(${4})
|
||||
{
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet mths "Static method" b
|
||||
${1:public} static ${2:void} ${3:MyMethod}(${4})
|
||||
{
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
###############
|
||||
# constructor #
|
||||
###############
|
||||
|
||||
snippet ctor "Constructor" b
|
||||
${1:public} ${2:`!p snip.rv = snip.basename or "untitled"`}(${3})
|
||||
{
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
##############
|
||||
# comments #
|
||||
##############
|
||||
|
||||
snippet /// "XML summary comment" b
|
||||
/// <summary>
|
||||
/// $0
|
||||
/// </summary>
|
||||
endsnippet
|
||||
|
||||
snippet <p "XML pramameter comment" w
|
||||
<param name="${1}">${2}</param>
|
||||
endsnippet
|
||||
|
||||
snippet <ex "XML exception comment" w
|
||||
<exception cref="${1:System.Exception}">${2}</exception>
|
||||
endsnippet
|
||||
|
||||
snippet <r "XML returns comment" w
|
||||
<returns>$0</returns>
|
||||
endsnippet
|
||||
|
||||
snippet <c "XML code comment" w
|
||||
<code>$0</code>
|
||||
endsnippet
|
493
.vim/UltiSnips/css.snippets
Normal file
|
@ -0,0 +1,493 @@
|
|||
priority -50
|
||||
|
||||
snippet p "padding"
|
||||
padding: ${1:0};$0
|
||||
endsnippet
|
||||
|
||||
snippet m "margin"
|
||||
margin: ${1:0};$0
|
||||
endsnippet
|
||||
|
||||
snippet bd "border"
|
||||
border: ${1:0};$0
|
||||
endsnippet
|
||||
|
||||
snippet d "display"
|
||||
display: ${1:none};$0
|
||||
endsnippet
|
||||
|
||||
snippet bg "background"
|
||||
background: ${1:none};$0
|
||||
endsnippet
|
||||
|
||||
snippet ff "font-family"
|
||||
font-family: ${1:"Helvetica Neue", Helvetica, Arial, sans-serif};$0
|
||||
endsnippet
|
||||
|
||||
snippet h "height"
|
||||
height: ${1:auto};$0
|
||||
endsnippet
|
||||
|
||||
snippet w "width"
|
||||
width: ${1:auto};$0
|
||||
endsnippet
|
||||
|
||||
snippet pos "position"
|
||||
position: ${1:relative};$0
|
||||
endsnippet
|
||||
|
||||
snippet tt "text-transform"
|
||||
text-transform: ${1:none};$0
|
||||
endsnippet
|
||||
|
||||
snippet ! "!important CSS (!)"
|
||||
!important
|
||||
endsnippet
|
||||
|
||||
snippet tsh "text-shadow: color-hex x y blur (text)"
|
||||
text-shadow: ${1:${2:offset-x} ${3:offset-y} ${4:blur} ${5:color}};$0
|
||||
endsnippet
|
||||
|
||||
snippet bxsh "box-shadow: color-hex x y blur (text)"
|
||||
box-shadow: ${1:${2:offset-x} ${3:offset-y} ${4:blur} ${5:spread} ${6:color} ${7:inset}};$0
|
||||
endsnippet
|
||||
|
||||
#
|
||||
# Colors
|
||||
#
|
||||
|
||||
snippet rgb "color rgb"
|
||||
rgb(${1:255}, ${2:255}, ${3:255})$0
|
||||
endsnippet
|
||||
|
||||
snippet rgba "color rgba"
|
||||
rgba(${1:255}, ${2:255}, ${3:255}, ${4:0.5})$0
|
||||
endsnippet
|
||||
|
||||
snippet hsl "color hsl"
|
||||
hsl(${1:360}, ${2:100}%, ${3:100}%)$0
|
||||
endsnippet
|
||||
|
||||
snippet hsla "color hsla"
|
||||
hsla(${1:360}, ${2:100}%, ${3:100}%, ${4:0.5})$0
|
||||
endsnippet
|
||||
|
||||
#
|
||||
# Selectors
|
||||
#
|
||||
|
||||
snippet :fc
|
||||
:first-child
|
||||
endsnippet
|
||||
|
||||
snippet :lc
|
||||
:last-child
|
||||
endsnippet
|
||||
|
||||
snippet :nc
|
||||
:nth-child($0)
|
||||
endsnippet
|
||||
|
||||
snippet :nlc
|
||||
:nth-last-child($0)
|
||||
endsnippet
|
||||
|
||||
snippet :oc
|
||||
:only-child
|
||||
endsnippet
|
||||
|
||||
#
|
||||
# Pseudo-elements
|
||||
#
|
||||
|
||||
snippet :a
|
||||
:after
|
||||
endsnippet
|
||||
|
||||
snippet :b
|
||||
:before
|
||||
endsnippet
|
||||
|
||||
snippet ::a
|
||||
::after
|
||||
endsnippet
|
||||
|
||||
snippet ::b
|
||||
::before
|
||||
endsnippet
|
||||
|
||||
###########################################################################
|
||||
# Most of these came from TextMate #
|
||||
###########################################################################
|
||||
|
||||
snippet background "background-attachment: scroll:fixed (background)"
|
||||
background-attachment: ${1:scroll/fixed};$0
|
||||
endsnippet
|
||||
|
||||
snippet background "background-color: color-hex (background)"
|
||||
background-color: #${1:DDD};$0
|
||||
endsnippet
|
||||
|
||||
snippet background "background-color: color-name (background)"
|
||||
background-color: ${1:red};$0
|
||||
endsnippet
|
||||
|
||||
snippet background "background-color: color-rgb (background)"
|
||||
background-color: rgb(${1:255},${2:255},${3:255});$0
|
||||
endsnippet
|
||||
|
||||
snippet background "background-color: transparent (background)"
|
||||
background-color: transparent;$0
|
||||
endsnippet
|
||||
|
||||
snippet background "background-image: none (background)"
|
||||
background-image: none;$0
|
||||
endsnippet
|
||||
|
||||
snippet background "background-image: url (background)"
|
||||
background-image: url($1);$0
|
||||
endsnippet
|
||||
|
||||
snippet background "background-position: position (background)"
|
||||
background-position: ${1:top left/top center/top right/center left/center center/center right/bottom left/bottom center/bottom right/x-% y-%/x-pos y-pos};$0
|
||||
endsnippet
|
||||
|
||||
snippet background "background-repeat: r:r-x:r-y:n-r (background)"
|
||||
background-repeat: ${1:repeat/repeat-x/repeat-y/no-repeat};$0
|
||||
endsnippet
|
||||
|
||||
snippet background "background: color image repeat attachment position (background)"
|
||||
background:${6: #${1:DDD}} url($2) ${3:repeat/repeat-x/repeat-y/no-repeat} ${4:scroll/fixed} ${5:top left/top center/top right/center left/center center/center right/bottom left/bottom center/bottom right/x-% y-%/x-pos y-pos};$0
|
||||
endsnippet
|
||||
|
||||
snippet border "border-bottom-color: size style color (border)"
|
||||
border-bottom-color: #${1:999};$0
|
||||
endsnippet
|
||||
|
||||
snippet border "border-bottom-style: size style color (border)"
|
||||
border-bottom-style: ${1:none/hidden/dotted/dashed/solid/double/groove/ridge/inset/outset};$0
|
||||
endsnippet
|
||||
|
||||
snippet border "border-bottom-width: size style color (border)"
|
||||
border-bottom-width: ${1:1}px ${2:solid} #${3:999};$0
|
||||
endsnippet
|
||||
|
||||
snippet border "border-bottom: size style color (border)"
|
||||
border-bottom: ${1:1}px ${2:solid} #${3:999};$0
|
||||
endsnippet
|
||||
|
||||
snippet border "border-color: color (border)"
|
||||
border-color: ${1:999};$0
|
||||
endsnippet
|
||||
|
||||
snippet border "border-left-color: color (border)"
|
||||
border-right-color: #${1:999};$0
|
||||
endsnippet
|
||||
|
||||
snippet border "border-left-style: style (border)"
|
||||
border-left-style: ${1:none/hidden/dotted/dashed/solid/double/groove/ridge/inset/outset};$0
|
||||
endsnippet
|
||||
|
||||
snippet border "border-left-width: size (border)"
|
||||
border-left-width: ${1:1}px
|
||||
endsnippet
|
||||
|
||||
snippet border "border-left: size style color (border)"
|
||||
border-left: ${1:1}px ${2:solid} #${3:999};$0
|
||||
endsnippet
|
||||
|
||||
snippet border "border-right-color: color (border)"
|
||||
border-right-color: #${1:999};$0
|
||||
endsnippet
|
||||
|
||||
snippet border "border-right-style: style (border)"
|
||||
border-right-style: ${1:none/hidden/dotted/dashed/solid/double/groove/ridge/inset/outset};$0
|
||||
endsnippet
|
||||
|
||||
snippet border "border-right-width: size (border)"
|
||||
border-right-width: ${1:1}px
|
||||
endsnippet
|
||||
|
||||
snippet border "border-right: size style color (border)"
|
||||
border-right: ${1:1}px ${2:solid} #${3:999};$0
|
||||
endsnippet
|
||||
|
||||
snippet border "border-style: style (border)"
|
||||
border-style: ${1:none/hidden/dotted/dashed/solid/double/groove/ridge/inset/outset};$0
|
||||
endsnippet
|
||||
|
||||
snippet border "border-top-color: color (border)"
|
||||
border-top-color: #${1:999};$0
|
||||
endsnippet
|
||||
|
||||
snippet border "border-top-style: style (border)"
|
||||
border-top-style: ${1:none/hidden/dotted/dashed/solid/double/groove/ridge/inset/outset};$0
|
||||
endsnippet
|
||||
|
||||
snippet border "border-top-width: size (border)"
|
||||
border-top-width: ${1:1}px
|
||||
endsnippet
|
||||
|
||||
snippet border "border-top: size style color (border)"
|
||||
border-top: ${1:1}px ${2:solid} #${3:999};$0
|
||||
endsnippet
|
||||
|
||||
snippet border "border-width: width (border)"
|
||||
border-width: ${1:1px};$0
|
||||
endsnippet
|
||||
|
||||
snippet border "border: size style color (border)"
|
||||
border: ${1:1px} ${2:solid} #${3:999};$0
|
||||
endsnippet
|
||||
|
||||
snippet clear "clear: value (clear)"
|
||||
clear: ${1:left/right/both/none};$0
|
||||
endsnippet
|
||||
|
||||
snippet color "color: color-hex (color)"
|
||||
color: #${1:DDD};$0
|
||||
endsnippet
|
||||
|
||||
snippet color "color: color-name (color)"
|
||||
color: ${1:red};$0
|
||||
endsnippet
|
||||
|
||||
snippet color "color: color-rgb (color)"
|
||||
color: rgb(${1:255},${2:255},${3:255});$0
|
||||
endsnippet
|
||||
|
||||
snippet cursor "cursor: type (cursor)"
|
||||
cursor: ${1:default/auto/crosshair/pointer/move/*-resize/text/wait/help};$0
|
||||
endsnippet
|
||||
|
||||
snippet cursor "cursor: url (cursor)"
|
||||
cursor: url($1);$0
|
||||
endsnippet
|
||||
|
||||
snippet direction "direction: ltr|rtl (direction)"
|
||||
direction: ${1:ltr|rtl};$0
|
||||
endsnippet
|
||||
|
||||
snippet display "display: block (display)"
|
||||
display: block;$0
|
||||
endsnippet
|
||||
|
||||
snippet display "display: common-types (display)"
|
||||
display: ${1:none/inline/block/list-item/run-in/compact/marker};$0
|
||||
endsnippet
|
||||
|
||||
snippet display "display: inline (display)"
|
||||
display: inline;$0
|
||||
endsnippet
|
||||
|
||||
snippet display "display: table-types (display)"
|
||||
display: ${1:table/inline-table/table-row-group/table-header-group/table-footer-group/table-row/table-column-group/table-column/table-cell/table-caption};$0
|
||||
endsnippet
|
||||
|
||||
snippet float "float: left:right:none (float)"
|
||||
float: ${1:left/right/none};$0
|
||||
endsnippet
|
||||
|
||||
snippet font "font-family: family (font)"
|
||||
font-family: ${1:Arial, "MS Trebuchet"}, ${2:sans-}serif;$0
|
||||
endsnippet
|
||||
|
||||
snippet font "font-size: size (font)"
|
||||
font-size: ${1:100%};$0
|
||||
endsnippet
|
||||
|
||||
snippet font "font-style: normal:italic:oblique (font)"
|
||||
font-style: ${1:normal/italic/oblique};$0
|
||||
endsnippet
|
||||
|
||||
snippet font "font-variant: normal:small-caps (font)"
|
||||
font-variant: ${1:normal/small-caps};$0
|
||||
endsnippet
|
||||
|
||||
snippet font "font-weight: weight (font)"
|
||||
font-weight: ${1:normal/bold};$0
|
||||
endsnippet
|
||||
|
||||
snippet font "font: style variant weight size:line-height font -family (font)"
|
||||
font: ${1:normal/italic/oblique} ${2:normal/small-caps} ${3:normal/bold} ${4:1em/1.5em} ${5:Arial}, ${6:sans-}serif;$0
|
||||
endsnippet
|
||||
|
||||
snippet font "font: size font (font)"
|
||||
font: ${1:75%} ${2:"Lucida Grande", "Trebuchet MS", Verdana,} ${3:sans-}serif;$0
|
||||
endsnippet
|
||||
|
||||
snippet letter "letter-spacing: length-em (letter)"
|
||||
letter-spacing: $1em;$0
|
||||
endsnippet
|
||||
|
||||
snippet letter "letter-spacing: length-px (letter)"
|
||||
letter-spacing: $1px;$0
|
||||
endsnippet
|
||||
|
||||
snippet list "list-style-image: url (list)"
|
||||
list-style-image: url($1);$0
|
||||
endsnippet
|
||||
|
||||
snippet list "list-style-position: pos (list)"
|
||||
list-style-position: ${1:inside/outside};$0
|
||||
endsnippet
|
||||
|
||||
snippet list "list-style-type: asian (list)"
|
||||
list-style-type: ${1:cjk-ideographic/hiragana/katakana/hiragana-iroha/katakana-iroha};$0
|
||||
endsnippet
|
||||
|
||||
snippet list "list-style-type: marker(list)"
|
||||
list-style-type: ${1:none/disc/circle/square};$0
|
||||
endsnippet
|
||||
|
||||
snippet list "list-style-type: numeric (list)"
|
||||
list-style-type: ${1:decimal/decimal-leading-zero/zero};$0
|
||||
endsnippet
|
||||
|
||||
snippet list "list-style-type: other (list)"
|
||||
list-style-type: ${1:hebrew/armenian/georgian};$0
|
||||
endsnippet
|
||||
|
||||
snippet list "list-style-type: roman-alpha-greek (list)"
|
||||
list-style-type: ${1:lower-roman/upper-roman/lower-alpha/upper-alpha/lower-greek/lower-latin/upper-latin};$0
|
||||
endsnippet
|
||||
|
||||
snippet list "list-style: type position image (list)"
|
||||
list-style: ${1:none/disc/circle/square/decimal/zero} ${2:inside/outside} url($3);$0
|
||||
endsnippet
|
||||
|
||||
snippet margin "margin-bottom: length (margin)"
|
||||
margin-bottom: ${1:20px};$0
|
||||
endsnippet
|
||||
|
||||
snippet margin "margin-left: length (margin)"
|
||||
margin-left: ${1:20px};$0
|
||||
endsnippet
|
||||
|
||||
snippet margin "margin-right: length (margin)"
|
||||
margin-right: ${1:20px};$0
|
||||
endsnippet
|
||||
|
||||
snippet margin "margin-top: length (margin)"
|
||||
margin-top: ${1:20px};$0
|
||||
endsnippet
|
||||
|
||||
snippet margin "margin: all (margin)"
|
||||
margin: ${1:20px};$0
|
||||
endsnippet
|
||||
|
||||
snippet margin "margin: T R B L (margin)"
|
||||
margin: ${1:20px} ${2:0px} ${3:40px} ${4:0px};$0
|
||||
endsnippet
|
||||
|
||||
snippet margin "margin: V H (margin)"
|
||||
margin: ${1:20px} ${2:0px};$0
|
||||
endsnippet
|
||||
|
||||
snippet marker "marker-offset: auto (marker)"
|
||||
marker-offset: auto;$0
|
||||
endsnippet
|
||||
|
||||
snippet marker "marker-offset: length (marker)"
|
||||
marker-offset: ${1:10px};$0
|
||||
endsnippet
|
||||
|
||||
snippet overflow "overflow: type (overflow)"
|
||||
overflow: ${1:visible/hidden/scroll/auto};$0
|
||||
endsnippet
|
||||
|
||||
snippet padding "padding-bottom: length (margin)"
|
||||
padding-bottom: ${1:20px};$0
|
||||
endsnippet
|
||||
|
||||
snippet padding "padding-left: length (margin)"
|
||||
padding-left: ${1:20px};$0
|
||||
endsnippet
|
||||
|
||||
snippet padding "padding-right: length (margin)"
|
||||
padding-right: ${1:20px};$0
|
||||
endsnippet
|
||||
|
||||
snippet padding "padding-top: length (margin)"
|
||||
padding-top: ${1:20px};$0
|
||||
endsnippet
|
||||
|
||||
snippet padding "padding: T R B L (padding)"
|
||||
padding: ${1:20px} ${2:0px} ${3:40px} ${4:0px};$0
|
||||
endsnippet
|
||||
|
||||
snippet padding "padding: V H (padding)"
|
||||
padding: ${1:20px} ${2:0px};$0
|
||||
endsnippet
|
||||
|
||||
snippet padding "padding: all (padding)"
|
||||
padding: ${1:20px};$0
|
||||
endsnippet
|
||||
|
||||
snippet position "position: type (position)"
|
||||
position: ${1:static/relative/absolute/fixed};$0
|
||||
endsnippet
|
||||
|
||||
snippet { "properties { } ( } )"
|
||||
{
|
||||
/* $1 */
|
||||
$0
|
||||
|
||||
endsnippet
|
||||
|
||||
snippet scrollbar "scrollbar"
|
||||
scrollbar-base-color: ${1:#CCCCCC};${2:
|
||||
scrollbar-arrow-color: ${3:#000000};
|
||||
scrollbar-track-color: ${4:#999999};
|
||||
scrollbar-3dlight-color: ${5:#EEEEEE};
|
||||
scrollbar-highlight-color: ${6:#FFFFFF};
|
||||
scrollbar-face-color: ${7:#CCCCCC};
|
||||
scrollbar-shadow-color: ${9:#999999};
|
||||
scrollbar-darkshadow-color: ${8:#666666};}
|
||||
endsnippet
|
||||
|
||||
snippet selection "selection"
|
||||
$1::-moz-selection,
|
||||
$1::selection {
|
||||
color: ${2:inherit};
|
||||
background: ${3:inherit};
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet text "text-align: left:center:right (txt)"
|
||||
text-align: ${1:left/right/center/justify};$0
|
||||
endsnippet
|
||||
|
||||
snippet text "text-decoration: none:underline:overline:line-through:blink (text)"
|
||||
text-decoration: ${1:none/underline/overline/line-through/blink};$0
|
||||
endsnippet
|
||||
|
||||
snippet text "text-indent: length (text)"
|
||||
text-indent: ${1:10}px;$0
|
||||
endsnippet
|
||||
|
||||
snippet text "text-transform: capitalize:upper:lower (text)"
|
||||
text-transform: ${1:capitalize/uppercase/lowercase};$0
|
||||
endsnippet
|
||||
|
||||
snippet vertical "vertical-align: type (vertical)"
|
||||
vertical-align: ${1:baseline/sub/super/top/text-top/middle/bottom/text-bottom/length/%};$0
|
||||
endsnippet
|
||||
|
||||
snippet visibility "visibility: type (visibility)"
|
||||
visibility: ${1:visible/hidden/collapse};$0
|
||||
endsnippet
|
||||
|
||||
snippet white "white-space: normal:pre:nowrap (white)"
|
||||
white-space: ${1:normal/pre/nowrap};$0
|
||||
endsnippet
|
||||
|
||||
snippet word "word-spacing: length (word)"
|
||||
word-spacing: ${1:10px};$0
|
||||
endsnippet
|
||||
|
||||
snippet z "z-index: index (z)"
|
||||
z-index: $1;$0
|
||||
endsnippet
|
||||
|
||||
# vim:ft=snippets:
|
5
.vim/UltiSnips/cuda.snippets
Normal file
|
@ -0,0 +1,5 @@
|
|||
priority -50
|
||||
|
||||
extends cpp
|
||||
|
||||
# vim:ft=snippets:
|
584
.vim/UltiSnips/d.snippets
Normal file
|
@ -0,0 +1,584 @@
|
|||
# Simple shortcuts
|
||||
|
||||
priority -50
|
||||
|
||||
snippet imp "import (imp)" b
|
||||
import ${1:std.stdio};
|
||||
endsnippet
|
||||
|
||||
snippet pimp "public import (pimp)" b
|
||||
public import ${1:/*module*/};
|
||||
endsnippet
|
||||
|
||||
snippet over "override (over)" b
|
||||
override ${1:/*function*/}
|
||||
endsnippet
|
||||
|
||||
snippet al "alias (al)"
|
||||
alias ${1:/*orig*/} ${2:/*alias*/};
|
||||
endsnippet
|
||||
|
||||
snippet mixin "mixin (mixin)" b
|
||||
mixin ${1:/*mixed_in*/} ${2:/*name*/};
|
||||
endsnippet
|
||||
|
||||
snippet new "new (new)"
|
||||
new $1($2);
|
||||
endsnippet
|
||||
|
||||
snippet scpn "@safe const pure nothrow (scpn)"
|
||||
@safe const pure nothrow
|
||||
endsnippet
|
||||
|
||||
snippet spn "@safe pure nothrow (spn)"
|
||||
@safe pure nothrow
|
||||
endsnippet
|
||||
|
||||
snippet cont "continue (cont)"
|
||||
continue;
|
||||
endsnippet
|
||||
|
||||
snippet dis "@disable (dis)" b
|
||||
@disable ${1:/*method*/};
|
||||
endsnippet
|
||||
|
||||
snippet pub "public (pub)" b
|
||||
public:
|
||||
${1:/*members*/}
|
||||
endsnippet
|
||||
|
||||
snippet priv "private (priv)" b
|
||||
private:
|
||||
${1:/*members*/}
|
||||
endsnippet
|
||||
|
||||
snippet prot "protected (prot)" b
|
||||
protected:
|
||||
${1:/*members*/}
|
||||
endsnippet
|
||||
|
||||
snippet pack "package (pack)" b
|
||||
package:
|
||||
${1:/*members*/}
|
||||
endsnippet
|
||||
|
||||
snippet ret "return (ret)"
|
||||
return ${1:/*value to return*/};
|
||||
endsnippet
|
||||
|
||||
snippet auto "auto (auto)" b
|
||||
auto ${1:/*variable*/} = ${2:/*value*/};
|
||||
endsnippet
|
||||
|
||||
snippet con "const (con)" b
|
||||
const ${1:/*variable*/} = ${2:/*value*/};
|
||||
endsnippet
|
||||
|
||||
snippet siz "size_t (siz)" b
|
||||
size_t ${1:/*variable*/} = ${2:/*value*/};
|
||||
endsnippet
|
||||
|
||||
snippet sup "super (sup)" b
|
||||
super(${1:/*args*/});
|
||||
endsnippet
|
||||
|
||||
# Phobos
|
||||
|
||||
snippet tup "tuple (tup)"
|
||||
tuple(${1:/*args*/})
|
||||
endsnippet
|
||||
|
||||
snippet wr "writeln (wr)"
|
||||
writeln(${1:/*args*/});
|
||||
endsnippet
|
||||
|
||||
snippet to "to (to)"
|
||||
to!(${1:/*type*/})(${2:/*arg*/})
|
||||
endsnippet
|
||||
|
||||
snippet enf "enforce (enf)" b
|
||||
enforce(${1:/*condition*/},
|
||||
new $2Exception(${3:/*args*/}));
|
||||
endsnippet
|
||||
|
||||
# Branches
|
||||
|
||||
snippet if "if .. (if)"
|
||||
if(${1:/*condition*/})
|
||||
{
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet ife "if .. else (ife)" b
|
||||
if(${1:/*condition*/})
|
||||
{
|
||||
$2
|
||||
}
|
||||
else
|
||||
{
|
||||
${3:/*else*/}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet el "else (el)" b
|
||||
else
|
||||
{
|
||||
${VISUAL}$1
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet elif "else if (elif)" b
|
||||
else if(${1:/*condition*/})
|
||||
{
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet sw "switch (sw)"
|
||||
switch(${1:/*var*/})
|
||||
{
|
||||
case ${2:/*value*/}:
|
||||
$3
|
||||
break;
|
||||
case ${4:/*value*/}:
|
||||
$5
|
||||
break;
|
||||
${7:/*more cases*/}
|
||||
default:
|
||||
${6:assert(false);}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet fsw "final switch (fsw)"
|
||||
final switch(${1:/*var*/})
|
||||
{
|
||||
case ${2:/*value*/}:
|
||||
$3
|
||||
break;
|
||||
case ${4:/*value*/}:
|
||||
$5
|
||||
break;
|
||||
${7:/*more cases*/}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet case "case (case)" b
|
||||
case ${1:/*value*/}:
|
||||
$2
|
||||
break;
|
||||
endsnippet
|
||||
|
||||
snippet ?: "ternary operator (?:)"
|
||||
${1:/*condition*/} ? ${2:/*then*/} : ${3:/*else*/}$4
|
||||
endsnippet
|
||||
|
||||
# Loops
|
||||
|
||||
snippet do "do while (do)" b
|
||||
do
|
||||
{
|
||||
${VISUAL}$2
|
||||
} while(${1:/*condition*/});
|
||||
endsnippet
|
||||
|
||||
snippet wh "while (wh)" b
|
||||
while(${1:/*condition*/})
|
||||
{
|
||||
${VISUAL}$2
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet for "for (for)" b
|
||||
for (${4:size_t} ${2:i} = 0; $2 < ${1:count}; ${3:++$2})
|
||||
{
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet forever "forever (forever)" b
|
||||
for(;;)
|
||||
{
|
||||
${VISUAL}$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet fore "foreach (fore)"
|
||||
foreach(${1:/*elem*/}; ${2:/*range*/})
|
||||
{
|
||||
${VISUAL}$3
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet forif "foreach if (forif)" b
|
||||
foreach(${1:/*elem*/}; ${2:/*range*/}) if(${3:/*condition*/})
|
||||
{
|
||||
${VISUAL}$4
|
||||
}
|
||||
endsnippet
|
||||
|
||||
# Contracts
|
||||
snippet in "in contract (in)" b
|
||||
in
|
||||
{
|
||||
assert(${1:/*condition*/}, "${2:error message}");
|
||||
$3
|
||||
}
|
||||
body
|
||||
endsnippet
|
||||
|
||||
snippet out "out contract (out)" b
|
||||
out${1:(result)}
|
||||
{
|
||||
assert(${2:/*condition*/}, "${3:error message}");
|
||||
$4
|
||||
}
|
||||
body
|
||||
endsnippet
|
||||
|
||||
snippet inv "invariant (inv)" b
|
||||
invariant()
|
||||
{
|
||||
assert(${1:/*condition*/}, "${2:error message}");
|
||||
$3
|
||||
}
|
||||
endsnippet
|
||||
|
||||
# Functions (generic)
|
||||
|
||||
snippet fun "function definition (fun)"
|
||||
${1:void} ${2:/*function name*/}(${3:/*args*/}) ${4:@safe pure nothrow}
|
||||
{
|
||||
${VISUAL}$5
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet void "void function definition (void)"
|
||||
void ${1:/*function name*/}(${2:/*args*/}) ${3:@safe pure nothrow}
|
||||
{
|
||||
${VISUAL}$4
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet this "ctor (this)" w
|
||||
this(${1:/*args*/})
|
||||
{
|
||||
${VISUAL}$2
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet get "getter property (get)"
|
||||
@property ${1:/*type*/} ${2:/*member_name*/}() const pure nothrow {return ${3:$2_};}
|
||||
endsnippet
|
||||
|
||||
snippet set "setter property (set)"
|
||||
@property void ${1:/*member_name*/}(${2:/*type*/} rhs) pure nothrow {${3:$1_} = rhs;}
|
||||
endsnippet
|
||||
|
||||
# Functions (concrete)
|
||||
|
||||
snippet main "Main" b
|
||||
void main(string[] args)
|
||||
{
|
||||
${VISUAL}${0: /*code*/}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
# Mixins
|
||||
|
||||
snippet signal "signal (signal)" b
|
||||
mixin Signal!(${1:/*args*/}) ${2:/*name*/};
|
||||
endsnippet
|
||||
|
||||
# Scope
|
||||
|
||||
snippet scope "scope (scope)" b
|
||||
scope(${1:exit})
|
||||
{
|
||||
${VISUAL}$2
|
||||
}
|
||||
endsnippet
|
||||
|
||||
# With
|
||||
|
||||
snippet with "with (with)"
|
||||
with($1)
|
||||
{
|
||||
${VISUAL}$2
|
||||
}
|
||||
endsnippet
|
||||
|
||||
# Exception handling
|
||||
|
||||
snippet try "try/catch (try)" b
|
||||
try
|
||||
{
|
||||
${VISUAL}${1:/*code to try*/}
|
||||
}
|
||||
catch($2Exception e)
|
||||
{
|
||||
${3:/*handle exception*/}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet tryf "try/catch/finally (tryf)" b
|
||||
try
|
||||
{
|
||||
${VISUAL}${1:/*code to try*/}
|
||||
}
|
||||
catch($2Exception e)
|
||||
{
|
||||
${3:/*handle exception*/}
|
||||
}
|
||||
finally
|
||||
{
|
||||
${4:/*cleanup*/}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet catch "catch (catch)" b
|
||||
catch($1Exception e)
|
||||
{
|
||||
${2:/*handle exception*/}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet thr "throw (thr)"
|
||||
throw new $1Exception("$2");
|
||||
endsnippet
|
||||
|
||||
|
||||
# Type declarations
|
||||
|
||||
snippet struct "struct (struct)"
|
||||
struct ${1:`!p snip.rv = (snip.basename or "name")`}
|
||||
{
|
||||
$2
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet union "union (union)"
|
||||
union ${1:`!p snip.rv = (snip.basename or "name")`}
|
||||
{
|
||||
$2
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet class "class (class)"
|
||||
class ${1:`!p snip.rv = (snip.basename or "name")`}
|
||||
{
|
||||
$2
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet inter "interface (inter)"
|
||||
interface ${1:`!p snip.rv = (snip.basename or "name")`}
|
||||
{
|
||||
$2
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet enum "enum (enum)"
|
||||
enum ${1:`!p snip.rv = (snip.basename or "name")`}
|
||||
{
|
||||
$2
|
||||
}
|
||||
endsnippet
|
||||
|
||||
|
||||
# Exception declarations
|
||||
|
||||
snippet exc "exception declaration (exc)" b
|
||||
/// ${3:/*documentation*/}
|
||||
class $1Exception : $2Exception
|
||||
{
|
||||
public this(string msg, string file = __FILE__, int line = __LINE__)
|
||||
{
|
||||
super(msg, file, line);
|
||||
}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
|
||||
# Conditional compilation
|
||||
|
||||
snippet version "version (version)" b
|
||||
version(${1:/*version name*/})
|
||||
{
|
||||
${VISUAL}$2
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet debug "debug" b
|
||||
debug
|
||||
{
|
||||
${VISUAL}$1
|
||||
}
|
||||
endsnippet
|
||||
|
||||
|
||||
# Templates
|
||||
|
||||
snippet temp "template (temp)" b
|
||||
template ${2:/*name*/}(${1:/*args*/})
|
||||
{
|
||||
$3
|
||||
}
|
||||
endsnippet
|
||||
|
||||
|
||||
# Asserts
|
||||
|
||||
snippet ass "assert (ass)" b
|
||||
assert(${1:false}, "${2:TODO}");
|
||||
|
||||
endsnippet
|
||||
|
||||
|
||||
# Unittests
|
||||
|
||||
snippet unittest "unittest (unittest)" b
|
||||
unittest
|
||||
{
|
||||
$1
|
||||
}
|
||||
endsnippet
|
||||
|
||||
|
||||
# Common member functions
|
||||
|
||||
snippet opDis "opDispatch (opDis)" b
|
||||
${1:/*return type*/} opDispatch(string s)()
|
||||
{
|
||||
$2;
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet op= "opAssign (op=)" b
|
||||
void opAssign($1 rhs) ${2:@safe pure nothrow}
|
||||
{
|
||||
$2
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet opCmp "opCmp (opCmp)" b
|
||||
int opCmp($1 rhs) @safe const pure nothrow
|
||||
{
|
||||
$2
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet opApply "opApply (opApply)" b
|
||||
int opApply(int delegate(ref ${1:/*iterated type/s*/}) dg)
|
||||
{
|
||||
int result = 0;
|
||||
${2:/*loop*/}
|
||||
{
|
||||
result = dg(${3:/*arg/s*/});
|
||||
if(result){break;}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet toString "toString (toString)" b
|
||||
string toString() @safe const pure nothrow
|
||||
{
|
||||
$1
|
||||
}
|
||||
endsnippet
|
||||
|
||||
|
||||
# Comments
|
||||
|
||||
|
||||
snippet todo "TODO (todo)"
|
||||
// TODO: $1
|
||||
endsnippet
|
||||
|
||||
|
||||
# DDoc
|
||||
|
||||
snippet doc "generic ddoc block (doc)" b
|
||||
/// ${1:description}
|
||||
///
|
||||
/// ${2:details}
|
||||
endsnippet
|
||||
|
||||
snippet fdoc "function ddoc block (fdoc)" b
|
||||
/// ${1:description}
|
||||
///
|
||||
/// ${2:Params: ${3:param} = ${4:param description}
|
||||
/// $5}
|
||||
///
|
||||
/// ${6:Returns: ${7:return value}}
|
||||
///
|
||||
/// ${8:Throws: $9Exception $10}
|
||||
endsnippet
|
||||
|
||||
snippet Par "Params (Par)"
|
||||
Params: ${1:param} = ${2:param description}
|
||||
/// $3
|
||||
endsnippet
|
||||
|
||||
snippet Ret "Returns (Ret)"
|
||||
Returns: ${1:return value/s}
|
||||
endsnippet
|
||||
|
||||
snippet Thr "Throws (Thr)"
|
||||
Throws: $1Exception $2
|
||||
endsnippet
|
||||
|
||||
snippet Example "Examples (Example)"
|
||||
Examples:
|
||||
/// --------------------
|
||||
/// ${1:example code}
|
||||
/// --------------------
|
||||
endsnippet
|
||||
|
||||
|
||||
# License blocks
|
||||
|
||||
snippet gpl "GPL (gpl)" b
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
// Copyright (C) ${1:Author}, `!v strftime("%Y")`
|
||||
|
||||
$2
|
||||
endsnippet
|
||||
|
||||
snippet boost "Boost (boost)" b
|
||||
// Copyright ${1:Author} `!v strftime("%Y")`.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
$2
|
||||
endsnippet
|
||||
|
||||
|
||||
# New module
|
||||
|
||||
snippet module "New module (module)" b
|
||||
// Copyright ${1:Author} `!v strftime("%Y")`.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
module $2.`!v vim_snippets#Filename('$1', 'name')`;
|
||||
|
||||
|
||||
$3
|
||||
endsnippet
|
360
.vim/UltiSnips/django.snippets
Normal file
|
@ -0,0 +1,360 @@
|
|||
priority -50
|
||||
|
||||
# This files will define django snippets from sublime text djaneiro
|
||||
# FORMS SNIPPETS
|
||||
|
||||
snippet form "Form" b
|
||||
class ${1:FORMNAME}(forms.Form):
|
||||
|
||||
${2:# TODO: Define form fields here}
|
||||
endsnippet
|
||||
|
||||
snippet modelform "ModelForm" b
|
||||
class ${1:MODELNAME}Form(forms.ModelForm):
|
||||
|
||||
class Meta:
|
||||
model = $1
|
||||
endsnippet
|
||||
|
||||
snippet fbool "BooleanField" b
|
||||
${1:FIELDNAME} = forms.BooleanField($2)
|
||||
endsnippet
|
||||
|
||||
snippet fchar "CharField" b
|
||||
${1:FIELDNAME} = forms.CharField($2)
|
||||
endsnippet
|
||||
|
||||
snippet fchoice "ChoiceField" b
|
||||
${1:FIELDNAME} = forms.ChoiceField($2)
|
||||
endsnippet
|
||||
|
||||
snippet fcombo "ComboField" b
|
||||
${1:FIELDNAME} = forms.ComboField($2)
|
||||
endsnippet
|
||||
|
||||
snippet fdate "DateField" b
|
||||
${1:FIELDNAME} = forms.DateField($2)
|
||||
endsnippet
|
||||
|
||||
snippet fdatetime "DateTimeField" b
|
||||
${1:FIELDNAME} = forms.DateTimeField($2)
|
||||
endsnippet
|
||||
|
||||
snippet fdecimal "DecimalField" b
|
||||
${1:FIELDNAME} = forms.DecimalField($2)
|
||||
endsnippet
|
||||
|
||||
snippet fmail "EmailField" b
|
||||
${1:FIELDNAME} = forms.EmailField($2)
|
||||
endsnippet
|
||||
|
||||
snippet ffile "FileField" b
|
||||
${1:FIELDNAME} = forms.FileField($2)
|
||||
endsnippet
|
||||
|
||||
snippet ffilepath "FilePathField" b
|
||||
${1:FIELDNAME} = forms.FilePathField($2)
|
||||
endsnippet
|
||||
|
||||
snippet ffloat "FloatField" b
|
||||
${1:FIELDNAME} = forms.FloatField($2)
|
||||
endsnippet
|
||||
|
||||
snippet fip "IPAddressField" b
|
||||
${1:FIELDNAME} = forms.IPAddressField($2)
|
||||
endsnippet
|
||||
|
||||
snippet fimg "ImageField" b
|
||||
${1:FIELDNAME} = forms.ImageField($2)
|
||||
endsnippet
|
||||
|
||||
snippet fint "IntegerField" b
|
||||
${1:FIELDNAME} = forms.IntegerField($2)
|
||||
endsnippet
|
||||
|
||||
snippet fmochoice "ModelChoiceField" b
|
||||
${1:FIELDNAME} = forms.ModelChoiceField($2)
|
||||
endsnippet
|
||||
|
||||
snippet fmomuchoice "ModelMultipleChoiceField" b
|
||||
${1:FIELDNAME} = forms.ModelMultipleChoiceField($2)
|
||||
endsnippet
|
||||
|
||||
snippet fmuval "MultiValueField" b
|
||||
${1:FIELDNAME} = forms.MultiValueField($2)
|
||||
endsnippet
|
||||
|
||||
snippet fmuchoice "MultipleChoiceField" b
|
||||
${1:FIELDNAME} = forms.MultipleChoiceField($2)
|
||||
endsnippet
|
||||
|
||||
snippet fnullbool "NullBooleanField" b
|
||||
${1:FIELDNAME} = forms.NullBooleanField($2)
|
||||
endsnippet
|
||||
|
||||
snippet freg "RegexField" b
|
||||
${1:FIELDNAME} = forms.RegexField($2)
|
||||
endsnippet
|
||||
|
||||
snippet fslug "SlugField" b
|
||||
${1:FIELDNAME} = forms.SlugField($2)
|
||||
endsnippet
|
||||
|
||||
snippet fsdatetime "SplitDateTimeField" b
|
||||
${1:FIELDNAME} = forms.SplitDateTimeField($2)
|
||||
endsnippet
|
||||
|
||||
snippet ftime "TimeField" b
|
||||
${1:FIELDNAME} = forms.TimeField($2)
|
||||
endsnippet
|
||||
|
||||
snippet ftchoice "TypedChoiceField" b
|
||||
${1:FIELDNAME} = forms.TypedChoiceField($2)
|
||||
endsnippet
|
||||
|
||||
snippet ftmuchoice "TypedMultipleChoiceField" b
|
||||
${1:FIELDNAME} = forms.TypedMultipleChoiceField($2)
|
||||
endsnippet
|
||||
|
||||
snippet furl "URLField" b
|
||||
${1:FIELDNAME} = forms.URLField($2)
|
||||
endsnippet
|
||||
|
||||
# MODELS SNIPPETS
|
||||
|
||||
snippet model "Model" b
|
||||
class ${1:MODELNAME}(models.Model):
|
||||
$0
|
||||
class Meta:
|
||||
verbose_name = "$1"
|
||||
verbose_name_plural = "$1s"
|
||||
|
||||
def __str__(self):
|
||||
return super($1, self).__str__()
|
||||
|
||||
endsnippet
|
||||
|
||||
snippet modelfull "Model" b
|
||||
class ${1:MODELNAME}(models.Model):
|
||||
${2:# TODO: Define fields here}
|
||||
|
||||
class Meta:
|
||||
verbose_name = "$1"
|
||||
verbose_name_plural = "$1s"
|
||||
|
||||
def __str__(self):
|
||||
return super($1, self).__str__()
|
||||
|
||||
def save(self):
|
||||
return super($1, self).save()
|
||||
|
||||
def get_absolute_url(self):
|
||||
return ('')
|
||||
|
||||
${3:# TODO: Define custom methods here}
|
||||
|
||||
endsnippet
|
||||
|
||||
snippet mauto "AutoField" b
|
||||
${1:FIELDNAME} = models.AutoField($2)
|
||||
endsnippet
|
||||
|
||||
snippet mbigint "BigIntegerField" b
|
||||
${1:FIELDNAME} = models.BigIntegerField($2)
|
||||
endsnippet
|
||||
|
||||
snippet mbool "BooleanField" b
|
||||
${1:FIELDNAME} = models.BooleanField($2)
|
||||
endsnippet
|
||||
|
||||
snippet mchar "CharField" b
|
||||
${1:FIELDNAME} = models.CharField($2, max_length=${3:50})
|
||||
endsnippet
|
||||
|
||||
snippet mcoseint "CommaSeparatedIntegerField" b
|
||||
${1:FIELDNAME} = models.CommaSeparatedIntegerField($2)
|
||||
endsnippet
|
||||
|
||||
snippet mdate "DateField" b
|
||||
${1:FIELDNAME} = models.DateField($2)
|
||||
endsnippet
|
||||
|
||||
snippet mdatetime "DateTimeField" b
|
||||
${1:FIELDNAME} = models.DateTimeField($2)
|
||||
endsnippet
|
||||
|
||||
snippet mdecimal "DecimalField" b
|
||||
${1:FIELDNAME} = models.DecimalField(max_digits=${2:10}, decimal_places=${3:2})
|
||||
endsnippet
|
||||
|
||||
snippet memail "EmailField" b
|
||||
${1:FIELDNAME} = models.EmailField($2)
|
||||
endsnippet
|
||||
|
||||
snippet mfile "FileField" b
|
||||
${1:FIELDNAME} = models.FileField($2)
|
||||
endsnippet
|
||||
|
||||
snippet mfilepath "FilePathField" b
|
||||
${1:FIELDNAME} = models.FilePathField($2)
|
||||
endsnippet
|
||||
|
||||
snippet mfloat "FloatField" b
|
||||
${1:FIELDNAME} = models.FloatField($2)
|
||||
endsnippet
|
||||
|
||||
snippet fk "ForeignKey" b
|
||||
${1:FIELDNAME} = models.ForeignKey($2)
|
||||
endsnippet
|
||||
|
||||
snippet mip "IPAddressField" b
|
||||
${1:FIELDNAME} = models.IPAddressField($2)
|
||||
endsnippet
|
||||
|
||||
snippet mimg "ImageField" b
|
||||
${1:FIELDNAME} = models.ImageField($2)
|
||||
endsnippet
|
||||
|
||||
snippet mint "IntegerField" b
|
||||
${1:FIELDNAME} = models.IntegerField($2)
|
||||
endsnippet
|
||||
|
||||
snippet m2m "ManyToManyField" b
|
||||
${1:FIELDNAME} = models.ManyToManyField($2)
|
||||
endsnippet
|
||||
|
||||
snippet mnullbool "NullBooleanField" b
|
||||
${1:FIELDNAME} = models.NullBooleanField($2)
|
||||
endsnippet
|
||||
|
||||
snippet o2o "OneToOneField" b
|
||||
${1:FIELDNAME} = models.OneToOneField($2)
|
||||
endsnippet
|
||||
|
||||
snippet mphone "PhoneNumberField" b
|
||||
${1:FIELDNAME} = models.PhoneNumberField($2)
|
||||
endsnippet
|
||||
|
||||
snippet mposint "PositiveIntegerField" b
|
||||
${1:FIELDNAME} = models.PositiveIntegerField($2)
|
||||
endsnippet
|
||||
|
||||
snippet mpossmallint "PositiveSmallIntegerField" b
|
||||
${1:FIELDNAME} = models.PositiveSmallIntegerField($2)
|
||||
endsnippet
|
||||
|
||||
snippet mslug "SlugField" b
|
||||
${1:FIELDNAME} = models.SlugField($2)
|
||||
endsnippet
|
||||
|
||||
snippet msmallint "SmallIntegerField" b
|
||||
${1:FIELDNAME} = models.SmallIntegerField($2)
|
||||
endsnippet
|
||||
|
||||
snippet mtext "TextField" b
|
||||
${1:FIELDNAME} = models.TextField($2)
|
||||
endsnippet
|
||||
|
||||
snippet mtime "TimeField" b
|
||||
${1:FIELDNAME} = models.TimeField($2)
|
||||
endsnippet
|
||||
|
||||
snippet murl "URLField" b
|
||||
${1:FIELDNAME} = models.URLField($2)
|
||||
endsnippet
|
||||
|
||||
snippet musstate "USStateField" b
|
||||
${1:FIELDNAME} = models.USStateField($2)
|
||||
endsnippet
|
||||
|
||||
snippet mxml "XMLField" b
|
||||
${1:FIELDNAME} = models.XMLField($2)
|
||||
endsnippet
|
||||
|
||||
# VIEWS SNIPPETS
|
||||
|
||||
snippet adminview "Model Admin View" b
|
||||
class $1Admin(admin.ModelAdmin):
|
||||
'''
|
||||
Admin View for $1
|
||||
'''
|
||||
list_display = ('$2',)
|
||||
list_filter = ('$3',)
|
||||
inlines = [
|
||||
$4Inline,
|
||||
]
|
||||
raw_id_fields = ('$5',)
|
||||
readonly_fields = ('$6',)
|
||||
search_fields = ['$7']
|
||||
admin.site.register($1, $1Admin)
|
||||
endsnippet
|
||||
|
||||
snippet createview "Generic Create View" b
|
||||
class ${1:MODEL_NAME}CreateView(CreateView):
|
||||
model = $1
|
||||
template_name = "${2:TEMPLATE_NAME}"
|
||||
endsnippet
|
||||
|
||||
snippet deleteview "Generic Delete View" b
|
||||
class ${1:MODEL_NAME}DeleteView(DeleteView):
|
||||
model = $1
|
||||
template_name = "${2:TEMPLATE_NAME}"
|
||||
endsnippet
|
||||
|
||||
snippet detailview "Generic Detail View" b
|
||||
class ${1:MODEL_NAME}DetailView(DetailView):
|
||||
model = $1
|
||||
template_name = "${2:TEMPLATE_NAME}"
|
||||
endsnippet
|
||||
|
||||
snippet listview "Generic List View" b
|
||||
class ${1:MODEL_NAME}ListView(ListView):
|
||||
model = $1
|
||||
template_name = "${2:TEMPLATE_NAME}"
|
||||
endsnippet
|
||||
|
||||
snippet stackedinline "Stacked Inline" b
|
||||
class $1Inline(admin.StackedInline):
|
||||
'''
|
||||
Stacked Inline View for $1
|
||||
'''
|
||||
model = ${2:$1}
|
||||
min_num = ${3:3}
|
||||
max_num = ${4:20}
|
||||
extra = ${5:1}
|
||||
raw_id_fields = ($6,)
|
||||
endsnippet
|
||||
|
||||
snippet tabularinline "Tabular Inline" b
|
||||
class $1Inline(admin.TabularInline):
|
||||
'''
|
||||
Tabular Inline View for $1
|
||||
'''
|
||||
model = ${2:$1}
|
||||
min_num = ${3:3}
|
||||
max_num = ${4:20}
|
||||
extra = ${5:1}
|
||||
raw_id_fields = ($6,)
|
||||
endsnippet
|
||||
|
||||
snippet templateview "Generic Template View" b
|
||||
class ${1:CLASS_NAME}(TemplateView):
|
||||
template_name = "${2:TEMPLATE_NAME}"
|
||||
endsnippet
|
||||
|
||||
snippet updateview "Generic Update View" b
|
||||
class ${1:MODEL_NAME}UpdateView(UpdateView):
|
||||
model = $1
|
||||
template_name = "${2:TEMPLATE_NAME}"
|
||||
endsnippet
|
||||
|
||||
snippet dispatch "Dispatch View method" b
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
return super(${1:CLASS_NAME}, self).dispatch(request, *args, **kwargs)
|
||||
endsnippet
|
||||
|
||||
snippet context "get_context_data view method" b
|
||||
def get_context_data(self, **kwargs):
|
||||
kwargs['extra_context'] = ${1:'New Value'}
|
||||
return super(${2:CLASS_NAME}, self).get_context_data(**kwargs)
|
||||
endsnippet
|
43
.vim/UltiSnips/eelixir.snippets
Normal file
|
@ -0,0 +1,43 @@
|
|||
priority -50
|
||||
|
||||
extends html
|
||||
|
||||
snippet % "<% %>" w
|
||||
<% $0 %>
|
||||
endsnippet
|
||||
|
||||
snippet = "<%= %>" w
|
||||
<%= $0 %>
|
||||
endsnippet
|
||||
|
||||
snippet end "<% end %>" w
|
||||
<% end %>
|
||||
endsnippet
|
||||
|
||||
snippet for
|
||||
<%= for ${1:item} <- ${2:$1s} ${3:@conn} do %>
|
||||
$0
|
||||
<% end %>
|
||||
endsnippet
|
||||
|
||||
snippet ft "form_tag" w
|
||||
<%= form_tag(${1:"${2:/users}"}, method: ${3::post}) %>
|
||||
$0
|
||||
</form>
|
||||
endsnippet
|
||||
|
||||
snippet lin "link" w
|
||||
<%= link ${1:"${2:Submit}"}, to: ${3:"${4:/users}"}, method: ${5::delete} %>
|
||||
endsnippet
|
||||
|
||||
snippet ff "form_for" w
|
||||
<%= form_for @changeset, ${1:"${2:/users}"}, fn f -> %>
|
||||
$0
|
||||
|
||||
<%= submit "Submit" %>
|
||||
<% end %>
|
||||
endsnippet
|
||||
|
||||
snippet gt "gettext" w
|
||||
<%= gettext("${0:${VISUAL}}") %>
|
||||
endsnippet
|
10
.vim/UltiSnips/ejs.snippets
Normal file
|
@ -0,0 +1,10 @@
|
|||
snippet for "ejs for loop" b
|
||||
<% for (let ${1:i = 0}; ${2:i<arr.length}; ${3:i++}) { %>
|
||||
${0:body}
|
||||
<% } %>
|
||||
endsnippet
|
||||
snippet forE "ejs for Each loop" b
|
||||
<% ${1:array}.forEach((${2:single var}) => { %>
|
||||
${0:body}
|
||||
<% }) %>
|
||||
endsnippet
|
9
.vim/UltiSnips/elm.snippets
Normal file
|
@ -0,0 +1,9 @@
|
|||
priority -50
|
||||
|
||||
snippet impa "Qualified import"
|
||||
import ${1:Json.Encode} as ${0:`!p snip.rv = t[1].split(".")[-1]`}
|
||||
endsnippet
|
||||
|
||||
snippet impae "Qualified import with exposing"
|
||||
import ${1:Json.Encode} as ${2:`!p snip.rv = t[1].split(".")[-1]`} exposing (${0:Value})
|
||||
endsnippet
|
24
.vim/UltiSnips/erlang.snippets
Normal file
|
@ -0,0 +1,24 @@
|
|||
###########################################################################
|
||||
# TEXTMATE SNIPPETS #
|
||||
###########################################################################
|
||||
|
||||
priority -50
|
||||
|
||||
snippet pat "Case:Receive:Try Clause"
|
||||
${1:pattern}${2: when ${3:guard}} ->
|
||||
${4:body}
|
||||
endsnippet
|
||||
|
||||
snippet mod "Module Directive" b
|
||||
-module(${1:`!p snip.rv = snip.basename or "module"`}).
|
||||
endsnippet
|
||||
|
||||
snippet || "List Comprehension"
|
||||
[${1:X} || ${2:X} <- ${3:List}${4:, gen}]
|
||||
endsnippet
|
||||
|
||||
snippet gen "Generator Expression"
|
||||
${1:X} <- ${2:List}${3:, gen}
|
||||
endsnippet
|
||||
|
||||
# vim:ft=snippets:
|
237
.vim/UltiSnips/eruby.snippets
Normal file
|
@ -0,0 +1,237 @@
|
|||
extends html
|
||||
|
||||
priority -50
|
||||
|
||||
# TextMate added these variables to cope with changes in ERB handling
|
||||
# in different versions of Rails -- for instance, Rails 3 automatically
|
||||
# strips whitespace so that it's no longer necessary to use a form like
|
||||
# <% end -%>, but if you're still maintaining Rails 2 projects, you
|
||||
# can't omit the minus sign and get the same behavior.
|
||||
#
|
||||
# The following regex replace substitutes the function below for the
|
||||
# TextMate variable references after the snippets are converted:
|
||||
#
|
||||
# /\v\$\{(TM_RAILS_TEMPLATE_([^_]+)_RUBY_([^_\s]+))\}/`!p textmate_var('\1', snip)`/g
|
||||
#
|
||||
global !p
|
||||
def textmate_var(var, snip):
|
||||
lookup = dict(
|
||||
TM_RAILS_TEMPLATE_START_RUBY_EXPR = snip.opt('g:tm_rails_template_start_ruby_expr', '<%= '),
|
||||
TM_RAILS_TEMPLATE_END_RUBY_EXPR = snip.opt('g:tm_rails_template_end_ruby_expr', ' %>'),
|
||||
TM_RAILS_TEMPLATE_START_RUBY_INLINE = snip.opt('g:tm_rails_template_start_ruby_inline', '<% '),
|
||||
TM_RAILS_TEMPLATE_END_RUBY_INLINE = snip.opt('g:tm_rails_template_end_ruby_inline', ' %>'),
|
||||
TM_RAILS_TEMPLATE_END_RUBY_BLOCK = '<% end %>'
|
||||
)
|
||||
snip.rv = lookup[var]
|
||||
return
|
||||
endglobal
|
||||
|
||||
|
||||
snippet % "<% $0 %>" i
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`$0`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_INLINE', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet = "<%= $0 %>" i
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`$0`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
###########################################################################
|
||||
# GENERATED FROM get_tm_snippets.py + REGEX REPLACE #
|
||||
###########################################################################
|
||||
|
||||
snippet fi "<%= Fixtures.identify(:symbol) %>"
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`Fixtures.identify(:${1:name})`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`$0
|
||||
endsnippet
|
||||
|
||||
snippet ft "form_tag" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`form_tag(${1:action: '${2:update}'}${3:, ${4:${5:class}: '${6:form}'\}}}) do`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
$0
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet ffs "form_for submit 2" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`${1:f}.submit '${2:Submit}'${3:, disable_with: '${4:$2ing...}'}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet f. "f_fields_for (nff)" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_INLINE', snip)`f.fields_for :${1:attribute} do |${2:f}|`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_INLINE', snip)`
|
||||
$0
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet f. "f.checkbox" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.check_box :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet f. "f.file_field" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.file_field :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet f. "f.hidden_field" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.hidden_field :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet f. "f.label" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.label :${1:attribute}${2:, "${3:${1/[[:alpha:]]+|(_)/(?1: :\u$0)/g}}"}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet f. "f.password_field" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.password_field :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet f. "f.radio_button" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.radio_button :${1:attribute}, :${2:tag_value}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet f. "f.submit" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.submit "${1:Submit}"${2:, disable_with: '${3:$1ing...}'}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet f. "f.text_area" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.text_area :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet f. "f.text_field" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`f.text_field :${1:attribute}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet ffe "form_for with errors" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`error_messages_for :${1:model}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`form_for @${2:$1} do |f|`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
$0
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet ff "form_for" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`form_for @${1:model} do |f|`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
$0
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_BLOCK', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet ist "image_submit_tag" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`image_submit_tag("${1:agree.png}"${2:${3:, id: "${4:${1/^(\w+)(\.\w*)?$/$1/}}"}${5:, name: "${6:${1/^(\w+)(\.\w*)?$/$1/}}"}${7:, class: "${8:${1/^(\w+)(\.\w*)?$/$1/}-button}"}${9:, disabled: ${10:false}}})`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet it "image_tag" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`image_tag "$1${2:.png}"${3:${4:, title: "${5:title}"}${6:, class: "${7:class}"}}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet layout "layout"
|
||||
layout "${1:template_name}"${2:${3:, only: ${4:[:${5:action}, :${6:action}]}}${7:, except: ${8:[:${9:action}, :${10:action}]}}}
|
||||
endsnippet
|
||||
|
||||
snippet jit "javascript_include_tag" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`javascript_include_tag ${1::all}${2:, cache: ${3:true}}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet lt "link_to (name, dest)" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", ${2:dest}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet lia "link_to (action)" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", action: "${2:index}"`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet liai "link_to (action, id)" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", action: "${2:edit}", id: ${3:@item}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet lic "link_to (controller)" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", controller: "${2:items}"`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet lica "link_to (controller, action)" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", controller: "${2:items}", action: "${3:index}"`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet licai "link_to (controller, action, id)" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to "${1:link text...}", controller: "${2:items}", action: "${3:edit}", id: ${4:@item}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet linpp "link_to (nested path plural)" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to ${1:"${2:link text...}"}, ${3:${10:parent}_${11:child}_path(${12:@}${13:$10})}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet linp "link_to (nested path)" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to ${1:"${2:link text...}"}, ${3:${12:parent}_${13:child}_path(${14:@}${15:$12}, ${16:@}${17:$13})}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet lipp "link_to (path plural)" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to ${1:"${2:link text...}"}, ${3:${4:model}s_path}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet lip "link_to (path)" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to ${1:"${2:link text...}"}, ${3:${12:model}_path(${13:@}${14:$12})}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet lim "link_to model" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to ${1:model}.${2:name}, ${3:${4:$1}_path(${14:$1})}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet hide "page.hide (*ids)"
|
||||
page.hide ${1:"${2:id(s)}"}
|
||||
endsnippet
|
||||
|
||||
snippet ins "page.insert_html (position, id, partial)"
|
||||
page.insert_html :${1:top}, ${2:"${3:id}"}, ${4:partial: "${5:template}"}
|
||||
endsnippet
|
||||
|
||||
snippet rep "page.replace (id, partial)"
|
||||
page.replace ${1:"${2:id}"}, ${3:partial: "${4:template}"}
|
||||
endsnippet
|
||||
|
||||
snippet reph "page.replace_html (id, partial)"
|
||||
page.replace_html ${1:"${2:id}"}, ${3:partial: "${4:template}"}
|
||||
endsnippet
|
||||
|
||||
snippet show "page.show (*ids)"
|
||||
page.show ${1:"${2:id(s)}"}
|
||||
endsnippet
|
||||
|
||||
snippet tog "page.toggle (*ids)"
|
||||
page.toggle ${1:"${2:id(s)}"}
|
||||
endsnippet
|
||||
|
||||
snippet vis "page.visual_effect (effect, id)"
|
||||
page.visual_effect :${1:toggle_slide}, ${2:"${3:DOM ID}"}
|
||||
endsnippet
|
||||
|
||||
snippet rp "render (partial) (rp)"
|
||||
render partial: "${1:item}"
|
||||
endsnippet
|
||||
|
||||
snippet rpc "render (partial,collection) (rpc)"
|
||||
render partial: "${1:item}", collection: ${2:@$1s}
|
||||
endsnippet
|
||||
|
||||
snippet rpl "render (partial,locals) (rpl)"
|
||||
render partial: "${1:item}", locals: { ${2:$1}: ${3:@$1}$0 }
|
||||
endsnippet
|
||||
|
||||
snippet rpo "render (partial,object) (rpo)"
|
||||
render partial: "${1:item}", object: ${2:@$1}
|
||||
endsnippet
|
||||
|
||||
snippet rps "render (partial,status) (rps)"
|
||||
render partial: "${1:item}", status: ${2:500}
|
||||
endsnippet
|
||||
|
||||
snippet slt "stylesheet_link_tag" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`stylesheet_link_tag ${1::all}${2:, cache: ${3:true}}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet st "submit_tag" w
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`submit_tag "${1:Save changes}"${2:, id: "${3:submit}"}${4:, name: "${5:$3}"}${6:, class: "${7:form_$3}"}${8:, disabled: ${9:false}}${10:, disable_with: "${11:Please wait...}"}`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
snippet else "else (ERB)"
|
||||
<% else %>
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet lf "link_to_function"
|
||||
`!p textmate_var('TM_RAILS_TEMPLATE_START_RUBY_EXPR', snip)`link_to_function ${1:"${2:Greeting}"}, "${3:alert('Hello world!')}"$4`!p textmate_var('TM_RAILS_TEMPLATE_END_RUBY_EXPR', snip)`
|
||||
endsnippet
|
||||
|
||||
# vim:ft=snippets:
|
130
.vim/UltiSnips/gitcommit.snippets
Normal file
|
@ -0,0 +1,130 @@
|
|||
global !p
|
||||
def complete(t, opts):
|
||||
if t:
|
||||
opts = [ m[len(t):] for m in opts if m.startswith(t) ]
|
||||
if len(opts) == 1:
|
||||
return opts[0]
|
||||
return '(' + '|'.join(opts) + ')'
|
||||
endglobal
|
||||
|
||||
snippet status "Status" bA
|
||||
status $1`!p snip.rv = complete(t[1], ['build', 'ci', 'test', 'refactor', 'perf', 'improvement', 'docs', 'chore', 'feat', 'fix'])`
|
||||
endsnippet
|
||||
|
||||
snippet fix "fix conventional commit"
|
||||
fix(${1:scope}): ${2:title}
|
||||
|
||||
${0:${VISUAL}}
|
||||
endsnippet
|
||||
|
||||
snippet feat "feat conventional commit"
|
||||
feat(${1:scope}): ${2:title}
|
||||
|
||||
${0:${VISUAL}}
|
||||
endsnippet
|
||||
|
||||
snippet chore "chore conventional commit"
|
||||
chore(${1:scope}): ${2:title}
|
||||
|
||||
${0:${VISUAL}}
|
||||
endsnippet
|
||||
|
||||
snippet docs "docs conventional commit"
|
||||
docs(${1:scope}): ${2:title}
|
||||
|
||||
${0:${VISUAL}}
|
||||
endsnippet
|
||||
|
||||
snippet improvement "improvement conventional commit"
|
||||
improvement(${1:scope}): ${2:title}
|
||||
|
||||
${0:${VISUAL}}
|
||||
endsnippet
|
||||
|
||||
snippet perf "perf conventional commit"
|
||||
perf(${1:scope}): ${2:title}
|
||||
|
||||
${0:${VISUAL}}
|
||||
endsnippet
|
||||
|
||||
snippet refactor "refactor conventional commit"
|
||||
refactor(${1:scope}): ${2:title}
|
||||
|
||||
${0:${VISUAL}}
|
||||
endsnippet
|
||||
|
||||
snippet test "test conventional commit"
|
||||
test(${1:scope}): ${2:title}
|
||||
|
||||
${0:${VISUAL}}
|
||||
endsnippet
|
||||
|
||||
snippet ci "ci conventional commit"
|
||||
ci(${1:scope}): ${2:title}
|
||||
|
||||
${0:${VISUAL}}
|
||||
endsnippet
|
||||
|
||||
snippet build "build conventional commit"
|
||||
build(${1:scope}): ${2:title}
|
||||
|
||||
${0:${VISUAL}}
|
||||
endsnippet
|
||||
|
||||
snippet sign "Signature"
|
||||
-------------------------------------------------------------------------------
|
||||
${1:Company Name}
|
||||
|
||||
${2:Author Name}
|
||||
|
||||
${3:Streetname 21}
|
||||
${4:City and Area}
|
||||
|
||||
${5:Tel: +44 (0)987 / 888 8888}
|
||||
${6:Fax: +44 (0)987 / 888 8882}
|
||||
${7:Mail: Email}
|
||||
${8:Web: https://}
|
||||
-------------------------------------------------------------------------------
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet t "Todo"
|
||||
TODO: ${1:What is it} (`date "+%b %d %Y %a (%H:%M:%S)"`, `echo $USER`)
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet cmt "Commit Structure" bA
|
||||
${1:Summarize changes in around 50 characters or less}
|
||||
|
||||
${2:More detailed explanatory text, if necessary. Wrap it to about 72
|
||||
characters or so. In some contexts, the first line is treated as the
|
||||
subject of the commit and the rest of the text as the body. The
|
||||
blank line separating the summary from the body is critical (unless
|
||||
you omit the body entirely); various tools like `log`, `shortlog`
|
||||
and `rebase` can get confused if you run the two together.}
|
||||
|
||||
${3:Explain the problem that this commit is solving. Focus on why you
|
||||
are making this change as opposed to how (the code explains that).
|
||||
Are there side effects or other unintuitive consequences of this
|
||||
change? Here's the place to explain them.}
|
||||
|
||||
${4:Further paragraphs come after blank lines.
|
||||
|
||||
- Bullet points are okay, too
|
||||
|
||||
- Typically a hyphen or asterisk is used for the bullet, preceded
|
||||
by a single space, with blank lines in between, but conventions
|
||||
vary here}
|
||||
|
||||
${5:Status}
|
||||
|
||||
${6:If you use an issue tracker, put references to them at the bottom,
|
||||
like this.}
|
||||
|
||||
${7:Any todos}
|
||||
|
||||
${8:Resolves: #123
|
||||
See also: #456, #789}
|
||||
|
||||
${9:Signature}
|
||||
endsnippet
|
13
.vim/UltiSnips/haskell.snippets
Normal file
|
@ -0,0 +1,13 @@
|
|||
priority -50
|
||||
|
||||
snippet imp "Simple import"
|
||||
import ${1:${2:Data}.${0:Text}}
|
||||
endsnippet
|
||||
|
||||
snippet imp2 "Selective import" b
|
||||
import ${1:${2:Data}.${3:Text}} (${4})${0}
|
||||
endsnippet
|
||||
|
||||
snippet impq "Qualified import"
|
||||
import qualified ${1:${2:Data}.${3:Text}} as ${0:`!p snip.rv = t[1].split(".")[-1]`}
|
||||
endsnippet
|
37
.vim/UltiSnips/help.snippets
Normal file
|
@ -0,0 +1,37 @@
|
|||
# Snippets for VIM Help Files
|
||||
|
||||
priority -50
|
||||
|
||||
global !p
|
||||
def sec_title(snip, t):
|
||||
file_start = snip.fn.split('.')[0]
|
||||
sec_name = t[1].strip("1234567890. ").lower().replace(' ', '-')
|
||||
return ("*%s-%s*" % (file_start, sec_name)).rjust(78-len(t[1]))
|
||||
endglobal
|
||||
|
||||
snippet sec "Section marker" b
|
||||
==============================================================================
|
||||
${1:SECTION}`!p snip.rv = sec_title(snip, t)`
|
||||
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet ssec "Sub section marker" b
|
||||
${1:Subsection}`!p snip.rv = sec_title(snip, t)
|
||||
snip += "-"*len(t[1])`
|
||||
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet sssec "Subsub Section marker" b
|
||||
${1:SubSubsection}:`!p snip.rv = sec_title(snip, t)`
|
||||
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
# For vim help, follow the same settings as the official docs.
|
||||
snippet modeline "Vim help modeline"
|
||||
`!v 'vim'`:tw=78:ts=8:ft=help:norl:
|
||||
endsnippet
|
||||
|
||||
# vim:ft=snippets:
|
534
.vim/UltiSnips/html.snippets
Normal file
|
@ -0,0 +1,534 @@
|
|||
priority -50
|
||||
|
||||
###########################################################################
|
||||
# TextMate Snippets #
|
||||
###########################################################################
|
||||
|
||||
global !p
|
||||
def x(snip):
|
||||
if snip.ft.startswith("x"):
|
||||
snip.rv = '/'
|
||||
else:
|
||||
snip.rv = ""
|
||||
endglobal
|
||||
|
||||
snippet doctype "HTML - 5.0 (doctype)" b
|
||||
<!DOCTYPE html>
|
||||
|
||||
endsnippet
|
||||
|
||||
#############
|
||||
# Shortcuts #
|
||||
#############
|
||||
snippet down "Down (down)"
|
||||
↓
|
||||
endsnippet
|
||||
|
||||
snippet enter "Enter (enter)"
|
||||
⌅
|
||||
endsnippet
|
||||
|
||||
snippet escape "Escape (escape)"
|
||||
⎋
|
||||
endsnippet
|
||||
|
||||
snippet left "Left (left)"
|
||||
←
|
||||
endsnippet
|
||||
|
||||
snippet return "Return (return)"
|
||||
↩
|
||||
endsnippet
|
||||
|
||||
snippet right "Right (right)"
|
||||
→
|
||||
endsnippet
|
||||
|
||||
snippet shift "Shift (shift)"
|
||||
⇧
|
||||
endsnippet
|
||||
|
||||
snippet tab "Tab (tab)"
|
||||
⇥
|
||||
endsnippet
|
||||
|
||||
snippet up "Up (up)"
|
||||
↑
|
||||
endsnippet
|
||||
|
||||
#############
|
||||
# HTML TAGS #
|
||||
#############
|
||||
snippet a "Link" w
|
||||
<a href="${1:http://www.${2:url.com}}"${3: target="_blank"}>${4:Anchor Text}</a>
|
||||
endsnippet
|
||||
|
||||
snippet abbr "<abbr>" w
|
||||
<abbr title="$2">$1</abbr>
|
||||
endsnippet
|
||||
|
||||
snippet access "accesskey global attribute"
|
||||
accesskey="$1"
|
||||
endsnippet
|
||||
|
||||
snippet address "<address>" w
|
||||
<address>$1</address>
|
||||
endsnippet
|
||||
|
||||
snippet article "<article>"
|
||||
<article>
|
||||
${1:article content}
|
||||
</article>
|
||||
endsnippet
|
||||
|
||||
snippet aside "<aside>"
|
||||
<aside>
|
||||
${1:aside content}
|
||||
</aside>
|
||||
endsnippet
|
||||
|
||||
snippet b "<b>" w
|
||||
<b>$1</b>
|
||||
endsnippet
|
||||
|
||||
snippet base "HTML <base>" w
|
||||
<base href="$1"${2: target="$3"}`!p x(snip)`>
|
||||
endsnippet
|
||||
|
||||
snippet blockquote "<blockquote>"
|
||||
<blockquote>$1</blockquote>
|
||||
endsnippet
|
||||
|
||||
snippet body "<body>"
|
||||
<body>
|
||||
${0:${VISUAL}}
|
||||
</body>
|
||||
endsnippet
|
||||
|
||||
snippet br "<br>" w
|
||||
<br>$1</br>
|
||||
endsnippet
|
||||
|
||||
snippet button "<button>"
|
||||
<button>$1</button>
|
||||
endsnippet
|
||||
|
||||
snippet caption "<caption>"
|
||||
<caption>$1</caption>
|
||||
endsnippet
|
||||
|
||||
snippet cite "<cite>" w
|
||||
<cite>$1</cite>
|
||||
endsnippet
|
||||
|
||||
snippet class "class global attribute"
|
||||
class="$1"
|
||||
endsnippet
|
||||
|
||||
snippet code "<code>" w
|
||||
<code>$1</code>
|
||||
endsnippet
|
||||
|
||||
snippet data "<data>"
|
||||
<data value="$2">$1</data>
|
||||
endsnippet
|
||||
|
||||
snippet datalist "<datalist>"
|
||||
<datalist id="$1" name="$2">
|
||||
opt$3
|
||||
</datalist>
|
||||
endsnippet
|
||||
|
||||
snippet dd "<dd>"
|
||||
<dd>$1</dd>
|
||||
endsnippet
|
||||
|
||||
snippet del "<del>" w
|
||||
<del cite="$2" datetime="${3:`date '+%Y-%m-%dT%H:%M:%S%:z'`}">$1</del>
|
||||
endsnippet
|
||||
|
||||
snippet dfn "<dfn>" w
|
||||
<dfn>$1</dfn>
|
||||
endsnippet
|
||||
|
||||
snippet div "<div>" w
|
||||
<div>
|
||||
${0:${VISUAL}}
|
||||
</div>
|
||||
endsnippet
|
||||
|
||||
snippet div# "<div> with ID & class" w
|
||||
<div`!p snip.rv=' id="' if t[1] else ""`${1:name}`!p snip.rv = '"' if t[1] else ""``!p snip.rv=' class="' if t[2] else ""`${2:name}`!p snip.rv = '"' if t[2] else ""`>
|
||||
${0:${VISUAL}}
|
||||
</div>
|
||||
endsnippet
|
||||
|
||||
snippet div. "<div> with class" w
|
||||
<div`!p snip.rv=' class="' if t[1] else ""`${1:name}`!p snip.rv = '"' if t[1] else ""`>
|
||||
${0:${VISUAL}}
|
||||
</div>
|
||||
endsnippet
|
||||
|
||||
snippet dl "<dl>"
|
||||
<dl>
|
||||
${1:Definition list}
|
||||
</dl>
|
||||
endsnippet
|
||||
|
||||
snippet dt "<dt>"
|
||||
<dt>$1</dt>
|
||||
endsnippet
|
||||
|
||||
snippet em "<em>" w
|
||||
<em>$1</em>
|
||||
endsnippet
|
||||
|
||||
snippet fieldset "Fieldset" w
|
||||
<fieldset id="${1/[\w\d]+|( )/(?1:_:\L$0\E)/g}" ${2:class="${3:}"}>
|
||||
<legend>$1</legend>
|
||||
${0:${VISUAL}}
|
||||
</fieldset>
|
||||
endsnippet
|
||||
|
||||
snippet fig "<figure>"
|
||||
<figure>
|
||||
$1
|
||||
<figcaption>$2</figcaption>
|
||||
</figure>
|
||||
endsnippet
|
||||
|
||||
snippet figcaption "<figcaption>"
|
||||
<figcaption>$1</figcaption>
|
||||
endsnippet
|
||||
|
||||
snippet footer "<footer>"
|
||||
<footer>
|
||||
${1:footer content}
|
||||
</footer>
|
||||
endsnippet
|
||||
|
||||
snippet form "HTML <form>" w
|
||||
<form action="${1:`!p
|
||||
snip.rv = (snip.basename or 'unnamed') + '_submit'
|
||||
`}" method="${2:get}" accept-charset="utf-8">
|
||||
${0:${VISUAL}}
|
||||
</form>
|
||||
endsnippet
|
||||
|
||||
snippet h1 "HTML <h1>" w
|
||||
<h1>${0:${VISUAL}}</h1>
|
||||
endsnippet
|
||||
|
||||
snippet h2 "HTML <h2>" w
|
||||
<h2>${0:${VISUAL}}</h2>
|
||||
endsnippet
|
||||
|
||||
snippet h3 "HTML <h3>" w
|
||||
<h3>${0:${VISUAL}}</h3>
|
||||
endsnippet
|
||||
|
||||
snippet h4 "HTML <h4>" w
|
||||
<h4>${0:${VISUAL}}</h4>
|
||||
endsnippet
|
||||
|
||||
snippet h5 "HTML <h5>" w
|
||||
<h5>${0:${VISUAL}}</h5>
|
||||
endsnippet
|
||||
|
||||
snippet h6 "HTML <h6>" w
|
||||
<h6>${0:${VISUAL}}</h6>
|
||||
endsnippet
|
||||
|
||||
snippet head "HTML <head>"
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>${1:`!p snip.rv = snip.basename or "Page Title"`}</title>
|
||||
${0:${VISUAL}}
|
||||
</head>
|
||||
endsnippet
|
||||
|
||||
snippet header "<header>"
|
||||
<header>
|
||||
${1:header content}
|
||||
</header>
|
||||
endsnippet
|
||||
|
||||
snippet hr "<hr>"
|
||||
<hr>
|
||||
endsnippet
|
||||
|
||||
snippet html "HTML basic structure" b
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<title>${1:`!p snip.rv = snip.basename.replace('-', ' ').capitalize()`}</title>
|
||||
</head>
|
||||
<body>
|
||||
${0:body}
|
||||
</body>
|
||||
</html>
|
||||
endsnippet
|
||||
|
||||
snippet htmll "HTML basic structure with the lang attribute" b
|
||||
<!DOCTYPE html>
|
||||
<html lang="${1:es}">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>${2:`!p snip.rv = snip.basename.replace('-', ' ').capitalize()`}</title>
|
||||
</head>
|
||||
<body>
|
||||
${0:body}
|
||||
</body>
|
||||
</html>
|
||||
endsnippet
|
||||
|
||||
snippet i "<i>" w
|
||||
<i>$1</i>
|
||||
endsnippet
|
||||
|
||||
snippet id "id global attribute"
|
||||
id="$1"
|
||||
endsnippet
|
||||
|
||||
snippet img "<img>"
|
||||
<img src="$1" alt="$2">
|
||||
endsnippet
|
||||
|
||||
snippet input "Input with Label" w
|
||||
<label for="${2:${1/[[:alpha:]]+|( )/(?1:_:\L$0)/g}}">$1</label><input type="${3:text/submit/hidden/button}" name="${4:$2}" value="$5"${6: id="${7:$2}"}`!p x(snip)`>
|
||||
endsnippet
|
||||
|
||||
snippet input "HTML <input>" w
|
||||
<input type="${1:text/submit/hidden/button}" name="${2:some_name}" value="$3"${4: id="${5:$2}"}`!p x(snip)`>
|
||||
endsnippet
|
||||
|
||||
snippet ins "<ins>" w
|
||||
<ins cite="$2" datetime="${3:`date '+%Y-%m-%dT%H:%M:%S%:z'`}">$1</ins>
|
||||
endsnippet
|
||||
|
||||
snippet kbd "<kbd>" w
|
||||
<kbd>$1</kbd>
|
||||
endsnippet
|
||||
|
||||
snippet label "<label>"
|
||||
<label>$1</label>
|
||||
endsnippet
|
||||
|
||||
snippet legend "<legend>"
|
||||
<legend>$1</legend>
|
||||
endsnippet
|
||||
|
||||
snippet li "list item" w
|
||||
<li>${0:${VISUAL}}</li>
|
||||
endsnippet
|
||||
|
||||
snippet link "HTML <link>" w
|
||||
<link rel="${1:stylesheet}" href="${2:/css/master.css}" type="text/css" media="${3:screen}" title="${4:no title}" charset="${5:utf-8}"`!p x(snip)`>
|
||||
endsnippet
|
||||
|
||||
snippet mailto "HTML <a mailto: >" w
|
||||
<a href="mailto:${1:joe@example.com}?subject=${2:feedback}">${3:email me}</a>
|
||||
endsnippet
|
||||
|
||||
snippet tel "HTML <a tel: >" w
|
||||
<a href="tel:+${1:XX1234567890}">${2:call me}</a>
|
||||
endsnippet
|
||||
|
||||
snippet main "<main>"
|
||||
<main>
|
||||
${1:main content}
|
||||
</main>
|
||||
endsnippet
|
||||
|
||||
snippet mark "<mark>"
|
||||
<mark>$1</mark>
|
||||
endsnippet
|
||||
|
||||
snippet meta "HTML <meta>" w
|
||||
<meta name="${1:name}" content="${2:content}"`!p x(snip)`>
|
||||
endsnippet
|
||||
|
||||
snippet meter "<meter>"
|
||||
<meter>$1</meter>
|
||||
endsnippet
|
||||
|
||||
snippet nav "<nav>"
|
||||
<nav>
|
||||
${1:navigation links}
|
||||
</nav>
|
||||
endsnippet
|
||||
|
||||
snippet noscript "<noscript>"
|
||||
<noscript>$1</noscript>
|
||||
endsnippet
|
||||
|
||||
snippet ol "<ol>"
|
||||
<ol>
|
||||
<li>$1</li>
|
||||
</ol>
|
||||
endsnippet
|
||||
|
||||
snippet optgroup "<optgroup>"
|
||||
<optgroup label="$1">
|
||||
opt$2
|
||||
</optgroup>
|
||||
endsnippet
|
||||
|
||||
snippet output "<output>"
|
||||
<output for="$1" name="$2">$3</output>
|
||||
endsnippet
|
||||
|
||||
snippet option "Option" w
|
||||
<option${1: value="${2:option}"}>${3:$2}</option>
|
||||
endsnippet
|
||||
|
||||
snippet p "paragraph" w
|
||||
<p>${0:${VISUAL}}</p>
|
||||
endsnippet
|
||||
|
||||
snippet picture "<picture>"
|
||||
<picture>
|
||||
${1:image sources}
|
||||
</picture>
|
||||
endsnippet
|
||||
|
||||
snippet pre "<pre>"
|
||||
<pre>$1</pre>
|
||||
endsnippet
|
||||
|
||||
snippet progress "<progress>"
|
||||
<progress>$1</progress>
|
||||
endsnippet
|
||||
|
||||
snippet q "<q>" w
|
||||
<q>$1</q>
|
||||
endsnippet
|
||||
|
||||
snippet s "<s>" w
|
||||
<s>$1</s>
|
||||
endsnippet
|
||||
|
||||
snippet samp "<samp>" w
|
||||
<samp>$1</samp>
|
||||
endsnippet
|
||||
|
||||
snippet script "HTML <script>" w
|
||||
<script charset="utf-8">
|
||||
${0:${VISUAL}}
|
||||
</script>
|
||||
endsnippet
|
||||
|
||||
snippet scriptsrc "HTML <script src...>" w
|
||||
<script src="$1" charset="${3:utf-8}"></script>
|
||||
endsnippet
|
||||
|
||||
snippet select "Select Box" w
|
||||
<select name="${1:some_name}" id="${2:$1}"${3:${4: multiple}${5: size="${6:1}"}}>
|
||||
${0:${VISUAL}}
|
||||
</select>
|
||||
endsnippet
|
||||
|
||||
snippet small "<small>" w
|
||||
<small>$1</small>
|
||||
endsnippet
|
||||
|
||||
snippet span "<span>" w
|
||||
<span>${0:${VISUAL}}</span>
|
||||
endsnippet
|
||||
|
||||
snippet span# "<span> with ID & class" w
|
||||
<span`!p snip.rv=' id="' if t[1] else ""`${1:name}`!p snip.rv = '"' if t[1] else ""``!p snip.rv=' class="' if t[2] else ""`${2:name}`!p snip.rv = '"' if t[2] else ""`>${0:${VISUAL}}</span>
|
||||
endsnippet
|
||||
|
||||
snippet span. "<span> with class" w
|
||||
<span`!p snip.rv=' class="' if t[1] else ""`${1:name}`!p snip.rv = '"' if t[1] else ""`>${0:${VISUAL}}</span>
|
||||
endsnippet
|
||||
|
||||
snippet strong "<strong>" w
|
||||
<strong>$1</strong>
|
||||
endsnippet
|
||||
|
||||
snippet style "HTML <style>" w
|
||||
<style type="text/css" media="screen">
|
||||
${0:${VISUAL}}
|
||||
</style>
|
||||
endsnippet
|
||||
|
||||
snippet sub "<sub>" w
|
||||
<sub>$1</sub>
|
||||
endsnippet
|
||||
|
||||
snippet sup "<sup>" w
|
||||
<sup>$1</sup>
|
||||
endsnippet
|
||||
|
||||
snippet table "HTML <table>" w
|
||||
<table>
|
||||
${0:${VISUAL}}
|
||||
</table>
|
||||
endsnippet
|
||||
|
||||
snippet tbody "<tbody>"
|
||||
<tbody>$1</tbody>
|
||||
endsnippet
|
||||
|
||||
snippet td "table cell" w
|
||||
<td>${0:${VISUAL}}</td>
|
||||
endsnippet
|
||||
|
||||
snippet template "<template>"
|
||||
<template id="$1">
|
||||
$2
|
||||
</template>
|
||||
endsnippet
|
||||
|
||||
snippet textarea "HTML <textarea>" w
|
||||
<textarea name="${1:Name}" rows="${2:8}" cols="${3:40}">$0</textarea>
|
||||
endsnippet
|
||||
|
||||
snippet tfoot "<tfoot>"
|
||||
<tfoot>$1</tfoot>
|
||||
endsnippet
|
||||
|
||||
snippet th "table header" w
|
||||
<th>${0:${VISUAL}}</th>
|
||||
endsnippet
|
||||
|
||||
snippet thead "<thead>"
|
||||
<thead>$1</thead>
|
||||
endsnippet
|
||||
|
||||
snippet time "<time>" w
|
||||
<time datetime="$2">$1</time>
|
||||
endsnippet
|
||||
|
||||
snippet title "HTML <title>" w
|
||||
<title>${1:`!p snip.rv = snip.basename or "Page Title"`}</title>
|
||||
endsnippet
|
||||
|
||||
snippet tr "table row" w
|
||||
<tr>${0:${VISUAL}}</tr>
|
||||
endsnippet
|
||||
|
||||
snippet ul "unordered list" w
|
||||
<ul>
|
||||
${0:${VISUAL}}
|
||||
</ul>
|
||||
endsnippet
|
||||
|
||||
snippet var "<var>" w
|
||||
<var>$1</var>
|
||||
endsnippet
|
||||
|
||||
snippet viewport "Responsive viewport meta" w
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
endsnippet
|
||||
|
||||
snippet wbr "<wbr>" w
|
||||
<wbr>$1</wbr>
|
||||
endsnippet
|
||||
|
||||
# vim:ft=snippets:
|
33
.vim/UltiSnips/html_minimal.snippets
Normal file
|
@ -0,0 +1,33 @@
|
|||
# more can be found in snippets/html_minimal.snippets
|
||||
# these UltiSnips override snippets because nested placeholders are being used
|
||||
|
||||
priority -49
|
||||
|
||||
snippet id
|
||||
id="$1"$2
|
||||
endsnippet
|
||||
|
||||
snippet idn
|
||||
id="$1" name="${2:$1}"
|
||||
endsnippet
|
||||
|
||||
snippet label_and_input
|
||||
<label for="${2:$1}">$1</label>
|
||||
<input type="${3:text}" name="${4:$2}"${5: id="${6:$2}"} value="$7" />$8
|
||||
endsnippet
|
||||
|
||||
snippet input
|
||||
<input type="${1:text}" value="$2" name="$3"${4: id="${5:$3}"}/>$7
|
||||
endsnippet
|
||||
|
||||
snippet submit
|
||||
<input type="submit" value="$2" $3/>$7
|
||||
endsnippet
|
||||
|
||||
snippet textarea
|
||||
<textarea name="$2"${3: id="$4"}>$5</textarea>
|
||||
endsnippet
|
||||
|
||||
snippet img
|
||||
<img src="$1"${2: alt="$3"}/>
|
||||
endsnippet
|
299
.vim/UltiSnips/htmldjango.snippets
Normal file
|
@ -0,0 +1,299 @@
|
|||
priority -50
|
||||
|
||||
extends html
|
||||
|
||||
# Generic Tags
|
||||
snippet % "" bi
|
||||
{% $1 %}$2
|
||||
endsnippet
|
||||
|
||||
snippet %% "" bi
|
||||
{% ${1:tag_name} %}
|
||||
$2
|
||||
{% end$1 %}
|
||||
endsnippet
|
||||
|
||||
snippet { "" bi
|
||||
{{ $1 }}$2
|
||||
endsnippet
|
||||
|
||||
# Template Tags
|
||||
|
||||
snippet autoescape "" bi
|
||||
{% autoescape ${1:off} %}
|
||||
$2
|
||||
{% endautoescape %}
|
||||
endsnippet
|
||||
|
||||
snippet block "" bi
|
||||
{% block $1 %}
|
||||
$2
|
||||
{% endblock $1 %}
|
||||
endsnippet
|
||||
|
||||
snippet # "" bi
|
||||
{# ${1:comment} #}
|
||||
endsnippet
|
||||
|
||||
snippet comment "" bi
|
||||
{% comment %}
|
||||
$1
|
||||
{% endcomment %}
|
||||
endsnippet
|
||||
|
||||
snippet cycle "" bi
|
||||
{% cycle ${1:val1} ${2:val2} ${3:as $4} %}
|
||||
endsnippet
|
||||
|
||||
snippet debug "" bi
|
||||
{% debug %}
|
||||
endsnippet
|
||||
|
||||
snippet extends "" bi
|
||||
{% extends "${1:base.html}" %}
|
||||
endsnippet
|
||||
|
||||
snippet filter "" bi
|
||||
{% filter $1 %}
|
||||
$2
|
||||
{% endfilter %}
|
||||
endsnippet
|
||||
|
||||
snippet firstof "" bi
|
||||
{% firstof $1 %}
|
||||
endsnippet
|
||||
|
||||
snippet for "" bi
|
||||
{% for $1 in $2 %}
|
||||
$3
|
||||
{% endfor %}
|
||||
endsnippet
|
||||
|
||||
snippet empty "" bi
|
||||
{% empty %}
|
||||
$1
|
||||
endsnippet
|
||||
|
||||
snippet if "" bi
|
||||
{% if $1 %}
|
||||
$2
|
||||
{% endif %}
|
||||
endsnippet
|
||||
|
||||
snippet iif "" bi
|
||||
{% if $1 %}$2{% endif %}
|
||||
endsnippet
|
||||
|
||||
snippet ielse "" bi
|
||||
{% else %}$1
|
||||
endsnippet
|
||||
|
||||
snippet else "" bi
|
||||
{% else %}
|
||||
$1
|
||||
endsnippet
|
||||
|
||||
snippet ielif "" bi
|
||||
{% elif %}$1
|
||||
endsnippet
|
||||
|
||||
snippet elif "" bi
|
||||
{% elif %}
|
||||
$1
|
||||
endsnippet
|
||||
|
||||
snippet ifchanged "" bi
|
||||
{% ifchanged %}$1{% endifchanged %}
|
||||
endsnippet
|
||||
|
||||
snippet ifequal "" bi
|
||||
{% ifequal $1 $2 %}
|
||||
$3
|
||||
{% endifequal %}
|
||||
endsnippet
|
||||
|
||||
snippet ifnotequal "" bi
|
||||
{% ifnotequal $1 $2 %}
|
||||
$3
|
||||
{% endifnotequal %}
|
||||
endsnippet
|
||||
|
||||
snippet include "" bi
|
||||
{% include "$1" %}
|
||||
endsnippet
|
||||
|
||||
snippet load "" bi
|
||||
{% load $1 %}
|
||||
endsnippet
|
||||
|
||||
snippet now "" bi
|
||||
{% now "${1:jS F Y H:i}" %}
|
||||
endsnippet
|
||||
|
||||
snippet regroup "" bi
|
||||
{% regroup $1 by $2 as $3 %}
|
||||
endsnippet
|
||||
|
||||
snippet spaceless "" bi
|
||||
{% spaceless %}$1{% endspaceless %}
|
||||
endsnippet
|
||||
|
||||
snippet ssi "" bi
|
||||
{% ssi $1 %}
|
||||
endsnippet
|
||||
|
||||
snippet trans "" bi
|
||||
{% trans "${1:string}" %}
|
||||
endsnippet
|
||||
|
||||
snippet url "" bi
|
||||
{% url $1 as $2 %}
|
||||
endsnippet
|
||||
|
||||
snippet widthratio "" bi
|
||||
{% widthratio ${1:this_value} ${2:max_value} ${3:100} %}
|
||||
endsnippet
|
||||
|
||||
snippet with "" bi
|
||||
{% with $1 as $2 %}
|
||||
${VISUAL}
|
||||
{% endwith %}
|
||||
endsnippet
|
||||
|
||||
snippet verbatim "" bi
|
||||
{% verbatim %}
|
||||
${VISUAL}
|
||||
{% endverbatim %}
|
||||
endsnippet
|
||||
|
||||
snippet super "" bi
|
||||
{{ block.super }}
|
||||
endsnippet
|
||||
|
||||
snippet staticu "" bi
|
||||
{{ STATIC_URL }}
|
||||
endsnippet
|
||||
|
||||
snippet static "" bi
|
||||
{% static "${VISUAL}" %}
|
||||
endsnippet
|
||||
|
||||
snippet mediau "" bi
|
||||
{{ MEDIA_URL }}
|
||||
endsnippet
|
||||
|
||||
snippet iblock "" bi
|
||||
{% block ${1:blockname} %}${VISUAL}{% endblock $1 %}
|
||||
endsnippet
|
||||
|
||||
snippet csrf "" bi
|
||||
{% csrf_token %}
|
||||
endsnippet
|
||||
|
||||
snippet blocktrans "" bi
|
||||
{% blocktrans %}
|
||||
${VISUAL}
|
||||
{% endblocktrans %}
|
||||
endsnippet
|
||||
|
||||
snippet lorem "" bi
|
||||
{% lorem $1 %}
|
||||
endsnippet
|
||||
|
||||
# Template Filters
|
||||
|
||||
# Note: Since SnipMate can't determine which template filter you are
|
||||
# expanding without the "|" character, these do not add the "|"
|
||||
# character. These save a few keystrokes still.
|
||||
|
||||
# Note: Template tags that take no arguments are not implemented.
|
||||
|
||||
snippet add "" bi
|
||||
add:"$1"
|
||||
endsnippet
|
||||
|
||||
snippet center "" bi
|
||||
center:"$1"
|
||||
endsnippet
|
||||
|
||||
snippet cut "" bi
|
||||
cut:"$1"
|
||||
endsnippet
|
||||
|
||||
snippet date "" bi
|
||||
date:"$1"
|
||||
endsnippet
|
||||
|
||||
snippet default "" bi
|
||||
default:"$1"
|
||||
endsnippet
|
||||
|
||||
snippet defaultifnone "" bi
|
||||
default_if_none:"$1"
|
||||
endsnippet
|
||||
|
||||
snippet dictsort "" bi
|
||||
dictsort:"$1"
|
||||
endsnippet
|
||||
|
||||
snippet dictsortrev "" bi
|
||||
dictsortreversed:"$1"
|
||||
endsnippet
|
||||
|
||||
snippet divisibleby "" bi
|
||||
divisibleby:"$1"
|
||||
endsnippet
|
||||
|
||||
snippet floatformat "" bi
|
||||
floatformat:"$1"
|
||||
endsnippet
|
||||
|
||||
snippet getdigit "" bi
|
||||
get_digit:"$1"
|
||||
endsnippet
|
||||
|
||||
snippet join "" bi
|
||||
join:"$1"
|
||||
endsnippet
|
||||
|
||||
snippet lengthis "" bi
|
||||
length_is:"$1"
|
||||
endsnippet
|
||||
|
||||
snippet pluralize "" bi
|
||||
pluralize:"$1"
|
||||
endsnippet
|
||||
|
||||
snippet removetags "" bi
|
||||
removetags:"$1"
|
||||
endsnippet
|
||||
|
||||
snippet slice "" bi
|
||||
slice:"$1"
|
||||
endsnippet
|
||||
|
||||
snippet stringformat "" bi
|
||||
stringformat:"$1"
|
||||
endsnippet
|
||||
|
||||
snippet time "" bi
|
||||
time:"$1"
|
||||
endsnippet
|
||||
|
||||
snippet truncatewords "" bi
|
||||
truncatewords:$1
|
||||
endsnippet
|
||||
|
||||
snippet truncatewordshtml "" bi
|
||||
truncatewords_html:$1
|
||||
endsnippet
|
||||
|
||||
snippet urlizetrunc "" bi
|
||||
urlizetrunc:$1
|
||||
endsnippet
|
||||
|
||||
snippet wordwrap "" bi
|
||||
wordwrap:$1
|
||||
endsnippet
|
||||
|
||||
# vim:ft=snippets:
|
3
.vim/UltiSnips/htmljinja.snippets
Normal file
|
@ -0,0 +1,3 @@
|
|||
priority -50
|
||||
|
||||
extends html, jinja2
|
435
.vim/UltiSnips/java.snippets
Normal file
|
@ -0,0 +1,435 @@
|
|||
priority -50
|
||||
|
||||
# Many of the snippets here use a global option called
|
||||
# "g:ultisnips_java_brace_style" which, if set to "nl" will put a newline
|
||||
# before '{' braces.
|
||||
# Setting "g:ultisnips_java_junit" will change how the test method snippet
|
||||
# looks, it is defaulted to junit4, setting this option to 3 will remove the
|
||||
# @Test annotation from the method
|
||||
|
||||
global !p
|
||||
def junit(snip):
|
||||
if snip.opt("g:ultisnips_java_junit", "") == "3":
|
||||
snip += ""
|
||||
else:
|
||||
snip.rv += "@Test\n\t"
|
||||
|
||||
def nl(snip):
|
||||
if snip.opt("g:ultisnips_java_brace_style", "") == "nl":
|
||||
snip += ""
|
||||
else:
|
||||
snip.rv += " "
|
||||
def getArgs(group):
|
||||
import re
|
||||
word = re.compile('[a-zA-Z0-9><.]+ \w+')
|
||||
return [i.split(" ") for i in word.findall(group) ]
|
||||
|
||||
def camel(word):
|
||||
if not word: return ''
|
||||
return word[0].upper() + word[1:]
|
||||
|
||||
def mixedCase(word):
|
||||
if not word: return ''
|
||||
return word[0].lower() + word[1:]
|
||||
|
||||
endglobal
|
||||
|
||||
snippet sleep "try sleep catch" b
|
||||
try {
|
||||
Thread.sleep(${1:1000});
|
||||
} catch (InterruptedException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet /i|n/ "new primitive or int" br
|
||||
${1:int} ${2:i} = ${3:1};
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet /o|v/ "new Object or variable" br
|
||||
${1:Object} ${2:var} = new $1($3);
|
||||
endsnippet
|
||||
|
||||
snippet f "field" b
|
||||
${1:private} ${2:String} ${3:`!p snip.rv = t[2].lower()`};
|
||||
endsnippet
|
||||
|
||||
snippet ab "abstract" b
|
||||
abstract $0
|
||||
endsnippet
|
||||
|
||||
snippet as "assert" b
|
||||
assert ${1:test}${2/(.+)/(?1: \: ")/}${2:Failure message}${2/(.+)/(?1:")/};
|
||||
endsnippet
|
||||
|
||||
snippet at "assert true" b
|
||||
assertTrue(${1:actual});
|
||||
endsnippet
|
||||
|
||||
snippet af "assert false" b
|
||||
assertFalse(${1:actual});
|
||||
endsnippet
|
||||
|
||||
snippet ae "assert equals" b
|
||||
assertEquals(${1:expected}, ${2:actual});
|
||||
endsnippet
|
||||
|
||||
snippet br "break"
|
||||
break;
|
||||
|
||||
endsnippet
|
||||
|
||||
snippet cs "case" b
|
||||
case $1:
|
||||
$2
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet ca "catch" b
|
||||
catch (${1:Exception} ${2:e})`!p nl(snip)`{
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet cle "class extends" b
|
||||
public class ${1:`!p
|
||||
snip.rv = snip.basename or "untitled"`} ${2:extends ${3:Parent} }${4:implements ${5:Interface} }{
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet clc "class with constructor, fields, setter and getters" b
|
||||
public class `!p
|
||||
snip.rv = snip.basename or "untitled"` {
|
||||
`!p
|
||||
args = getArgs(t[1])
|
||||
if len(args) == 0: snip.rv = ""
|
||||
for i in args:
|
||||
snip.rv += "\n\tprivate " + i[0] + " " + i[1]+ ";"
|
||||
if len(args) > 0:
|
||||
snip.rv += "\n"`
|
||||
public `!p snip.rv = snip.basename or "unknown"`($1) {`!p
|
||||
args = getArgs(t[1])
|
||||
for i in args:
|
||||
snip.rv += "\n\t\tthis." + i[1] + " = " + i[1] + ";"
|
||||
if len(args) == 0:
|
||||
snip.rv += "\n"`
|
||||
}$0
|
||||
`!p
|
||||
args = getArgs(t[1])
|
||||
if len(args) == 0: snip.rv = ""
|
||||
for i in args:
|
||||
snip.rv += "\n\tpublic void set" + camel(i[1]) + "(" + i[0] + " " + i[1] + ") {\n" + "\
|
||||
\tthis." + i[1] + " = " + i[1] + ";\n\t}\n"
|
||||
|
||||
snip.rv += "\n\tpublic " + i[0] + " get" + camel(i[1]) + "() {\n\
|
||||
\treturn " + i[1] + ";\n\t}\n"
|
||||
`
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet clc "class with constructor, with field names" b
|
||||
public class `!p
|
||||
snip.rv = snip.basename or "untitled"` {
|
||||
`!p
|
||||
args = getArgs(t[1])
|
||||
for i in args:
|
||||
snip.rv += "\n\tprivate " + i[0] + " " + i[1]+ ";"
|
||||
if len(args) > 0:
|
||||
snip.rv += "\n"`
|
||||
public `!p snip.rv = snip.basename or "unknown"`($1) {`!p
|
||||
args = getArgs(t[1])
|
||||
for i in args:
|
||||
snip.rv += "\n\t\tthis.%s = %s;" % (i[1], i[1])
|
||||
if len(args) == 0:
|
||||
snip.rv += "\n"`
|
||||
}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet clc "class and constructor" b
|
||||
public class `!p
|
||||
snip.rv = snip.basename or "untitled"` {
|
||||
|
||||
public `!p snip.rv = snip.basename or "untitled"`($2) {
|
||||
$0
|
||||
}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet cl "class" b
|
||||
public class ${1:`!p
|
||||
snip.rv = snip.basename or "untitled"`} {
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet cos "constant string" b
|
||||
public static final String ${1:var} = "$2";$0
|
||||
endsnippet
|
||||
|
||||
snippet co "constant" b
|
||||
public static final ${1:String} ${2:var} = $3;$0
|
||||
endsnippet
|
||||
|
||||
snippet de "default" b
|
||||
default:
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet elif "else if"
|
||||
else if ($1)`!p nl(snip)`{
|
||||
$0${VISUAL}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet el "else" w
|
||||
else`!p nl(snip)`{
|
||||
$0${VISUAL}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet fi "final" b
|
||||
final $0
|
||||
endsnippet
|
||||
|
||||
snippet fore "for (each)" b
|
||||
for ($1 : $2)`!p nl(snip)`{
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet fori "for" b
|
||||
for (int ${1:i} = 0; $1 < ${2:10}; $1++)`!p nl(snip)`{
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet for "for" b
|
||||
for ($1; $2; $3)`!p nl(snip)`{
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet if "if" b
|
||||
if ($1)`!p nl(snip)`{
|
||||
$0${VISUAL}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet imt "import junit_framework_TestCase;" b
|
||||
import junit.framework.TestCase;
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet im "import" b
|
||||
import ${1:java}.${2:util}.$0;
|
||||
endsnippet
|
||||
|
||||
snippet in "interface" b
|
||||
interface ${1:`!p snip.rv = snip.basename or "untitled"`} ${2:extends ${3:Parent} }{
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet cc "constructor call or setter body"
|
||||
this.${1:var} = $1;
|
||||
endsnippet
|
||||
|
||||
snippet list "Collections List" b
|
||||
List<${1:String}> ${2:list} = new ${3:Array}List<$1>();
|
||||
endsnippet
|
||||
|
||||
snippet map "Collections Map" b
|
||||
Map<${1:String}, ${2:String}> ${3:map} = new ${4:Hash}Map<$1, $2>();
|
||||
endsnippet
|
||||
|
||||
snippet set "Collections Set" b
|
||||
Set<${1:String}> ${2:set} = new ${3:Hash}Set<$1>();
|
||||
endsnippet
|
||||
|
||||
snippet /Str?|str/ "String" br
|
||||
String $0
|
||||
endsnippet
|
||||
|
||||
snippet cn "Constructor" b
|
||||
public `!p snip.rv = snip.basename or "untitled"`(${1:}) {
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet cn "constructor, \w fields + assigments" b
|
||||
`!p
|
||||
args = getArgs(t[1])
|
||||
for i in args:
|
||||
snip.rv += "\n\tprivate " + i[0] + " " + i[1]+ ";"
|
||||
if len(args) > 0:
|
||||
snip.rv += "\n"`
|
||||
public `!p snip.rv = snip.basename or "unknown"`($1) {`!p
|
||||
args = getArgs(t[1])
|
||||
for i in args:
|
||||
snip.rv += "\n\t\tthis.%s = %s;" % (i[1], i[1])
|
||||
if len(args) == 0:
|
||||
snip.rv += "\n"`
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet j.b "java_beans_" i
|
||||
java.beans.
|
||||
endsnippet
|
||||
|
||||
snippet j.i "java_io" i
|
||||
java.io.
|
||||
endsnippet
|
||||
|
||||
snippet j.m "java_math" i
|
||||
java.math.
|
||||
endsnippet
|
||||
|
||||
snippet j.n "java_net_" i
|
||||
java.net.
|
||||
endsnippet
|
||||
|
||||
snippet j.u "java_util_" i
|
||||
java.util.
|
||||
endsnippet
|
||||
|
||||
snippet main "method (main)" b
|
||||
public static void main(String[] args)`!p nl(snip)`{
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet try "try/catch" b
|
||||
try {
|
||||
$1${VISUAL}
|
||||
} catch(${2:Exception} ${3:e}){
|
||||
${4:e.printStackTrace();}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet mt "method throws" b
|
||||
${1:private} ${2:void} ${3:method}($4) ${5:throws $6 }{
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet m "method" b
|
||||
${1:private} ${2:void} ${3:method}($4) {
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet md "Method With javadoc" b
|
||||
/**
|
||||
* ${7:Short Description}`!p
|
||||
for i in getArgs(t[4]):
|
||||
snip.rv += "\n\t * @param " + i[1] + " usage..."`
|
||||
*`!p
|
||||
if "throws" in t[5]:
|
||||
snip.rv = "\n\t * @throws " + t[6]
|
||||
else:
|
||||
snip.rv = ""``!p
|
||||
if not "void" in t[2]:
|
||||
snip.rv = "\n\t * @return object"
|
||||
else:
|
||||
snip.rv = ""`
|
||||
**/
|
||||
${1:public} ${2:void} ${3:method}($4) ${5:throws $6 }{
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet /get(ter)?/ "getter" br
|
||||
public ${1:String} get${2:Name}() {
|
||||
return `!p snip.rv = mixedCase(t[2])`;
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet /set(ter)?/ "setter" br
|
||||
public void set${1:Name}(${2:String} `!p snip.rv = mixedCase(t[1])`) {
|
||||
this.`!p snip.rv = mixedCase(t[1])` = `!p snip.rv = mixedCase(t[1])`;
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet /se?tge?t|ge?tse?t|gs/ "setter and getter" br
|
||||
public void set${1:Name}(${2:String} `!p snip.rv = mixedCase(t[1])`) {
|
||||
this.`!p snip.rv = mixedCase(t[1])` = `!p snip.rv = mixedCase(t[1])`;
|
||||
}`!p snip.rv += "\n"`
|
||||
public $2 get$1() {
|
||||
return `!p snip.rv = mixedCase(t[1])`;
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet pa "package" b
|
||||
package $0
|
||||
endsnippet
|
||||
|
||||
snippet p "print" b
|
||||
System.out.print($1);$0
|
||||
endsnippet
|
||||
|
||||
snippet pl "println" b
|
||||
System.out.println($1);$0
|
||||
endsnippet
|
||||
|
||||
snippet pr "private" b
|
||||
private $0
|
||||
endsnippet
|
||||
|
||||
snippet po "protected" b
|
||||
protected $0
|
||||
endsnippet
|
||||
|
||||
snippet pu "public" b
|
||||
public $0
|
||||
endsnippet
|
||||
|
||||
snippet re "return" b
|
||||
return $0
|
||||
endsnippet
|
||||
|
||||
snippet st "static"
|
||||
static $0
|
||||
endsnippet
|
||||
|
||||
snippet sw "switch" b
|
||||
switch ($1)`!p nl(snip)`{
|
||||
case $2: $0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet sy "synchronized"
|
||||
synchronized $0
|
||||
endsnippet
|
||||
|
||||
snippet tc "test case"
|
||||
public class ${1:`!p snip.rv = snip.basename or "untitled"`} extends ${2:TestCase}`!p nl(snip)`{
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet t "test" b
|
||||
`!p junit(snip)`public void test${1:Name}() {
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet tt "test throws" b
|
||||
`!p junit(snip)`public void test${1:Name}() ${2:throws Exception }{
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet th "throw" b
|
||||
throw new $0
|
||||
endsnippet
|
||||
|
||||
snippet wh "while" b
|
||||
while ($1)`!p nl(snip)`{
|
||||
$0
|
||||
}
|
||||
endsnippet
|
||||
|
||||
# vim:ft=snippets:
|
77
.vim/UltiSnips/javascript-angular.snippets
Normal file
|
@ -0,0 +1,77 @@
|
|||
priority -50
|
||||
|
||||
snippet iti "it (js, inject)" b
|
||||
it('${1:description}', inject(function($2) {
|
||||
$0
|
||||
}));
|
||||
endsnippet
|
||||
|
||||
snippet befi "before each (js, inject)" b
|
||||
beforeEach(inject(function($1) {
|
||||
$0
|
||||
}));
|
||||
endsnippet
|
||||
|
||||
snippet aconf "angular config" i
|
||||
config(function($1) {
|
||||
$0
|
||||
});
|
||||
endsnippet
|
||||
|
||||
snippet acont "angular controller" i
|
||||
controller('${1:name}', [$2function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) {
|
||||
$0
|
||||
}]);
|
||||
endsnippet
|
||||
|
||||
snippet aconts "angular controller with scope" i
|
||||
controller('${1:name}', [${2:'$scope', }function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) {
|
||||
$0
|
||||
}]);
|
||||
endsnippet
|
||||
|
||||
snippet adir "angular directive" i
|
||||
directive('$1', [$2function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) {
|
||||
return {
|
||||
restrict: '${3:EA}',
|
||||
link: function(scope, element, attrs) {
|
||||
$0
|
||||
}
|
||||
};
|
||||
}]);
|
||||
endsnippet
|
||||
|
||||
snippet adirs "angular directive with scope" i
|
||||
directive('$1', [${2:'$scope', }function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) {
|
||||
return {
|
||||
restrict: '${3:EA}',
|
||||
link: function(scope, element, attrs) {
|
||||
$0
|
||||
}
|
||||
};
|
||||
}]);
|
||||
endsnippet
|
||||
|
||||
snippet afact "angular factory" i
|
||||
factory('${1:name}', [$2function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) {
|
||||
$0
|
||||
}]);
|
||||
endsnippet
|
||||
|
||||
snippet afacts "angular factory with scope" i
|
||||
factory('${1:name}', [${2:'$scope', }function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) {
|
||||
$0
|
||||
}]);
|
||||
endsnippet
|
||||
|
||||
snippet aserv "angular service" i
|
||||
service('${1:name}', [$2function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) {
|
||||
$0
|
||||
}]);
|
||||
endsnippet
|
||||
|
||||
snippet aservs "angular service" i
|
||||
service('${1:name}', [${2:'$scope', }function(${2/('|")([A-Z_$]+)?\1?((, ?)$)?/$2(?3::$4)/ig}) {
|
||||
$0
|
||||
}]);
|
||||
endsnippet
|