snips/minimal.vimrc.vim
2023-08-26 20:54:52 -07:00

295 lines
7.2 KiB
VimL

"
" Vim customization and package management
"
" This uses Vim Plug for package management, so Vim Plug is installed on the first
" run.
"
" Run the following to install plugins:
"
" * Launch vim and run :PluginInstall
" * To install from command line: vim +PluginInstall +qall
" Plug Installation {{{
" Bootstrap Plug if it's not installed
if has("nvim")
if empty(glob("~/.config/nvim/autoload/plug.vim"))
echo "No vim-plug, getting it ..."
execute '!curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
echo "Getting vim-plug ... done"
endif
else
if empty(glob("~/.vim/autoload/plug.vim"))
echo "No vim-plug, getting it ..."
execute '!curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
echo "Getting vim-plug ... done"
endif
endif
" }}}
" Base settings {{{
set nocompatible " be iMproved, required
filetype off " required
syntax on
set mouse=a
set mousehide
scriptencoding utf-8
set encoding=utf-8
let g:airline_powerline_fonts=1
let mapleader=","
let g:indent_guides_enable_on_vim_startup=0
let g:indent_guides_start_level=2
let g:indent_guides_guide_size=1
let g:indent_guides_soft_pattern = ' '
" }}}
" Vim Plug setup - Preamble {{{
call plug#begin()
" }}}
" Vim Plug setup - Packages {{{
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'tpope/vim-fugitive'
Plug 'mhinz/vim-signify'
Plug 'tmhedberg/matchit'
Plug 'spf13/vim-colors'
Plug 'romainl/vim-cool'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-repeat'
Plug 'drmikehenry/vim-fontsize'
Plug 'jiangmiao/auto-pairs'
Plug 'mg979/vim-visual-multi'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
"Plug 'roxma/vim-hug-neovim-rpc'
"Plug 'roxma/nvim-yarp'
"Plug 'Shougo/denite.nvim'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'asolkar/vim-color-molokini'
Plug 'nathanaelkane/vim-indent-guides'
Plug 'luochen1990/rainbow'
Plug 'https://gitlab.devtools.intel.com/masolkar/vim-iosf.git' " intel
Plug 'vhda/verilog_systemverilog.vim'
Plug 'nanotech/jellybeans.vim'
" }}}
" Vim Plug - Closing {{{
call plug#end()
" }}}
" Customization {{{
" Base customization {{{
if has("gui_running")
if has("nvim")
else
if has("mac")
set guifont=Iosevka-Term:h20
elseif has("win32")
set guifont=Iosevka\ Term\ Regular\ 15
else
set guifont=Iosevka\ Term\ Regular\ 13.5
end
end
set columns=120 lines=54
" Hide/Show menu and tool bar
function! ToggleGUICruft()
if &guioptions=='iaA'
exec('set guioptions=imTrLaA')
else
exec('set guioptions=iaA')
endif
endfunction
map <F11> <Esc>:call ToggleGUICruft()<cr>
" GUI default:
" - 'i' : Hide gui menus
" - 'aA' : Modal and modeless autoselect copy to yank buffer
set guioptions=iaA
else
set background=dark
if has('vcon')
set termguicolors
endif
endif
" check to make sure vim has been compiled with colorcolumn support
" before enabling it
if exists("+colorcolumn")
set colorcolumn=120
endif
"let g:molokini_gui_italic = 0
colorscheme molokini
set norelativenumber
set number
set visualbell t_vb=
set cindent
set noautoindent
set tabstop=4
set softtabstop=4
set shiftwidth=4
set cmdheight=2
set scrolloff=5
set expandtab
set showmatch
set cursorline
set mat=2
set showmode
set hlsearch
set incsearch
set ignorecase
set wildmenu
set wildmode=list:longest,full " Command <Tab> completion, list matches, then longest common part, then all.
set backspace=indent,eol,start
set history=1024
set ruler
set hid
set viminfo='20,\"50
set smartcase
set magic
set showmode
set autochdir
set list
set listchars=tab:▶\ ,trail:●,extends:#,nbsp:. " Highlight problematic whitespace
" Directories {{{
set backup " backups are nice ...
set backupdir=$HOME/.vimbackup// " but not when they clog .
set directory=$HOME/.vimswap// " Same for swap files
set viewdir=$HOME/.vimviews// " same for view files
" Creating directories if they don't exist
silent execute '!mkdir -p $HOME/.vimbackup'
silent execute '!mkdir -p $HOME/.vimswap'
silent execute '!mkdir -p $HOME/.vimviews'
au BufWinLeave \* silent! mkview "make vim save view (state) (fds, cursor, etc)
au BufWinEnter \* silent! loadview "make vim load view (state) (fds, cursor, etc)
if exists('$TMUX')
let &t_SI = "\<Esc>Ptmux;\<Esc>\e[5 q\<Esc>\\"
let &t_EI = "\<Esc>Ptmux;\<Esc>\e[2 q\<Esc>\\"
else
let &t_SI = "\e[5 q"
let &t_EI = "\e[2 q"
endif
" }}}
" }}}
" Module customization {{{
if isdirectory(expand("~/.vim/plugged/nerdtree"))
map <C-t> <plug>NERDTreeTabsToggle<CR>
map <leader>e :NERDTreeFind<CR>
nmap <leader>nt :NERDTreeFind<CR>
let g:NERDTreeShowBookmarks=1
let g:NERDTreeIgnore=['\.py[cd]$', '\~$', '\.swo$', '\.swp$', '^\.git$', '^\.hg$', '^\.svn$', '\.bzr$']
let g:NERDTreeChDirMode=1
let g:NERDTreeQuitOnOpen=1
let g:NERDTreeMouseMode=2
let g:NERDTreeShowHidden=1
let g:NERDTreeKeepTreeInNewTab=1
let g:nerdtree_tabs_open_on_gui_startup=0
endif
let g:airline#extensions#tabline#enabled = 1
let g:airline_theme='deus'
let g:rainbow_active = 1 "0 if you want to enable it later via :RainbowToggle
let g:iosftrk_folddisable = 1 " intel
let g:iosfsbtrk_folddisable = 1 " intel
let g:fugitive_git_executable = '/usr/intel/bin/git' " intel
" }}}
" Key bindings {{{
map <C-t> :NERDTreeToggle<CR>
nnoremap <F5> :e<CR> G
nnoremap <F6> <C-W>w
nnoremap <S-F6> <C-W>W
nnoremap <C-F6> :IndentGuidesToggle<CR>
nnoremap <C-F11> :confirm bd<CR>
nnoremap <F7> <C-w>o
nnoremap <S-F8> <C-w>s
nnoremap <F8> <C-w>v
"nnoremap <F9> :Denite buffer<CR>
"nnoremap <leader>b :Denite buffer<CR>
nnoremap <F9> :CtrlPMixed<CR>
nnoremap <leader>b :CtrlPBuffer<CR>
nnoremap <S-F10> :set wrap!<CR>
nnoremap <S-F1> :set spell!<CR>
nnoremap <C-N> :next<CR>
nnoremap <C-P> :prev<CR>
vnoremap <C-r> "hy/<C-r>h<cr>
nnoremap <C-Z> :bnext <CR>
" Visual mode: Keep selection after indent
vnoremap < <gv
vnoremap > >gv
if has("nvim")
nnoremap <C-Space> za
elseif has("gui_running")
nnoremap <C-Space> za
else
nnoremap <Nul> za
end
" Reflow text
nnoremap Q gqap
" reflow visually highlighted lines with Q:
vnoremap Q gq
" Remove trailing spaces
nnoremap <C-S-F3> :%s/\s\+$//g<CR>:noh<CR>
" }}}
" Highlights {{{
"
" Highlight coloring I prefer
highlight Search guibg=yellow guifg=black
highlight Cursor guifg=white guibg=red
highlight iCursor guifg=white guibg=red
highlight SpecialKey guifg=#772222 guibg=#331111
" }}}
"
" File associations {{{
au! BufRead,BufNewFile *_iosf*_trk.out set filetype=iosftrk " intel
au! BufRead,BufNewFile *_iosfsb*_trk.out set filetype=iosfsbtrk " intel
au! BufRead,BufNewFile * RainbowToggleOn
" }}}
"
" }}}
" vim: foldenable foldmethod=marker