Pstemmet/nvim tmux changes (#1)

* added tmux config

* part 2

* large improvements to vimrc
This commit is contained in:
Paul Stemmet 2020-06-09 21:41:11 +01:00 committed by GitHub
parent 0906f87346
commit 70510003c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 184 additions and 60 deletions

3
.gitmodules vendored
View File

@ -22,3 +22,6 @@
[submodule "zsh-custom/zshnip"]
path = zsh-custom/zshnip
url = https://github.com/facetframer/zshnip.git
[submodule "tmux/plugins/tpm"]
path = tmux/plugins/tpm
url = https://github.com/tmux-plugins/tpm

1
tmux/plugins/tpm Submodule

@ -0,0 +1 @@
Subproject commit 06d41226af02ca4f5bcf58169dd4f0a2aa42218c

View File

@ -1,3 +1,13 @@
# Plugins
set-environment -g TMUX_PLUGIN_MANAGER_PATH "$TMUX_PLUGINS"
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
set -g @prefix_highlight_prefix_prompt 'Pre'
set -g @prefix_highlight_fg 'yellow'
set -g @prefix_highlight_bg 'default'
set -g @plugin 'tmux-plugins/tmux-copycat'
set -g @plugin 'tmux-plugins/tmux-yank'
set-option -g prefix C-a
set-option -g set-titles on
set-window-option -g automatic-rename on
@ -12,7 +22,7 @@ set -s escape-time 0
set -g visual-activity on
set -g status-left-length 200
set -g status-right-length 200
set -g status-left ' #[fg=blue,bold]#h #S:#I.#P (#D) #[default]'
set -g status-left '#{prefix_highlight} #[fg=blue,bold]#h #S:#I.#P (#D) #[default]'
set -g status-right '#T #[fg=yellow,bold]#(uptime -p)#[default] #[fg=cyan,bold]%Y-%m-%d %H:%M:%S#[default] '
set -g set-titles on
setw -g aggressive-resize on
@ -35,8 +45,5 @@ bind - last-window \; swap-pane -s tmux-zoom.0 \; kill-window -t tmux-zoom
# prefix + / to search
bind-key / copy-mode \; send-key ?
# Copy Piping pstemmet-2019-04-03
set-option -g update-environment "DISPLAY"
bind-key C-y run "export DISPLAY=`tmux show-env | sed -n 's/^DISPLAY=//p'`; tmux save-buffer - | xclip -i -selection clipboard >/dev/null"
bind-key C-p run "xclip -d `tmux show-env | sed -n s/^DISPLAY=//p` -o | tmux load-buffer - && tmux paste-buffer"
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run -b "$TMUX_PLUGINS/tpm/tpm"

188
vimrc
View File

@ -7,7 +7,46 @@ function! SourceIfExists(file)
endfunction
" }
" Default colorscheme
colorscheme murphy
" Hide buffers don't close them
set hidden
" Airline replaces showmode
set noshowmode
" File indent opts
set shiftwidth=2
set tabstop=8
set softtabstop=2
set expandtab
filetype plugin indent on
" Set completion messages off
set shortmess+=c
" Preview window + menu for autocompletions
set completeopt+=preview
set completeopt+=menuone
set completeopt+=longest
" Lower update time (Default 4000)
set updatetime=300
" Always show the signcolumn, otherwise it would shift the text each time
" diagnostics appear/become resolved.
try
" Vim 8.2 only
set signcolumn=number
catch
set signcolumn=yes:1
endtry
set number
set relativenumber
if exists('+termguicolors')
set termguicolors
endif
exec "set rtp=$VIMHOME," . &rtp
@ -19,40 +58,32 @@ set encoding=utf-8
call plug#begin("$VIMHOME/plugged")
Plug 'junegunn/vim-easy-align'
Plug 'majutsushi/tagbar'
Plug 'tpope/vim-sensible'
Plug 'tpope/vim-fugitive'
Plug 'scrooloose/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'Xuyuanp/nerdtree-git-plugin', { 'on': 'NERDTreeToggle' }
Plug 'scrooloose/syntastic'
Plug 'scrooloose/nerdcommenter'
Plug 'scrooloose/vim-statline'
Plug 'vim-perl/vim-perl', { 'for': 'perl', 'do': 'make clean carp dancer highlight-all-pragmas moose test-more try-tiny' }
Plug 'rust-lang/rust.vim'
Plug 'vim-scripts/taglist.vim'
Plug 'pearofducks/ansible-vim'
Plug 'rust-lang/rust.vim', { 'for': 'rust' }
Plug 'pearofducks/ansible-vim', { 'for': ['yaml', 'yml'] }
Plug 'luochen1990/rainbow'
Plug 'jremmen/vim-ripgrep'
Plug 'autozimu/LanguageClient-neovim', { 'branch': 'next', 'do': 'bash install.sh' }
Plug 'junegunn/fzf'
Plug 'jremmen/vim-ripgrep', { 'on': ['Rg', 'RgRoot'] }
Plug 'junegunn/fzf', { 'on': ['FZF', '<Plug>fzf#run', '<Plug>fzf#wrap'] }
Plug 'sheerun/vim-polyglot'
Plug 'adelarsq/vim-matchit'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'airblade/vim-gitgutter'
Plug 'neoclide/coc.nvim', { 'branch': 'release' }
call SourceIfExists("~/.config/vim/plug.vimrc")
if v:version > 704
" Plug 'Valloric/YouCompleteMe'
Plug 'prabirshrestha/async.vim'
endif
if has('nvim')
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
else
Plug 'Shougo/deoplete.nvim'
Plug 'roxma/nvim-yarp'
Plug 'roxma/vim-hug-neovim-rpc'
endif
call plug#end()
set number
set relativenumber
execute ':silent !mkdir -p ~/.vimbackup'
@ -60,6 +91,11 @@ set backupdir=~/.vimbackup
set directory=~/.vimbackup
set hlsearch
" Airline
let g:airline_theme='angr'
let g:airline#extensions#branch#format = 2
let g:airline#extensions#branch#displayed_head_limit = 16
" Commenting
let g:NERDSpaceDelims = 1
let g:NERDCompactSexyComs = 1
@ -67,10 +103,22 @@ let g:NERDDefaultAlign = 'left'
let g:NERDCommentEmptyLines = 1
let g:NERDTrimTrailingWhitespace = 1
augroup PsoxNERDTree
autocmd!
" Autoquit if nerdtree is last open window
autocmd BufEnter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" Open nerdtree if opening a directory
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | exe 'cd '.argv()[0] | endif
augroup END
" Syntastic Settings
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
" Note that airline automatically configures these
" set statusline+=%#warningmsg#
" set statusline+=%{exists('g:loaded_syntastic_plugin')?SyntasticStatuslineFlag():''}
" set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_enable_signs = 1
let g:syntastic_auto_loc_list = 1
@ -82,37 +130,85 @@ let g:syntastic_check_on_wq = 0
let g:syntastic_enable_zsh_checker = 1
let g:syntastic_enable_bash_checker = 1
" rust lang
autocmd FileType rust let g:autofmt_autosave = 1
autocmd FileType rust let g:deoplete#enable_at_startup = 1
let g:ycm_rust_src_path = expand('~/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc')
" Other
let g:rainbow_active = 1
set shiftwidth=2
set tabstop=8
set softtabstop=2
set expandtab
filetype plugin indent on
autocmd FileType yaml setl indentkeys-=<:>
autocmd FileType yaml setlocal ts=8 sts=2 sw=2 expandtab
colorscheme murphy
cmap w!! w !sudo tee % > /dev/null
let g:ycm_server_keep_logfiles = 1
let g:ycm_server_log_level = 'debug'
" ripgrep settings
let g:rg_highlight = 'true'
let g:rg_derive_root = 'true'
nmap <F8> :TagbarToggle<CR>
" Other
let g:rainbow_active = 1
augroup PsoxFileAutos
autocmd!
autocmd FileType rust let g:autofmt_autosave = 1
autocmd FileType yaml setlocal indentkeys-=<:> ts=8 sts=2 sw=2 expandtab
" Tidy nerdtree windiw
autocmd FileType nerdtree setlocal nocursorcolumn nonumber norelativenumber signcolumn=no
augroup END
" Set bindings for coc.nvim
if has_key(plugs, 'coc.nvim')
let g:coc_global_extensions=['coc-yank', 'coc-spell-checker', 'coc-actions', 'coc-yaml', 'coc-vimlsp', 'coc-rust-analyzer', 'coc-json']
" Use tab for trigger completion with characters ahead and navigate.
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config.
inoremap <buffer><silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <buffer><expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
" Use <c-space> to trigger completion.
inoremap <buffer><silent><expr> <c-space> coc#refresh()
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current
" position. Coc only does snippet and additional edit on confirm.
" <cr> could be remapped by other vim plugin, try `:verbose imap <CR>`.
if exists('*complete_info')
inoremap <buffer><expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
else
inoremap <buffer><expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
endif
" Use `[g` and `]g` to navigate diagnostics
nmap <buffer><silent> [g <Plug>(coc-diagnostic-prev)
nmap <buffer><silent> ]g <Plug>(coc-diagnostic-next)
" Remap for do codeAction of selected region
function! s:cocActionsOpenFromSelected(type) abort
execute 'CocCommand actions.open ' . a:type
endfunction
xmap <buffer><silent> <leader>a :<C-u>execute 'CocCommand actions.open ' . visualmode()<CR>
nmap <buffer><silent> <leader>a :<C-u>set operatorfunc=<SID>cocActionsOpenFromSelected<CR>g@
nmap <buffer><silent> <leader>. :CocCommand actions.open<CR>
nnoremap <buffer><silent> <C-Y> :<C-u>CocList -A --normal yank<CR>
endif
" NERDTree Toggle
nnoremap <F2> :NERDTreeToggle<CR>
" Workaround for writing readonly files
cnoremap w!! w !sudo tee % > /dev/null
" Toggles all gutter items
nnoremap <silent> <leader>N :call ToggleGutter()<CR>
function! ToggleGutter() abort
if &number
exec "set nonumber norelativenumber signcolumn=no"
else
exec "set number relativenumber"
try | set signcolumn=number | catch | set signcolumn=yes:1 | endtry
endif
endfunction
call SourceIfExists("~/.config/vim/late.vimrc")
set exrc
set secure
set modeline

33
zshrc
View File

@ -49,6 +49,8 @@ then
fi
fi
path+=( $GOPATH/bin ${GOROOT+${GOROOT}/bin} )
# Path to your oh-my-zsh installation.
export ZSH=$PSOXIZSH/oh-my-zsh
export ZSH_CACHE_DIR=~/.cache/zsh
@ -181,12 +183,31 @@ source $PSOXIZSH/zsh-custom/zshnip/zshnip.zsh
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
export LANG=en_US.UTF-8
# export LANG=en_US.UTF-8
( which vi 2>/dev/null >/dev/null ) && export EDITOR='vi'
( which vim 2>/dev/null >/dev/null ) && export EDITOR='vim'
( which nvim 2>/dev/null >/dev/null ) && export EDITOR='nvim'
# Set zsh tmux config path
if which tmux 2>/dev/null >/dev/null; then
for tmux_config in {~/.config/tmux,~/.tmux,/etc/tmux}; do
if [ -d "$tmux_config" ]; then
TMUX_PATH="$tmux_config"
break
fi
done
[ -z "$TMUX_PATH" ] && TMUX_PATH=~/.config/tmux
export TMUX_PATH=$TMUX_PATH
[ -d "$TMUX_PATH" ] && [ -d "$TMUX_PATH/plugins" ] || { mkdir -vp $TMUX_PATH && cp -r $PSOXIZSH/tmux/. $TMUX_PATH }
# If a .conf is detected override the default zsh tmux path
[ -f "$TMUX_PATH/tmux.conf" ] && export ZSH_TMUX_CONFIG="$TMUX_PATH/tmux.conf"
export TMUX_PLUGINS="$TMUX_PATH/plugins"
fi
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
@ -196,6 +217,8 @@ export LANG=en_US.UTF-8
alias zshconfig="vim $PSOXIZSH/zshrc"
alias ohmyzsh="vim $PSOXIZSH/oh-my-zsh"
alias curlj="curl -H 'Content-Type: application/json' "
which nvim >/dev/null 2>&1 && alias vim="$(which nvim)"
[[ -x /usr/bin/yay ]] && [[ "$(whoami)" != "pacman" ]] && alias yay='sudo -iupacman /usr/bin/yay'
typeset -A key
@ -216,7 +239,7 @@ bindkey '\ej' zshnip-expand-or-edit # Alt-J
bindkey '\ee' zshnip-edit-and-expand # Alt-E
# cutomize options
setopt no_bang_hist
setopt no_bang_hist cdable_vars auto_name_dirs
# Finally, make sure the terminal is in application mode, when zle is
# active. Only then are the values from $terminfo valid.
@ -231,11 +254,9 @@ if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
zle -N zle-line-finish
fi
[[ -x /usr/bin/yay ]] && [[ "$(whoami)" != "pacman" ]] && alias yay='sudo -iupacman /usr/bin/yay'
[[ -d /cygdrive/c/qemu/ ]] && path+=( /cygdrive/c/qemu/ )
[[ ! -z "$DISPLAY" ]] && xhost +LOCAL:
path+=( $GOPATH/bin ${GOROOT+${GOROOT}/bin} )
# Set Time Variables
precmd() {
@ -253,8 +274,4 @@ precmd() {
# Clean up global aliases
source <(alias -g | awk -F= '/^[A-Za-z]+/{print $1}' | xargs -I{} -n1 echo unalias "'{}'")
foreach _OPT in AUTO_NAME_DIRS CDABLE_VARS
setopt $_OPT
end
# vim: sw=2 ts=8 si relativenumber number