diff options
author | William Carroll <wpcarro@gmail.com> | 2016-12-12T05·24-0500 |
---|---|---|
committer | William Carroll <wpcarro@gmail.com> | 2016-12-12T05·24-0500 |
commit | 4954544a5b38059ce772d3aa61cd148b3907732b (patch) | |
tree | 0aeff86204bfb1b8b43d2ac7dab6cd5ba0081618 | |
parent | 539b2fd32f483a58e4ccf088b02a0eed69a38456 (diff) |
Adds emacs configs; updates tmux; updates vimrc
-rw-r--r-- | configs/.emacs | 79 | ||||
-rw-r--r-- | configs/.tmux.conf | 19 | ||||
-rw-r--r-- | configs/.vimrc | 179 |
3 files changed, 145 insertions, 132 deletions
diff --git a/configs/.emacs b/configs/.emacs new file mode 100644 index 000000000000..e8f98a082d17 --- /dev/null +++ b/configs/.emacs @@ -0,0 +1,79 @@ +(add-to-list 'load-path "~/.emacs.d/el-get/el-get") + +(unless (require 'el-get nil 'noerror) + (with-current-buffer + (url-retrieve-synchronously + "https://raw.githubusercontent.com/dimitri/el-get/master/el-get-install.el") + (goto-char (point-max)) + (eval-print-last-sexp))) + +(add-to-list 'el-get-recipe-path "~/.emacs.d/el-get-user/recipes") +(el-get 'sync) + +(load-theme 'monokai t) + +;; Exit insert mode by pressing jk in sequence +(setq key-chord-two-keys-delay 0.5) +(key-chord-define evil-insert-state-map "jk" 'evil-normal-state) +(key-chord-mode 1) + + +(setq +el-get-sources +'((:name evil + :after (progn + ;; my vim bindings + ; (define-key evil-normal-state-map "\C-;" 'comment-line) + + ;; (define-key evil-normal-state-map "vv" 'split-window-vertically) + ;; (define-key evil-normal-state-map "vs" 'split-window-vertically) + ;; (define-key evil-normal-state-map "ss" 'split-window-horizontally) + ;; (define-key evil-normal-state-map "sp" 'split-window-horizontally) + + (define-key evil-normal-state-map "\S-h" 'evil-beginning-of-line) + (define-key evil-normal-state-map "\S-l" 'evil-end-of-line) + (define-key evil-visual-state-map "\S-h" 'evil-beginning-of-line) + (define-key evil-visual-state-map "\S-l" 'evil-beginning-of-line) + + (define-key evil-insert-state-map "\C-a" 'beginning-of-line) + (define-key evil-insert-state-map "\C-e" 'end-of-line))) + +(:name auto-complete + :after (progn + (define-key ac-complete-mode-map "\C-n" 'ac-next) + (define-key ac-complete-mode-map "\C-p" 'ac-previous))))) + + +(setq +my:el-get-packages +'(el-get + alchemist + auto-complete + evil + monokai-theme + neotree)) + +(el-get 'sync my:el-get-packages) + +;; Generic Settings +;; Line numbering +(line-number-mode 1) ; have line numbers and +(column-number-mode 1) ; column numbers in the mode line +(global-linum-mode 1) ; add line numbers on the left + +;; activates evil-mode +(evil-mode 1) + +;; evil-leader settings +;; enables evil-leader every time evil-mode is loaded. +(global-evil-leader-mode) + +;; change the <leader> key +(evil-leader/set-leader "<SPC>") + + +;; neotree settings +(evil-leader/set-key + "n" 'neotree-toggle + ) + diff --git a/configs/.tmux.conf b/configs/.tmux.conf index 1a7918444b82..190ab2cb3f99 100644 --- a/configs/.tmux.conf +++ b/configs/.tmux.conf @@ -105,15 +105,6 @@ bind '"' split-window -c "#{pane_current_path}" bind % split-window -h -c "#{pane_current_path}" bind c new-window -c "#{pane_current_path}" - -# Smart pane switching with awareness of vim splits -is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?)(diff)?$"' -bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L" -bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D" -bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U" -bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R" -bind -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l" - # source '/usr/local/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf' bind-key h set -g status @@ -126,3 +117,13 @@ set-option -g status-left-length 60 set-option -g status-right-length 90 # set-option -g status-left "#(~/dotfiles/tmux-powerline/powerline.sh left)" # set-option -g status-right "#(~/dotfiles/tmux-powerline/powerline.sh right)" + + +# Bindings for "christoomey/vim-tmux-navigator" +is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ + | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" +bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L" +bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D" +bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U" +bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R" +bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l" diff --git a/configs/.vimrc b/configs/.vimrc index 9c676c82a3f1..55b03752c54a 100644 --- a/configs/.vimrc +++ b/configs/.vimrc @@ -25,7 +25,6 @@ Plugin 'kien/ctrlp.vim' Plugin 'mileszs/ack.vim' Plugin 'pangloss/vim-javascript' Plugin 'scrooloose/nerdtree' -Plugin 'scrooloose/syntastic' " Syntax Highlighting Support Plugin 'lambdatoast/elm.vim' @@ -43,9 +42,6 @@ Plugin 'sickill/vim-monokai' Plugin 'altercation/vim-colors-solarized' Plugin 'mhartington/oceanic-next' -" Tmux tooling -Plugin 'christoomey/vim-tmux-navigator' - " Executes shell commands and pipes output into new Vim buffer. Plugin 'sjl/clam.vim' @@ -63,6 +59,12 @@ Plugin 'godlygeek/tabular' " Visually Highlight and comment code. Plugin 'tpope/vim-commentary' +" Seamlessly navigate Vim and Tmux with similar bindings. +Plugin 'christoomey/vim-tmux-navigator' + +" Async `:make` for code linting etc. +Plugin 'neomake/neomake' + call vundle#end() " required filetype plugin indent on " required @@ -70,6 +72,24 @@ filetype plugin indent on " required " -- END: Vundle config -- +" Neomake Settings +autocmd! BufWritePost * Neomake + +" Elixir linting +let g:neomake_elixir_credo_maker = { + \ 'exe': 'mix', + \ 'args': ['credo', 'list', '%:p', '--format=oneline'], + \ 'errorformat': + \ '%W[F] %. %f:%l:%c %m,' . + \ '%W[F] %. %f:%l %m,' . + \ '%W[R] %. %f:%l:%c %m,' . + \ '%W[R] %. %f:%l %m,' . + \ '%I[C] %. %f:%l:%c %m,' . + \ '%I[C] %. %f:%l %m,' . + \ '%-Z%.%#' + \ } + + " Airline Settings " Enables the list of buffers. let g:airline#extensions#tabline#enabled = 1 @@ -80,6 +100,9 @@ let g:airline#extensions#tabline#fnamemod = ':t' " Allow glyphs in airline let g:airline_powerline_fonts = 1 +" Change Airline theme +let g:airline_theme = 'base16_google' + " It's the twenty-first century...no swaps. set noswapfile @@ -127,6 +150,11 @@ nnoremap zK zC nnoremap zk zc +" Smart Comment code (has dependency 'tpope/vim-commentary') +nnoremap <C-/> Vgc +vnoremap <C-/> gc + + " Changes <leader> to <space> character. let mapleader = " " @@ -186,13 +214,15 @@ nnoremap ss <Esc>:sp<CR> " Move around splits with <leader> -nnoremap <leader>h <C-w>h -nnoremap <leader>j <C-w>j -nnoremap <leader>k <C-w>k -nnoremap <leader>l <C-w>l +" NOTE: no longer needed with tmux navigator plugin +" nnoremap <leader>h <C-w>h +" nnoremap <leader>j <C-w>j +" nnoremap <leader>k <C-w>k +" nnoremap <leader>l <C-w>l " Delete (i.e. "close") the currently opened buffer +" TODO: unless it's a split window, which should be :q nnoremap <leader>q :bdelete<CR> @@ -216,8 +246,8 @@ nnoremap <leader>pm :CtrlPMRUFiles<CR> " Buffer creation and management " Buffer movement -nnoremap <C-l> :1bnext<CR> -nnoremap <C-h> :1bprevious<CR> +nnoremap <Tab> :1bnext<CR> +nnoremap <S-Tab> :1bprevious<CR> " Buffer creation " nnoremap <C-t> :enew<CR> @@ -233,91 +263,15 @@ nnoremap <leader>bq :bp <BAR> bd #<CR> nnoremap Y y$ -" flip number keys to their shift+ counterparts -nnoremap t1 t! -nnoremap t2 t@ -nnoremap t3 t# -nnoremap t4 t$ -nnoremap t5 t% -nnoremap t6 t^ -nnoremap t7 t& -nnoremap t8 t* -nnoremap t9 t( -nnoremap t0 t) - -nnoremap T1 T! -nnoremap T2 T@ -nnoremap T3 T# -nnoremap T4 T$ -nnoremap T5 T% -nnoremap T6 T^ -nnoremap T7 T& -nnoremap T8 T* -nnoremap T9 T( -nnoremap T0 T) - -nnoremap f1 f! -nnoremap f2 f@ -nnoremap f3 f# -nnoremap f4 f$ -nnoremap f5 f% -nnoremap f6 f^ -nnoremap f7 f& -nnoremap f8 f* -nnoremap f9 f( -nnoremap f0 f) - -nnoremap F1 F! -nnoremap F2 F@ -nnoremap F3 F# -nnoremap F4 F$ -nnoremap F5 F% -nnoremap F6 F^ -nnoremap F7 F& -nnoremap F8 F* -nnoremap F9 F( -nnoremap F0 F) - - -" Karate edits -nnoremap ca9 ca( -nnoremap da9 da( -nnoremap va9 va( - -nnoremap ca0 ca) -nnoremap da0 da) -nnoremap va0 va) - -nnoremap ci9 ci( -nnoremap di9 di( -nnoremap vi9 vi( - -nnoremap ci0 ci) -nnoremap di0 di) -nnoremap vi0 vi) - - " scrolling and maintaing mouse position -nnoremap <C-j> j<C-e> -nnoremap <C-k> k<C-y> +" nnoremap <C-j> j<C-e> +" nnoremap <C-k> k<C-y> " reload file after git changes nnoremap <C-r> :e<CR> -" -- Syntastic Settings -- -set statusline+=%#warningmsg# -set statusline+=%{SyntasticStatuslineFlag()} -set statusline+=%* - -let g:syntastic_always_populate_loc_list = 1 -let g:syntastic_auto_loc_list = 1 -let g:syntastic_check_on_open = 1 -let g:syntastic_check_on_wq = 1 -let g:syntastic_javascript_checkers = ['gjslint'] - - " Basic settings set number set wrap! @@ -327,7 +281,7 @@ set shiftwidth=2 set background=dark syntax enable -colorscheme OceanicNext +colorscheme solarized set history=1000 set undolevels=1000 @@ -438,7 +392,7 @@ vnoremap L $ " Search for visually selected text -" vnoremap // y/<C-r>"<CR>N +vnoremap // y/<C-r>"<CR>N " trim trailing whitespace on save @@ -460,38 +414,6 @@ let g:ctrlp_custom_ignore = { \} -" Search within a visual selection -function! RangeSearch(direction) - call inputsave() - let g:srchstr = input(a:direction) - call inputrestore() - if strlen(g:srchstr) > 0 - let g:srchstr = g:srchstr. - \ '\%>'.(line("'<")-1).'l'. - \ '\%<'.(line("'>")+1).'l' - else - let g:srchstr = '' - endif -endfunction -vnoremap <silent> / :<C-U>call RangeSearch('/')<CR>:if strlen(g:srchstr) > 0\|exec '/'.g:srchstr\|endif<CR> -vnoremap <silent> ? :<C-U>call RangeSearch('?')<CR>:if strlen(g:srchstr) > 0\|exec '?'.g:srchstr\|endif<CR> - - -" Elixir linting via Neomake -let g:neomake_elixir_credo_maker = { - \ 'exe': 'mix', - \ 'args': ['credo', 'list', '%:p', '--format=oneline'], - \ 'errorformat': - \ '%W[F] %. %f:%l:%c %m,' . - \ '%W[F] %. %f:%l %m,' . - \ '%W[R] %. %f:%l:%c %m,' . - \ '%W[R] %. %f:%l %m,' . - \ '%I[C] %. %f:%l:%c %m,' . - \ '%I[C] %. %f:%l %m,' . - \ '%-Z%.%#' - \ } - - " WIP: Run elixir tests on that line nnoremap <leader>t :call ExTestToggle()<CR> @@ -501,7 +423,7 @@ fun! ExTestToggle() if expand('%:e') == "ex" let l:test_file_name = expand('%:t:r') . "_test.exs" - let l:test_file_dir = substitute(expand('%:p:h'), "/lib/core/", "/test/", "") + let l:test_file_dir = substitute(expand('%:p:h'), "/lib/core/", "/lib/test/", "") let l:full_test_path = join([test_file_dir, test_file_name], "/") e `=full_test_path` @@ -518,3 +440,14 @@ fun! ExTestToggle() endfun + +" Creates intermediate directories and file to match current buffer's filepath +fun! CreateNonExistingDirsAndFile() + ! echo "Creating directory..." && mkdir -p %:p:h && echo "Created directory." && echo "Creating file..." && touch %:t:p && echo "Created file." + + " Write the buffer to the recently created file. + w +endfun + + + |