tmux, vim, and git configs
This commit is contained in:
+12
@@ -0,0 +1,12 @@
|
|||||||
|
[user]
|
||||||
|
email = randyjordan@email.com
|
||||||
|
name = Randy Jordan
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[init]
|
||||||
|
defaultBranch = main
|
||||||
|
[commit]
|
||||||
|
gpgsign = true
|
||||||
|
[tag]
|
||||||
|
gpgSign = true
|
||||||
+34
@@ -0,0 +1,34 @@
|
|||||||
|
set-option -g status-style fg=white,bg=black
|
||||||
|
set-window-option -g window-status-style bg=green
|
||||||
|
set -g history-limit 10000
|
||||||
|
|
||||||
|
# Remap default "prefix" from Ctrl-b to Ctrl-a
|
||||||
|
set -g prefix C-a
|
||||||
|
bind C-a send-prefix
|
||||||
|
unbind C-b
|
||||||
|
|
||||||
|
# Reaload conf with r
|
||||||
|
unbind r
|
||||||
|
bind r source-file ~/.tmux.conf \; display "Reloaded ~/.tmux.conf"
|
||||||
|
|
||||||
|
# Enable mouse control (clickable windows,panes, resizable panes)
|
||||||
|
set -g mouse on
|
||||||
|
|
||||||
|
# Use vim keybindings in copy mode
|
||||||
|
setw -g mode-keys vi
|
||||||
|
|
||||||
|
# Pane Splitting
|
||||||
|
unbind v
|
||||||
|
unbind h
|
||||||
|
|
||||||
|
unbind % # Split vertically
|
||||||
|
unbind '"' # Split horizontally
|
||||||
|
|
||||||
|
bind v split-window -h -c "#{pane_current_path}"
|
||||||
|
bind h split-window -v -c "#{pane_current_path}"
|
||||||
|
|
||||||
|
# Pane navigation Alt-Arrow
|
||||||
|
bind -n M-Left select-pane -L
|
||||||
|
bind -n M-Right select-pane -R
|
||||||
|
bind -n M-Up select-pane -U
|
||||||
|
bind -n M-Down select-pane -D
|
||||||
@@ -0,0 +1,349 @@
|
|||||||
|
"- | LEADER KEY | ----------------------------------------------------------{{{
|
||||||
|
let mapleader = " "
|
||||||
|
set timeoutlen=1000
|
||||||
|
"}}}
|
||||||
|
"- | GENERAL SETTINGS | ----------------------------------------------------{{{
|
||||||
|
colorscheme slate
|
||||||
|
set t_Co=256
|
||||||
|
set previewheight=12 " Set the file preview height
|
||||||
|
set splitbelow " Splits go below by default
|
||||||
|
set nocompatible " Disable compatibility with vi which can cause unexpected issues.
|
||||||
|
filetype on " Enable type file detection. Vim will be able to try to detect the type of file in use.
|
||||||
|
filetype plugin on " Enable plugins and load plugin for the detected file type.
|
||||||
|
set filetype=txt " Set filetype to text if none specified.
|
||||||
|
set autochdir "ctags
|
||||||
|
set tags=./tags,tags; "ctags
|
||||||
|
""filetype indent on " Load an indent file for the detected file type.
|
||||||
|
syntax on " Turn syntax highlighting on.
|
||||||
|
set foldmethod=syntax " Fold based on syntax
|
||||||
|
set scrolloff=5 " Keep at least 5 lines above/below cursor
|
||||||
|
set mouse=a " Enable mouse usage in modes
|
||||||
|
set mousehide " Hide the mouse when typing
|
||||||
|
|
||||||
|
set number " Add numbers to each line on the left-hand side.
|
||||||
|
set cursorline " Highlight cursor line underneath the cursor horizontally.
|
||||||
|
set cursorcolumn " Highlight cursor line underneath the cursor vertically.
|
||||||
|
set nowrap " Do not wrap lines. Allow long lines to extend as far as the line goes.
|
||||||
|
set colorcolumn=80 " Highlight column for recommended size.
|
||||||
|
|
||||||
|
set shiftwidth=4 " Set shift width to 4 spaces.
|
||||||
|
set tabstop=2 " Set tab width to 2 columns.
|
||||||
|
set expandtab " Use space characters instead of tabs.
|
||||||
|
set autoindent "Enables automatic indentation for new lines.
|
||||||
|
set smartindent "Provides intelligent indentation based on syntax.
|
||||||
|
set cindent
|
||||||
|
|
||||||
|
set incsearch " While searching though a file incrementally highlight matching characters as you type.
|
||||||
|
set ignorecase " Ignore capital letters during search.
|
||||||
|
set showmatch " Show matching words during a search.
|
||||||
|
set hlsearch " Use highlighting when doing a search.
|
||||||
|
|
||||||
|
" Override the ignorecase option if searching for capital letters.
|
||||||
|
" This will allow you to search specifically for capital letters.
|
||||||
|
set smartcase
|
||||||
|
|
||||||
|
set showcmd " Show partial command you type in the last line of the screen.
|
||||||
|
set showmode " Show the mode you are on the last line.
|
||||||
|
|
||||||
|
set history=1000 " Set the commands to save in history default number is 20.
|
||||||
|
set wildmenu " Enable auto completion menu after pressing TAB.
|
||||||
|
set wildmode=list:longest " Make wildmenu behave like similar to Bash completion.
|
||||||
|
set path+=** " Provides tab-completion for all file-related tasks
|
||||||
|
|
||||||
|
" There are certain files that we would never want to edit with Vim.
|
||||||
|
" Wildmenu will ignore files with these extensions.
|
||||||
|
set wildignore=*.docx,*.jpg,*.png,*.gif,*.pdf,*.pyc,*.exe,*.flv,*.img,*.xlsx
|
||||||
|
|
||||||
|
" }}}
|
||||||
|
"- | SPECIFIC FILETYPE SETTINGS | ------------------------------------------{{{
|
||||||
|
autocmd FileType c,cpp setlocal equalprg=clang-format
|
||||||
|
" This will enable code folding.
|
||||||
|
" Use the marker method of folding
|
||||||
|
augroup filetype_vim
|
||||||
|
autocmd!
|
||||||
|
autocmd FileType vim setlocal foldmethod=marker
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
augroup txt
|
||||||
|
autocmd!
|
||||||
|
au BufEnter *.txt setlocal spell spelllang=en_us
|
||||||
|
au BufEnter *.txt setlocal wrap
|
||||||
|
au BufEnter *.txt setlocal textwidth=80
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
augroup md
|
||||||
|
autocmd!
|
||||||
|
au BufEnter *.md setlocal spell spelllang=en_us
|
||||||
|
augroup END
|
||||||
|
" }}}
|
||||||
|
"- | STATUS LINE | ---------------------------------------------------------{{{
|
||||||
|
highlight StatusLine ctermfg=black ctermbg=white cterm=bold
|
||||||
|
highlight StatusLineNC ctermfg=black ctermbg=darkgrey
|
||||||
|
|
||||||
|
" Clear status line when vimrc is reloaded.
|
||||||
|
set statusline=
|
||||||
|
|
||||||
|
" Status line left side.
|
||||||
|
set statusline+=\ %F\ %M\ %Y\ %R
|
||||||
|
|
||||||
|
" Use a divider to separate the left side from the right side.
|
||||||
|
set statusline+=%=
|
||||||
|
|
||||||
|
" Status line right side.
|
||||||
|
set statusline+=\ ascii:\ %b\ hex:\ 0x%B\ row:\ %l\ col:\ %c\ percent:\ %p%%
|
||||||
|
|
||||||
|
" Show the status on the second to last line.
|
||||||
|
set laststatus=2
|
||||||
|
" }}}
|
||||||
|
"- | NETRW FILE TREE TOGGLE WITH L-F |--------------------------------------{{{
|
||||||
|
"
|
||||||
|
let g:netrw_keepdir = 0
|
||||||
|
let g:netrw_banner = 0
|
||||||
|
let g:netrw_winsize = 15
|
||||||
|
let g:netrw_liststyle = 3
|
||||||
|
let g:netrw_browse_split = 4
|
||||||
|
let g:netrw_localcopydircmd = 'cp -r'
|
||||||
|
let g:netrw_list_hide = '\(^\|\s\s\)\zs\.\S\+'
|
||||||
|
|
||||||
|
" Toggle Vexplore with Ctrl-F
|
||||||
|
function! ToggleVExplorer()
|
||||||
|
if exists("t:expl_buf_num")
|
||||||
|
let expl_win_num = bufwinnr(t:expl_buf_num)
|
||||||
|
if expl_win_num != -1
|
||||||
|
let cur_win_nr = winnr()
|
||||||
|
exec expl_win_num . 'wincmd w'
|
||||||
|
close
|
||||||
|
unlet t:expl_buf_num
|
||||||
|
else
|
||||||
|
unlet t:expl_buf_num
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
exec '1wincmd w'
|
||||||
|
Vexplore
|
||||||
|
let t:expl_buf_num = bufnr("%")
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
nnoremap <silent> <leader>f :call ToggleVExplorer()<CR>
|
||||||
|
|
||||||
|
function! OpenToRight()
|
||||||
|
:normal v
|
||||||
|
let g:path=expand('%:p')
|
||||||
|
:q!
|
||||||
|
execute 'belowright vnew' g:path
|
||||||
|
:normal <C-l>
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
nnoremap <silent> <Leader>o :call OpenToRight()<CR>
|
||||||
|
|
||||||
|
" }}}
|
||||||
|
"- | TOGGLE TERMINAL WITH L-T | --------------------------------------------{{{
|
||||||
|
let s:term_buf_nr = -1
|
||||||
|
function! s:ToggleTerminal() abort
|
||||||
|
if s:term_buf_nr == -1
|
||||||
|
execute "botright terminal"
|
||||||
|
let s:term_buf_nr = bufnr("$")
|
||||||
|
else
|
||||||
|
try
|
||||||
|
execute "bdelete! " . s:term_buf_nr
|
||||||
|
catch
|
||||||
|
let s:term_buf_nr = -1
|
||||||
|
call <SID>ToggleTerminal()
|
||||||
|
return
|
||||||
|
endtry
|
||||||
|
let s:term_buf_nr = -1
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
nnoremap <silent> <Leader>t :call <SID>ToggleTerminal()<CR>
|
||||||
|
tnoremap <silent> <Leader>t <C-\><C-n>:call <SID>ToggleTerminal()<CR>
|
||||||
|
|
||||||
|
|
||||||
|
" }}}
|
||||||
|
"- | C-TAGS/DEFINITIONS AND TABS L+D | -------------------------------------{{{
|
||||||
|
nnoremap <leader>d :tab tag <C-R><C-W><CR>
|
||||||
|
nnoremap <leader>dn :tabnext<CR>
|
||||||
|
nnoremap <leader>dp :tabprevious<CR>
|
||||||
|
nnoremap <leader>dc :tabclose<CR>
|
||||||
|
"}}}
|
||||||
|
"- | BUFFERS WITH L-B | ----------------------------------------------------{{{
|
||||||
|
nnoremap <leader>b :set nomore <Bar> :ls <Bar> :set more <CR>:b<Space>
|
||||||
|
nnoremap <leader>bn :bnext<CR>
|
||||||
|
nnoremap <leader>bp :bprevious<CR>
|
||||||
|
|
||||||
|
"}}}
|
||||||
|
"- | WINDOWS WITH L-W | ----------------------------------------------------{{{
|
||||||
|
|
||||||
|
nnoremap <leader>v :vsplit<CR>
|
||||||
|
nnoremap <leader>s :split<CR>
|
||||||
|
|
||||||
|
nnoremap <leader>c :close<CR>
|
||||||
|
nnoremap <leader>o :only<CR>
|
||||||
|
|
||||||
|
nnoremap <leader>h <C-w>h
|
||||||
|
nnoremap <leader>j <C-w>j
|
||||||
|
nnoremap <leader>k <C-w>k
|
||||||
|
nnoremap <leader>l <C-w>l
|
||||||
|
"}}}"
|
||||||
|
"- | GLOBAL COPY AND PASTE | -----------------------------------------------{{{
|
||||||
|
vmap <leader>c "+y
|
||||||
|
map <leader>v "+p
|
||||||
|
"}}}
|
||||||
|
"- | CODE SNIPPETS/TEMPLATES | ---------------------------------------------{{{
|
||||||
|
|
||||||
|
"HTML SNIPPET/TEMPLATE"
|
||||||
|
nnoremap ,html :-1read $HOME/eg/webdev/index.html<CR>:11<CR>
|
||||||
|
if has("autocmd")
|
||||||
|
augroup templates
|
||||||
|
autocmd BufNewFile index.html 0r ~/eg/webdev/index.html
|
||||||
|
autocmd BufReadPost index.html normal! 10j
|
||||||
|
augroup END
|
||||||
|
endif
|
||||||
|
|
||||||
|
"CSS SNIPPET/TEMPLATE"
|
||||||
|
nnoremap ,css :-1read $HOME/eg/webdev/style.css<CR>
|
||||||
|
if has("autocmd")
|
||||||
|
augroup templates
|
||||||
|
autocmd BufNewFile style.css 0r ~/eg/webdev/style.css
|
||||||
|
augroup END
|
||||||
|
endif
|
||||||
|
|
||||||
|
"README SNIPPET/TEMPLATE"
|
||||||
|
nnoremap ,read :-1read $HOME/eg/README.md<CR>
|
||||||
|
if has("autocmd")
|
||||||
|
augroup templates
|
||||||
|
autocmd BufNewFile README.md 0r ~/eg/README.md
|
||||||
|
augroup END
|
||||||
|
endif
|
||||||
|
|
||||||
|
"C SNIPPET/TEMPLATE"
|
||||||
|
function! s:TemplatePost() abort
|
||||||
|
let l:fname = escape(expand('%:t:r'), '\/&')
|
||||||
|
let l:fname_up = toupper(l:fname)
|
||||||
|
let pat = '\c\<template'
|
||||||
|
silent! execute '%s/' . pat . '/' . l:fname_up . '/g'
|
||||||
|
" jump to last line and lowercase that line only
|
||||||
|
silent! normal! guu
|
||||||
|
setlocal filetype=c
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
nnoremap ,read :-1read $HOME/eg/c_dev/template.c<CR>
|
||||||
|
if has("autocmd")
|
||||||
|
augroup templates
|
||||||
|
autocmd BufNewFile *.c 0r ~/eg/c_dev/template.c | call s:TemplatePost()
|
||||||
|
augroup END
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
nnoremap ,read :-1read $HOME/eg/c_dev/template.h<CR>
|
||||||
|
if has("autocmd")
|
||||||
|
augroup templates
|
||||||
|
autocmd BufNewFile *.h 0r ~/eg/c_dev/template.h | call s:TemplatePost()
|
||||||
|
augroup END
|
||||||
|
endif
|
||||||
|
|
||||||
|
"}}}
|
||||||
|
"{{{ - | ENCLOSE VISUALLY HIGHLIGHTED |---------------------------------------
|
||||||
|
xnoremap <leader>p c(<C-r>")<Esc>
|
||||||
|
xnoremap <leader>q c"<C-r>""<Esc>
|
||||||
|
xnoremap <leader>c c{<C-r>"}<Esc>
|
||||||
|
xnoremap <leader>b c[<C-r>"]<Esc>
|
||||||
|
"}}}"
|
||||||
|
"- | MINIMALIST TAB COMPLETE PLUGIN | --------------------------------------{{{
|
||||||
|
inoremap <expr> <Tab> TabComplete()
|
||||||
|
fun! TabComplete()
|
||||||
|
if getline('.')[col('.') - 2] =~ '\K' || pumvisible()
|
||||||
|
return "\<C-P>"
|
||||||
|
else
|
||||||
|
return "\<Tab>"
|
||||||
|
endif
|
||||||
|
endfun
|
||||||
|
|
||||||
|
" Minimalist-AutoCompletePop-Plugin
|
||||||
|
set completeopt=menu,menuone,noinsert
|
||||||
|
inoremap <expr> <CR> pumvisible() ? "\<C-Y>" : "\<CR>"
|
||||||
|
autocmd InsertCharPre * call AutoComplete()
|
||||||
|
fun! AutoComplete()
|
||||||
|
if v:char =~ '\K'
|
||||||
|
\ && getline('.')[col('.') - 4] !~ '\K'
|
||||||
|
\ && getline('.')[col('.') - 3] =~ '\K'
|
||||||
|
\ && getline('.')[col('.') - 2] =~ '\K' " last char
|
||||||
|
\ && getline('.')[col('.') - 1] !~ '\K'
|
||||||
|
|
||||||
|
call feedkeys("\<C-P>", 'n')
|
||||||
|
end
|
||||||
|
endfun
|
||||||
|
" }}}
|
||||||
|
"- | MINIMALIST CLOSING TAGS | ---------------------------------------------{{{
|
||||||
|
inoremap " ""<left>
|
||||||
|
inoremap ' ''<left>
|
||||||
|
inoremap ( ()<left>
|
||||||
|
inoremap [ []<left>
|
||||||
|
inoremap { {}<left>
|
||||||
|
inoremap {<CR> {<CR>}<ESC>O
|
||||||
|
inoremap {;<CR> {<CR>};<ESC>O
|
||||||
|
|
||||||
|
" }}}
|
||||||
|
"- | COMMENT BOXS | --------------------------------------------------------{{{
|
||||||
|
function! Insertcomment()
|
||||||
|
let lnum = line('.') " insert a single-line C-style comment with one space inside
|
||||||
|
call append(lnum - 1, ['/* */']) " move cursor to the inserted line, column 4 (between /* and */)
|
||||||
|
call cursor(lnum, 4)
|
||||||
|
startinsert
|
||||||
|
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
nnoremap <leader>xc :call Insertcomment()<cr>
|
||||||
|
inoremap <leader>xc <c-o>:call Insertcomment()<cr>
|
||||||
|
|
||||||
|
function! InsertCommentLine()
|
||||||
|
let l:lines = [
|
||||||
|
\ '/* - | COMMENT | ------------------------------------------------------------*/',
|
||||||
|
\ ]
|
||||||
|
call append(line('.')-1, l:lines)
|
||||||
|
normal! g$ " move cursor to the blank line
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
nnoremap <leader>xl :call InsertCommentLine()<CR>
|
||||||
|
inoremap <leader>xl <C-o>:call InsertCommentLine()<CR>
|
||||||
|
|
||||||
|
function! Insertcommentbox()
|
||||||
|
let l:lines = [
|
||||||
|
\ '/* - | comment | --------------------------------------------------------------',
|
||||||
|
\ ' * comment goes here',
|
||||||
|
\ ' * --------------------------------------------------------------------------*/'
|
||||||
|
\ ]
|
||||||
|
call append(line('.')-1, l:lines)
|
||||||
|
normal! j$ " move cursor to the blank line
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
nnoremap <leader>xb :call Insertcommentbox()<cr>
|
||||||
|
inoremap <leader>xb <c-o>:call Insertcommentbox()<cr>
|
||||||
|
|
||||||
|
|
||||||
|
"}}}
|
||||||
|
"- | FOLD SECTIONS | ------------------------------------------------------ {{{
|
||||||
|
function! InsertFoldBox()
|
||||||
|
let l:lines = [
|
||||||
|
\ '"- | FOLD | ----------------------------------------------------------------{{{',
|
||||||
|
\ '',
|
||||||
|
\ '"}}}'
|
||||||
|
\ ]
|
||||||
|
call append(line('.')-1, l:lines)
|
||||||
|
normal! j$ " move cursor to the blank line
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
nnoremap <leader>xz :call InsertFoldBox()<cr>
|
||||||
|
inoremap <leader>xz <c-o>:call InsertFoldBox()<cr>
|
||||||
|
|
||||||
|
|
||||||
|
"}}}"
|
||||||
|
"- | CUSTOM HIGHTLIGHTING | ------------------------------------------------{{{
|
||||||
|
|
||||||
|
call matchadd('Todo', '\v\BUG:', -1)
|
||||||
|
call matchadd('Todo', '\v\NOTE:', -1)
|
||||||
|
"}}}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user