dotfiles

config files for my linux setup
git clone git://edryd.org/dotfiles
Log | Files | Refs | README

nvimrc (4502B)


      1 " basic{{{1
      2 syntax on
      3 set autoindent                  " I hope you know what this does
      4 set autowrite                   " automatically write before running commands that need it to be written
      5 set hlsearch                    " turn on highlighting of searches
      6 set ignorecase                  " make search non case sensitive
      7 set incsearch                   " show the search result before you finish typing
      8 set noshowmode                  " turn off "--INSERT--" at bottom of screen
      9 set nowrap                      " change what happens when you get to edge of screen.
     10 set shiftround                  " make indents always be at a multiple of the tab width
     11 set showcmd                     " show commands that you are typing
     12 set showmatch                   " when a bracket is inserted, briefly jump to the matching one.
     13 set smartcase                   " allow you to search with more charters
     14 set timeout                     " set timeout for mappings
     15 set notitle                     " turn off the Vim title at the top of the window
     16 set ttyfast                     " makes Vim faster
     17 set visualbell                  " use visual bell instead of beeping
     18 set backspace=2                 " turn on backspace
     19 set completeopt-=preview        " disable pop-up when using Neocomplete
     20 set formatoptions+=w            " when text get over the number set by `set textwidth`, wrap it to next line
     21 set foldmethod=marker           " set the folding method to use three { to start and three } to end
     22 set laststatus=2                " always turn on status line
     23 set modelines=5                 " number of lines down Vim checks for set commands
     24 set mouse=a                     " turn on the mouse
     25 set nrformats=octal,hex,alpha   " allow you to ctrl-a/ctrl-x to increase/decrease letters and numbers
     26 set scrolloff=7                 " make Vim have 7 lines below cursor when moving down
     27 set t_ut=                       " needed if using Vim inside of tmux
     28 set textwidth=79                " set what line to wrap charters at.
     29 set ttimeoutlen=50              " change wait time for `timeout`
     30 set clipboard=unnamedplus       " Vim yanks go to OS's clipboard as well
     31 "                                 remove "plus" if not on Linux
     32 
     33 " set up menu stuff
     34 set wildmenu
     35 set wildmode=list,longest,full
     36 
     37 " make line numbers go 1,2,3,4...
     38 set number
     39 " make the line your cursor is on 0
     40 " set relativenumber
     41 
     42 " extra chars like the end of line one and when text raps to next line
     43 set list
     44 set listchars=tab:\|\ ,eol:¬,extends:❯,precedes:❮
     45 
     46 " make Vim's clipboard the same as OS's clipboard
     47 let g:clipbrdDefaultReg = '+'
     48 
     49 " make Vim save every time it leaves insert mode
     50 au InsertLeave * if &mod && expand('%')!=''|write|endif
     51 
     52 " save line number line when reopening file
     53 if has("autocmd")
     54   au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
     55 endif
     56 
     57 " highlighting{{{1
     58 " highlight the 81st column so you know when your line is to long
     59 call matchadd('Error', '\%81v', 100)
     60 
     61 au BufRead,BufNewFile *.md  set filetype=markdown
     62 au BufRead,BufNewFile *bash_profile* set filetype=sh
     63 au BufRead,BufNewFile *tmux.conf*    set filetype=sh
     64 au BufRead,BufNewFile *conkyrc*      set filetype=sh
     65 au BufRead,BufNewFile *gitconfig*    set filetype=gitconfig
     66 
     67 " spell check
     68 hi SpellBad ctermfg=red cterm=underline
     69 if version >= 700
     70   set spl=en spell
     71   set nospell
     72 endif
     73 
     74 " mapping{{{1
     75 " make jj typed quickly while in insert mode switch to normal mode :D
     76 inoremap jj <Esc>
     77 
     78 " ZZ is save and quit and ZQ is just quit, so...
     79 " make ZS to save without closing
     80 nnoremap ZS :w<CR>
     81 " make ZA save and quit all windows
     82 nnoremap ZA :wqall<CR>
     83 
     84 " C changes until end of line and D deletes until end of line, so why not Y?
     85 noremap Y y$
     86 
     87 " better indenting for visual mode
     88 vnoremap > >gv
     89 vnoremap < <gv
     90 
     91 " easily change buffers
     92 nnoremap <C-H> :bprev<CR>
     93 nnoremap <C-L> :bnext<CR>
     94 
     95 " improve up and down shortcuts
     96 nnoremap <C-J> <C-D>
     97 nnoremap <C-K> <C-U>
     98 
     99 " pair completion
    100 inoremap {        {}<Left>
    101 inoremap {<CR>    {<CR>}<Esc>O
    102 inoremap {<Space> {<Space><Space>}<Left><Left>
    103 inoremap {{       {
    104 inoremap {}       {}
    105 
    106 inoremap (        ()<Left>
    107 inoremap (<CR>    (<CR>)<Esc>O
    108 inoremap (<Space> (<Space><Space>)<Left><Left>
    109 inoremap ((       (
    110 inoremap ()       ()
    111 
    112 inoremap [        []<Left>
    113 inoremap [<CR>    [<CR>]<Esc>O
    114 inoremap [<Space> [<Space><Space>]<Left><Left>
    115 inoremap [[       [
    116 inoremap []       []
    117 
    118 inoremap <>    <><Left>
    119 inoremap ""    ""<Left>
    120 inoremap ''    ''<Left>
    121 inoremap ``    ``<Left>
    122