diff --git a/tcshrc.colors b/tcshrc.colors index d8b74ff..6aba697 100644 --- a/tcshrc.colors +++ b/tcshrc.colors @@ -22,6 +22,7 @@ set ansi_white='37' set bright="$csi$ansi_bright$ansi_color" set dim="$csi$ansi_dim$ansi_color" set reverse="$csi$ansi_reverse$ansi_color" +set blink="${csi}5${ansi_color}" set black="$csi$ansi_black$ansi_color" diff --git a/tcshrc.prompt.defs b/tcshrc.prompt.defs index 734ab0d..4de75f6 100644 --- a/tcshrc.prompt.defs +++ b/tcshrc.prompt.defs @@ -6,6 +6,11 @@ if( $?CSHENV_DEBUG ) then echo "Sourcing prompt setup and definitions..." endif +which shuf >& /dev/null +if( $? == 0 ) then + setenv CSHENV_DETECTED_SHUF +endif + if( ! $?unknown_tty ) then set unknown_tty="?" if( $?CSHENV_DEBUG ) then @@ -87,6 +92,12 @@ foreach ch ($referencechars_raw) set referencechars=( $referencechars `env LC_ALL=C.UTF-8 printf "\u${ch}"` ) end +if( $CSHENV_SYSTEM == "Darwin" ) then + # Macos seems to dislike using printf to construct unicode chars. + # So you get a dumb set of ABCDXYZ + set referencechars="A B C D X Y Z" +endif + # Rotation alias precmd 'source ${CSHENV_DIR}/tcshrc.prompt.final' #alias postcmd echo doit @@ -97,12 +108,12 @@ set prompt_simple="${oldp_color_seq}[%n@%m: %c]%# " # Screens are almost certainly not a million chars wide. # If they are... oh well, that's a really weird one. -set date_prefix="%{${csi}A${csi}1000000G${csi}18D%}" -set date_suffix="%{${csi}G${csi}1B%}" +set align_prefix="%{${csi}A${csi}1000000G${csi}18D%}" +set align_suffix="%{${csi}G${csi}1B%}" #set screen_return="%{8%}" set date_prompt_core="${date_color_seq}%{%Y-%W-%D %}${time_color_seq}%{%P%}" set date_prompt_left="${date_prompt_core}" -set date_prompt="${date_prefix}${date_prompt_core}${date_suffix}" +set date_prompt="${date_prompt_core}" #unset edit if( $?CSHENV_DEBUG ) then diff --git a/tcshrc.prompt.final b/tcshrc.prompt.final index bf70099..40aa90b 100644 --- a/tcshrc.prompt.final +++ b/tcshrc.prompt.final @@ -4,12 +4,25 @@ @ prompt_hcolor = $prompt_hcolor % ${#reference_colors} @ prompt_hsym = $prompt_hsym % ${#referencechars} +set critical_battery_level = 10 +set low_battery_level = 20 +set weak_battery_level = 33 +set medium_battery_level = 50 +set strong_battery_level = 75 + + if( ${prompt_hcolor} == 0 ) then #if( $?CSHENV_DEBUG ) then #echo colorshuffle #endif #echo  - set reference_colors=`shuf -e $reference_colors` + # Shuffle, if supported + if( $?CSHENV_DETECTED_SHUF ) then + set reference_colors=`shuf -e $reference_colors` + else + #echo "FALLBACK COLOR!" + set reference_colors=`echo $reference_colors | tr " " "\n" | sort -R | xargs` + endif endif @@ -18,8 +31,13 @@ if( ${prompt_hsym} == 0 ) then # && ${prompt_hcolor} == 0 ) then echo symbolshuffle endif #echo  - set referencechars=`shuf -e $referencechars` - #set reference_colors=`shuf -e $reference_colors` + if( $?CSHENV_DETECTED_SHUF ) then + set referencechars=`shuf -e $referencechars` + #set reference_colors=`shuf -e $reference_colors` + else + #echo "FALLBACK CHAR!" + set referencechars=`echo $referencechars | tr " " "\n" | sort -R | xargs` + endif endif @ prompt_hcolor = ${prompt_hcolor} + 1 @@ -30,6 +48,7 @@ if( $?CSHENV_DEBUG ) then echo "Setting prompt" endif + set prompt_reference_core="%{${reference_colors[${prompt_hcolor}]}%}${referencechars[${prompt_hsym}]}" #if( ${referencechars[${prompt_hsym}]} == `env LC_ALL=C.UTF-8 printf "\u2328"` ) then # set prompt_reference="%{${dim}%}<${prompt_reference_core} %{${dim}%}> " @@ -40,7 +59,41 @@ set prompt_reference="%{${dim}%}< ${prompt_reference_core} %{${dim}%}> " #set prompt_reference="%{${csi}0;48\;5\;7m%}(${prompt_reference_core}%{${csi}0;48\;5\;7m%})%{${dim}%}" #set prompt_reference="${prompt_reference_core}%{${text_color_seq}%} \- " -set prompt_cool="\n${date_prompt}${brace_color_seq}\[${prompt_reference}${line_prompt}${depth_prompt}${user_prompt}${at_color_seq}@${host_prompt}${text_color_seq}\: ${path_prompt}${brace_color_seq}\]${end_prompt}" +if( $?CSHENV_SHOW_BATTERY_LEVEL ) then + if( $CSHENV_SYSTEM == "Darwin" ) then + set battery_level=`pmset -g batt | grep -Eo "\d+%" | cut -d% -f1` + else if( $?CSHENV_BATTERY_DEVICE ) then + set battery_level=`cat ${CSHENV_BATTERY_DEVICE}` + else + set battery_level=`cat /sys/class/power_supply/BAT1/capacity` + endif + if( ${battery_level} < ${critical_battery_level} ) then + set battery_color=${red}${blink} + else if( ${battery_level} < ${low_battery_level} ) then + set battery_color=${red} + else if( ${battery_level} < ${weak_battery_level} ) then + set battery_color=${yellow} + else if( ${battery_level} < ${medium_battery_level} ) then + set battery_color=${bright_yellow} + else if( ${battery_level} < ${strong_battery_level} ) then + set battery_color=${green} + else + set battery_color=${bright_green} + endif + + if( ${battery_level} < 10 ) then + set battery_level=" ${battery_level}" + else if( ${battery_level} < 100 ) then + set battery_level=" ${battery_level}" + endif + + #set battery_prompt="%{${battery_color}%}%{${battery_level}${at_color}\%%}%{${dim}%} " + set battery_prompt="%{${csi}28D${csi}38;2;128;128;255;3mBattery Level:${dim} ${battery_color}${battery_level}${at_color}\%${dim} %}" +else + set battery_prompt="" +endif + +set prompt_cool="%{\n%}${align_prefix}${battery_prompt}${date_prompt}${align_suffix}${brace_color_seq}\[${prompt_reference}${line_prompt}${depth_prompt}${user_prompt}${at_color_seq}@${host_prompt}${text_color_seq}\: ${path_prompt}${brace_color_seq}\]${end_prompt}" if( ! ${?cshenv_user_prompt_override} ) then set prompt="$prompt_cool" diff --git a/vim/after/syntax/cpp.vim b/vim/after/syntax/cpp.vim index 3e77b4d..a59cbd5 100644 --- a/vim/after/syntax/cpp.vim +++ b/vim/after/syntax/cpp.vim @@ -59,7 +59,7 @@ syn keyword cxxStlKeywords contained containedin=cxxAttribute noreturn carries_d syn keyword cxxStlKeywords contained containedin=cxxStlLibrary,cxxBoostLibrary mutex condition_variable condition_variable_any thread lock_guard scoped_lock unique_lock " Strings -syn keyword cxxStlKeywords containedin=cxxStlLibrary string contained +syn keyword cxxStlKeywords containedin=cxxStlLibrary wstring string contained syn keyword cxxStlKeywords contained containedin=cxxStlLibrary byte syn keyword cxxStlKeywords contained containedin=cxxStlLibrary,cxxBoostLibrary string_view @@ -68,7 +68,8 @@ syn keyword cxxStlKeywords containedin=cxxStlLibrary,cxxBoostLibrary function co syn keyword cxxStlTypes containedin=cxxStlLibrary exception_ptr contained syn keyword cxxStlTypes containedin=cxxStlLibrary iostream istream ostream fstream ifstream ofstream contained syn keyword cxxStlTypes containedin=cxxStlLibrary stringstream istringstream ostringstream contained -syn keyword cxxStlTypes containedin=cxxStlLibrary iostream basic_string vector deque list pair queue priority_queue stack contained +syn keyword cxxStlTypes containedin=cxxStlLibrary iostream basic_string vector deque pair queue priority_queue stack contained +syn keyword cxxStlTypes containedin=cxxStlLibrary list forward_list syn keyword cxxStlTypes containedin=cxxStlLibrary map multimap set multiset contained syn keyword cxxStlTypes containedin=cxxStlLibrary istream_iterator ostream_iterator contained syn keyword cxxStlTypes containedin=cxxStlLibrary iterator contained diff --git a/vim/vimrc b/vim/vimrc index 533641f..b838cb5 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -23,5 +23,9 @@ source ~/.vim/vimrc.functions source ~/.vim/vimrc.fileprefs source ~/.vim/vimrc.statusline +if exists('$CSHENV_TOUCHSCREEN') + source ~/.vim/vimrc.mousescroll +endif + set shell=/bin/tcsh "set t_Co=1 diff --git a/vim/vimrc.defkeymaps b/vim/vimrc.defkeymaps index d167eb2..25def8c 100644 --- a/vim/vimrc.defkeymaps +++ b/vim/vimrc.defkeymaps @@ -36,3 +36,8 @@ imap [A imap [B imap [C imap [D + +" On my touchscreen laptop, the gnome keyboard doesn't have special keys... +" So we map a key I'll never use to 'escape' +imap £ +map £ diff --git a/vim/vimrc.mousescroll b/vim/vimrc.mousescroll new file mode 100644 index 0000000..86094d9 --- /dev/null +++ b/vim/vimrc.mousescroll @@ -0,0 +1,41 @@ +function! MouseScrollTouch() + "mark b is the current cursor position + "mark a is the previous cursor position + norm mb + let currPos= line('.') + norm `a + let prevPos= line('.') + let amt= 1 + abs(currPos - prevPos) / 2 + "norm `bma + while amt > 0 + if currPos>prevPos + norm  + elseif currPos 0 + if currPos>prevPos + norm  + elseif currPos ma:call MouseScrollTouch()