snips/minimal.vimrc.vim

258 lines
5.9 KiB
VimL
Raw Normal View History

2019-01-03 03:30:49 +00:00
"
" Vim customization and package management
"
2019-02-14 05:53:34 +00:00
" This uses Vundle for package management, so Vundle is installed on the first
" 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
2019-02-14 05:53:34 +00:00
" Vundle Installation {{{
" Bootstrap Vundle if it's not installed
if empty(system("grep lazy_load ~/.vim/bundle/Vundle.vim/autoload/vundle.vim"))
silent !mkdir -p ~/.vim/bundle
silent !rm -rf ~/.vim/bundle/Vundle.vim
silent !git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
endif
" }}}
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
let g:airline_powerline_fonts=1
let mapleader=","
let g:indent_guides_enable_on_vim_startup=1
" }}}
" Vundle setup - Preamble {{{
2019-02-14 05:53:34 +00:00
set runtimepath+=~/.vim/bundle/Vundle.vim
2019-01-03 03:30:49 +00:00
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
" }}}
" Vundle setup - Packages {{{
Plugin 'scrooloose/nerdtree'
Plugin 'tpope/vim-fugitive'
2019-02-14 05:53:34 +00:00
Plugin 'mhinz/vim-signify'
Plugin 'tmhedberg/matchit'
2019-01-03 03:30:49 +00:00
Plugin 'spf13/vim-colors'
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-repeat'
Plugin 'jiangmiao/auto-pairs'
Plugin 'terryma/vim-multiple-cursors'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'roxma/vim-hug-neovim-rpc'
Plugin 'roxma/nvim-yarp'
2019-01-03 03:30:49 +00:00
Plugin 'Shougo/denite.nvim'
Plugin 'pR0Ps/molokai-dark'
Plugin 'nathanaelkane/vim-indent-guides'
2019-01-07 03:26:59 +00:00
Plugin 'luochen1990/rainbow'
2019-02-14 05:53:34 +00:00
Plugin 'vhda/verilog_systemverilog.vim'
2019-01-03 03:30:49 +00:00
" }}}
" Vundle - Closing {{{
call vundle#end() " required
filetype plugin indent on " required
" }}}
" Customization {{{
" Base customization {{{
if has("gui_running")
2019-01-07 03:26:59 +00:00
if has("mac")
set guifont=Iosevka:h13
elseif has("win32")
set guifont=Iosevka\ Term\ Regular\ 13
else
set guifont=Iosevka\ Term\ Regular\ 10.5
2019-01-07 03:26:59 +00:00
end
2019-01-03 03:30:49 +00:00
set columns=120 lines=54
2019-02-14 05:53:34 +00:00
" 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
2019-01-03 03:30:49 +00:00
else
set background=dark
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
2019-01-03 03:30:49 +00:00
colorscheme molokai-dark
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
set listchars=tab:\ ,trail:•,extends:#,nbsp:. " Highlight problematic whitespace
" 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-02-14 05:53:34 +00:00
" }}}
2019-01-03 03:30:49 +00:00
" }}}
" Module customization {{{
if isdirectory(expand("~/.vim/bundle/nerdtree"))
2019-02-14 05:53:34 +00:00
map <C-e> <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
2019-01-03 03:30:49 +00:00
endif
let g:airline#extensions#tabline#enabled = 1
let g:airline_theme='molokai'
2019-01-07 03:26:59 +00:00
let g:rainbow_active = 1 "0 if you want to enable it later via :RainbowToggle
2019-01-03 03:30:49 +00:00
" }}}
" Key bindings {{{
map <C-e> :NERDTreeToggle<CR>
nnoremap <F5> :e<CR> G
nnoremap <F6> <C-W>w
nnoremap <S-F6> <C-W>W
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 <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
" }}}
"
" File associations {{{
au! BufRead,BufNewFile * RainbowToggleOn
" }}}
"
2019-01-03 03:30:49 +00:00
" }}}
" vim: foldenable foldmethod=marker