From 2b98d4a30d401403934a550c0e753942aa0faece Mon Sep 17 00:00:00 2001 From: Jakob Stendahl Date: Wed, 9 Oct 2019 17:07:39 +0200 Subject: :truck: Add install-scripts, reorganize --- Common/bashrc | 1 + Common/vim/vimrc | 382 ++++++++++++++++++++++++++++++++++++++++++++++++ bashrc | 1 - bin/install_arch.sh | 15 -- bin/install_mac.sh | 24 --- bin/install_win.bat | 10 -- install.sh | 18 +++ install/install_arch.sh | 15 ++ install/install_mac.sh | 82 +++++++++++ install/install_win.bat | 10 ++ linux/vim/vimrc | 382 ------------------------------------------------ mac/Hyperterm/hyper.js | 10 +- mac/zshrc | 10 +- 13 files changed, 525 insertions(+), 435 deletions(-) create mode 100644 Common/bashrc create mode 100644 Common/vim/vimrc delete mode 100644 bashrc delete mode 100644 bin/install_arch.sh delete mode 100755 bin/install_mac.sh delete mode 100644 bin/install_win.bat create mode 100755 install.sh create mode 100644 install/install_arch.sh create mode 100755 install/install_mac.sh create mode 100644 install/install_win.bat delete mode 100644 linux/vim/vimrc diff --git a/Common/bashrc b/Common/bashrc new file mode 100644 index 0000000..36357ee --- /dev/null +++ b/Common/bashrc @@ -0,0 +1 @@ +alias lamp='curl -i -H Accept: application/json -H Content-Type: application/json -X GET http://192.168.10.191/j?lamp=toggle' diff --git a/Common/vim/vimrc b/Common/vim/vimrc new file mode 100644 index 0000000..84216c1 --- /dev/null +++ b/Common/vim/vimrc @@ -0,0 +1,382 @@ + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Maintainer: +" jakobs1n +" +" Version: +" 1.0 - 19/03/18 11:00:34 +" +" Sections: +" -> General +" -> VIM user interface +" -> Colors and Fonts +" -> Files and backups +" -> Text, tab and indent related +" -> Visual mode related +" -> Moving around, tabs and buffers +" -> Status line +" -> Editing mappings +" -> vimgrep searching and cope displaying +" -> Spell checking +" -> Misc +" -> Helper functions +" +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => General +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Sets how many lines of history VIM has to remember +set history=500 +set nu +" Enable filetype plugins +filetype plugin on +filetype indent on + +" Set to auto read when a file is changed from the outside +set autoread + +" With a map leader it's possible to do extra key combinations +" like w saves the current file +let mapleader = "," +let g:mapleader = "," + +" Fast saving +nmap w :w! + +" :W sudo saves the file +" (useful for handling the permission-denied error) +command W w !sudo tee % > /dev/null + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => VIM user interface +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Set 7 lines to the cursor - when moving vertically using j/k +set so=7 + +" Avoid garbled characters in Chinese language windows OS +let $LANG='en' +set langmenu=en +source $VIMRUNTIME/delmenu.vim +source $VIMRUNTIME/menu.vim + +" Turn on the WiLd menu +set wildmenu + +" Ignore compiled files +set wildignore=*.o,*~,*.pyc +if has("win16") || has("win32") + set wildignore+=.git\*,.hg\*,.svn\* +else + set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store +endif + +"Always show current position +set ruler + +" Height of the command bar +set cmdheight=2 + +" A buffer becomes hidden when it is abandoned +set hid + +" Configure backspace so it acts as it should act +set backspace=eol,start,indent +set whichwrap+=<,>,h,l + +" Ignore case when searching +set ignorecase + +" When searching try to be smart about cases +set smartcase + +" Highlight search results +set hlsearch + +" Makes search act like search in modern browsers +set incsearch + +" Don't redraw while executing macros (good performance config) +set lazyredraw + +" For regular expressions turn magic on +set magic + +" Show matching brackets when text indicator is over them +set showmatch +" How many tenths of a second to blink when matching brackets +set mat=2 + +" No annoying sound on errors +set noerrorbells +set novisualbell +set t_vb= +set tm=500 + +" Properly disable sound on errors on MacVim +if has("gui_macvim") + autocmd GUIEnter * set vb t_vb= +endif + + +" Add a bit extra margin to the left +set foldcolumn=1 + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Colors and Fonts +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Enable syntax highlighting +syntax enable + +" Enable 256 colors palette in Gnome Terminal +if $COLORTERM == 'gnome-terminal' + set t_Co=256 +endif + +try + colorscheme evening +catch +endtry + +set background=dark + +" Set extra options when running in GUI mode +if has("gui_running") + set guioptions-=T + set guioptions-=e + set t_Co=256 + set guitablabel=%M\ %t +endif + +" Set utf8 as standard encoding and en_US as the standard language +set encoding=utf8 + +" Use Unix as the standard file type +set ffs=unix,dos,mac + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Files, backups and undo +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Turn backup off, since most stuff is in SVN, git et.c anyway... +set nobackup +set nowb +set noswapfile + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Text, tab and indent related +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Use spaces instead of tabs +set expandtab + +" Be smart when using tabs ;) +set smarttab + +" 1 tab == 4 spaces +set shiftwidth=4 +set tabstop=4 + +" Linebreak on 500 characters +set lbr +set tw=500 + +set ai "Auto indent +set si "Smart indent +set wrap "Wrap lines + + +"""""""""""""""""""""""""""""" +" => Visual mode related +"""""""""""""""""""""""""""""" +" Visual mode pressing * or # searches for the current selection +" Super useful! From an idea by Michael Naumann +vnoremap * :call VisualSelection('', '')/=@/ +vnoremap # :call VisualSelection('', '')?=@/ + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Moving around, tabs, windows and buffers +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Map to / (search) and Ctrl- to ? (backwards search) +map / +map ? + +" Disable highlight when is pressed +map :noh + +" Smart way to move between windows +map j +map k +map h +map l + +" Close the current buffer +map bd :Bclose:tabclosegT + +" Close all the buffers +map ba :bufdo bd + +map l :bnext +map h :bprevious + +" Useful mappings for managing tabs +map tn :tabnew +map to :tabonly +map tc :tabclose +map tm :tabmove +map t :tabnext + +" Let 'tl' toggle between this and the last accessed tab +let g:lasttab = 1 +nmap tl :exe "tabn ".g:lasttab +au TabLeave * let g:lasttab = tabpagenr() + + +" Opens a new tab with the current buffer's path +" Super useful when editing files in the same directory +map te :tabedit =expand("%:p:h")/ + +" Switch CWD to the directory of the open buffer +map cd :cd %:p:h:pwd + +" Specify the behavior when switching between buffers +try + set switchbuf=useopen,usetab,newtab + set stal=2 +catch +endtry + +" Return to last edit position when opening files (You want this!) +au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif + + +"""""""""""""""""""""""""""""" +" => Status line +"""""""""""""""""""""""""""""" +" Always show the status line +set laststatus=2 + +" Format the status line +set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l\ \ Column:\ %c + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Editing mappings +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Remap VIM 0 to first non-blank character +map 0 ^ + +" Move a line of text using ALT+[jk] or Command+[jk] on mac +nmap mz:m+`z +nmap mz:m-2`z +vmap :m'>+`mzgv`yo`z +vmap :m'<-2`>my` + nmap + vmap + vmap +endif + +" Delete trailing white space on save, useful for some filetypes ;) +fun! CleanExtraSpaces() + let save_cursor = getpos(".") + let old_query = getreg('/') + silent! %s/\s\+$//e + call setpos('.', save_cursor) + call setreg('/', old_query) +endfun + +if has("autocmd") + autocmd BufWritePre *.txt,*.js,*.py,*.wiki,*.sh,*.coffee :call CleanExtraSpaces() +endif + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Spell checking +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Pressing ,ss will toggle and untoggle spell checking +map ss :setlocal spell! + +" Shortcuts using +map sn ]s +map sp [s +map sa zg +map s? z= + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Misc +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Remove the Windows ^M - when the encodings gets messed up +noremap m mmHmt:%s///ge'tzt'm + +" Quickly open a buffer for scribble +map q :e ~/buffer + +" Quickly open a markdown buffer for scribble +map x :e ~/buffer.md + +" Toggle paste mode on and off +map pp :setlocal paste! + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Helper functions +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Returns true if paste mode is enabled +function! HasPaste() + if &paste + return 'PASTE MODE ' + endif + return '' +endfunction + +" Don't close window, when deleting a buffer +command! Bclose call BufcloseCloseIt() +function! BufcloseCloseIt() + let l:currentBufNum = bufnr("%") + let l:alternateBufNum = bufnr("#") + + if buflisted(l:alternateBufNum) + buffer # + else + bnext + endif + + if bufnr("%") == l:currentBufNum + new + endif + + if buflisted(l:currentBufNum) + execute("bdelete! ".l:currentBufNum) + endif +endfunction + +function! CmdLine(str) + exe "menu Foo.Bar :" . a:str + emenu Foo.Bar + unmenu Foo +endfunction + +function! VisualSelection(direction, extra_filter) range + let l:saved_reg = @" + execute "normal! vgvy" + + let l:pattern = escape(@", "\\/.*'$^~[]") + let l:pattern = substitute(l:pattern, "\n$", "", "") + + if a:direction == 'gv' + call CmdLine("Ack '" . l:pattern . "' " ) + elseif a:direction == 'replace' + call CmdLine("%s" . '/'. l:pattern . '/') + endif + + let @/ = l:pattern + let @" = l:saved_reg +endfunction diff --git a/bashrc b/bashrc deleted file mode 100644 index 36357ee..0000000 --- a/bashrc +++ /dev/null @@ -1 +0,0 @@ -alias lamp='curl -i -H Accept: application/json -H Content-Type: application/json -X GET http://192.168.10.191/j?lamp=toggle' diff --git a/bin/install_arch.sh b/bin/install_arch.sh deleted file mode 100644 index 5306ba2..0000000 --- a/bin/install_arch.sh +++ /dev/null @@ -1,15 +0,0 @@ -echo "Install Oh-My-Zsh" -sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" - -echo "Install zsh-autosuggestions" -git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions - -echo "Install powerlevel9k" -sudo pacman -S zsh-theme-powerlevel9k - -sudo pacman -S highlight atool w3m mediainfo - -ln -i zshrc ~/.zshrc - - -echo "Please install the font Roboto mono nerd, and enable it in your terminal." diff --git a/bin/install_mac.sh b/bin/install_mac.sh deleted file mode 100755 index 69e84d0..0000000 --- a/bin/install_mac.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh - -echo "> Install Homebrew" -/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" - -echo "> Install \"Highlight, atool, w3m, mediainfo\"" -bew install highlight atool w3m mediainfo - -echo "> Install Oh-My-Zsh" -sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" - -echo "> Install zsh-autosuggestions" -git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions - -echo "> Install powerlevel9k" -brew tap sambadevi/powerlevel9k - -echo "> Install our dotfiles" -ln -i mac/zshrc ~/.zshrc -ln -i mac/tmux.conf ~/.tmux.conf -ln -i mac/Hyperterm/hyper.js ~/.hyper.js -ln -i mac/Hyperterm/local/ ~/.hyper_plugins/local/ - -echo "\nPlease install the font Roboto mono nerd, and enable it in your terminal." diff --git a/bin/install_win.bat b/bin/install_win.bat deleted file mode 100644 index 44b529b..0000000 --- a/bin/install_win.bat +++ /dev/null @@ -1,10 +0,0 @@ -@echo off - -echo This installer will setup you system with jakobs1n's dotfiles. -echo It will not care about your current setup, and will assume that you have a "stock" setup, or are trying a new version of jakobs1n's config. -echo -echo Are you an administrator on your system? (Y/n) -echo I don't care... -echo -echo this key should point to your env.cmd -echo REG Add "HKCU\SOFTWARE\Microsoft\Command Processor" /v AutoRun /t REG_SZ /d diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..90df61b --- /dev/null +++ b/install.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +echo "Install the dependencies and symlink the dotfiles" +tput setaf 4 +echo "Install on wich system? Enter either \"mac\", \"arch\":" +tput setaf 3 +printf "> " +read platform +printf "\n" +tput sgr0 + +if [ $platform == "mac" ]; then + ./install/install_mac.sh +fi + +if [ $platform == "arch" ]; then + ./install/install_arch.sh +fi diff --git a/install/install_arch.sh b/install/install_arch.sh new file mode 100644 index 0000000..5306ba2 --- /dev/null +++ b/install/install_arch.sh @@ -0,0 +1,15 @@ +echo "Install Oh-My-Zsh" +sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" + +echo "Install zsh-autosuggestions" +git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions + +echo "Install powerlevel9k" +sudo pacman -S zsh-theme-powerlevel9k + +sudo pacman -S highlight atool w3m mediainfo + +ln -i zshrc ~/.zshrc + + +echo "Please install the font Roboto mono nerd, and enable it in your terminal." diff --git a/install/install_mac.sh b/install/install_mac.sh new file mode 100755 index 0000000..04666cc --- /dev/null +++ b/install/install_mac.sh @@ -0,0 +1,82 @@ +#!/bin/sh + +function dlgYN() { + tput sc + tput setaf 4 + printf "$1 (y/n)? " + while : + do + read -n 1 -p "" YNQuestionAnswer + if [[ $YNQuestionAnswer == "y" ]]; then + tput rc; tput el + printf "$1?: \e[0;32mYes\e[0m\n" + tput sc + eval $2=1 # Set parameter 2 of input to the return value + break + elif [[ $YNQuestionAnswer == "n" ]]; then + tput rc; tput el + printf "$1?: \e[0;31mNo\e[0m\n" + eval $2=0 # Set parameter 2 of input to the return value + break + fi + done +} + +dlgYN "> Install Homebrew" res +if [ $res -eq 1 ]; then + tput sc + /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" + tput rc; tput ed +fi + +dlgYN "> Install \"Highlight, atool, w3m, mediainfo\"" res +if [ $res -eq 1 ]; then + tput sc + bew install highlight atool w3m mediainfo + tput rc; tput ed +fi + +dlgYN "> Install Oh-My-Zsh" res +if [ $res -eq 1 ]; then + tput sc + sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" + tput rc; tput ed +fi + +dlgYN "> Install zsh-autosuggestions" res +if [ $res -eq 1 ]; then + tput sc + git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions + tput rc; tput ed +fi + +dlgYN "> Install Powerline" res +if [ $res -eq 1 ]; then + tput sc + pip3 install powerline-status + tput rc; tput ed +fi + +dlgYN "> Install powerlevel9k" res +if [ $res -eq 1 ]; then + tput sc + brew tap sambadevi/powerlevel9k + brew install powerlevel9k + tput rc; tput ed +fi + +dlgYN "> Create symlinks" res +if [ $res -eq 1 ]; then + CWD=$(PWD) + tput sc + ln -isf "$CWD/mac/zshrc" ~/.zshrc + ln -isf "$CWD/mac/tmux.conf" ~/.tmux.conf + ln -isf "$CWD/mac/Hyperterm/hyper.js" ~/.hyper.js + ln -isf "$CWD/mac/Hyperterm/local" ~/.hyper_plugins/local + ln -isf "$CWD/Common/vim/vimrc" ~/.vimrc + tput rc; tput ed +fi + +tput setaf 3 +echo "\nPlease install the font Roboto mono nerd, and enable it in your terminal." +tput sgr0 diff --git a/install/install_win.bat b/install/install_win.bat new file mode 100644 index 0000000..44b529b --- /dev/null +++ b/install/install_win.bat @@ -0,0 +1,10 @@ +@echo off + +echo This installer will setup you system with jakobs1n's dotfiles. +echo It will not care about your current setup, and will assume that you have a "stock" setup, or are trying a new version of jakobs1n's config. +echo +echo Are you an administrator on your system? (Y/n) +echo I don't care... +echo +echo this key should point to your env.cmd +echo REG Add "HKCU\SOFTWARE\Microsoft\Command Processor" /v AutoRun /t REG_SZ /d diff --git a/linux/vim/vimrc b/linux/vim/vimrc deleted file mode 100644 index 84216c1..0000000 --- a/linux/vim/vimrc +++ /dev/null @@ -1,382 +0,0 @@ - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Maintainer: -" jakobs1n -" -" Version: -" 1.0 - 19/03/18 11:00:34 -" -" Sections: -" -> General -" -> VIM user interface -" -> Colors and Fonts -" -> Files and backups -" -> Text, tab and indent related -" -> Visual mode related -" -> Moving around, tabs and buffers -" -> Status line -" -> Editing mappings -" -> vimgrep searching and cope displaying -" -> Spell checking -" -> Misc -" -> Helper functions -" -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => General -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Sets how many lines of history VIM has to remember -set history=500 -set nu -" Enable filetype plugins -filetype plugin on -filetype indent on - -" Set to auto read when a file is changed from the outside -set autoread - -" With a map leader it's possible to do extra key combinations -" like w saves the current file -let mapleader = "," -let g:mapleader = "," - -" Fast saving -nmap w :w! - -" :W sudo saves the file -" (useful for handling the permission-denied error) -command W w !sudo tee % > /dev/null - - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => VIM user interface -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Set 7 lines to the cursor - when moving vertically using j/k -set so=7 - -" Avoid garbled characters in Chinese language windows OS -let $LANG='en' -set langmenu=en -source $VIMRUNTIME/delmenu.vim -source $VIMRUNTIME/menu.vim - -" Turn on the WiLd menu -set wildmenu - -" Ignore compiled files -set wildignore=*.o,*~,*.pyc -if has("win16") || has("win32") - set wildignore+=.git\*,.hg\*,.svn\* -else - set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store -endif - -"Always show current position -set ruler - -" Height of the command bar -set cmdheight=2 - -" A buffer becomes hidden when it is abandoned -set hid - -" Configure backspace so it acts as it should act -set backspace=eol,start,indent -set whichwrap+=<,>,h,l - -" Ignore case when searching -set ignorecase - -" When searching try to be smart about cases -set smartcase - -" Highlight search results -set hlsearch - -" Makes search act like search in modern browsers -set incsearch - -" Don't redraw while executing macros (good performance config) -set lazyredraw - -" For regular expressions turn magic on -set magic - -" Show matching brackets when text indicator is over them -set showmatch -" How many tenths of a second to blink when matching brackets -set mat=2 - -" No annoying sound on errors -set noerrorbells -set novisualbell -set t_vb= -set tm=500 - -" Properly disable sound on errors on MacVim -if has("gui_macvim") - autocmd GUIEnter * set vb t_vb= -endif - - -" Add a bit extra margin to the left -set foldcolumn=1 - - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => Colors and Fonts -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Enable syntax highlighting -syntax enable - -" Enable 256 colors palette in Gnome Terminal -if $COLORTERM == 'gnome-terminal' - set t_Co=256 -endif - -try - colorscheme evening -catch -endtry - -set background=dark - -" Set extra options when running in GUI mode -if has("gui_running") - set guioptions-=T - set guioptions-=e - set t_Co=256 - set guitablabel=%M\ %t -endif - -" Set utf8 as standard encoding and en_US as the standard language -set encoding=utf8 - -" Use Unix as the standard file type -set ffs=unix,dos,mac - - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => Files, backups and undo -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Turn backup off, since most stuff is in SVN, git et.c anyway... -set nobackup -set nowb -set noswapfile - - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => Text, tab and indent related -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Use spaces instead of tabs -set expandtab - -" Be smart when using tabs ;) -set smarttab - -" 1 tab == 4 spaces -set shiftwidth=4 -set tabstop=4 - -" Linebreak on 500 characters -set lbr -set tw=500 - -set ai "Auto indent -set si "Smart indent -set wrap "Wrap lines - - -"""""""""""""""""""""""""""""" -" => Visual mode related -"""""""""""""""""""""""""""""" -" Visual mode pressing * or # searches for the current selection -" Super useful! From an idea by Michael Naumann -vnoremap * :call VisualSelection('', '')/=@/ -vnoremap # :call VisualSelection('', '')?=@/ - - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => Moving around, tabs, windows and buffers -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Map to / (search) and Ctrl- to ? (backwards search) -map / -map ? - -" Disable highlight when is pressed -map :noh - -" Smart way to move between windows -map j -map k -map h -map l - -" Close the current buffer -map bd :Bclose:tabclosegT - -" Close all the buffers -map ba :bufdo bd - -map l :bnext -map h :bprevious - -" Useful mappings for managing tabs -map tn :tabnew -map to :tabonly -map tc :tabclose -map tm :tabmove -map t :tabnext - -" Let 'tl' toggle between this and the last accessed tab -let g:lasttab = 1 -nmap tl :exe "tabn ".g:lasttab -au TabLeave * let g:lasttab = tabpagenr() - - -" Opens a new tab with the current buffer's path -" Super useful when editing files in the same directory -map te :tabedit =expand("%:p:h")/ - -" Switch CWD to the directory of the open buffer -map cd :cd %:p:h:pwd - -" Specify the behavior when switching between buffers -try - set switchbuf=useopen,usetab,newtab - set stal=2 -catch -endtry - -" Return to last edit position when opening files (You want this!) -au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif - - -"""""""""""""""""""""""""""""" -" => Status line -"""""""""""""""""""""""""""""" -" Always show the status line -set laststatus=2 - -" Format the status line -set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l\ \ Column:\ %c - - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => Editing mappings -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Remap VIM 0 to first non-blank character -map 0 ^ - -" Move a line of text using ALT+[jk] or Command+[jk] on mac -nmap mz:m+`z -nmap mz:m-2`z -vmap :m'>+`mzgv`yo`z -vmap :m'<-2`>my` - nmap - vmap - vmap -endif - -" Delete trailing white space on save, useful for some filetypes ;) -fun! CleanExtraSpaces() - let save_cursor = getpos(".") - let old_query = getreg('/') - silent! %s/\s\+$//e - call setpos('.', save_cursor) - call setreg('/', old_query) -endfun - -if has("autocmd") - autocmd BufWritePre *.txt,*.js,*.py,*.wiki,*.sh,*.coffee :call CleanExtraSpaces() -endif - - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => Spell checking -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Pressing ,ss will toggle and untoggle spell checking -map ss :setlocal spell! - -" Shortcuts using -map sn ]s -map sp [s -map sa zg -map s? z= - - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => Misc -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Remove the Windows ^M - when the encodings gets messed up -noremap m mmHmt:%s///ge'tzt'm - -" Quickly open a buffer for scribble -map q :e ~/buffer - -" Quickly open a markdown buffer for scribble -map x :e ~/buffer.md - -" Toggle paste mode on and off -map pp :setlocal paste! - - -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => Helper functions -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Returns true if paste mode is enabled -function! HasPaste() - if &paste - return 'PASTE MODE ' - endif - return '' -endfunction - -" Don't close window, when deleting a buffer -command! Bclose call BufcloseCloseIt() -function! BufcloseCloseIt() - let l:currentBufNum = bufnr("%") - let l:alternateBufNum = bufnr("#") - - if buflisted(l:alternateBufNum) - buffer # - else - bnext - endif - - if bufnr("%") == l:currentBufNum - new - endif - - if buflisted(l:currentBufNum) - execute("bdelete! ".l:currentBufNum) - endif -endfunction - -function! CmdLine(str) - exe "menu Foo.Bar :" . a:str - emenu Foo.Bar - unmenu Foo -endfunction - -function! VisualSelection(direction, extra_filter) range - let l:saved_reg = @" - execute "normal! vgvy" - - let l:pattern = escape(@", "\\/.*'$^~[]") - let l:pattern = substitute(l:pattern, "\n$", "", "") - - if a:direction == 'gv' - call CmdLine("Ack '" . l:pattern . "' " ) - elseif a:direction == 'replace' - call CmdLine("%s" . '/'. l:pattern . '/') - endif - - let @/ = l:pattern - let @" = l:saved_reg -endfunction diff --git a/mac/Hyperterm/hyper.js b/mac/Hyperterm/hyper.js index c802677..664287d 100644 --- a/mac/Hyperterm/hyper.js +++ b/mac/Hyperterm/hyper.js @@ -149,7 +149,15 @@ module.exports = { // `hyperpower` // `@company/project` // `project#1.0.1` - plugins: ["hyper-startup", "hyper-dark-scrollbar", "hyperlinks", "gitrocket", "space-pull", "hyper-blink" ], + plugins: [ + "hyper-startup", + "hyperminimal", + "hyper-dark-scrollbar", + "hyperlinks", + "gitrocket", + "space-pull", + "hyper-blink" + ], // in development, you can create a directory under // `~/.hyper_plugins/local/` and include it here diff --git a/mac/zshrc b/mac/zshrc index d6bde23..2d932d9 100644 --- a/mac/zshrc +++ b/mac/zshrc @@ -1,7 +1,12 @@ # If you come from bash you might have to change your $PATH. # export PATH=$HOME/bin:/usr/local/bin:$PATH -export ZSH=/Users/jakobstendahl/.oh-my-zsh +if [ ! -f /usr/local/etc/zsh_env_setup ]; then + echo "export ZSH=$HOME/.oh-my-zsh" > /usr/local/etc/zsh_env_setup + echo "DEFAULT_USER=$USER" >> /usr/local/etc/zsh_env_setup +fi + +source /usr/local/etc/zsh_env_setup source /usr/local/opt/powerlevel9k/powerlevel9k.zsh-theme @@ -19,7 +24,6 @@ source $ZSH/oh-my-zsh.sh # You may need to manually set your language environment # export LANG=en_US.UTF-8 -DEFAULT_USER="jakobstendahl" # POWERLINE9K POWERLEVEL9K_MODE="nerdfont-complete" @@ -60,5 +64,7 @@ export LANG=en_US.UTF-8 path+=("/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/share/dotnet:/Library/Frameworks/Mono.framework/Versions/Current/Commands") export PATH export PATH=/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/share/dotnet:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/opt/local/bin:/opt/local/sbin + + alias lamp='/Users/jakobstendahl/.lamp.sh' alias uio-linux='ssh -YC jakobste@login.ifi.uio.no' -- cgit v1.2.3