From 10e736783b0691530590ad0abdea5e0e62a9c49a Mon Sep 17 00:00:00 2001 From: Mark Valor Date: Wed, 15 Mar 2017 00:36:16 -0700 Subject: [PATCH] added dot files and tmux commands file --- .tmux.conf.unused | 126 ++++++++++++++++++++++++++++++ .vimrc | 191 ++++++++++++++++++++++++++++++++++++++++++++++ tmux_cmds | 170 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 487 insertions(+) create mode 100644 .tmux.conf.unused create mode 100644 .vimrc create mode 100644 tmux_cmds diff --git a/.tmux.conf.unused b/.tmux.conf.unused new file mode 100644 index 0000000..6933bc0 --- /dev/null +++ b/.tmux.conf.unused @@ -0,0 +1,126 @@ +# mkvalor tmux config +# edit 2/26/2017: don't customize tmux, so I can get used to the defaults + +# remap prefix from ctrl-b to ctrl-a +unbind C-b +set-option -g prefix C-a +bind-key C-a send-prefix + +# split panes using - and | +bind | split-window -h +bind - split-window -v +unbind '"' +unbind % + +# reload tmux config with prifix-r +bind r source-file ~/.tmux.conf + +# switch panes with Alt-[vim movement keys] +bind -n M-h select-pane -L +bind -n M-j select-pane -D +bind -n M-k select-pane -U +bind -n M-l select-pane -R +#could also bind arrow keys, but no, trying to train navigation without them! + +# don't re-name windows based on last executed command +set-option -g allow-rename off + +###################### +### DESIGN CHANGES ### +###################### + +# panes +set -g pane-border-fg black +set -g pane-active-border-fg brightred + +## Status bar design +# status line +set -g status-utf8 on +set -g status-justify left +set -g status-bg default +set -g status-fg colour12 +set -g status-interval 2 + +# messaging +set -g message-fg black +set -g message-bg yellow +set -g message-command-fg blue +set -g message-command-bg black + +#window mode +setw -g mode-bg colour6 +setw -g mode-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-bg colour0 +setw -g window-status-current-fg colour11 +setw -g window-status-current-attr dim +setw -g window-status-bg green +setw -g window-status-fg black +setw -g window-status-attr 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 + +set -g default-terminal "screen-256color" + +# The modes { +setw -g clock-mode-colour colour135 +setw -g mode-attr bold +setw -g mode-fg colour196 +setw -g mode-bg colour238 + +# } +# The panes { + +set -g pane-border-bg colour235 +set -g pane-border-fg colour238 +set -g pane-active-border-bg colour236 +set -g pane-active-border-fg colour51 + +# } +# The statusbar { + +set -g status-position bottom +set -g status-bg colour234 +set -g status-fg colour137 +set -g status-attr dim +set -g status-left '' +set -g status-right '#[fg=colour233,bg=colour241,bold] %d/%m #[fg=colour233,bg=colour245,bold] %H:%M:%S ' +set -g status-right-length 50 +set -g status-left-length 20 + +setw -g window-status-current-fg colour81 +setw -g window-status-current-bg colour238 +setw -g window-status-current-attr bold +setw -g window-status-current-format ' #I#[fg=colour250]:#[fg=colour255]#W#[fg=colour50]#F ' + +setw -g window-status-fg colour138 +setw -g window-status-bg colour235 +setw -g window-status-attr none +setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F ' + +setw -g window-status-bell-attr bold +setw -g window-status-bell-fg colour255 +setw -g window-status-bell-bg colour1 + +# } +# The messages { + +set -g message-attr bold +set -g message-fg colour232 +set -g message-bg colour166 + +# } + diff --git a/.vimrc b/.vimrc new file mode 100644 index 0000000..0dbad18 --- /dev/null +++ b/.vimrc @@ -0,0 +1,191 @@ +" URL: http://vim.wikia.com/wiki/Example_vimrc +" Authors: http://vim.wikia.com/wiki/Vim_on_Freenode +" Description: A minimal, but feature rich, example .vimrc. If you are a +" newbie, basing your first .vimrc on this file is a good choice. +" If you're a more advanced user, building your own .vimrc based +" on this file is still a good idea. + +"------------------------------------------------------------ +" Features {{{1 +" +" These options and commands enable some very useful features in Vim, that +" no user should have to live without. + +" Set 'nocompatible' to ward off unexpected things that your distro might +" have made, as well as sanely reset options when re-sourcing .vimrc +set nocompatible + +filetype off + +set rtp+=~/.vim/bundle/Vundle.vim + +call vundle#begin() +" ---begin vundle-managed plugins--- + +" Vundle must be set to manage itself +Plugin 'VundleVim/Vundle.vim' + +Plugin 'scrooloose/nerdtree.git' +Plugin 'ctrlpvim/ctrlp.vim.git' +Plugin 'rust-lang/rust.vim' +" ---end vundle-managed plugins--- +call vundle#end() + +" Attempt to determine the type of a file based on its name and possibly its +" contents. Use this to allow intelligent auto-indenting for each filetype, +" and for plugins that are filetype specific. +filetype plugin indent on + +" Enable syntax highlighting +syntax on + + +"------------------------------------------------------------ +" Must have options {{{1 +" +" These are highly recommended options. + +" Vim with default settings does not allow easy switching between multiple files +" in the same editor window. Users can use multiple split windows or multiple +" tab pages to edit multiple files, but it is still best to enable an option to +" allow easier switching between files. +" +" One such option is the 'hidden' option, which allows you to re-use the same +" window and switch from an unsaved buffer without saving it first. Also allows +" you to keep an undo history for multiple files when re-using the same window +" in this way. Note that using persistent undo also lets you undo in multiple +" files even in the same window, but is less efficient and is actually designed +" for keeping undo history after closing Vim entirely. Vim will complain if you +" try to quit without saving, and swap files will keep you safe if your computer +" crashes. +"set hidden + +" Note that not everyone likes working this way (with the hidden option). +" Alternatives include using tabs or split windows instead of re-using the same +" window as mentioned above, and/or either of the following options: +" set confirm +" set autowriteall + +" Auto group for writing all on focus change +augroup save + au! + au FocusLost * wall +augroup END +set autoread +set autowrite +set autowriteall +set undodir=~/.vim/undo +set undofile +set undolevels=1000 +set undoreload=1000 + +" Better command-line completion +set wildmenu + +" Show partial commands in the last line of the screen +set showcmd + +" Highlight searches (use to temporarily turn off highlighting; see the +" mapping of below) +set hlsearch + +" Modelines have historically been a source of security vulnerabilities. As +" such, it may be a good idea to disable them and use the securemodelines +" script, . +" set nomodeline + +" Show right margin +set colorcolumn=78 +"------------------------------------------------------------ +" Usability options {{{1 +" +" These are options that users frequently set in their .vimrc. Some of them +" change Vim's behaviour in ways which deviate from the true Vi way, but +" which are considered to add usability. Which, if any, of these options to +" use is very much a personal preference, but they are harmless. + +" Use case insensitive search, except when using capital letters +set ignorecase +set smartcase + +" Allow backspacing over autoindent, line breaks and start of insert action +set backspace=indent,eol,start + +" When opening a new line and no filetype-specific indenting is enabled, keep +" the same indent as the line you're currently on. Useful for READMEs, etc. +set autoindent + +" Stop certain movements from always going to the first character of a line. +" While this behaviour deviates from that of Vi, it does what most users +" coming from other editors would expect. +set nostartofline + +" Display the cursor position on the last line of the screen or in the status +" line of a window +set ruler + +" Always display the status line, even if only one window is displayed +set laststatus=2 + +" Instead of failing a command because of unsaved changes, instead raise a +" dialogue asking if you wish to save changed files. +set confirm + +" Use visual bell instead of beeping when doing something wrong +set visualbell + +" And reset the terminal code for the visual bell. If visualbell is set, and +" this line is also included, vim will neither flash nor beep. If visualbell +" is unset, this does nothing. +"set t_vb= + +" Enable use of the mouse for all modes +"set mouse=a + +" Set the command window height to 2 lines, to avoid many cases of having to +" "press to continue" +set cmdheight=2 + +" Display line numbers on the left +set relativenumber number + +" Quickly time out on keycodes, but never time out on mappings +set notimeout ttimeout ttimeoutlen=200 + +" Use to toggle between 'paste' and 'nopaste' +set pastetoggle= + + +"------------------------------------------------------------ +" Indentation options {{{1 +" +" Indentation settings according to personal preference. + +" Indentation settings for using 4 spaces instead of tabs. +set tabstop=4 +set softtabstop=4 +set shiftwidth=4 +set expandtab + +" Indentation settings for using hard tabs for indent. Display tabs as +" four characters wide. +"set tabstop=4 +"set softtabstop=4 +"set shiftwidth=4 +"set noexpandtab + + +"------------------------------------------------------------ +" Mappings {{{1 +" +" Useful mappings + +" Map Y to act like D and C, i.e. to yank until EOL, rather than act as yy, +" which is the default +map Y y$ + +" Map (redraw screen) to also turn off search highlighting until the +" next search +nnoremap :nohl + +"------------------------------------------------------------ diff --git a/tmux_cmds b/tmux_cmds new file mode 100644 index 0000000..6a0ba35 --- /dev/null +++ b/tmux_cmds @@ -0,0 +1,170 @@ +tmux shortcuts & cheatsheet +=========================== + +start new: + tmux + +start new with session name: + tmux new -s myname + +attach: + tmux a # (or at, or attach) + +attach to named: + tmux a -t myname + +list sessions: + tmux ls + +kill session: + tmux kill-session -t myname + +Kill all the tmux sessions: + tmux ls | grep : | cut -d. -f1 | _ + awk '{print substr($1, 0, length($1)-1)}' | xargs kill + +---------- + +In tmux, hit the prefix ctrl+b (my modified prefix is ctrl+a) and then: + +Sessions + +:new new session +s list sessions +$ name session + +Windows (tabs) + +c create window +w list windows +n next window +p previous window +f find window +, name window +& kill window + +Panes (splits) + +% vertical split +" horizontal split + +o swap panes +q show pane numbers +x kill pane ++ break pane into window (e.g. to select text by mouse to copy) +- restore pane from window +⍽ space - toggle between layouts + q (Show pane numbers, type the key to goto that pane) + { (Move the current pane left) + } (Move the current pane right) + z toggle pane zoom + +Sync Panes + +You can do this by switching to the appropriate window, typing your +Tmux prefix (commonly Ctrl-B or Ctrl-A) and then a colon to bring up +a Tmux command line, and typing: + :setw synchronize-panes + +You can optionally add 'on' or 'off' to specify which state you want; otherwise +the option is simply toggled. This option is specific to one window, so it +won’t change the way your other sessions or windows operate. When you’re done, +toggle it off again by repeating the command. tip source + +Resizing Panes + +You can also resize panes if you don’t like the layout defaults. I personally +rarely need to do this, though it’s handy to know how. Here is the basic +syntax to resize panes: + +PREFIX : resize-pane -D (Resizes the current pane down) +PREFIX : resize-pane -U (Resizes the current pane upward) +PREFIX : resize-pane -L (Resizes the current pane left) +PREFIX : resize-pane -R (Resizes the current pane right) +PREFIX : resize-pane -D 20 (Resizes the current pane down by 20 cells) +PREFIX : resize-pane -U 20 (Resizes the current pane upward by 20 cells) +PREFIX : resize-pane -L 20 (Resizes the current pane left by 20 cells) +PREFIX : resize-pane -R 20 (Resizes the current pane right by 20 cells) +PREFIX : resize-pane -t 2 20 (Resizes pane with the id of 2 down by 20 cells) +PREFIX : resize-pane -t -L 20 (Resizes pane with the id of 2 left by 20 cells) +Copy mode: + +Pressing PREFIX [ places us in Copy mode. We can then use our movement keys +to move our cursor around the screen. By default, the arrow keys work. we set +our configuration file to use Vim keys for moving between windows and resizing +panes so we wouldn’t have to take our hands off the home row. tmux has a vi +mode for working with the buffer as well. To enable it, add this line to +.tmux.conf: + +setw -g mode-keys vi +With this option set, we can use h, j, k, and l to move around our buffer. + +To get out of Copy mode, we just press the ENTER key. Moving around one +character at a time isn’t very efficient. Since we enabled vi mode, we can +also use some other visible shortcuts to move around the buffer. + +For example, we can use "w" to jump to the next word and "b" to jump back one +word. And we can use "f", followed by any character, to jump to that character +on the same line, and "F" to jump backwards on the line. + + Function vi emacs + Back to indentation ^ M-m + Clear selection Escape C-g + Copy selection Enter M-w + Cursor down j Down + Cursor left h Left + Cursor right l Right + Cursor to bottom line L + Cursor to middle line M M-r + Cursor to top line H M-R + Cursor up k Up + Delete entire line d C-u + Delete to end of line D C-k + End of line $ C-e + Goto line : g + Half page down C-d M-Down + Half page up C-u M-Up + Next page C-f Page down + Next word w M-f + Paste buffer p C-y + Previous page C-b Page up + Previous word b M-b + Quit mode q Escape + Scroll down C-Down or J C-Down + Scroll up C-Up or K C-Up + Search again n n + Search backward ? C-r + Search forward / C-s + Start of line 0 C-a + Start selection Space C-Space + Transpose chars C-t + +Misc + +d detach +t big clock +? list shortcuts +: prompt +Configurations Options: + +# Mouse support - set to on if you want to use the mouse +* setw -g mode-mouse off +* set -g mouse-select-pane off +* set -g mouse-resize-pane off +* set -g mouse-select-window off + +# Set the default terminal mode to 256color mode +set -g default-terminal "screen-256color" + +# enable activity alerts +setw -g monitor-activity on +set -g visual-activity on + +# Center the window list +set -g status-justify centre + +# Maximize and restore a pane +unbind Up +bind Up new-window -d -n tmp \; swap-pane -s tmp.1 \; select-window -t tmp +unbind Down +bind Down last-window \; swap-pane -s tmp.1 \; kill-window -t tmp