Skip to content

Instantly share code, notes, and snippets.

@mb64
Created December 9, 2020 07:10
Show Gist options
  • Save mb64/7345b763d8ab519f96004733f3af7703 to your computer and use it in GitHub Desktop.
Save mb64/7345b763d8ab519f96004733f3af7703 to your computer and use it in GitHub Desktop.
reMarkable 2 dotfiles
umask 022
declare -x PAGER='less'
declare -x EDITOR='vim'
declare -x VISUAL="${EDITOR}"
declare -x FCEDIT="${EDITOR}"
declare -x LS_COLORS='no=01;37:fi=01;37:di=01;34:ln=01;36:pi=01;32:so=01;35:do=01;35:bd=01;33:cd=01;33:ex=01;31:mi=00;37:or=00;36:'
declare -x HISTCONTROL=ignoreboth:erasedups
declare -x HISTSIZE=-1
declare -x HISTFILE=~/.bash_history
declare -x PROMPT_COMMAND="history -a" # sync history immediately
set -o physical
alias vi=vim
alias ll='ls -l'
alias la='ls -la'
alias pg='ps | grep'
########
# prompt
rgb_restore='\[\033[00m\]'
rgb_black='\[\033[00;30m\]'
rgb_firebrick='\[\033[00;31m\]'
rgb_red='\[\033[01;31m\]'
rgb_forest='\[\033[00;32m\]'
rgb_green='\[\033[01;32m\]'
rgb_brown='\[\033[00;33m\]'
rgb_yellow='\[\033[01;33m\]'
rgb_navy='\[\033[00;34m\]'
rgb_blue='\[\033[01;34m\]'
rgb_purple='\[\033[00;35m\]'
rgb_magenta='\[\033[01;35m\]'
rgb_cadet='\[\033[00;36m\]'
rgb_cyan='\[\033[01;36m\]'
rgb_gray='\[\033[00;37m\]'
rgb_white='\[\033[01;37m\]'
rgb_std="${rgb_white}"
if [ `id -u` -eq 0 ]
then
rgb_usr="${rgb_red}"
else
rgb_usr="${rgb_green}"
fi
export ELIDED_PATH='$(echo -n "${PWD/#$HOME/\~}" | awk -F "/" '"'"'{
if (length($0) > 50) { if (NF>4) print $1 "/" $2 "/.../" $(NF-1) "/" $NF;
else if (NF>3) print $1 "/" $2 "/.../" $NF;
else print $1 "/.../" $NF; }
else print $0;}'"'"')'
PS1="${rgb_gray}`hostname`${rgb_usr}: ${rgb_std}${ELIDED_PATH}/${rgb_restore} "
unset rgb_restore \
rgb_black \
rgb_firebrick \
rgb_red \
rgb_forest \
rgb_green \
rgb_brown \
rgb_yellow \
rgb_navy \
rgb_blue \
rgb_purple \
rgb_magenta \
rgb_cadet \
rgb_cyan \
rgb_gray \
rgb_white \
rgb_std \
rgb_usr
" Random vim config collected and handed over through the years at the Student
" Society in Trondheim
" Now mine.
filetype plugin indent on
syntax on
let osys=system('uname -s')
let vimdir=$HOME . '/.vim/'
" Store all backup files in a central folder instead of cluttering
let &viminfo="'20," . '%,n' . vimdir . 'viminfo'
let &backupdir=vimdir . 'tmp'
if !isdirectory(&backupdir)
call mkdir(&backupdir, "p")
endif
" If we have a saved position in the file, go there.
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
set ai " Always set auto-indenting on
set bs=2 " Allow backspacing over everything in insert mode
set bg=dark " gir ugly ugly farger, men men
set backup " Keep a backup file
set backspace=2
set clipboard+=unnamed " put yanks/etc on the clipboard
set errorbells " beep/flash on errors, vil vi ha det da ???
set expandtab
set foldmethod=marker
set foldlevelstart=99 " start with all folds open
set foldopen-=search " don't open folds when you search into them
set foldopen-=undo " don't open folds when you undo stuff
set history=100 " keep 50 lines of command history
set hidden " lukker ikke ei fil i et buffer n�r du forlater den ("abandon")
set hlsearch " highlighter siste s�k, kjekt....
"set incsearch " noen syntes dette er nice, jeg synes ikke det :P
set nocompatible " Use Vim defaults (much better!)
set nowrap " vi liker da ikke wrap'ing... bare dritt
set number " for � f� linjenumrering... litt slitsomt i starten
set nowarn
set ruler " Show the cursor position all the time
set suffixes+=.class,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc
set showcmd
set showmatch " vise fold'a kode eller noe... ???
set smartcase " lurt n�r man driver � s�ker...
set ignorecase
set shortmess=at "shortens messages to avoid 'press a key' prompt
set shiftwidth=2 " two spaces per sw
set diffopt+=iwhite " ignore trailing whitespace in vimdiff
" set smarttab " sw at start, not tab
set sts=4
set sw=4
set ts=8
set tabstop=4 " The One True Tab
set softtabstop=4
set shiftwidth=4
set expandtab
set timeout " allow keys to timeout
set ttimeoutlen=100 " Timeout of successive keys from keyboard driver
set novisualbell " s�rge for at vi bare f�r flash ihverfall
"set viminfo='20,\"50 " read/write a .viminfo file -- limit to only 50
set wildmode=list:longest "(file-listing when opening a new file)
" latex-suite wants grep to always generate a file-name.
set grepprg=grep\ -nH\ $*
" Disable autoloading of vimspell
let loaded_vimspell = 1
let spell_insert_mode = 0
let spell_auto_type = "tex,mail"
let spell_language_list = "norsk,english"
" Setup Taglist plugin
let Tlist_Ctags_Cmd=$HOME . '/local/' . tolower(substitute(osys,"\n",'','')) . '/bin/ctags'
" F1 for help is really annoying.
"nnoremap <xF1> <nop>
"inoremap <xF1> <nop>
:nmap <F1> :echo<CR>
:imap <F1> <C-o>:echo<CR>
"" Change directory to the directory of the file I'm working on.
"autocmd BufEnter *
" \ if isdirectory( '%:p:h' ) |
" \ lcd %:p:h |
" \ endif
" Set a satusline that gives some cool information.
set statusline=%<%F%h%m%r%=\[%B\]\ %l,%c%V\ %P
" Always show the statusline
set laststatus=2
" Don't use Ex mode, use Q for formatting
map Q gq
let g:Tex_DefaultTargetFormat="dvi"
" We play utf-8
set fileencoding=utf-8
set encoding=utf-8
set termencoding=utf-8
au BufNewFile,BufRead mutt* set tw=77 ai nocindent fileencoding=utf-8
au BufNewFile,BufRead psql.edit.* set tw=77 ai nocindent fileencoding=utf-8 filetype=sql
" Highlight bogus whitespace at the end of files
highlight WhitespaceEOL ctermbg=red guibg=red
match WhitespaceEOL /\s\+$/
" Make spelling errors readable
highlight SpellBad ctermbg=0 ctermfg=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment