From 82895857991fb869ab7b56777dbc16baf78dc3b2 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Tue, 19 Jul 2016 13:25:54 -0500 Subject: [PATCH] vim terminal stuff and man page fix --- sh/bashrc | 9 +++++++-- variables.bash | 2 +- vim/config/init.vim | 31 ++++++++++++++++++++++++++++--- 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/sh/bashrc b/sh/bashrc index fa75ec1..3a1c2d4 100644 --- a/sh/bashrc +++ b/sh/bashrc @@ -104,13 +104,18 @@ if [ -t 0 ]; then # man pages with vim vman() { - vim -c "SuperMan $*" + if command -v nvim >/dev/null 2>&1; then + echo "NVIM MANUAL" + nvim -c "SuperMan $*" + else + vim -c "SuperMan $*" + fi if [ "$?" != "0" ]; then echo "No manual entry for $*" fi } - alias _man="man" + alias _man="\\man" alias man="vman" # save the current directory for later retrieval diff --git a/variables.bash b/variables.bash index a617d8d..d2d995e 100755 --- a/variables.bash +++ b/variables.bash @@ -6,7 +6,7 @@ export DOTFILES_PATH="$HOME/.dotfiles" export REPOSITORY_PATH="$HOME/Documents/open-source" export WINDOW_GAP=5 -export BORDER_WIDTH=3 +export BORDER_WIDTH=1 export BAR_PID_FILE="$DOTFILES_PATH/wm_bar.pid" source "$DOTFILES_PATH/scripts/get_x_fonts.sh" diff --git a/vim/config/init.vim b/vim/config/init.vim index a4be30a..3159380 100644 --- a/vim/config/init.vim +++ b/vim/config/init.vim @@ -49,7 +49,7 @@ Plug 'tmux-plugins/vim-tmux-focus-events' " allow transitions within tmux Plug 'christoomey/vim-tmux-navigator' " allow transitions within tmux Plug 'tasklist.vim' " show tasks with leader,t Plug 'godlygeek/tabular' " align text lines together -Plug 'jez/vim-superman' " view man pages with vim +Plug 'lytedev/vim-superman' " view man pages with vim Plug 'tpope/vim-surround' " quickly modify text surrounding objects Plug 'tpope/vim-speeddating' " vim knows about date-like text objects Plug 'junegunn/fzf', {'dir': '~/.fzf', 'do': './install --all'} " fuzzy file finding @@ -120,7 +120,11 @@ set formatoptions=crql1j set title " handle window title set synmaxcol=2048 -set number " line numbers +if exists('asmanviewer') + set nonumber " no line numbers when viewing a man page +else + set number " line numbers +endif " set relativenumber set cursorline " highlight the current line " set cursorcolumn " highlight the current column @@ -213,6 +217,12 @@ endif " no empty buffer on startup autocmd VimEnter * nested if bufname('')=='' && line('$') == 1 && col('$')==1 && !&modified | bd % | endif +function! TerminalSplit() + vsplit + vertical resize 80 + terminal +endfunction + " bindings " common typo fixes @@ -225,6 +235,22 @@ command! Q q " best leader let mapleader = "\" +" terminal mappings +" open a terminal split at 80 columns +nnoremap :call TerminalSplit() + +" close the terminal +tnoremap :q! + +" moving between terminal splits +tnoremap h +tnoremap j +tnoremap k +tnoremap l + +" enter insert mode when entering a terminal buffer +autocmd BufWinEnter,WinEnter term://* startinsert + " change buffers with leader,tab nnoremap :bnext nnoremap :bprevious @@ -313,7 +339,6 @@ xmap ae CamelCaseMotion_ae map mw:%s/\s\+$//:let @/ = ""'w " close buffer: -nnoremap :bd nnoremap w :bd " toggle spell checking: