From 6de728230dfc753f05133c3ca9e69703b575bbad Mon Sep 17 00:00:00 2001 From: "Joe (rorschach-dev)" Date: Wed, 16 Nov 2022 15:02:04 +0100 Subject: [PATCH] initial commit --- .tmux.conf | 88 ++++++++++++ .vimrc | 384 ++++++++++++++++++++++++++++++++++++++++++++++++++++ config.fish | 13 ++ setup.sh | 25 ++++ 4 files changed, 510 insertions(+) create mode 100644 .tmux.conf create mode 100644 .vimrc create mode 100644 config.fish create mode 100755 setup.sh diff --git a/.tmux.conf b/.tmux.conf new file mode 100644 index 0000000..0d932c0 --- /dev/null +++ b/.tmux.conf @@ -0,0 +1,88 @@ +#set-window-option -g xterm-keys +#set-option -g default-terminal "xterm-256color" +set-option -g default-terminal "screen-256color" +set -g pane-border-status + +bind c new-window -c "#{pane_current_path}" +bind '"' split-window -c "#{pane_current_path}" +bind % split-window -h -c "#{pane_current_path}" + +###################### +### DESIGN CHANGES ### +###################### + +# panes +set -g pane-border-style fg=black +set -g pane-active-border-style fg=brightred + +## Status bar design +# status line +set -g status-justify left +set -g status-style bg=default,fg=colour12 +set -g status-interval 2 + +# messaging +set -g message-style fg=black,bg=yellow +set -g message-command-style fg=blue,bg=black + +#window mode +setw -g mode-style bg=colour6,fg=colour0 + +# window status +setw -g window-status-format " #F#I:#W#F " +setw -g window-status-current-format " #F#I:#W#F " +setw -g window-status-format "#[fg=magenta]#[bg=black] #I #[bg=cyan]#[fg=colour8] #W " +setw -g window-status-current-format "#[bg=brightmagenta]#[fg=colour8] #I #[fg=colour8]#[bg=colour14] #W " +setw -g window-status-current-style bg=colour0,fg=colour11,dim +setw -g window-status-style bg=green,fg=black,reverse + +# Info on left (I don't have a session display for now) +set -g status-left '' + +# loud or quiet? +set-option -g visual-activity off +set-option -g visual-bell off +set-option -g visual-silence off +set-window-option -g monitor-activity off +set-option -g bell-action none + +# The modes { +setw -g clock-mode-colour colour135 +setw -g mode-style fg=colour196,bg=colour238,bold + +# } +# The panes { + +set -g pane-border-style bg=colour235,fg=colour238 +set -g pane-active-border-style bg=colour236,fg=colour51 + +# } +# The statusbar { + +set -g status-position bottom +set -g status-style bg=colour234,fg=colour137,dim +set -g status-left '' +set -g status-right '#[fg=colour233,bg=colour241,bold] %Y-%m-%d #[fg=colour233,bg=colour245,bold] %H:%M ' +set -g status-right-length 50 +set -g status-left-length 20 + +setw -g window-status-current-style fg=colour81,bg=colour238,bold +setw -g window-status-current-format ' #I#[fg=colour250]:#[fg=colour255]#W#[fg=colour50]#F ' + +setw -g window-status-style fg=colour138,bg=colour235,none +setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F ' + +setw -g window-status-bell-style fg=colour255,bg=colour1,bold + +# } +# The messages { + +set -g message-style fg=colour232,bg=colour166,bold + +# } + +#set -g default-shell /bin/zsh +set -g default-shell /usr/bin/fish + +# scrollback limit +set-option -g history-limit 20000 diff --git a/.vimrc b/.vimrc new file mode 100644 index 0000000..9dcfba6 --- /dev/null +++ b/.vimrc @@ -0,0 +1,384 @@ +let mapleader = "," +" set the runtime path to include Vundle and initialize +set rtp+=~/.vim/bundle/Vundle.vim +call vundle#begin() + +" Vundle bundles +Bundle 'gmarik/Vundle.vim' +Bundle 'tomasr/molokai' +Bundle 'tpope/vim-dispatch' +Bundle 'vim-scripts/JavaDecompiler.vim' +Bundle 'jszakmeister/vim-togglecursor' +Plugin 'xolox/vim-notes' +Plugin 'xolox/vim-misc' +Plugin 'kien/ctrlp.vim' +Plugin 'alvan/vim-closetag' +Plugin 'elzr/vim-json' +Plugin 'fatih/vim-go' +Plugin 'machakann/vim-sandwich' +Plugin 'junegunn/vim-easy-align' +Plugin 'darfink/vim-plist' + +call vundle#end() + +let mapleader = ',' +let g:mapleader = ',' + +colorscheme molokai + +" mape space to execute makro q +map @q + +" Nerdtree +map :NERDTreeTabsToggle + +" ctr-p + +nnoremap :tabprevious +nnoremap :tabnext + +set nu +set nocompatible +filetype indent plugin on +set ignorecase +set smartcase +set backspace=indent,eol,start +set autoindent +set notimeout ttimeout ttimeoutlen=200 +set background=dark +syntax on +set incsearch + +command Wm w|Make + +imap jk + +set cursorline + +" Return to last edit position when opening files (You want this!) +autocmd BufReadPost * + \ if line("'\"") > 0 && line("'\"") <= line("$") | + \ exe "normal! g`\"" | + \ endif + +"""""""""""""""""""""""""" GO Settings + +" go auto imports +let g:go_fmt_autosave = 1 +let g:go_fmt_fail_silently = 1 +let g:go_fmt_command = "goimports" + +" Remap some commands +au FileType go nmap r (go-run) +au FileType go nmap b (go-build) +au FileType go nmap ds (go-def-split) +au FileType go nmap dv (go-def-vertical) +au FileType go nmap dt (go-def-tab) + +" Highlighting +let g:go_highlight_functions = 1 +let g:go_highlight_methods = 1 +let g:go_highlight_structs = 1 +let g:go_highlight_interfaces = 1 +let g:go_highlight_operators = 1 +let g:go_highlight_build_constraints = 1 + + +"""""""""""""""""""""""" END GO Settings +"""""""""""""""""""""""" Omnicomplete Settings (more like IDE) + +set completeopt=longest,menuone,preview + +inoremap pumvisible() ? "\" : "\u\" +inoremap pumvisible() ? '' : + \ '=pumvisible() ? "\Down>" : ""' + +inoremap pumvisible() ? '' : + \ '=pumvisible() ? "\Down>" : ""' + +"inoremap +"inoremap +inoremap +"""""""""""""""""""""""" END Omnicomplete Settings (more like IDE) + + + +let g:togglecursor_default = "block" + + + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Maintainer: +" Amir Salihefendic +" http://amix.dk - amix@amix.dk +" +" Version: +" 5.0 - 29/05/12 15:43:36 +" +" Blog_post: +" http://amix.dk/blog/post/19691#The-ultimate-Vim-configuration-on-Github +" +" Awesome_version: +" Get this config, nice color schemes and lots of plugins! +" +" Install the awesome version from: +" +" https://github.com/amix/vimrc +" +" Syntax_highlighted: +" http://amix.dk/vim/vimrc.html +" +" Raw_version: +" http://amix.dk/vim/vimrc.txt +" +" 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 +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" 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 = "," + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => VIM user interface +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Set 7 lines to the cursor - when moving vertically using j/k +set so=7 + +" Turn on the WiLd menu +set wildmenu + +" Ignore compiled files +set wildignore=*.o,*~,*.pyc + +" 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 + +" Don't redraw while executing macros (good performance config) +set lazyredraw + +" 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 + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Colors and Fonts +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +" 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 + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Moving around, tabs, windows and buffers +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Treat long lines as break lines (useful when moving around in them) +map j gj +map k gk + +"""""""""""""""""""""""""""""" +" => 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 + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Editing mappings +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Move a line of text using ALT+[jk] or Comamnd+[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 Python and CoffeeScript ;) +func! DeleteTrailingWS() + exe "normal mz" + %s/\s\+$//ge + exe "normal `z" +endfunc +autocmd BufWrite *.py :call DeleteTrailingWS() +autocmd BufWrite *.coffee :call DeleteTrailingWS() + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Misc +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Remove the Windows ^M - when the encodings gets messed up +noremap m mmHmt:%s///ge'tzt'm + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Helper functions +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +function! CmdLine(str) + exe "menu Foo.Bar :" . a:str + emenu Foo.Bar + unmenu Foo +endfunction + +function! VisualSelection(direction) range + let l:saved_reg = @" + execute "normal! vgvy" + + let l:pattern = escape(@", '\\/.*$^~[]') + let l:pattern = substitute(l:pattern, "\n$", "", "") + + if a:direction == 'b' + execute "normal ?" . l:pattern . "^M" + elseif a:direction == 'gv' + call CmdLine("vimgrep " . '/'. l:pattern . '/' . ' **/*.') + elseif a:direction == 'replace' + call CmdLine("%s" . '/'. l:pattern . '/') + elseif a:direction == 'f' + execute "normal /" . l:pattern . "^M" + endif + + let @/ = l:pattern + let @" = l:saved_reg +endfunction + + +" Returns true if paste mode is enabled +function! HasPaste() + if &paste + return 'PASTE MODE ' + en + 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 + +" make as :m +command MyMake :w|:Make +" Use :ww instead of :WriteWithSudo +cnoreabbrev m MyMake + +" tex files with textwidth 80 +au BufRead,BufNewFile *.tex setlocal textwidth=80 +set fo-=t +set fo+=c + +command JsonIndentReorder :%!python -m json.tool +command JsonIndent :%!python3 -c "import json, sys, collections; print(json.dumps(json.loads(sys.stdin.read(), object_pairs_hook=collections.OrderedDict), indent=4))" +command XmlIndent :%!xmllint --format - + +" set font and size in MacVim +set guifont=Hack-Regular:h15 +" disable terminal bell in MacVim +autocmd! GUIEnter * set vb t_vb= + +" set shortcut for easyalign +au FileType markdown vmap a :EasyAlign* + +" unlimited undos even between closing and opening the editor +set undofile +set undodir=~/.vim/undodir diff --git a/config.fish b/config.fish new file mode 100644 index 0000000..d7bf2e2 --- /dev/null +++ b/config.fish @@ -0,0 +1,13 @@ +if status is-interactive + # Commands to run in interactive sessions can go here +end + +# Custom aliases +alias cat='bat --style changes,numbers' +alias ls='exa' +alias ll='exa -bgla' +alias la='exa -bgla' +# alias clear='command clear; task limit:3 next; echo ""; echo ""' +# alias tui='taskwarrior-tui' + +clear diff --git a/setup.sh b/setup.sh new file mode 100755 index 0000000..a32b86a --- /dev/null +++ b/setup.sh @@ -0,0 +1,25 @@ +#!/bin/bash +set -e + + +# install +sudo apt-get update +sudo apt-get install tmux vim exa bat git ripgrep + + +# install vundle and all packages +if [ ! -d "$HOME/.vim/bundle/Vundle.vim" ]; then + git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim +else + echo "Vundle already installed" +fi + +vim +'PlugInstall --sync' +qa + + +# link files + +ln -s $PWD/.tmux.conf $HOME/ +ln -s $PWD/.vimrc $HOME/ +mkdir -p $HOME/.config/fish/ +ln -s $PWD/config.fish $HOME/.config/fish/