vim terminal stuff and man page fix

This commit is contained in:
Daniel Flanagan 2016-07-19 13:25:54 -05:00
parent a246b30fa6
commit 8289585799
3 changed files with 36 additions and 6 deletions

View file

@ -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

View file

@ -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"

View file

@ -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 = "\<Space>"
" terminal mappings
" open a terminal split at 80 columns
nnoremap <C-t> :call TerminalSplit()<CR>
" close the terminal
tnoremap <C-w> <C-\><C-n>:q!<CR>
" moving between terminal splits
tnoremap <C-h> <C-\><C-n><C-w>h
tnoremap <C-j> <C-\><C-n><C-w>j
tnoremap <C-k> <C-\><C-n><C-w>k
tnoremap <C-l> <C-\><C-n><C-w>l
" enter insert mode when entering a terminal buffer
autocmd BufWinEnter,WinEnter term://* startinsert
" change buffers with leader,tab
nnoremap <leader><Tab> :bnext<CR>
nnoremap <leader><S-Tab> :bprevious<CR>
@ -313,7 +339,6 @@ xmap <silent> ae <Plug>CamelCaseMotion_ae
map <F3> mw:%s/\s\+$//<CR>:let @/ = ""<CR>'w
" close buffer:
nnoremap <silent> <C-w> :bd<CR>
nnoremap <silent> <leader>w :bd<CR>
" toggle spell checking: