diff --git a/.emacs b/.emacs deleted file mode 100644 index 7bf3b83..0000000 --- a/.emacs +++ /dev/null @@ -1,84 +0,0 @@ -;; Great inspiration taken from: -;; https://github.com/howardabrams/dot-files/blob/master/emacs.org - -(setq gc-cons-threshold 50000000) - -(setq initial-scratch-message "") ;; Uh, I know what Scratch is for - -(when (window-system) - (tool-bar-mode 0) ;; Toolbars were only cool with XEmacs - (when (fboundp 'horizontal-scroll-bar-mode) - (horizontal-scroll-bar-mode -1)) - (scroll-bar-mode -1)) ;; Scrollbars are waste screen estate - -(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/") - -;; Half-fix for Mac OSX Option key not being the meta key -(set-keyboard-coding-system nil) - -;; Change text size -(set-face-attribute 'default nil :height 120) - -;; 4 spaces per tab -(setq-default indent-tabs-mode nil) -(setq default-tab-width 4) -(setq c-basic-offset 4) - -;; Move backup files to a temporary directory on disk -;; (rather than in the same location as the saved file) -(setq backup-directory-alist - `((".*" . ,temporary-file-directory))) -(setq auto-save-file-name-transforms - `((".*" ,temporary-file-directory t))) - -;; Skip startup screen. -(custom-set-variables - ;; custom-set-variables was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - '(custom-safe-themes (quote ("e9df267a1c808451735f2958730a30892d9a2ad6879fb2ae0b939a29ebf31b63" default))) - '(inhibit-startup-screen t)) - -;; Brighten up that god awful dark blue -(custom-set-faces - ;; custom-set-faces was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - '(font-lock-function-name-face ((t (:foreground "color-33")))) - '(font-lock-preprocessor-face ((t (:inherit font-lock-builtin-face :foreground "#3bb4ff"))))) - -;; Brighten up that god awful dark blue in the minibuffer -(set-face-foreground 'minibuffer-prompt "white") - -;; Highlight extra whitespace and (optionally) characters exceeding 80 columns -;; (require 'whitespace) -;; (setq whitespace-line-column 79) -;; (setq whitespace-style '(face empty tabs lines-tail trailing)) -;; (global-whitespace-mode t) - -;; Format the entire file -(defun indent-buffer () - "indent whole buffer" - (interactive) - (delete-trailing-whitespace) - (indent-region (point-min) (point-max) nil) - (untabify (point-min) (point-max))) - -(fset 'yes-or-no-p 'y-or-n-p) ;; Ask for y/n instead of yes/no - -(defun compile-on-save-start () - (let ((buffer (compilation-find-buffer))) - (unless (get-buffer-process buffer) - (recompile)))) - -(define-minor-mode compile-on-save-mode - "Minor mode to automatically call `recompile' whenever the -current buffer is saved. When there is ongoing compilation, -nothing happens." - :lighter " CoS" - (if compile-on-save-mode - (progn (make-local-variable 'after-save-hook) - (add-hook 'after-save-hook 'compile-on-save-start nil t)) - (kill-local-variable 'after-save-hook))) diff --git a/.vimrc b/.vimrc new file mode 100644 index 0000000..11e139a --- /dev/null +++ b/.vimrc @@ -0,0 +1,230 @@ +" Use Vim settings, rather than Vi settings (much better!). +" This must be first, because it changes other options as a side effect. +set nocompatible + +" Vundle stuff +filetype off " required + +" set the runtime path to include Vundle and initialize +set rtp+=~/.vim/bundle/Vundle.vim +call vundle#begin() + +" let Vundle manage Vundle, required +Plugin 'VundleVim/Vundle.vim' + +Plugin 'tpope/vim-fugitive' +Plugin 'scrooloose/nerdtree' +Plugin 'vim-syntastic/syntastic' +Plugin 'rust-lang/rust.vim' + +call vundle#end() " required +filetype plugin indent on " required + + +" allow backspacing over everything in insert mode +set backspace=indent,eol,start + + +if has("vms") + set nobackup " do not keep a backup file, use versions instead +else + set backup " keep a backup file +endif +set ruler " show the cursor position all the time +set showcmd " display incomplete commands +set incsearch " do incremental searching + +" Don't use Ex mode, use Q for word wrapping +map Q gq + +" CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo, +" so that you can undo CTRL-U after inserting a line break. +inoremap u + +" Switch syntax highlighting on, when the terminal hascolors +" Also switch on highlighting the last used search pattern. +if &t_Co > 2 || has("gui_running") + syntax on + set hlsearch +endif + +" Only do this part when compiled with support for autocommands. +if has("autocmd") + + " Enable file type detection. + " Use the default filetype settings, so that mail gets 'tw' set to 72, + " 'cindent' is on in C files, etc. + " Also load indent files, to automatically do language-dependent indenting. + filetype plugin indent on + + " Put these in an autocmd group, so that we can delete them easily. + augroup vimrcEx + au! + + " For all text files set 'textwidth' to 78 characters. + autocmd FileType text setlocal textwidth=78 + + " When editing a file, always jump to the last known cursor position. + " Don't do it when the position is invalid or when inside an event handler + " (happens when dropping a file on gvim). + " Also don't do it when the mark is in the first line, that is the default + " position when opening a file. + autocmd BufReadPost * + \ if line("'\"") > 1 && line("'\"") <= line("$") | + \ exe "normal! g`\"" | + \ endif + + augroup END + +else + + set autoindent " always set autoindenting on + +endif " has("autocmd") + +" Convenient command to see the difference between the current buffer and the +" file it was loaded from, thus the changes you made. +" Only define it when not defined already. +if !exists(":DiffOrig") + command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis + \ | wincmd p | diffthis +endif + + + +"""""""""""""""""""""""""""""""""""""""""""""""" +""""""""""" My changes """"""""""" +"""""""""""""""""""""""""""""""""""""""""""""""" + +let mapleader=" " + +" Indentation +set tabstop=4 " tab width +set softtabstop=4 " number of space deleted +set shiftwidth=4 " number of spaces inserted +set expandtab " spaces instead of tabs + +let g:loaded_matchparen=1 + +" Showing whitespace +set list lcs=eol:¬,trail:·,tab:▸\ + +" Invisible character colors +highlight NonText guifg=#4a4a59 +highlight SpecialKey guifg=#4a4a59 + +" Leader binds +nnoremap t :set paste! +nnoremap r :redraw! +nnoremap m :0r ~/templates/competitive.cc +"vnoremap y "+y +nnoremap p "+p +vnoremap p "+p + +" Change terminal title +set title + +" Better tab menu +set wildmenu + +" Search case-insensitive if all lowercase +set ignorecase +set smartcase + +" Clear search highlighting without asdfadf +nmap ,/ :nohlsearch + +" Long history +set history=1000 " command +set undolevels=1000 " undo + +" Move by visual lines +noremap j gj +noremap k gk + +" Relative line numbers +set relativenumber +set nu + +function! NumberToggle() + if(&relativenumber == 1) + set norelativenumber + else + set relativenumber + endif +endfunc +nnoremap :call NumberToggle() + +" Filetype specific settings +autocmd FileType ruby setlocal tabstop=2 softtabstop=2 shiftwidth=2 +"autocmd FileType python setlocal tabstop=2 softtabstop=2 shiftwidth=2 +autocmd FileType make setlocal noexpandtab + +" Quickly edit/reload vimrc +" let s:dot_path = expand("~/dots/.vimrc") +" if filereadable(s:dot_path) +" let g:vimrc_loc = s:dot_path +" else +" let g:vimrc_loc = $MYVIMRC +" endif +" +let g:vimrc_loc = $MYVIMRC + +:execute "nmap ev :tabedit" . g:vimrc_loc . "" +:execute "nmap sv :so" . g:vimrc_loc . "" +nmap eb :tabedit ~/.bashrc +nmap et :tabedit ~/.tmux.conf + +" timeout length for mapping commands +set ttimeoutlen=0 + +" highlight columns over 80 characters +highlight ColorColumn ctermbg=magenta +call matchadd('ColorColumn', '\%82v', 100) "set column nr + +" scroll with cursor +nnoremap j +nnoremap k + +" intuitive placement of vim splits +set splitbelow +set splitright + +" disable folds +set nofoldenable + +""""""""""""""""""""" +"""""" Plugins """""" +""""""""""""""""""""" + +" NERDTree +"map :NERDTreeFocus +nnoremap f :NERDTreeFind +let NERDTreeQuitOnOpen=1 + +" ctrl-p +"nnoremap o :CtrlP + +" Syntastic +set statusline+=%#warningmsg# +set statusline+=%{SyntasticStatuslineFlag()} +set statusline+=%* + +let g:syntastic_always_populate_loc_list = 0 +let g:syntastic_auto_loc_list = 0 +let g:syntastic_check_on_open = 0 +let g:syntastic_check_on_wq = 0 +let g:syntastic_cpp_compiler_options = "-std=c++11 -pedantic" +let g:syntastic_python_python_exec = "/usr/bin/python3.4" +nnoremap c :SyntasticCheck +nnoremap C :SyntasticReset +autocmd VimEnter * :SyntasticToggleMode + +" CommandT settings +nnoremap o :CommandT +let g:CommandTMaxFiles=100000 +let g:CommandTFileScanner = "watchman" +let g:CommandTWildIgnore = "*.o,*.obj,*~,*.*~" +let g:CommandTTraverseSCM = "pwd" + +set mouse=