Add vimrc for ref and for use if vim is needed in one-off cases
This commit is contained in:
parent
948db247d7
commit
8e6c7e27b8
@ -28,8 +28,8 @@ log "---------------- dotfiles ----------------"
|
|||||||
copy_dir src_files/.config $XDG_CONFIG_HOME
|
copy_dir src_files/.config $XDG_CONFIG_HOME
|
||||||
copy_dir src_files/.local $DIR_LOCAL
|
copy_dir src_files/.local $DIR_LOCAL
|
||||||
|
|
||||||
# duplicate, but copy anyway, ensures set if zsh isn't yet looking to $XDG_CONFIG_HOME/zsh
|
copy_file src_files/.config/zsh/.zshenv $HOME # duplicate, copy anyway, ensures $ZDOTDIR
|
||||||
copy_file src_files/.config/zsh/.zshenv $HOME
|
# copy_file src_files/.config/vim/.vimrc $HOME # copy to $HOME if need to use vim
|
||||||
|
|
||||||
# on macos, handle sim-linking to gimp config since gimp defaults to app-support
|
# on macos, handle sim-linking to gimp config since gimp defaults to app-support
|
||||||
if [[ "$BOX_SETUP_OS" = "macos" ]]; then
|
if [[ "$BOX_SETUP_OS" = "macos" ]]; then
|
||||||
|
126
src_files/.config/vim/.vimrc
Normal file
126
src_files/.config/vim/.vimrc
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
" base settings
|
||||||
|
set nocompatible
|
||||||
|
let mapleader=","
|
||||||
|
|
||||||
|
" plugin manager and plugin list
|
||||||
|
filetype off
|
||||||
|
set rtp+=$XDG_CONFIG_HOME/vim/plugins/Vundle.vim
|
||||||
|
call vundle#begin('$XDG_CONFIG_HOME/vim/plugins')
|
||||||
|
Plugin 'VundleVim/Vundle.vim'
|
||||||
|
|
||||||
|
" language-specific
|
||||||
|
Plugin 'leafgarland/typescript-vim'
|
||||||
|
|
||||||
|
" themes
|
||||||
|
Plugin 'rose-pine/vim'
|
||||||
|
Plugin 'ghifarit53/tokyonight-vim'
|
||||||
|
call vundle#end()
|
||||||
|
filetype plugin on " or plugin indent on ?
|
||||||
|
|
||||||
|
" plugin config
|
||||||
|
let g:netrw_banner=0 " hide banner
|
||||||
|
let g:netrw_browse_split=0 " <cr> opens in same window
|
||||||
|
let g:netrw_liststyle=3 " listing style: tree
|
||||||
|
let g:netrw_list_hide= '.*\.swp$'
|
||||||
|
" let g:netrw_list_hide.=netrw_gitignore#Hide()
|
||||||
|
" TODO add toggle to exaand/collapse whole tree
|
||||||
|
|
||||||
|
let g:typescript_indent_disable = 1
|
||||||
|
|
||||||
|
" functions
|
||||||
|
func! ToggleTabMode()
|
||||||
|
set expandtab!
|
||||||
|
if &expandtab
|
||||||
|
echo "using space characters in place of tabs"
|
||||||
|
else
|
||||||
|
echo "using tab characters"
|
||||||
|
endif
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
" TODO add function (or something) similar to gf, but clear the buffer in
|
||||||
|
" which it is run (idea is to use this with results of grep in blank pane)
|
||||||
|
|
||||||
|
" copy & paste: registers, clipboard
|
||||||
|
set clipboard+=unnamed " TODO or maybe unamedplus?
|
||||||
|
|
||||||
|
" colors, themes, appearance
|
||||||
|
"set background=light
|
||||||
|
let g:tokyonight_style = 'night' " available: night, storm
|
||||||
|
colorscheme tokyonight
|
||||||
|
" colorscheme rosepine_moon
|
||||||
|
|
||||||
|
" measurements, numbers, visual/audible cues
|
||||||
|
set cursorline
|
||||||
|
set colorcolumn=89,90
|
||||||
|
set noerrorbells novisualbell
|
||||||
|
set hlsearch
|
||||||
|
set laststatus=2
|
||||||
|
set number relativenumber
|
||||||
|
set ruler
|
||||||
|
set showcmd
|
||||||
|
set noshowmode
|
||||||
|
set title
|
||||||
|
|
||||||
|
" syntax highlighting
|
||||||
|
syntax enable " TODO 'enable' or 'on'?
|
||||||
|
|
||||||
|
" settings for buffers
|
||||||
|
set hidden
|
||||||
|
|
||||||
|
" settings for panes/splits, tabs
|
||||||
|
set splitright splitbelow
|
||||||
|
map <C-h> <C-w>h
|
||||||
|
map <C-j> <C-w>j
|
||||||
|
map <C-k> <C-w>k
|
||||||
|
map <C-l> <C-w>l
|
||||||
|
|
||||||
|
" finding and opening files
|
||||||
|
set wildmenu
|
||||||
|
set path+=**
|
||||||
|
|
||||||
|
" text input and editing
|
||||||
|
set tabstop=4
|
||||||
|
set expandtab
|
||||||
|
autocmd BufEnter * set formatoptions-=ro
|
||||||
|
" TODO get recursion working for the tags command below
|
||||||
|
command! MakeTags !ctags -f tags -R .
|
||||||
|
|
||||||
|
" shortcuts or aliases
|
||||||
|
" shortcuts for find in pane/tab
|
||||||
|
nnoremap <leader>f. :find<Space>*
|
||||||
|
nmap <leader>fr :vnew<CR><leader>f.
|
||||||
|
nmap <leader>fb :new<CR><leader>f.
|
||||||
|
nmap <leader>ft :tabnew<CR><leader>f.
|
||||||
|
|
||||||
|
" shortcuts for grep in pane/tab
|
||||||
|
nnoremap <leader>g, :r<Space>!grep<Space>--exclude-dir=node_modules<Space>-rIi<Space><Space>.<Left><Left>
|
||||||
|
nmap <leader>g. :enew<CR><leader>g,
|
||||||
|
nmap <leader>gr :vnew<CR><leader>g,
|
||||||
|
nmap <leader>gb :new<CR><leader>g,
|
||||||
|
nmap <leader>gt :tabnew<CR><leader>g,
|
||||||
|
|
||||||
|
" shortcuts for tree (netrw) in pane/tab
|
||||||
|
nnoremap <leader>t. :edit<Space>.<CR>
|
||||||
|
nnoremap <leader>tr :vsplit<Space>.<CR>
|
||||||
|
nnoremap <leader>tb :split<Space>.<CR>
|
||||||
|
nnoremap <leader>tt :tabnew<Space>.<CR>
|
||||||
|
|
||||||
|
" toggle tab/space mode
|
||||||
|
nnoremap <leader>tab :call ToggleTabMode()<CR>
|
||||||
|
|
||||||
|
" toggles related to line numbers and cursor
|
||||||
|
nnoremap <leader>nu :set number!<CR>
|
||||||
|
nnoremap <leader>rnu :set relativenumber!<CR>
|
||||||
|
nnoremap <leader>cc :set cuc!<CR>
|
||||||
|
|
||||||
|
" searching: replace-all in file
|
||||||
|
nnoremap <leader>ra :%s//g<Left><Left>
|
||||||
|
" TODO maybe add global (working dir, recursive) replace-all feature?
|
||||||
|
|
||||||
|
" format file content
|
||||||
|
nnoremap <leader>fmtjson :%!jq<Space>.<Space>-<CR>
|
||||||
|
|
||||||
|
" automatic actions
|
||||||
|
autocmd BufWritePre * %s/\s\+$//e " delete trailing whitespace
|
||||||
|
" autocmd BufWritePre * %s/\n\+\%$//e " delete end-of-file newlines
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user