Compare commits
7 Commits
master
...
emacs-new-
Author | SHA1 | Date | |
---|---|---|---|
|
86307bca2d | ||
|
9ac7dd7953 | ||
|
3fc7b413b7 | ||
|
b103ec8cb7 | ||
|
8e88392d44 | ||
|
15d2e259e3 | ||
|
f3a1c670d9 |
11
fish/conf.d/gcloud_aliases.fish
Normal file
11
fish/conf.d/gcloud_aliases.fish
Normal file
@ -0,0 +1,11 @@
|
||||
function gstart
|
||||
gcloud compute instances start $argv
|
||||
end
|
||||
|
||||
function gstop
|
||||
gcloud compute instances stop $argv
|
||||
end
|
||||
|
||||
function gssh
|
||||
gcloud compute ssh $argv
|
||||
end
|
155
fish/conf.d/gcloud_sdk_argcomplete.fish
Normal file
155
fish/conf.d/gcloud_sdk_argcomplete.fish
Normal file
@ -0,0 +1,155 @@
|
||||
|
||||
function __log --description 'Logs to a file for debugging'
|
||||
# Uncomment this line to enable debug logging:
|
||||
# echo -e $argv >> ~/.fspy
|
||||
end
|
||||
|
||||
function __cut
|
||||
set -l str $argv[1]
|
||||
set -l pos $argv[2]
|
||||
echo (string sub -l $pos -- $str)
|
||||
echo (string sub -s (math 1+$pos) -- $str)
|
||||
end
|
||||
|
||||
function __right
|
||||
set -l str $argv[1]
|
||||
set -l pos $argv[2]
|
||||
string sub -s (math 1+$pos) -- $str
|
||||
end
|
||||
|
||||
function __substr --description 'Classic substr(str, start, end) with 0-based indexing, start inclusive, end exclusive'
|
||||
set -l str $argv[1]
|
||||
set -l start (math $argv[2] + 1)
|
||||
set -l len (math $argv[3] - $argv[2])
|
||||
string sub -s $start -l $len -- $str
|
||||
end
|
||||
|
||||
function __ltrim_ifmatch --description 'Trims arg2 from the left of arg1, if they match, returns 1 otherwise'
|
||||
set -l ln (string length -- $argv[2])
|
||||
set -l left (string sub -l $ln -- $argv[1])
|
||||
if test $left = $argv[2]
|
||||
string sub -s (math $ln + 1) -- $argv[1]
|
||||
else
|
||||
return 1
|
||||
end
|
||||
end
|
||||
|
||||
function __ltrim_unsafe --description 'Trims arg2 from the left of arg1, even if they not match'
|
||||
set -l ln (string length -- $argv[2])
|
||||
string sub -s (math $ln + 1) -- $argv[1]
|
||||
end
|
||||
|
||||
function __rtrim_unsafe --description 'Trims arg2 from the right of arg1, even if they not match'
|
||||
set -l ln (string length -- $argv[1])
|
||||
set -l ln (math $ln - (string length -- $argv[2]))
|
||||
string sub -l $ln -- $argv[1]
|
||||
end
|
||||
|
||||
function __rtrim_ifmatch --description 'Trims arg2 from the right of arg1, if they match, returns 1 otherwise'
|
||||
set -l ln (string length -- $argv[2])
|
||||
set -l start (math (string length -- $argv[1]) - $ln + 1)
|
||||
set -l right (string sub -s $start -- $argv[1])
|
||||
if test $right = $argv[2]
|
||||
string sub -s (math $start - 1) -- $argv[1]
|
||||
else
|
||||
return 1
|
||||
end
|
||||
end
|
||||
|
||||
function __call_argcomplete
|
||||
|
||||
__log "Call argcomplete:" $argv
|
||||
|
||||
set -lx input $argv[1]
|
||||
set -lx COMP_POINT $argv[2]
|
||||
set -lx tokenStart $argv[3]
|
||||
set -lx prefix $argv[4]
|
||||
|
||||
set -lx COMP_LINE (string sub -l $tokenStart -- $input)
|
||||
set -lx words (string split ' ' -- (string sub -l $COMP_POINT -- $input))
|
||||
set -lx lastWord $words[-1]
|
||||
|
||||
set -lx _ARGCOMPLETE_COMP_WORDBREAKS \n'"\'@><=;|&(:'
|
||||
set -lx _ARGCOMPLETE 1
|
||||
set -lx CMD $words[1]
|
||||
|
||||
set -l rval (eval $CMD 8>&1 9>&2 1>/dev/null 2>/dev/null)
|
||||
__log "CloudSDK returned: '$rval'"
|
||||
if test $status -ne 0
|
||||
return
|
||||
end
|
||||
|
||||
if test ! $rval
|
||||
if test (count $words) -gt 2 -a -n $lastWord
|
||||
# Fallback scenario 1: try to ignore the last word if it's not complete:
|
||||
# Note: this can only happen in the first call on the stack, since we then fallback by words
|
||||
set -l trimmed (__rtrim_unsafe $input $lastWord)
|
||||
set -l fallbackPos (string length -- $trimmed)
|
||||
__call_argcomplete $input $fallbackPos $fallbackPos ''
|
||||
end
|
||||
if test (count $words) -gt 3 -a -z $lastWord
|
||||
# Fallback scenario 2: if last word is blank try fallback to the previous word
|
||||
set -l prevWordLen (string length -- $words[-2])
|
||||
set -l fallbackPos (math $COMP_POINT - $prevWordLen - 1)
|
||||
__call_argcomplete $input $fallbackPos $tokenStart ''
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
set -l options (string split \v -- $rval)
|
||||
set -l pattern (__substr $input $COMP_POINT $tokenStart)
|
||||
|
||||
for opt in $options
|
||||
set opt (string replace -r '^(\w+)\\\\://' '$1://' -- $opt)
|
||||
set -l match (__ltrim_ifmatch $opt $pattern)
|
||||
if test $status -eq 0
|
||||
set -l args (string split -m 1 ' ' -- $match)
|
||||
if test (count $args) -gt 1
|
||||
echo -n "$prefix$args[1]"
|
||||
echo -n -e "\t"
|
||||
echo "$args[2]"
|
||||
else
|
||||
echo "$prefix$args[1]"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function gcloud_sdk_argcomplete
|
||||
|
||||
__log '$>' (date)
|
||||
|
||||
set -l token (commandline -t)
|
||||
set -l input (commandline -cp)
|
||||
set -l fullLine (commandline -p)
|
||||
set -l cursorAt (string length -- $input)
|
||||
|
||||
set -lx words (string split ' ' -- $input)
|
||||
|
||||
set -lx prefix ''
|
||||
if string match -q -- '*@*' $words[-1]
|
||||
if string match -q -- '* ssh *' $input
|
||||
set -l parts (string split '@' $words[-1])
|
||||
set prefix "$parts[1]@"
|
||||
set words[-1] (string replace -- $prefix '' $words[-1])
|
||||
set cursorAt (math $cursorAt - (string length -- $prefix))
|
||||
end
|
||||
end
|
||||
if string match -q -- '--*=*' $words[-1]
|
||||
set -l parts (string split '=' -- $words[-1])
|
||||
set words[-1] (string join ' ' -- $parts)
|
||||
set prefix "$parts[1]="
|
||||
end
|
||||
set input (string join ' ' -- $words)
|
||||
# well, this is a bit strage, but seemingly 8 \-s will actually print 1 \, a bit of escaping hell
|
||||
set -l escaped (string replace -a -r '(\s\w+)://' '${1}\\\\\\\\://' -- $input)
|
||||
set -l ilen (string length -- $input)
|
||||
set -l elen (string length -- $escaped)
|
||||
if test $elen -gt $ilen
|
||||
set input $escaped
|
||||
set cursorAt (math $cursorAt - $ilen + $elen)
|
||||
end
|
||||
|
||||
__call_argcomplete $input $cursorAt $cursorAt $prefix
|
||||
|
||||
end
|
43
fish/config.fish
Normal file
43
fish/config.fish
Normal file
@ -0,0 +1,43 @@
|
||||
# Fish configuration file
|
||||
|
||||
# Configuration for terminal / unix:
|
||||
set -x LC_CTYPE en_US.UTF-8
|
||||
set -x LC_ALL en_US.UTF-8
|
||||
|
||||
if test (uname) != "Darwin"
|
||||
set -x TERM xterm-256color
|
||||
end
|
||||
|
||||
# Creation mask
|
||||
umask 022
|
||||
|
||||
# Theme configuration (bobthefish):
|
||||
set -g theme_newline_cursor yes
|
||||
set -g theme_newline_prompt "\$ "
|
||||
set -g theme_color_scheme zenburn
|
||||
set -g VIRTUAL_ENV_DISABLE_PROMPT 1
|
||||
|
||||
# Python configuration:
|
||||
set -x PYTHONIOENCODING UTF-8
|
||||
set -xg WORKON_HOME $HOME/envs
|
||||
set -xg MYPYPATH $HOME/.mypy
|
||||
|
||||
# Aliases
|
||||
if test (uname) != "Darwin"
|
||||
alias ls='ls --color=auto'
|
||||
alias ll='ls -lh'
|
||||
alias la='ls -A'
|
||||
alias l='ls -CF'
|
||||
alias rm='rm -i --preserve-root'
|
||||
else
|
||||
alias rm='rm -i'
|
||||
end
|
||||
|
||||
# Extend path:
|
||||
set PPATHS /usr/local/bin /usr/local/sbin
|
||||
|
||||
for path in $PPATHS
|
||||
if test -e $path
|
||||
set -xg PATH $path $PATH
|
||||
end
|
||||
end
|
28
fish/fish_variables
Normal file
28
fish/fish_variables
Normal file
@ -0,0 +1,28 @@
|
||||
# This file contains fish universal variable definitions.
|
||||
# VERSION: 3.0
|
||||
SETUVAR fish_color_autosuggestion:555\x1ebrblack
|
||||
SETUVAR fish_color_cancel:\x2dr
|
||||
SETUVAR fish_color_command:005fd7
|
||||
SETUVAR fish_color_comment:990000
|
||||
SETUVAR fish_color_cwd:green
|
||||
SETUVAR fish_color_cwd_root:red
|
||||
SETUVAR fish_color_end:009900
|
||||
SETUVAR fish_color_error:ff0000
|
||||
SETUVAR fish_color_escape:00a6b2
|
||||
SETUVAR fish_color_history_current:\x2d\x2dbold
|
||||
SETUVAR fish_color_host:normal
|
||||
SETUVAR fish_color_match:\x2d\x2dbackground\x3dbrblue
|
||||
SETUVAR fish_color_normal:normal
|
||||
SETUVAR fish_color_operator:00a6b2
|
||||
SETUVAR fish_color_param:00afff
|
||||
SETUVAR fish_color_quote:999900
|
||||
SETUVAR fish_color_redirection:00afff
|
||||
SETUVAR fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack
|
||||
SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack
|
||||
SETUVAR fish_color_user:brgreen
|
||||
SETUVAR fish_color_valid_path:\x2d\x2dunderline
|
||||
SETUVAR fish_greeting:Welcome\x20to\x20fish\x2c\x20the\x20friendly\x20interactive\x20shell
|
||||
SETUVAR fish_key_bindings:fish_default_key_bindings
|
||||
SETUVAR fish_pager_color_description:B3A06D\x1eyellow
|
||||
SETUVAR fish_pager_color_prefix:white\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
|
||||
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
|
3
install-emacs-packages.sh
Executable file
3
install-emacs-packages.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
emacs -nw -q --batch --load install-packages.el
|
78
install-packages.el
Normal file
78
install-packages.el
Normal file
@ -0,0 +1,78 @@
|
||||
;;; install-packages --- Install required packages
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; Install the required packages.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'package) ;; You might already have this line
|
||||
|
||||
(add-to-list 'package-archives
|
||||
'("melpa" . "http://melpa.org/packages/"))
|
||||
(add-to-list 'package-archives
|
||||
'("melpa" . "http://melpa.milkbox.net/packages/"))
|
||||
(when (< emacs-major-version 24)
|
||||
;; For important compatibility libraries like cl-lib
|
||||
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
|
||||
(package-initialize) ;; You might already have this line
|
||||
|
||||
(package-refresh-contents)
|
||||
|
||||
(package-install '2048-game)
|
||||
(package-install 'async)
|
||||
(package-install 'auctex)
|
||||
(package-install 'auto-complete)
|
||||
(package-install 'company)
|
||||
(package-install 'company-auctex)
|
||||
(package-install 'company-c-headers)
|
||||
(package-install 'company-dict)
|
||||
(package-install 'company-jedi)
|
||||
(package-install 'company-math)
|
||||
(package-install 'company-web)
|
||||
(package-install 'cython-mode)
|
||||
(package-install 'dash)
|
||||
(package-install 'dash-functional)
|
||||
(package-install 'diffview)
|
||||
(package-install 'ein)
|
||||
(package-install 'elpy)
|
||||
(package-install 'fish-mode)
|
||||
(package-install 'flycheck)
|
||||
(package-install 'flycheck-color-mode-line)
|
||||
(package-install 'flycheck-mypy)
|
||||
(package-install 'flycheck-pos-tip)
|
||||
(package-install 'helm)
|
||||
(package-install 'helm-bibtex)
|
||||
(package-install 'helm-core)
|
||||
(package-install 'helm-flycheck)
|
||||
(package-install 'helm-flyspell)
|
||||
(package-install 'helm-ls-git)
|
||||
(package-install 'helm-projectile)
|
||||
(package-install 'helm-spotify)
|
||||
(package-install 'hydandata-light-theme)
|
||||
(package-install 'java-imports)
|
||||
(package-install 'java-snippets)
|
||||
(package-install 'javadoc-lookup)
|
||||
(package-install 'jedi)
|
||||
(package-install 'jedi-core)
|
||||
(package-install 'js-comint)
|
||||
(package-install 'json-mode)
|
||||
(package-install 'json-reformat)
|
||||
(package-install 'magit)
|
||||
(package-install 'magit-popup)
|
||||
(package-install 'markdown-mode)
|
||||
(package-install 'material-theme)
|
||||
(package-install 'math-symbol-lists)
|
||||
(package-install 'exec-path-from-shell)
|
||||
(package-install 'php-mode)
|
||||
(package-install 'powerline)
|
||||
(package-install 'projectile)
|
||||
(package-install 'python-mode)
|
||||
(package-install 'solarized-theme)
|
||||
(package-install 'sr-speedbar)
|
||||
(package-install 'visual-fill-column)
|
||||
(package-install 'web-mode)
|
||||
(package-install 'yaml-mode)
|
||||
(package-install 'yasnippet)
|
||||
|
||||
;;; install-packages.el ends here
|
Loading…
Reference in New Issue
Block a user