Skip to content

Instantly share code, notes, and snippets.

@phrohdoh
Last active June 13, 2019 12:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phrohdoh/71d9a38a40adb8c621ac to your computer and use it in GitHub Desktop.
Save phrohdoh/71d9a38a40adb8c621ac to your computer and use it in GitHub Desktop.
" vim-plug {{{
call plug#begin('~/.nvim/plugged')
Plug 'git@github.com:kien/ctrlp.vim.git'
Plug 'git@github.com:scrooloose/syntastic.git'
Plug 'git@github.com:itchyny/vim-cursorword.git'
Plug 'git@github.com:itchyny/lightline.vim.git'
Plug 'git@github.com:vim-scripts/Align.git'
Plug 'git@github.com:terryma/vim-multiple-cursors.git'
Plug 'git@github.com:mhinz/vim-startify.git'
Plug 'git@github.com:luochen1990/rainbow.git'
Plug 'git@github.com:rhysd/accelerated-jk.git'
Plug 'git@github.com:majutsushi/tagbar.git'
Plug 'git@github.com:davidhalter/jedi-vim.git'
Plug 'git@github.com:EinfachToll/DidYouMean.git'
" Rust-lang.org
Plug 'git@github.com:rust-lang/rust.vim.git'
call plug#end()
" }}}
" Enable syntax highlighting.
syntax enable
filetype plugin on
filetype plugin indent on
" general settings {{{
" No more BOM!
set nobomb
" Show the name of the current file in the terminal tab
set title
" Show special characters -- use :set list! to toggle
set list
set listchars=trail:·,tab:»\ ,extends:>,precedes:\<
" Disable line-wrapping by default
set nowrap
" Show line numbers
set number
" Show the status bar
set laststatus=2
" Allow deleting over everything in insert mode
set backspace=indent,eol,start
" Case-insensitive search
set ignorecase
" Only re-enable case-sensitive search if our query contains capitals
set smartcase
" Split logically
set splitright
set splitbelow
" }}}
" highlighting {{{
" Set folding highlight color to something visible
highlight Folded ctermbg=None
highlight SignColumn ctermbg=None
set cursorline
highlight CursorLine ctermbg=None
"}}}
" remaps {{{
" Don't enter Ex mode
nnoremap Q <nop>
" Unmap arrow-keys
nnoremap <Up> <nop>
nnoremap <Down> <nop>
nnoremap <Left> <nop>
nnoremap <Right> <nop>
vnoremap <Up> <nop>
vnoremap <Down> <nop>
vnoremap <Left> <nop>
vnoremap <Right> <nop>
inoremap <Up> <nop>
inoremap <Down> <nop>
inoremap <Left> <nop>
inoremap <Right> <nop>
" Non-recursively map space to : in normal mode
nnoremap <Space> :
" Open a new tab with ctrl-n, ctrl-n
nnoremap <C-n><C-n> :tabnew<return>
" Resize (h) windows smarter.
"{{{
nnoremap <Leader>, <C-w>>
nnoremap <Leader>. <C-w><
" Use = instead of + so we don't have to press shift.
nnoremap <Leader>= <C-w>+
nnoremap <Leader>- <C-w>-
"}}}
"}}}
" autocmds {{{
" We only want to execute these once
if !exists("autocommands_loaded") && has("autocmd")
let autocommands_loaded = 1
" Set syntax modes
autocmd BufNewFile,BufRead *rc set syntax=cfg
" Reset anything vim-related
autocmd BufNewFile,BufRead *vim* set syntax=vim
" Hack to override pymode folding
" :help BufWinEnter
autocmd BufWinEnter * set foldmethod=manual
" set noexpandtab on yaml and csharp
autocmd BufNewFile,BufRead *.cs set noexpandtab
autocmd BufNewFile,BufRead *.yaml set noexpandtab
" Source nvimrc when it is written
augroup reload_vimrc
autocmd!
autocmd BufWritePost $MYVIMRC source $MYVIMRC
augroup END
" Syntax highlighting for tmux configuration files
augroup filetypedetect
au BufNewFile,BufRead .tmux.conf*,tmux.conf* setf tmux
augroup END
autocmd InsertEnter * highlight CursorLine ctermfg=Red cterm=None
autocmd InsertLeave * highlight CursorLine ctermfg=None cterm=underline
autocmd VimEnter,BufEnter * nested :call tagbar#autoopen(1)
endif
" }}}
" ctrlp {{{
" Show hidden files in ctrlp
let g:ctrlp_show_hidden = 1
" Use ag if it exist
if executable("ag")
" Use ag over grep
set grepprg=ag\ --nogroup
" Use ag to get ctrlp results
let g:ctrlp_user_command = 'ag %s -l -g ""'
endif
"}}}
" lightline {{{
let g:lightline = {
\ 'active': { 'left' : [ ['mode', 'mySyntax' ], [ 'myTagbar', 'myFilename' ], [ 'modified', 'readonly' ] ] },
\ 'component_function': { 'myTagbar': 'MyTagbar', 'mySyntax': 'MySyntax' },
\ 'separator': { 'left': '', 'right': '' },
\ 'subseparator': { 'left': '', 'right': '' }
\ }
let g:lightline.colorscheme = 'default'
function! MySyntax()
return &syn
endfunction
function! MyTagbar()
return tagbar#currenttag("%s", "<no tag>", "s")
endfunction
" }}}
" Rainbow Parentheses
let g:rainbow_active = 1 " 0 if you want to use :RainbowToggle
" Tagbar {{{
let g:tagbar_left = 1
let g:tagbar_hide_nonpublic = 1
let g:tagbar_sort = 1
highlight TagbarHighlight ctermfg=Green ctermbg=None
" }}}
" vim: expandtab:tabstop=4:shiftwidth=4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment