258 lines
5.9 KiB
VimL
258 lines
5.9 KiB
VimL
"
|
||
" Vim customization and package management
|
||
"
|
||
|
||
" This uses Vundle for package management, so Vundle 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
|
||
|
||
" 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
|
||
" }}}
|
||
|
||
" 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 {{{
|
||
|
||
set runtimepath+=~/.vim/bundle/Vundle.vim
|
||
call vundle#begin()
|
||
|
||
Plugin 'VundleVim/Vundle.vim'
|
||
|
||
" }}}
|
||
|
||
" Vundle setup - Packages {{{
|
||
|
||
Plugin 'scrooloose/nerdtree'
|
||
Plugin 'tpope/vim-fugitive'
|
||
Plugin 'mhinz/vim-signify'
|
||
Plugin 'tmhedberg/matchit'
|
||
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'
|
||
Plugin 'Shougo/denite.nvim'
|
||
Plugin 'pR0Ps/molokai-dark'
|
||
Plugin 'nathanaelkane/vim-indent-guides'
|
||
Plugin 'luochen1990/rainbow'
|
||
Plugin 'vhda/verilog_systemverilog.vim'
|
||
|
||
" }}}
|
||
|
||
" Vundle - Closing {{{
|
||
|
||
call vundle#end() " required
|
||
filetype plugin indent on " required
|
||
|
||
" }}}
|
||
|
||
" Customization {{{
|
||
|
||
" Base customization {{{
|
||
|
||
if has("gui_running")
|
||
if has("mac")
|
||
set guifont=Iosevka:h13
|
||
elseif has("win32")
|
||
set guifont=Iosevka\ Term\ Regular\ 13
|
||
else
|
||
set guifont=Iosevka\ Term\ Regular\ 10.5
|
||
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
|
||
endif
|
||
|
||
" check to make sure vim has been compiled with colorcolumn support
|
||
" before enabling it
|
||
if exists("+colorcolumn")
|
||
set colorcolumn=120
|
||
endif
|
||
|
||
colorscheme molokai-dark
|
||
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)
|
||
|
||
" }}}
|
||
" }}}
|
||
|
||
" Module customization {{{
|
||
|
||
if isdirectory(expand("~/.vim/bundle/nerdtree"))
|
||
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
|
||
endif
|
||
|
||
let g:airline#extensions#tabline#enabled = 1
|
||
let g:airline_theme='molokai'
|
||
|
||
let g:rainbow_active = 1 "0 if you want to enable it later via :RainbowToggle
|
||
|
||
" }}}
|
||
|
||
" 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>
|
||
|
||
" 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
|
||
|
||
" }}}
|
||
"
|
||
" File associations {{{
|
||
|
||
au! BufRead,BufNewFile * RainbowToggleOn
|
||
|
||
" }}}
|
||
"
|
||
" }}}
|
||
|
||
" vim: foldenable foldmethod=marker
|