53 changed files with 2490 additions and 786 deletions
@ -0,0 +1,21 @@
@@ -0,0 +1,21 @@
|
||||
|
||||
!Настрока шрифтов |
||||
Xft.antialias: true |
||||
Xft.dpi: 96 |
||||
! Xft.dpi: 120 |
||||
Xft.hinting: true |
||||
!Xft.hintstyle: hintfull |
||||
Xft.hintstyle: hintslight |
||||
Xft.rgba: rgb |
||||
|
||||
!Настройки rofi |
||||
!#include "$HOME/etc/soft/rofi/rofi" |
||||
!#include "~/.shellrc/etc/soft/rofi/rofi.paper" |
||||
|
||||
!Настройки эмуляторов терминалов |
||||
!#include "~/.shellrc/etc/X/Xdefaults.urxvt" |
||||
!#include "~/.shellrc/etc/X/Xdefaults.xst" |
||||
|
||||
!Цветовые схемы |
||||
!#include "~/.shellrc/etc/X/Xdefaults.colorscheme.light" |
||||
|
@ -0,0 +1,44 @@
@@ -0,0 +1,44 @@
|
||||
! These are all possible options, presented with default values. |
||||
! xst will fallback to *.option if st.option is not present. |
||||
! see src/config.h for more information about option meanings. |
||||
|
||||
! These options only take effect on startup. |
||||
st.termname: st-256color |
||||
! if you do not set shell, precedence is: -e arg, utmp option, SHELL env var, /etc/passwd shell |
||||
st.shell: /bin/bash |
||||
|
||||
! The following options options can be reloaded via USR1 signal. |
||||
! st.font: Liberation Mono:pixelsize=12:antialias=true:autohint=true; |
||||
! st.font: Anonymice Nerd Font:pixelsize=19:antialias=true:autohint=true |
||||
st.font: Cousine:pixelsize=19:antialias=true:autohint=true |
||||
! st.font: DejaVuSansMono:pixelsize=16:antialias=true:autohint=true |
||||
st.borderpx: 0 |
||||
! Available cursor values: 2 4 6 7 = █ _ | ☃ ( 1 3 5 are blinking versions) |
||||
st.cursorshape: 2 |
||||
! thickness of underline and bar cursors |
||||
st.cursorthickness: 1 |
||||
! 0: normal blinking, 1: leave cursor border and blink with cursors background |
||||
st.cursorblinkstyle: 0 |
||||
! 0: cursor blinks with a constant interval; 1: blinking cycle resets on key input |
||||
st.cursorblinkontype: 1 |
||||
st.bold_font: 0 |
||||
st.xfps: 120 |
||||
st.actionfps: 30 |
||||
! Amount of lines scrolled |
||||
st.mouseScrollLines: 3 |
||||
! Kerning / character bounding-box height multiplier |
||||
st.chscale: 1.0 |
||||
! Kerning / character bounding-box width multiplier |
||||
st.cwscale: 1.0 |
||||
! blinking timeout for terminal and cursor blinking (0 disables) |
||||
st.blinktimeout: 800 |
||||
! bell volume. Value between -100 and 100. (0 disables) |
||||
st.bellvolume: 100 |
||||
! this is a char that is exposed like so: `printf '\033[z'` |
||||
st.prompt_char: $ |
||||
! This option is can be preedit style. Available values: `root` `overthespot` (Default taken `root`) |
||||
st.imstyle: root |
||||
|
||||
! opacity==255 means what terminal will be not transparent, 0 - fully transparent |
||||
st.opacity: 255 |
||||
|
@ -0,0 +1,3 @@
@@ -0,0 +1,3 @@
|
||||
! Использование PrintScreen в качестве Mod1 наряду с Alt_L |
||||
! clear Mod1 |
||||
add Mod1 = Alt_L Print |
@ -0,0 +1,32 @@
@@ -0,0 +1,32 @@
|
||||
# xbindkeysrc.AuthenticAMD |
||||
# |
||||
# Изменён: Ср 03 ноя 2021 15:30:27 |
||||
# |
||||
|
||||
#ACPI#{{{ |
||||
|
||||
# Pulseaudio |
||||
"pactl -- set-sink-volume 0 -5%" |
||||
XF86AudioLowerVolume |
||||
|
||||
"pactl -- set-sink-volume 0 +5%" |
||||
XF86AudioRaiseVolume |
||||
|
||||
"pactl set-sink-mute @DEFAULT_SINK@ toggle" |
||||
XF86AudioMute |
||||
|
||||
# Light |
||||
"light -U 5" |
||||
XF86MonBrightnessDown |
||||
|
||||
"light -A 5" |
||||
XF86MonBrightnessUp |
||||
|
||||
"light -U 2" |
||||
Control + XF86MonBrightnessDown |
||||
|
||||
"light -A 2" |
||||
Control + XF86MonBrightnessUp |
||||
|
||||
#}}} |
||||
|
@ -1,21 +1,16 @@
@@ -1,21 +1,16 @@
|
||||
display -window root $SHELLRC/etc/wm/img/wallpaper.$(uname -i).jpg |
||||
xsetroot -cursor_name left_ptr |
||||
#!/usr/bin/env bash |
||||
|
||||
setxkbmap -option "" |
||||
setxkbmap -model pc104 -layout us,ru,el,co -variant ,,polytonic, |
||||
setxkbmap -option -option terminate:ctrl_alt_bksp,caps:escape,grp:lwin_toggle,compose:ralt |
||||
#display -window root $SHELLRC/etc/wm/img/wallpaper.$(uname -i).jpg |
||||
#xsetroot -cursor_name left_ptr |
||||
|
||||
xmodmap $SHELLRC/etc/X/Xmodmaprc.$(uname -i) |
||||
xbindkeys -f $SHELLRC/etc/X/xbindkeysrc.$(uname -i) |
||||
sh $SHELLRC/etc/X/xrandr.$(uname -i) |
||||
#exec setxkbmap -option "" |
||||
#exec setxkbmap -model pc104 -layout us,ru,el,co -variant ,,polytonic, |
||||
#exec setxkbmap -option -option terminate:ctrl_alt_bksp,caps:escape,grp:lwin_toggle,compose:ralt |
||||
|
||||
# export GTK_IM_MODULE="ibus" |
||||
# export QT_IM_MODULE="ibus" |
||||
unset XMODIFIERS |
||||
# export XMODIFIERS=@im=ibus |
||||
#exec xbindkeys -f $SHELLRC/etc/X/xbindkeysrc.$HOSTNAME |
||||
#sh $SHELLRC/etc/X/xrandr.$HOSTNAME |
||||
|
||||
#exec musca |
||||
#exec ck-launch-session xmonad |
||||
#unset XMODIFIERS |
||||
|
||||
exec bspwm |
||||
|
||||
|
@ -0,0 +1,9 @@
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash |
||||
|
||||
#exec xbindkeys -f "$SHELLRC/etc/X/xbindkeysrc.$PLATFORM.$HOSTNAME" |
||||
#sh $SHELLRC/etc/X/xrandr.$HOSTNAME |
||||
|
||||
#unset XMODIFIERS |
||||
|
||||
exec bspwm |
||||
|
@ -0,0 +1 @@
@@ -0,0 +1 @@
|
||||
/home/envrm/.shellrc/etc/media/ncmpcpp |
@ -0,0 +1 @@
@@ -0,0 +1 @@
|
||||
/home/envrm/.shellrc/etc/net/newsboat |
@ -0,0 +1 @@
@@ -0,0 +1 @@
|
||||
/home/envrm/.shellrc/etc/soft/htop |
@ -0,0 +1,19 @@
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2014 <Daiderd Jordan> |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy |
||||
of this software and associated documentation files (the "Software"), to deal |
||||
in the Software without restriction, including without limitation the rights |
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||
copies of the Software, and to permit persons to whom the Software is |
||||
furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included in |
||||
all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
||||
THE SOFTWARE. |
@ -0,0 +1,55 @@
@@ -0,0 +1,55 @@
|
||||
# vim-nix |
||||
|
||||
[](https://travis-ci.org/LnL7/vim-nix) |
||||
|
||||
Support for writing [Nix expressions](http://nixos.org/nix/manual/#chap-writing-nix-expressions) in vim. |
||||
|
||||
Features included so far: |
||||
|
||||
* Syntax highlighting for Nix |
||||
* Filetype detection for `.nix` files |
||||
* Automatic indentation |
||||
* [`NixEdit`](https://github.com/LnL7/vim-nix/commit/9b2e5c5d389e4a7f2b587ae1fdf7a46143993f21) command: navigate nixpkgs by attribute name |
||||
|
||||
|
||||
## Installation |
||||
|
||||
### Plugin managers |
||||
|
||||
As of version 8.0 Vim supports packages. Clone this repository inside `~/.vim/pack/all/start`: |
||||
|
||||
```bash |
||||
git clone https://github.com/LnL7/vim-nix.git ~/.vim/pack/all/start/vim-nix |
||||
``` |
||||
|
||||
The most common plugin managers include [vim-plug][vim-plug], |
||||
[NeoBundle][neobundle], [Vundle][vundle] and [pathogen.vim][pathogen]. |
||||
|
||||
With pathogen.vim, just clone this repository inside `~/.vim/bundle`: |
||||
|
||||
```bash |
||||
git clone https://github.com/LnL7/vim-nix.git ~/.vim/bundle/vim-nix |
||||
``` |
||||
|
||||
With the other plugin managers, just follow the instructions on the homepage of |
||||
each plugin. In general, you have to add a line to your `~/.vimrc`: |
||||
|
||||
```viml |
||||
" vim-plug |
||||
Plug 'LnL7/vim-nix' |
||||
" NeoBundle |
||||
NeoBundle 'LnL7/vim-nix' |
||||
" Vundle |
||||
Plugin 'LnL7/vim-nix' |
||||
``` |
||||
|
||||
### Manual installation |
||||
|
||||
Copy the contents of each directory in the respective directories inside |
||||
`~/.vim`. |
||||
|
||||
|
||||
[vim-plug]: https://github.com/junegunn/vim-plug |
||||
[vundle]: https://github.com/gmarik/Vundle.vim |
||||
[neobundle]: https://github.com/Shougo/neobundle.vim |
||||
[pathogen]: https://github.com/tpope/vim-pathogen |
@ -0,0 +1,11 @@
@@ -0,0 +1,11 @@
|
||||
if exists('current_compiler') |
||||
finish |
||||
endif |
||||
let current_compiler = 'nix-build' |
||||
|
||||
if exists(":CompilerSet") != 2 |
||||
command -nargs=* CompilerSet setlocal <args> |
||||
endif |
||||
|
||||
CompilerSet errorformat=error:\ %m\ at\ %f:%l:%c,builder\ for\ \'%m\'\ failed\ with\ exit\ code\ %n,fixed-output\ derivation\ produced\ path\ \'%s\'\ with\ %m |
||||
CompilerSet makeprg=nix-build |
@ -0,0 +1,58 @@
@@ -0,0 +1,58 @@
|
||||
{ pkgs ? import <nixpkgs> {} }: |
||||
|
||||
let |
||||
inherit (pkgs) stdenv fetchFromGitHub writeText runCommand vim; |
||||
|
||||
# Fallback for nix 1.11 |
||||
fetchGit = builtins.fetchGit or (x: x); |
||||
|
||||
vader = fetchFromGitHub { |
||||
owner = "junegunn"; |
||||
repo = "vader.vim"; |
||||
rev = "ddb714246535e814ddd7c62b86ca07ffbec8a0af"; |
||||
sha256 = "0jlxbp883y84nal5p55fxg7a3wqh3zny9dhsvfjajrzvazmiz44n"; |
||||
}; |
||||
in |
||||
|
||||
stdenv.mkDerivation rec { |
||||
name = "vim-nix-${version}${versionSuffix}"; |
||||
version = "0.1.0"; |
||||
versionSuffix = "pre${toString src.revCount or 0}.${src.shortRev or "0000000"}"; |
||||
src = fetchGit ./.; |
||||
|
||||
dontBuild = true; |
||||
preferLocalBuild = true; |
||||
|
||||
buildInputs = [ vim ]; |
||||
|
||||
installPhase = '' |
||||
mkdir -p $out |
||||
cp -r ftdetect ftplugin indent syntax $out |
||||
''; |
||||
|
||||
vimrc = writeText "vimrc" '' |
||||
filetype off |
||||
set rtp+=${vader} |
||||
set rtp+=${src} |
||||
filetype plugin indent on |
||||
syntax enable |
||||
|
||||
function! Syntax() |
||||
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")') |
||||
endfunction |
||||
|
||||
command! Syntax call Syntax() |
||||
''; |
||||
|
||||
checkPhase = '' |
||||
( vim -XNu ${vimrc} -i NONE -c 'Vader! test/*.vader' ) |& tee vim-nix-test.log >&2 |
||||
''; |
||||
|
||||
doCheck = true; |
||||
|
||||
shellHook = '' |
||||
vim() { |
||||
command vim -XNu ${vimrc} -i NONE "$@" |
||||
} |
||||
''; |
||||
} |
@ -0,0 +1,6 @@
@@ -0,0 +1,6 @@
|
||||
" Vim filetype detect |
||||
" Language: Nix |
||||
" Maintainer: Daiderd Jordan <daiderd@gmail.com> |
||||
" URL: https://github.com/LnL7/vim-nix |
||||
|
||||
au BufRead,BufNewFile *.nix setf nix |
@ -0,0 +1,21 @@
@@ -0,0 +1,21 @@
|
||||
" Vim filetype plugin |
||||
" Language: Nix |
||||
" Maintainer: Daiderd Jordan <daiderd@gmail.com> |
||||
" URL: https://github.com/LnL7/vim-nix |
||||
|
||||
if (exists("b:did_ftplugin")) |
||||
finish |
||||
endif |
||||
let b:did_ftplugin = 1 |
||||
|
||||
setlocal |
||||
\ comments=:# |
||||
\ commentstring=#\ %s |
||||
\ iskeyword+=- |
||||
|
||||
if get(g:, 'nix_recommended_style', 1) |
||||
setlocal |
||||
\ shiftwidth=2 |
||||
\ softtabstop=2 |
||||
\ expandtab |
||||
endif |
@ -0,0 +1,103 @@
@@ -0,0 +1,103 @@
|
||||
" Vim indent file |
||||
" Language: Nix |
||||
" Maintainer: Daiderd Jordan <daiderd@gmail.com> |
||||
" URL: https://github.com/LnL7/vim-nix |
||||
|
||||
if exists("b:did_indent") |
||||
finish |
||||
endif |
||||
let b:did_indent = 1 |
||||
|
||||
setlocal indentexpr=GetNixIndent() |
||||
setlocal indentkeys+=0=then,0=else,0=inherit,0=in,*<Return> |
||||
|
||||
if exists("*GetNixIndent") |
||||
finish |
||||
endif |
||||
|
||||
let s:cpo_save = &cpo |
||||
set cpo&vim |
||||
|
||||
let s:skip_syntax = '\%(Comment\|String\)$' |
||||
let s:binding_open = '\%(\<let\>\)' |
||||
let s:binding_close = '\%(\<in\>\)' |
||||
let s:block_open = '\%({\|[\)' |
||||
let s:block_close = '\%(}\|]\)' |
||||
|
||||
function! GetNixIndent() |
||||
let lnum = prevnonblank(v:lnum - 1) |
||||
let ind = indent(lnum) |
||||
|
||||
" At the start of the file use zero indent. |
||||
if lnum == 0 |
||||
return 0 |
||||
endif |
||||
|
||||
" Skip indentation for single line comments explicitly, in case a |
||||
" comment was just inserted (eg. visual block mode) |
||||
if getline(v:lnum) =~ '^\s*#' |
||||
return indent(v:lnum) |
||||
endif |
||||
|
||||
if synIDattr(synID(v:lnum, 1, 1), "name") !~ s:skip_syntax |
||||
let current_line = getline(v:lnum) |
||||
let last_line = getline(lnum) |
||||
|
||||
if current_line =~ '^\s*in\>' |
||||
let save_cursor = getcurpos() |
||||
normal ^ |
||||
let bslnum = searchpair(s:binding_open, '', s:binding_close, 'bnW', |
||||
\ 'synIDattr(synID(line("."), col("."), 0), "name") =~? "StringSpecial$"') |
||||
call setpos('.', save_cursor) |
||||
return indent(bslnum) |
||||
endif |
||||
|
||||
if last_line =~ s:block_open . '\s*$' |
||||
let ind += &sw |
||||
endif |
||||
|
||||
if current_line =~ '^\s*' . s:block_close |
||||
let ind -= &sw |
||||
endif |
||||
|
||||
if last_line =~ '[(=]$' |
||||
let ind += &sw |
||||
endif |
||||
|
||||
if last_line =~ '\<let\s*$' |
||||
let ind += &sw |
||||
endif |
||||
|
||||
if last_line =~ '^\<in\s*$' |
||||
let ind += &sw |
||||
endif |
||||
|
||||
if current_line =~ '^\s*in\>' |
||||
let ind -= &sw |
||||
endif |
||||
endif |
||||
|
||||
if synIDattr(synID(v:lnum, 1, 1), "name") =~ '^nixString' |
||||
let current_line = getline(v:lnum) |
||||
|
||||
let ind = indent(v:lnum) |
||||
let bslnum = searchpair('''''', '', '''''', 'bnW', |
||||
\ 'synIDattr(synID(line("."), col("."), 0), "name") =~? "StringSpecial$"') |
||||
|
||||
if ind <= indent(bslnum) |
||||
let ind = indent(bslnum) + &sw |
||||
endif |
||||
|
||||
if current_line =~ '^\s*''''[^''\$]' |
||||
let ind = indent(bslnum) |
||||
endif |
||||
if current_line =~ '^\s*''''$' |
||||
let ind = indent(bslnum) |
||||
endif |
||||
endif |
||||
|
||||
return ind |
||||
endfunction |
||||
|
||||
let &cpo = s:cpo_save |
||||
unlet s:cpo_save |
@ -0,0 +1,25 @@
@@ -0,0 +1,25 @@
|
||||
function! nix#find_drv_position() |
||||
let line = search("description") |
||||
if line == 0 |
||||
let line = search("name") |
||||
endif |
||||
if line == 0 |
||||
echo "error: could not find derivation" |
||||
return |
||||
endif |
||||
|
||||
return expand("%") . ":" . line |
||||
endfunction |
||||
|
||||
function! nix#edit(attr) |
||||
let output = system("nix-instantiate --eval ./. -A " . a:attr . ".meta.position") |
||||
if match(output, "^error:") == -1 |
||||
let position = split(split(output, '"')[0], ":") |
||||
execute "edit " . position[0] |
||||
execute position[1] |
||||
" Update default command to nix-build. |
||||
let b:dispatch = 'nix-build --no-out-link -A ' . a:attr |
||||
endif |
||||
endfunction |
||||
|
||||
command! -bang -nargs=* NixEdit call nix#edit(<q-args>) |
@ -0,0 +1,198 @@
@@ -0,0 +1,198 @@
|
||||
" Vim syntax file |
||||
" Language: Nix |
||||
" Maintainer: Daiderd Jordan <daiderd@gmail.com> |
||||
" URL: https://github.com/LnL7/vim-nix |
||||
|
||||
if exists("b:current_syntax") |
||||
finish |
||||
endif |
||||
|
||||
syn keyword nixBoolean true false |
||||
syn keyword nixNull null |
||||
syn keyword nixRecKeyword rec |
||||
|
||||
syn keyword nixOperator or |
||||
syn match nixOperator '!=\|!' |
||||
syn match nixOperator '<=\?' |
||||
syn match nixOperator '>=\?' |
||||
syn match nixOperator '&&' |
||||
syn match nixOperator '//\=' |
||||
syn match nixOperator '==' |
||||
syn match nixOperator '?' |
||||
syn match nixOperator '||' |
||||
syn match nixOperator '++\=' |
||||
syn match nixOperator '-' |
||||
syn match nixOperator '\*' |
||||
syn match nixOperator '->' |
||||
|
||||
syn match nixParen '[()]' |
||||
syn match nixInteger '\d\+' |
||||
|
||||
syn keyword nixTodo FIXME NOTE TODO OPTIMIZE XXX HACK contained |
||||
syn match nixComment '#.*' contains=nixTodo,@Spell |
||||
syn region nixComment start=+/\*+ end=+\*/+ contains=nixTodo,@Spell |
||||
|
||||
syn region nixInterpolation matchgroup=nixInterpolationDelimiter start="\${" end="}" contained contains=@nixExpr,nixInterpolationParam |
||||
|
||||
syn match nixSimpleStringSpecial /\\\%([nrt"\\$]\|$\)/ contained |
||||
syn match nixStringSpecial /''['$]/ contained |
||||
syn match nixStringSpecial /\$\$/ contained |
||||
syn match nixStringSpecial /''\\[nrt]/ contained |
||||
|
||||
syn match nixInvalidSimpleStringEscape /\\[^nrt"\\$]/ contained |
||||
syn match nixInvalidStringEscape /''\\[^nrt]/ contained |
||||
|
||||
syn region nixSimpleString matchgroup=nixStringDelimiter start=+"+ skip=+\\"+ end=+"+ contains=nixInterpolation,nixSimpleStringSpecial,nixInvalidSimpleStringEscape |
||||
syn region nixString matchgroup=nixStringDelimiter start=+''+ skip=+''['$\\]+ end=+''+ contains=nixInterpolation,nixStringSpecial,nixInvalidStringEscape |
||||
|
||||
syn match nixFunctionCall "[a-zA-Z_][a-zA-Z0-9_'-]*" |
||||
|
||||
syn match nixPath "[a-zA-Z0-9._+-]*\%(/[a-zA-Z0-9._+-]\+\)\+" |
||||
syn match nixHomePath "\~\%(/[a-zA-Z0-9._+-]\+\)\+" |
||||
syn match nixSearchPath "[a-zA-Z0-9._+-]\+\%(\/[a-zA-Z0-9._+-]\+\)*" contained |
||||
syn match nixPathDelimiter "[<>]" contained |
||||
syn match nixSearchPathRef "<[a-zA-Z0-9._+-]\+\%(\/[a-zA-Z0-9._+-]\+\)*>" contains=nixSearchPath,nixPathDelimiter |
||||
syn match nixURI "[a-zA-Z][a-zA-Z0-9.+-]*:[a-zA-Z0-9%/?:@&=$,_.!~*'+-]\+" |
||||
|
||||
syn match nixAttributeDot "\." contained |
||||
syn match nixAttribute "[a-zA-Z_][a-zA-Z0-9_'-]*\ze\%([^a-zA-Z0-9_'.-]\|$\)" contained |
||||
syn region nixAttributeAssignment start="=" end="\ze;" contained contains=@nixExpr |
||||
syn region nixAttributeDefinition start=/\ze[a-zA-Z_"$]/ end=";" contained contains=nixComment,nixAttribute,nixInterpolation,nixSimpleString,nixAttributeDot,nixAttributeAssignment |
||||
|
||||
syn region nixInheritAttributeScope start="(" end=")" contained contains=nixComment,nixAttributeDot |
||||
syn region nixAttributeDefinition matchgroup=nixInherit start="\<inherit\>" end=";" contained contains=nixComment,nixInheritAttributeScope,nixAttribute |
||||
|
||||
syn region nixAttributeSet start="{" end="}" contains=nixComment,nixAttributeDefinition |
||||
|
||||
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv |
||||
syn region nixArgumentDefinitionWithDefault matchgroup=nixArgumentDefinition start="[a-zA-Z_][a-zA-Z0-9_'-]*\ze\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*?\@=" matchgroup=NONE end="[,}]\@=" transparent contained contains=@nixExpr |
||||
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv |
||||
syn match nixArgumentDefinition "[a-zA-Z_][a-zA-Z0-9_'-]*\ze\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*[,}]\@=" contained |
||||
syn match nixArgumentEllipsis "\.\.\." contained |
||||
syn match nixArgumentSeparator "," contained |
||||
|
||||
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv |
||||
syn match nixArgOperator '@\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*[a-zA-Z_][a-zA-Z0-9_'-]*\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*:'he=s+1 contained contains=nixAttribute |
||||
|
||||
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv |
||||
syn match nixArgOperator '[a-zA-Z_][a-zA-Z0-9_'-]*\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*@'hs=e-1 contains=nixAttribute nextgroup=nixFunctionArgument |
||||
|
||||
" This is a bit more complicated, because function arguments can be passed in a |
||||
" very similar form on how attribute sets are defined and two regions with the |
||||
" same start patterns will shadow each other. Instead of a region we could use a |
||||
" match on {\_.\{-\}}, which unfortunately doesn't take nesting into account. |
||||
" |
||||
" So what we do instead is that we look forward until we are sure that it's a |
||||
" function argument. Unfortunately, we need to catch comments and both vertical |
||||
" and horizontal white space, which the following regex should hopefully do: |
||||
" |
||||
" "\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*" |
||||
" |
||||
" It is also used throught the whole file and is marked with 'v's as well. |
||||
" |
||||
" Fortunately the matching rules for function arguments are much simpler than |
||||
" for real attribute sets, because we can stop when we hit the first ellipsis or |
||||
" default value operator, but we also need to paste the "whitespace & comments |
||||
" eating" regex all over the place (marked with 'v's): |
||||
" |
||||
" Region match 1: { foo ? ... } or { foo, ... } or { ... } (ellipsis) |
||||
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv {----- identifier -----}vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv |
||||
syn region nixFunctionArgument start="{\ze\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*\%([a-zA-Z_][a-zA-Z0-9_'-]*\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*[,?}]\|\.\.\.\)" end="}" contains=nixComment,nixArgumentDefinitionWithDefault,nixArgumentDefinition,nixArgumentEllipsis,nixArgumentSeparator nextgroup=nixArgOperator |
||||
|
||||
" Now it gets more tricky, because we need to look forward for the colon, but |
||||
" there could be something like "{}@foo:", even though it's highly unlikely. |
||||
" |
||||
" Region match 2: {} |
||||
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv@vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv{----- identifier -----} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv |
||||
syn region nixFunctionArgument start="{\ze\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*}\%(\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*@\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*[a-zA-Z_][a-zA-Z0-9_'-]*\)\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*:" end="}" contains=nixComment nextgroup=nixArgOperator |
||||
|
||||
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv |
||||
syn match nixSimpleFunctionArgument "[a-zA-Z_][a-zA-Z0-9_'-]*\ze\%(\s\|#.\{-\}\n\|\n\|/\*\_.\{-\}\*/\)*:\([\n ]\)\@=" |
||||
|
||||
syn region nixList matchgroup=nixListBracket start="\[" end="\]" contains=@nixExpr |
||||
|
||||
syn region nixLetExpr matchgroup=nixLetExprKeyword start="\<let\>" end="\<in\>" contains=nixComment,nixAttributeDefinition |
||||
|
||||
syn keyword nixIfExprKeyword then contained |
||||
syn region nixIfExpr matchgroup=nixIfExprKeyword start="\<if\>" end="\<else\>" contains=@nixExpr,nixIfExprKeyword |
||||
|
||||
syn region nixWithExpr matchgroup=nixWithExprKeyword start="\<with\>" matchgroup=NONE end=";" contains=@nixExpr |
||||
|
||||
syn region nixAssertExpr matchgroup=nixAssertKeyword start="\<assert\>" matchgroup=NONE end=";" contains=@nixExpr |
||||
|
||||
syn cluster nixExpr contains=nixBoolean,nixNull,nixOperator,nixParen,nixInteger,nixRecKeyword,nixConditional,nixBuiltin,nixSimpleBuiltin,nixComment,nixFunctionCall,nixFunctionArgument,nixArgOperator,nixSimpleFunctionArgument,nixPath,nixHomePath,nixSearchPathRef,nixURI,nixAttributeSet,nixList,nixSimpleString,nixString,nixLetExpr,nixIfExpr,nixWithExpr,nixAssertExpr,nixInterpolation |
||||
|
||||
" These definitions override @nixExpr and have to come afterwards: |
||||
|
||||
syn match nixInterpolationParam "[a-zA-Z_][a-zA-Z0-9_'-]*\%(\.[a-zA-Z_][a-zA-Z0-9_'-]*\)*" contained |
||||
|
||||
" Non-namespaced Nix builtins as of version 2.0: |
||||
syn keyword nixSimpleBuiltin |
||||
\ abort baseNameOf derivation derivationStrict dirOf fetchGit |
||||
\ fetchMercurial fetchTarball import isNull map placeholder removeAttrs |
||||
\ scopedImport throw toString |
||||
|
||||
|
||||
" Namespaced and non-namespaced Nix builtins as of version 2.0: |
||||
syn keyword nixNamespacedBuiltin contained |
||||
\ abort add addErrorContext all any attrNames attrValues baseNameOf |
||||
\ catAttrs compareVersions concatLists concatStringsSep currentSystem |
||||
\ currentTime deepSeq derivation derivationStrict dirOf div elem elemAt |
||||
\ fetchGit fetchMercurial fetchTarball fetchurl filter \ filterSource |
||||
\ findFile foldl' fromJSON functionArgs genList \ genericClosure getAttr |
||||
\ getEnv hasAttr hasContext hashString head import intersectAttrs isAttrs |
||||
\ isBool isFloat isFunction isInt isList isNull isString langVersion |
||||
\ length lessThan listToAttrs map match mul nixPath nixVersion |
||||
\ parseDrvName partition path pathExists placeholder readDir readFile |
||||
\ removeAttrs replaceStrings scopedImport seq sort split splitVersion |
||||
\ storeDir storePath stringLength sub substring tail throw toFile toJSON |
||||
\ toPath toString toXML trace tryEval typeOf unsafeDiscardOutputDependency |
||||
\ unsafeDiscardStringContext unsafeGetAttrPos valueSize fromTOML bitAnd |
||||
\ bitOr bitXor |
||||
|
||||
syn match nixBuiltin "builtins\.[a-zA-Z']\+"he=s+9 contains=nixComment,nixNamespacedBuiltin |
||||
|
||||
hi def link nixArgOperator Operator |
||||
hi def link nixArgumentDefinition Identifier |
||||
hi def link nixArgumentEllipsis Operator |
||||
hi def link nixAssertKeyword Keyword |
||||
hi def link nixAttribute Identifier |
||||
hi def link nixAttributeDot Operator |
||||
hi def link nixBoolean Boolean |
||||
hi def link nixBuiltin Special |
||||
hi def link nixComment Comment |
||||
hi def link nixConditional Conditional |
||||
hi def link nixHomePath Include |
||||
hi def link nixIfExprKeyword Keyword |
||||
hi def link nixInherit Keyword |
||||
hi def link nixInteger Integer |
||||
hi def link nixInterpolation Macro |
||||
hi def link nixInterpolationDelimiter Delimiter |
||||
hi def link nixInterpolationParam Macro |
||||
hi def link nixInvalidSimpleStringEscape Error |
||||
hi def link nixInvalidStringEscape Error |
||||
hi def link nixLetExprKeyword Keyword |
||||
hi def link nixNamespacedBuiltin Special |
||||
hi def link nixNull Constant |
||||
hi def link nixOperator Operator |
||||
hi def link nixPath Include |
||||
hi def link nixPathDelimiter Delimiter |
||||
hi def link nixRecKeyword Keyword |
||||
hi def link nixSearchPath Include |
||||
hi def link nixSimpleBuiltin Keyword |
||||
hi def link nixSimpleFunctionArgument Identifier |
||||
hi def link nixSimpleString String |
||||
hi def link nixSimpleStringSpecial SpecialChar |
||||
hi def link nixString String |
||||
hi def link nixStringDelimiter Delimiter |
||||
hi def link nixStringSpecial Special |
||||
hi def link nixTodo Todo |
||||
hi def link nixURI Include |
||||
hi def link nixWithExprKeyword Keyword |
||||
|
||||
" This could lead up to slow syntax highlighting for large files, but usually |
||||
" large files such as all-packages.nix are one large attribute set, so if we'd |
||||
" use sync patterns we'd have to go back to the start of the file anyway |
||||
syn sync fromstart |
||||
|
||||
let b:current_syntax = "nix" |
@ -0,0 +1,547 @@
@@ -0,0 +1,547 @@
|
||||
Given nix (attribute): |
||||
{ |
||||
foo = pkgs.callPackage ./examples/foo {}; |
||||
} |
||||
|
||||
Do (reindent): |
||||
vip= |
||||
|
||||
Expect (indentation): |
||||
~~~~~~~ |
||||
{ |
||||
foo = pkgs.callPackage ./examples/foo {}; |
||||
} |
||||
~~~~~~~ |
||||
|
||||
Execute (syntax): |
||||
AssertEqual SyntaxOf('foo'), 'nixAttribute' |
||||
|
||||
Given nix (attribute-assignment): |
||||
{ |
||||
foo = rec { }; |
||||
} |
||||
|
||||
Execute (syntax): |
||||
AssertEqual SyntaxOf('foo'), 'nixAttribute' |
||||
AssertEqual SyntaxOf('rec'), 'nixRecKeyword' |
||||
|
||||
Given nix (attribute-path): |
||||
{ |
||||
foo.bar.baz = 2; |
||||
} |
||||
|
||||
Execute (syntax): |
||||
AssertNotEqual SyntaxOf('foo'), 'nixAttribute' |
||||
AssertNotEqual SyntaxOf('bar'), 'nixAttribute' |
||||
AssertEqual SyntaxOf('\.'), 'nixAttributeDot' |
||||
AssertEqual SyntaxOf('baz'), 'nixAttribute' |
||||
AssertEqual SyntaxOf('2'), 'nixInteger' |
||||
|
||||
Given nix (attribute-nested): |
||||
{ |
||||
a = { |
||||
b = { |
||||
c = "2}"; |
||||
}; |
||||
}; |
||||
} |
||||
|
||||
Do (reindent): |
||||
vip= |
||||
|
||||
Expect (indentation): |
||||
~~~~~~~ |
||||
{ |
||||
a = { |
||||
b = { |
||||
c = "2}"; |
||||
}; |
||||
}; |
||||
} |
||||
|
||||
Execute (syntax): |
||||
AssertEqual SyntaxOf('a'), 'nixAttribute' |
||||
AssertEqual SyntaxOf('b'), 'nixAttribute' |
||||
AssertEqual SyntaxOf('c'), 'nixAttribute' |
||||
AssertEqual SyntaxOf('2}'), 'nixSimpleString' |
||||
|
||||
Given nix (attribute-nested-insert-indentation): |
||||
Do (insert): |
||||
i{\<Enter>a = {\<Enter>b = {\<Enter>c = "2}";\<Enter>};\<Enter>};\<Enter>}\<Esc> |
||||
|
||||
Expect (indentation): |
||||
~~~~~~~ |
||||
{ |
||||
a = { |
||||
b = { |
||||
c = "2}"; |
||||
}; |
||||
}; |
||||
} |
||||
|
||||
Given nix (attribute-inherit): |
||||
{ |
||||
inherit (a.b.c) foo; |
||||
inherit bar baz; |
||||
} |
||||
|
||||
Execute (syntax): |
||||
AssertNotEqual SyntaxOf('c'), 'nixAttribute' |
||||
AssertEqual SyntaxOf('inherit'), 'nixInherit' |
||||
AssertEqual SyntaxOf('('), 'nixInheritAttributeScope' |
||||
AssertEqual SyntaxOf(')'), 'nixInheritAttributeScope' |
||||
AssertEqual SyntaxOf('\.'), 'nixAttributeDot' |
||||
AssertEqual SyntaxOf('foo'), 'nixAttribute' |
||||
AssertEqual SyntaxOf('bar'), 'nixAttribute' |
||||
AssertEqual SyntaxOf('baz'), 'nixAttribute' |
||||
|
||||
Given nix (attribute-lookup): |
||||
{ |
||||
foo = attrs."foo.foo"; |
||||
bar = attrs."${foo.bar}"; |
||||
baz = attrs.${foo.baz}; |
||||
} |
||||
|
||||
Execute (syntax): |
||||
AssertEqual SyntaxOf('foo'), 'nixAttribute' |
||||
AssertEqual SyntaxOf('foo.foo'), 'nixSimpleString' |
||||
AssertEqual SyntaxOf('bar'), 'nixAttribute' |
||||
AssertEqual SyntaxOf('${'), 'nixInterpolationDelimiter' |
||||
AssertEqual SyntaxOf('}'), 'nixInterpolationDelimiter' |
||||
AssertEqual SyntaxOf('foo.bar'), 'nixInterpolationParam' |
||||
AssertEqual SyntaxOf('baz'), 'nixAttribute' |
||||
AssertEqual SyntaxOf('${'), 'nixInterpolationDelimiter' |
||||
AssertEqual SyntaxOf('}'), 'nixInterpolationDelimiter' |
||||
AssertEqual SyntaxOf('foo.baz'), 'nixInterpolationParam' |
||||
|
||||
Given nix (list): |
||||
{ |
||||
foo = [ |
||||
a |
||||
b |
||||
]; |
||||
} |
||||
|
||||
Do (reindent): |
||||
vip= |
||||
|
||||
Expect (indentation): |
||||
~~~~~~~ |
||||
{ |
||||
foo = [ |
||||
a |
||||
b |
||||
]; |
||||
} |
||||
~~~~~~~ |
||||
|
||||
Execute (syntax): |
||||
AssertEqual SyntaxOf('foo'), 'nixAttribute' |
||||
AssertEqual SyntaxOf('a'), 'nixFunctionCall' |
||||
AssertEqual SyntaxOf('b'), 'nixFunctionCall' |
||||
|
||||
Given nix (string): |
||||
"https://github.com/${owner}/${repo}/archive/${rev}.tar.gz" |
||||
|
||||
Execute (syntax): |
||||
AssertEqual SyntaxOf('"'), 'nixStringDelimiter' |
||||
AssertEqual SyntaxOf('https'), 'nixSimpleString' |
||||
AssertEqual SyntaxOf('${'), 'nixInterpolationDelimiter' |
||||
AssertEqual SyntaxOf('}'), 'nixInterpolationDelimiter' |
||||
AssertEqual SyntaxOf('owner'), 'nixInterpolationParam' |
||||
AssertEqual SyntaxOf('repo'), 'nixInterpolationParam' |
||||
AssertEqual SyntaxOf('rev'), 'nixInterpolationParam' |
||||
|
||||
Given nix (multiline-string): |
||||
'' |
||||
line1 ${ref1} |
||||
${ref2} line2 |
||||
line3 ${ref3} |
||||
'' |
||||
|
||||
Execute (syntax): |
||||
AssertEqual SyntaxOf('line1'), 'nixString' |
||||
AssertEqual SyntaxOf('line2'), 'nixString' |
||||
AssertEqual SyntaxOf('line3'), 'nixString' |
||||
AssertEqual SyntaxOf('ref1'), 'nixInterpolationParam' |
||||
AssertEqual SyntaxOf('ref2'), 'nixInterpolationParam' |
||||
AssertEqual SyntaxOf('ref3'), 'nixInterpolationParam' |
||||
|
||||
Given nix (multiline-string): |
||||
'' |
||||
foo |
||||
''${bar} |
||||
''' |
||||
baz |
||||
'' |
||||
|
||||
Do (reindent): |
||||
vip= |
||||
|
||||
Expect (indentation): |
||||
~~~~~~~ |
||||
'' |
||||
foo |
||||
''${bar} |
||||
''' |
||||
baz |
||||
'' |
||||
~~~~~~~ |
||||
|
||||
Given nix (url): |
||||
https://github.com/LnL7/vim-nix |
||||
|
||||
Execute (syntax): |
||||
AssertEqual SyntaxOf('https'), 'nixURI' |
||||
AssertEqual SyntaxOf('github'), 'nixURI' |
||||
AssertEqual SyntaxOf('nix'), 'nixURI' |
||||
|
||||
Given nix (nix-search-path): |
||||
assert <foo-bar/blah/xxx.nix>; |
||||
|
||||
Execute (syntax): |
||||
AssertEqual SyntaxOf('<'), 'nixPathDelimiter' |
||||
AssertEqual SyntaxOf('foo'), 'nixSearchPath' |
||||
AssertEqual SyntaxOf('-'), 'nixSearchPath' |
||||
AssertEqual SyntaxOf('bar'), 'nixSearchPath' |
||||
AssertEqual SyntaxOf('/'), 'nixSearchPath' |
||||
AssertEqual SyntaxOf('\.'), 'nixSearchPath' |
||||
AssertEqual SyntaxOf('>'), 'nixPathDelimiter' |
||||
|
||||
Given nix (nix-paths): |
||||
[ ~/homefile ./. /etc/passwd ] |
||||
|
||||
Execute (syntax): |
||||
AssertEqual SyntaxOf('\~/homefile'), 'nixHomePath' |
||||
AssertEqual SyntaxOf('\./\.'), 'nixPath' |
||||
AssertEqual SyntaxOf('/etc/passwd'), 'nixPath' |
||||
|
||||
Given nix (let): |
||||
let |
||||
foo = true; |
||||
bar = false; |
||||
in { |
||||
result = foo && bar; |
||||
} |
||||
|
||||
Do (reindent): |
||||
vip= |
||||
|
||||
Expect (indentation): |
||||
~~~~~~~ |
||||
let |
||||
foo = true; |
||||
bar = false; |
||||
in { |
||||
result = foo && bar; |
||||
} |
||||
~~~~~~~ |
||||
|
||||
Given nix (let-in-whitespace): |
||||
let |
||||
|
||||
foo = true; |
||||
bar = false; |
||||
|
||||
in |
||||
|
||||
{ |
||||
result = foo && bar; |
||||
} |
||||
|
||||
Do (reindent): |
||||
vip= |
||||
|
||||
Expect (indentation): |
||||
~~~~~~~ |
||||
let |
||||
|
||||
foo = true; |
||||
bar = false; |
||||
|
||||
in |
||||
|
||||
{ |
||||
result = foo && bar; |
||||
} |
||||
~~~~~~~ |
||||
|
||||
Execute (syntax): |
||||
AssertEqual SyntaxOf('let'), 'nixLetExprKeyword' |
||||
AssertEqual SyntaxOf('in'), 'nixLetExprKeyword' |
||||
AssertEqual SyntaxOf('foo'), 'nixAttribute' |
||||
AssertEqual SyntaxOf('bar'), 'nixAttribute' |
||||
AssertEqual SyntaxOf('result'), 'nixAttribute' |
||||
AssertEqual SyntaxOf('&&'), 'nixOperator' |
||||
|
||||
Given nix (let-multiline-binding): |
||||
let |
||||
result = |
||||
foo && bar; |
||||
in |
||||
result |
||||
|
||||
Do (reindent): |
||||
vip= |
||||
|
||||
Expect (indentation): |
||||
~~~~~~~ |
||||
let |
||||
result = |
||||
foo && bar; |
||||
in |
||||
result |
||||
~~~~~~~ |
||||
|
||||
Given nix (let-multiline-binding-insert-indentation): |
||||
Do (insert): |
||||
ilet\<Enter>result =\<Enter>foo && bar;\<Enter>in\<Enter>result\<Esc> |
||||
|
||||
Expect (indentation): |
||||
~~~~~~~ |
||||
let |
||||
result = |
||||
foo && bar; |
||||
in |
||||
result |
||||
~~~~~~~ |
||||
|
||||
Given nix (let-inherit-insert-indentation): |
||||
Do (insert): |
||||
ilet\<Enter>inherit (attr) foo;\<Enter>in\<Enter>foo\<Esc> |
||||
|
||||
Expect (indentation): |
||||
~~~~~~~ |
||||
let |
||||
inherit (attr) foo; |
||||
in |
||||
foo |
||||
~~~~~~~ |
||||
|
||||
Given nix (let-in-indent-sameline): |
||||
Do (let-in-indent-sameline): |
||||
ilet\<Enter>foo = 111;\<Enter>in foo\<Esc> |
||||
|
||||
Expect (indentation): |
||||
~~~~~~~ |
||||
let |
||||
foo = 111; |
||||
in foo |
||||
~~~~~~~ |
||||
|
||||
Given nix (builtins): |
||||
builtins.doesntexist (builtins.map id [ |
||||
hashString (builtins.fetchurl (toString "abort")) |
||||
]) |
||||
|
||||
Execute (syntax): |
||||
AssertNotEqual SyntaxOf('doesntexist'), 'nixBuiltin' |
||||
AssertEqual SyntaxOf('map'), 'nixNamespacedBuiltin' |
||||
AssertNotEqual SyntaxOf('hashString'), 'nixBuiltin' |
||||
AssertNotEqual SyntaxOf('hashString'), 'nixNamespacedBuiltin' |
||||
AssertEqual SyntaxOf('builtins'), 'nixBuiltin' |
||||
AssertEqual SyntaxOf('\.'), 'nixBuiltin' |
||||
AssertEqual SyntaxOf('fetchurl'), 'nixNamespacedBuiltin' |
||||
AssertEqual SyntaxOf('toString'), 'nixSimpleBuiltin' |
||||
AssertEqual SyntaxOf('abort'), 'nixSimpleString' |
||||
|
||||
Given nix (simple-string-escape): |
||||
"foo\nbar\"end\${xxx}" |
||||
|
||||
Execute (syntax): |
||||
AssertEqual SyntaxAt(1, 1), 'nixStringDelimiter' |
||||
AssertEqual SyntaxOf('foo'), 'nixSimpleString' |
||||
AssertEqual SyntaxOf('\\n'), 'nixSimpleStringSpecial' |
||||
AssertEqual SyntaxOf('bar'), 'nixSimpleString' |
||||
AssertEqual SyntaxOf('\\"'), 'nixSimpleStringSpecial' |
||||
AssertEqual SyntaxOf('end'), 'nixSimpleString' |
||||
AssertEqual SyntaxOf('\$'), 'nixSimpleStringSpecial' |
||||
AssertEqual SyntaxOf('{'), 'nixSimpleString' |
||||
AssertEqual SyntaxOf('xxx'), 'nixSimpleString' |
||||
AssertEqual SyntaxOf('}'), 'nixSimpleString' |
||||
AssertEqual SyntaxAt(1, 22), 'nixStringDelimiter' |
||||
|
||||
Given nix (multiline-string-escape): |
||||
'' |
||||
foo'''bar''\nend |
||||
''${xxx} |
||||
$${foo} |
||||
'' |
||||
|
||||
Execute (syntax): |
||||
AssertEqual SyntaxOf('foo'), 'nixString' |
||||
AssertEqual SyntaxOf("'''"), 'nixStringSpecial' |
||||
AssertEqual SyntaxOf('bar'), 'nixString' |
||||
AssertEqual SyntaxOf("''\\\\"), 'nixStringSpecial' |
||||
AssertEqual SyntaxOf('end'), 'nixString' |
||||
AssertEqual SyntaxOf("''\\$"), 'nixStringSpecial' |
||||
AssertEqual SyntaxOf('{'), 'nixString' |
||||
AssertEqual SyntaxOf('xxx'), 'nixString' |
||||
AssertEqual SyntaxOf('}'), 'nixString' |
||||
AssertEqual SyntaxOf('\$\$'), 'nixStringSpecial' |
||||
AssertEqual SyntaxOf('{foo}'), 'nixString' |
||||
|
||||
Given nix (string-escape-errors): |
||||
'' |
||||
foo''\abar |
||||
foo''\nbar |
||||
${"foo\xbar"} |
||||
${"foo\tbar"} |
||||
${"foo \ |
||||
bar"} |
||||
${"foo\\bar"} |
||||
${"complex\\\\\f\\bar"} |
||||
'' |
||||
|
||||
Execute (syntax): |
||||
AssertEqual SyntaxOf("''\\\\a"), 'nixInvalidStringEscape' |
||||
AssertEqual SyntaxOf("''\\\\n"), 'nixStringSpecial' |
||||
AssertEqual SyntaxOf("\\\\x"), 'nixInvalidSimpleStringEscape' |
||||
AssertEqual SyntaxOf("\\\\t"), 'nixSimpleStringSpecial' |
||||
AssertEqual SyntaxOf("\\\\$"), 'nixSimpleStringSpecial' |
||||
AssertEqual SyntaxOf("foo\\\\\\zs\\\\"), 'nixSimpleStringSpecial' |
||||
AssertEqual SyntaxOf("complex\\zs."), 'nixSimpleStringSpecial' |
||||
AssertEqual SyntaxOf("complex.\\zs."), 'nixSimpleStringSpecial' |
||||
AssertEqual SyntaxOf("complex..\\zs."), 'nixSimpleStringSpecial' |
||||
AssertEqual SyntaxOf("complex.*\\zs.\\zebar"), 'nixSimpleStringSpecial' |
||||
AssertEqual SyntaxOf("complex....\\zs."), 'nixInvalidSimpleStringEscape' |
||||
|
||||
Given nix (lambda-attrs): |
||||
{ # very descriptive comment |
||||
foo |
||||
/**/ |
||||
? # another comment |
||||
/* yet another comment */ |
||||
# default value here: |
||||
1 |
||||
, bar ? "xxx" |
||||
, yyy |
||||
# last comment |
||||
, ... |
||||
}: { |
||||
result = null; |
||||
} |
||||
|
||||
Execute (syntax): |
||||
AssertEqual SyntaxOf('very descriptive comment'), 'nixComment' |
||||
AssertEqual SyntaxOf('foo'), 'nixArgumentDefinition' |
||||
AssertEqual SyntaxOf('?'), 'nixOperator' |
||||
AssertEqual SyntaxOf('/\*\*/'), 'nixComment' |
||||
AssertEqual SyntaxOf('another comment'), 'nixComment' |
||||
AssertEqual SyntaxOf('yet another comment'), 'nixComment' |
||||
AssertEqual SyntaxOf('default value here:'), 'nixComment' |
||||
AssertEqual SyntaxOf('1'), 'nixInteger' |
||||
AssertEqual SyntaxOf('bar'), 'nixArgumentDefinition' |
||||
AssertEqual SyntaxOf('xxx'), 'nixSimpleString' |
||||
AssertEqual SyntaxOf('yyy'), 'nixArgumentDefinition' |
||||
AssertEqual SyntaxOf('last comment'), 'nixComment' |
||||
AssertEqual SyntaxOf('\.\.\.'), 'nixArgumentEllipsis' |
||||
AssertEqual SyntaxOf('result'), 'nixAttribute' |
||||
AssertEqual SyntaxOf('null'), 'nixNull' |
||||
|
||||
Given nix (ifexpr): |
||||
if true then 111 else { a = 222; } |
||||
|
||||
Execute (syntax): |
||||
AssertEqual SyntaxOf('if'), 'nixIfExprKeyword' |
||||
AssertEqual SyntaxOf('true'), 'nixBoolean' |
||||
AssertEqual SyntaxOf('then'), 'nixIfExprKeyword' |
||||
AssertEqual SyntaxOf('111'), 'nixInteger' |
||||
AssertEqual SyntaxOf('else'), 'nixIfExprKeyword' |
||||
AssertEqual SyntaxOf('a'), 'nixAttribute' |
||||
AssertEqual SyntaxOf('222'), 'nixInteger' |
||||
|
||||
Given nix (multiline-ifexpr): |
||||
{ |
||||
foo = |
||||
if true |
||||
then 111 |
||||
else 222; |
||||
} |
||||
|
||||
Execute (syntax): |
||||
AssertEqual SyntaxOf('if'), 'nixIfExprKeyword' |
||||
AssertEqual SyntaxOf('then'), 'nixIfExprKeyword' |
||||
AssertEqual SyntaxOf('else'), 'nixIfExprKeyword' |
||||
|
||||
Do (visualblock-coment): |
||||
02jw\<C-v>2jI# \<Esc> |
||||
|
||||
Expect (indentation): |
||||
~~~~~~~ |
||||
{ |
||||
foo = |
||||
# if true |
||||
# then 111 |
||||
# else 222; |
||||
} |
||||
~~~~~~~ |
||||
|
||||
|
||||
Given nix (with-expr): |
||||
with foo; withfoo |
||||
|
||||
Execute (syntax): |
||||
AssertEqual SyntaxOf('with'), 'nixWithExprKeyword' |
||||
AssertEqual SyntaxOf('foo'), 'nixFunctionCall' |
||||
AssertEqual SyntaxOf('withfoo'), 'nixFunctionCall' |
||||
|
||||
Given nix (with-newline-let-staircase-bug): |
||||
Do (with-newline-let-staircase-bug): |
||||
iwith foo;\<Return>\<Return>let\<Return>bar = 111;\<Return>in bar\<Esc> |
||||
|
||||
Expect (indentation): |
||||
~~~~~~~ |
||||
with foo; |
||||
|
||||
let |
||||
bar = 111; |
||||
in bar |
||||
~~~~~~~ |
||||
|
||||
Given nix (assert-expr): |
||||
assert true -> false; null |
||||
|
||||
Execute (syntax): |
||||
AssertEqual SyntaxOf('assert'), 'nixAssertKeyword' |
||||
AssertEqual SyntaxOf('true'), 'nixBoolean' |
||||
AssertEqual SyntaxOf('->'), 'nixOperator' |
||||
AssertEqual SyntaxOf('false'), 'nixBoolean' |
||||
AssertEqual SyntaxOf('null'), 'nixNull' |
||||
|
||||
Given nix (funarg-let-attrset): |
||||
{ xxx ? null }@yyy: |
||||
|
||||
bbb@{ ccc, ... }: |
||||
|
||||
let foo = 11; in let xxx = 22; in { |
||||
bar = foo + zzz; |
||||
} |
||||
|
||||
Execute (syntax): |
||||
AssertEqual SyntaxOf('xxx'), 'nixArgumentDefinition' |
||||
AssertEqual SyntaxOf('?'), 'nixOperator' |
||||
AssertEqual SyntaxOf('null'), 'nixNull' |
||||
AssertEqual SyntaxOf('@'), 'nixArgOperator' |
||||
AssertEqual SyntaxOf('yyy'), 'nixAttribute' |
||||
AssertEqual SyntaxOf('bbb'), 'nixAttribute' |
||||
AssertEqual SyntaxOf('ccc'), 'nixArgumentDefinition' |
||||
AssertEqual SyntaxOf('let'), 'nixLetExprKeyword' |
||||
AssertEqual SyntaxOf('bar'), 'nixAttribute' |
||||
|
||||
Given nix (searchpath-versus-lt): |
||||
{ |
||||
alwaysTrue = 4 < 5; |
||||
alwaysFalse = 4 > 5; |
||||
somePath = <foo/bar>; |
||||
tailTrue = 4 <= 5; |
||||
tailFalse = 4 >= 5; |
||||
} |
||||
|
||||
Execute (syntax): |
||||
AssertEqual SyntaxOf('alwaysTrue.*\zs<'), 'nixOperator' |
||||
AssertEqual SyntaxOf('alwaysFalse.*\zs>'), 'nixOperator' |
||||
AssertEqual SyntaxOf('somePath.*\zs<'), 'nixPathDelimiter' |
||||
AssertEqual SyntaxOf('somePath.*\zs>'), 'nixPathDelimiter' |
||||
AssertEqual SyntaxOf('tailTrue.*\zs<'), 'nixOperator' |
||||
AssertEqual SyntaxOf('tailFalse.*\zs>'), 'nixOperator' |
@ -0,0 +1,3 @@
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash |
||||
|
||||
cd "$( dirname "${BASH_SOURCE[0]}" )" && vim -Nu vimrc -c 'Vader! *' |
@ -0,0 +1,5 @@
@@ -0,0 +1,5 @@
|
||||
filetype off |
||||
set rtp+=../vader.vim |
||||
set rtp+=../ |
||||
filetype plugin indent on |
||||
syntax enable |
@ -0,0 +1 @@
@@ -0,0 +1 @@
|
||||
/home/envrm/.shellrc/etc/soft/procps |
@ -0,0 +1,149 @@
@@ -0,0 +1,149 @@
|
||||
# |
||||
# wm independent hotkeys |
||||
# |
||||
|
||||
# {_,ctrl +} {XF86MonBrightnessDown, XF86MonBrightnessUp} |
||||
# light -{U,A} {7,3} |
||||
|
||||
# XF86MonBrightnessDown |
||||
# light -U 10 |
||||
|
||||
# XF86MonBrightnessUp |
||||
# light -A 10 |
||||
|
||||
# ctrl + XF86MonBrightnessDown |
||||
# light -U 5 |
||||
|
||||
# ctrl + XF86MonBrightnessUp |
||||
# light -A 5 |
||||
|
||||
# terminal emulator |
||||
alt + t |
||||
xstab |
||||
|
||||
# program launcher |
||||
alt + x |
||||
dmenu_run |
||||
|
||||
# alternate between the tiled and monocle layout |
||||
alt + o |
||||
bspc desktop -l next |
||||
|
||||
alt + g |
||||
calculator |
||||
|
||||
# focus the node in the given direction |
||||
alt + {_,shift + }{h,j,k,l} |
||||
bspc node -{f,s} {west,south,north,east} |
||||
|
||||
# focus the next/previous node in the current desktop |
||||
alt + {_,shift + }Tab |
||||
bspc node -f {next,prev}.local |
||||
|
||||
# focus or send to the given desktop |
||||
alt + {_,shift + }{1-9,0} |
||||
bspc {desktop -f,node -d} '^{1-9,10}' |
||||
|
||||
# focus or send to the next monitor |
||||
alt + Return |
||||
bspc monitor -f next |
||||
|
||||
alt + w |
||||
bspc monitor -f next |
||||
|
||||
# focus the next/previous desktop in the current monitor |
||||
alt + {_,shift + }Escape |
||||
bspc desktop -f {next,prev}.local |
||||
|
||||
|
||||
|
||||
|
||||
# make sxhkd reload its configuration files: |
||||
#alt + Escape |
||||
#pkill -USR1 -x sxhkd |
||||
|
||||
# focus the node for the given path jump |
||||
#super + {p,b,comma,period} |
||||
#bspc node -f @{parent,brother,first,second} |
||||
|
||||
# focus the last node/desktop |
||||
# super + {grave,Tab} |
||||
# bspc {node,desktop} -f last |
||||
|
||||
# focus the older or newer node in the focus history |
||||
#super + {o,i} |
||||
#bspc wm -h off; \ |
||||
#bspc node {older,newer} -f; \ |
||||
#bspc wm -h on |
||||
|
||||
# |
||||
# preselect |
||||
# |
||||
|
||||
# preselect the direction |
||||
#super + ctrl + {h,j,k,l} |
||||
#bspc node -p {west,south,north,east} |
||||
|
||||
# preselect the ratio |
||||
#super + ctrl + {1-9} |
||||
#bspc node -o 0.{1-9} |
||||
|
||||
# cancel the preselection for the focused node |
||||
#super + ctrl + space |
||||
#bspc node -p cancel |
||||
|
||||
# cancel the preselection for the focused desktop |
||||
#super + ctrl + shift + space |
||||
#bspc query -N -d | xargs -I id -n 1 bspc node id -p cancel |
||||
|
||||
# |
||||
# move/resize |
||||
# |
||||
|
||||
# expand a window by moving one of its side outward |
||||
alt + ctrl + {h,j,k,l} |
||||
bspc node -z {left -20 0,bottom 0 20,top 0 -20,right 20 0} |
||||
|
||||
# contract a window by moving one of its side inward |
||||
alt + shift + {h,j,k,l} |
||||
bspc node -z {right -20 0,top 0 20,bottom 0 -20,left 20 0} |
||||
|
||||
# move a floating window |
||||
alt + {Left,Down,Up,Right} |
||||
bspc node -v {-20 0,0 20,0 -20,20 0} |
||||
|
||||
# |
||||
# bspwm hotkeys |
||||
# |
||||
|
||||
# quit/restart bspwm |
||||
#super + alt + {q,r} |
||||
#bspc {quit,wm -r} |
||||
|
||||
# close and kill |
||||
#super + {_,shift + }w |
||||
#bspc node -{c,k} |
||||
|
||||
# send the newest marked node to the newest preselected node |
||||
#super + y |
||||
#bspc node newest.marked.local -n newest.!automatic.local |
||||
|
||||
# swap the current node and the biggest node |
||||
#super + g |
||||
#bspc node -s biggest |
||||
|
||||
# |
||||
# state/flags |
||||
# |
||||
|
||||
# set the window state |
||||
alt + {_,shift + }s |
||||
bspc node -t {floating,tiled} |
||||
|
||||
#super + {t,shift + t,s,f} |
||||
#bspc node -t {tiled,pseudo_tiled,floating,fullscreen} |
||||
|
||||
# set the node flags |
||||
#super + ctrl + {m,x,y,z} |
||||
#bspc node -g {marked,locked,sticky,private} |
||||
|
@ -0,0 +1 @@
@@ -0,0 +1 @@
|
||||
/home/envrm/.shellrc/etc/soft/sxiv |
@ -0,0 +1 @@
@@ -0,0 +1 @@
|
||||
/home/envrm/.shellrc/etc/soft/vifm |
@ -0,0 +1,51 @@
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env bash |
||||
|
||||
export HOST="$PLATFORM.$HOSTNAME" |
||||
|
||||
sxhkd & |
||||
polybar main & |
||||
unclutter & |
||||
|
||||
bspc monitor eDP-1 -d α β γ δ |
||||
|
||||
bspc config -m eDP-1 top_padding 21 |
||||
|
||||
bspc config border_width 1 |
||||
bspc config window_gap 0 |
||||
|
||||
bspc config split_ratio 0.50 |
||||
bspc config borderless_monocle true |
||||
bspc config gapless_monocle true |
||||
|
||||
bspc rule -a Sxiv state=fullscreen |
||||
bspc rule -a Geeqie state=fullscreen |
||||
bspc rule -a Zathura state=tiled |
||||
bspc rule -a mpv state=fullscreen |
||||
bspc rule -a Firefox desktop=^2 follow=on |
||||
bspc rule -a Vivaldi-stable desktop=^2 follow=on |
||||
bspc rule -a Mptk desktop=^5 follow=off |
||||
bspc rule -a Press-n-post state=fullscreen |
||||
bspc rule -a Joplin desktop=^4 follow=on |
||||
bspc rule -a Tcalendar state=floating follow=on focus=on |
||||
|
||||
#bspc config external_rules_command ~/bspwm_rules.sh |
||||
|
||||
bspc config focus_follows_pointer false |
||||
bspc config pointer_follows_monitor false |
||||
|
||||
bspc config normal_border_color "#dddddd" |
||||
bspc config focused_border_color "#3f7efc" |
||||
#bspc config urgent_border_color "magenta" |
||||
#bspc config presel_border_color "magenta" |
||||
|
||||
xrdb -merge "$SHELLRC/etc/X/Xdefaults.$HOST" |
||||
xrdb -merge "$SHELLRC/etc/X/Xdefaults.xst.$HOST" |
||||
xrdb -merge "$SHELLRC/etc/X/Xdefaults.colorscheme.light" |
||||
|
||||
xbindkeys -f "$SHELLRC/etc/X/xbindkeysrc.$HOST" |
||||
xkbcomp -I"$SHELLRC/etc/wm/xkb/xkb.$HOST" "$SHELLRC/etc/wm/xkb/xkb.$HOST/keymap/keymap" "$DISPLAY" |
||||
display -window root "$SHELLRC/etc/wm/img/wallpaper.$HOST.jpg" |
||||
xsetroot -cursor_name left_ptr |
||||
|
||||
xstab & |
||||
|
After Width: | Height: | Size: 718 KiB |
@ -0,0 +1,7 @@
@@ -0,0 +1,7 @@
|
||||
xkb_keymap { |
||||
xkb_keycodes { include "evdev+aliases(qwerty)" }; |
||||
xkb_types { include "complete" }; |
||||
xkb_compat { include "complete" }; |
||||
xkb_symbols { include "pc+us+ru:2+inet(evdev)+group(lwin_toggle)+capslock(escape)+compose(ralt)+terminate(ctrl_alt_bksp)+meta(bind_print_to_meta)" }; |
||||
xkb_geometry { include "pc(pc104)" }; |
||||
}; |
@ -0,0 +1,5 @@
@@ -0,0 +1,5 @@
|
||||
partial modifier_keys |
||||
xkb_symbols "bind_print_to_meta" { |
||||
replace key <PRSC> { [ Meta_L ] }; |
||||
}; |
||||
|
@ -0,0 +1,92 @@
@@ -0,0 +1,92 @@
|
||||
# --------------------------------------------------------------- |
||||
# [ GNU/LINUX ] |
||||
# --------------------------------------------------------------- |
||||
|
||||
# [ Shell ] |
||||
|
||||
+ shell/bash/bash_profile ~ |
||||
+ shell/bash/bashrc ~ |
||||
- shell/guile/guile ~ |
||||
- shell/screen/screenrc ~ |
||||
+ shell/hstr/hstr_blacklist ~ |
||||
|
||||
# [ X.org ] |
||||
|
||||
- X/Xdefaults ~ |
||||
+ X/XCompose ~ |
||||
+ X/xinitrc ~ |
||||
- wm/fonts/fonts.conf ~ |
||||
- wm/gtk/gtkrc-2.0 ~ |
||||
- wm/gtk/gtk-bookmarks ~ |
||||
+ wm/bspwm/bspwmrc ~/.config/bspwm |
||||
+ soft/sxhkd/sxhkdrc ~/.config/sxhkd |
||||
+ wm/xdg/user-dirs.dirs ~/.config |
||||
|
||||
# [ Net ] |
||||
|
||||
+ net/ssh ~ |
||||
- net/rtorrent/rtorrent.rc ~ |
||||
- net/lftp/lftprc ~ |
||||
- net/snownews ~ |
||||
- net/newsboat ~/.config |
||||
- mail/mailcap/mailcap ~ |
||||
- mail/procmail/procmailrc ~ |
||||
|
||||
# [ Soft ] |
||||
|
||||
+ media/ncmpcpp ~ |
||||
- media/moc ~ |
||||
- media/scmpc ~ |
||||
- soft/bar/barrc ~ |
||||
- soft/conky/conkyrc ~ |
||||
- soft/ctags/ctags ~ |
||||
+ soft/nvim ~/.config |
||||
+ soft/vifm ~/.config |
||||
- soft/vimperator ~ |
||||
- soft/vimperator/vimperatorrc ~ |
||||
+ soft/git/gitconfig ~ |
||||
- soft/git/gitk ~ |
||||
- soft/stalonetray/stalonetrayrc ~ |
||||
- soft/tmux/tmux.conf ~ |
||||
- media/alsa/asoundrc ~ |
||||
+ soft/sxiv ~/.config |
||||
+ soft/dfc ~/.config |
||||
+ soft/polybar/config ~/.config/polybar |
||||
+ soft/procps ~/.config |
||||
- soft/k9s/config.$(uname -i).yml ~/.k9s |
||||
- soft/k9s/skin.$(uname -i).yml ~/.k9s |
||||
- soft/htop ~/.config |
||||
- soft/mc ~/.config |
||||
- soft/vim ~/.config |
||||
- soft/vim/vimrc ~ |
||||
- soft/dunst/dunstrc ~/.config/dunst |
||||
- soft/linters/eslintrc ~ |
||||
+ soft/joplin/userchrome.css ~/.config/joplin-desktop/ |
||||
+ soft/joplin/userstyle.css ~/.config/joplin-desktop/ |
||||
|
||||
# [ Dev ] |
||||
|
||||
+ dev/tcl/tclshrc ~ |
||||
- dev/tcl/wishrc ~ |
||||
+ dev/terraform/tflint/tflint.hcl ~ |
||||
|
||||
: --------------------------------------------------------------- |
||||
|
||||
mkdir -pv ~/{FILES,Downloads} |
||||
mkdir -pv ~/FILES/{Projects,Work} |
||||
|
||||
mkdir -pv bin/{scripts,hub} |
||||
|
||||
mkdir -pv var/{shell,log,man,mpd,scmpc,vim} |
||||
mkdir -pv var/vim/{backup,undo,mru,swp,view,yankring} |
||||
#mkdir -pv net/ssh/sessions |
||||
|
||||
: --------------------------------------------------------------- |
||||
|
||||
#xdg-mime default zathura.desktop application/pdf |
||||
#xdg-mime default gpicview.desktop image/gif |
||||
#xdg-mime default gpicview.desktop image/jpg |
||||
#xdg-mime default gpicview.desktop image/png |
||||
|
||||
: --------------------------------------------------------------- |
||||
|
Loading…
Reference in new issue