snips/minimal.vimrc.vim

295 lines
7.2 KiB
VimL
Raw Normal View History

2019-01-03 03:30:49 +00:00
"
" Vim customization and package management
"
2021-12-29 02:38:57 +00:00
" This uses Vim Plug for package management, so Vim Plug is installed on the first
2019-02-14 05:53:34 +00:00
" run.
2019-01-03 03:30:49 +00:00
"
2019-02-14 05:53:34 +00:00
" Run the following to install plugins:
2019-01-03 03:30:49 +00:00
"
" * Launch vim and run :PluginInstall
" * To install from command line: vim +PluginInstall +qall
2021-04-11 03:07:26 +00:00
" 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
2019-12-26 21:59:01 +00:00
endif
2019-02-14 05:53:34 +00:00
" }}}
2019-01-03 03:30:49 +00:00
" Base settings {{{
set nocompatible " be iMproved, required
filetype off " required
syntax on
set mouse=a
set mousehide
scriptencoding utf-8
2019-12-11 04:35:42 +00:00
set encoding=utf-8
2019-01-03 03:30:49 +00:00
let g:airline_powerline_fonts=1
let mapleader=","
2019-04-22 23:58:36 +00:00
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 = ' '
2019-01-03 03:30:49 +00:00
" }}}
2021-12-29 02:38:57 +00:00
" Vim Plug setup - Preamble {{{
2019-01-03 03:30:49 +00:00
2019-12-26 21:59:01 +00:00
call plug#begin()
2019-01-03 03:30:49 +00:00
" }}}
2021-12-29 02:38:57 +00:00
" Vim Plug setup - Packages {{{
2019-01-03 03:30:49 +00:00
2019-12-26 21:59:01 +00:00
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'tpope/vim-fugitive'
Plug 'mhinz/vim-signify'
Plug 'tmhedberg/matchit'
Plug 'spf13/vim-colors'
2022-11-07 02:07:44 +00:00
Plug 'romainl/vim-cool'
2019-12-26 21:59:01 +00:00
Plug 'tpope/vim-surround'
Plug 'tpope/vim-repeat'
Plug 'drmikehenry/vim-fontsize'
Plug 'jiangmiao/auto-pairs'
2020-09-07 02:22:55 +00:00
Plug 'mg979/vim-visual-multi'
2019-12-26 21:59:01 +00:00
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'
2020-01-19 00:35:51 +00:00
Plug 'asolkar/vim-color-molokini'
2019-12-26 21:59:01 +00:00
Plug 'nathanaelkane/vim-indent-guides'
Plug 'luochen1990/rainbow'
2023-08-27 02:19:05 +00:00
Plug 'https://gitlab.devtools.intel.com/masolkar/vim-iosf.git' " intel
2019-12-26 21:59:01 +00:00
Plug 'vhda/verilog_systemverilog.vim'
Plug 'nanotech/jellybeans.vim'
2019-01-03 03:30:49 +00:00
" }}}
2021-12-29 02:38:57 +00:00
" Vim Plug - Closing {{{
2019-01-03 03:30:49 +00:00
2019-12-26 21:59:01 +00:00
call plug#end()
2019-01-03 03:30:49 +00:00
" }}}
" Customization {{{
" Base customization {{{
if has("gui_running")
2021-11-14 07:38:31 +00:00
if has("nvim")
2019-01-07 03:26:59 +00:00
else
2021-11-14 07:38:31 +00:00
if has("mac")
2023-08-27 03:54:52 +00:00
set guifont=Iosevka-Term:h20
2021-11-14 07:38:31 +00:00
elseif has("win32")
2023-08-27 02:19:05 +00:00
set guifont=Iosevka\ Term\ Regular\ 15
2021-11-14 07:38:31 +00:00
else
set guifont=Iosevka\ Term\ Regular\ 13.5
end
2019-01-07 03:26:59 +00:00
end
2019-01-03 03:30:49 +00:00
set columns=120 lines=54
2023-08-27 03:54:52 +00:00
" Hide/Show menu and tool bar
2019-02-14 05:53:34 +00:00
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
2019-01-03 03:30:49 +00:00
else
set background=dark
2019-12-26 21:59:01 +00:00
if has('vcon')
set termguicolors
endif
2019-01-03 03:30:49 +00:00
endif
2019-02-14 05:53:34 +00:00
" check to make sure vim has been compiled with colorcolumn support
" before enabling it
if exists("+colorcolumn")
set colorcolumn=120
endif
2023-08-27 02:19:05 +00:00
"let g:molokini_gui_italic = 0
2020-01-19 00:35:51 +00:00
colorscheme molokini
2023-08-27 02:19:05 +00:00
2019-01-03 03:30:49 +00:00
set norelativenumber
set number
set visualbell t_vb=
set cindent
set noautoindent
2019-02-14 05:53:34 +00:00
set tabstop=4
set softtabstop=4
set shiftwidth=4
set cmdheight=2
set scrolloff=5
2019-01-03 03:30:49 +00:00
set expandtab
set showmatch
set cursorline
set mat=2
set showmode
set hlsearch
set incsearch
2019-02-14 05:53:34 +00:00
set ignorecase
2019-01-03 03:30:49 +00:00
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
2019-02-14 05:53:34 +00:00
set autochdir
2019-01-03 03:30:49 +00:00
set list
2019-04-22 23:58:36 +00:00
set listchars=tab:▶\ ,trail:●,extends:#,nbsp:. " Highlight problematic whitespace
2019-01-03 03:30:49 +00:00
" Directories {{{
2019-02-14 05:53:34 +00:00
2019-01-03 03:30:49 +00:00
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)
2019-11-11 06:17:16 +00:00
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
2019-02-14 05:53:34 +00:00
" }}}
2019-01-03 03:30:49 +00:00
" }}}
" Module customization {{{
2020-02-09 20:06:08 +00:00
if isdirectory(expand("~/.vim/plugged/nerdtree"))
map <C-t> <plug>NERDTreeTabsToggle<CR>
2019-02-14 05:53:34 +00:00
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
2019-01-03 03:30:49 +00:00
endif
let g:airline#extensions#tabline#enabled = 1
2019-11-10 21:05:25 +00:00
let g:airline_theme='deus'
2019-01-03 03:30:49 +00:00
2019-01-07 03:26:59 +00:00
let g:rainbow_active = 1 "0 if you want to enable it later via :RainbowToggle
2023-08-27 02:19:05 +00:00
let g:iosftrk_folddisable = 1 " intel
let g:iosfsbtrk_folddisable = 1 " intel
let g:fugitive_git_executable = '/usr/intel/bin/git' " intel
2019-01-03 03:30:49 +00:00
" }}}
" Key bindings {{{
map <C-t> :NERDTreeToggle<CR>
2019-01-03 03:30:49 +00:00
nnoremap <F5> :e<CR> G
nnoremap <F6> <C-W>w
nnoremap <S-F6> <C-W>W
2019-04-22 23:58:36 +00:00
nnoremap <C-F6> :IndentGuidesToggle<CR>
2019-01-03 03:30:49 +00:00
nnoremap <C-F11> :confirm bd<CR>
nnoremap <F7> <C-w>o
nnoremap <S-F8> <C-w>s
nnoremap <F8> <C-w>v
2019-12-26 21:59:01 +00:00
"nnoremap <F9> :Denite buffer<CR>
"nnoremap <leader>b :Denite buffer<CR>
nnoremap <F9> :CtrlPMixed<CR>
nnoremap <leader>b :CtrlPBuffer<CR>
2019-01-03 03:30:49 +00:00
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>
2019-02-14 05:53:34 +00:00
" Visual mode: Keep selection after indent
vnoremap < <gv
vnoremap > >gv
2019-01-07 03:26:59 +00:00
if has("nvim")
nnoremap <C-Space> za
elseif has("gui_running")
2019-01-03 03:30:49 +00:00
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>
" }}}
2019-02-14 05:53:34 +00:00
" Highlights {{{
"
" Highlight coloring I prefer
highlight Search guibg=yellow guifg=black
highlight Cursor guifg=white guibg=red
highlight iCursor guifg=white guibg=red
2019-04-22 23:58:36 +00:00
highlight SpecialKey guifg=#772222 guibg=#331111
2019-02-14 05:53:34 +00:00
" }}}
"
" File associations {{{
2023-08-27 02:19:05 +00:00
au! BufRead,BufNewFile *_iosf*_trk.out set filetype=iosftrk " intel
au! BufRead,BufNewFile *_iosfsb*_trk.out set filetype=iosfsbtrk " intel
2019-02-14 05:53:34 +00:00
au! BufRead,BufNewFile * RainbowToggleOn
" }}}
"
2019-01-03 03:30:49 +00:00
" }}}
" vim: foldenable foldmethod=marker