• unrealapex
    link
    fedilink
    arrow-up
    1
    ·
    6 days ago

    I can’t live without these options:

    set background=dark
    set belloff=all
    set complete-=i
    set completeopt=menu,menuone,noselect
    set cursorline
    set hidden
    set hlsearch
    set incsearch
    set number
    set omnifunc=syntaxcomplete#Complete
    set path+=.,,
    set pumheight=12
    set relativenumber
    set showmode
    set wildmenu
    set wildmode=longest:full,full
    set wildoptions=pum,tagfile
    

    Use gx to open URLS or paths without Netrw :D

    nnoremap gx :silent !xdg-open <cfile><CR>
    

    Keep visual selection when shifting text

    xnoremap < <gv
    xnoremap > >gv
    

    I use buffers more than tabs but these tab keymaps are convenient

    nnoremap <leader>1 1gt<cr>
    nnoremap <leader>2 2gt<cr>
    nnoremap <leader>3 3gt<cr>
    nnoremap <leader>4 4gt<cr>
    nnoremap <leader>5 5gt<cr>
    nnoremap <leader>6 6gt<cr>
    nnoremap <leader>7 7gt<cr>
    nnoremap <leader>8 8gt<cr>
    nnoremap <leader>9 9gt<cr>
    nnoremap <leader>t :tabnew<cr>
    nnoremap <leader>x :tabclose<cr>
    

    Use fzy to pick files :O

    function! FzyCommand(choice_command, vim_command)
      try
        let output = system(a:choice_command . " | fzy ")
      catch /Vim:Interrupt/
        " Swallow errors from ^C, allow redraw! below
      endtry
      redraw!
      if v:shell_error == 0 && !empty(output)
        exec a:vim_command . ' ' . output
      endif
    endfunction
    
    nnoremap <leader>ff :call FzyCommand("fd", ":e")<cr>
    

    My favorite plugins

    • comment (comment package bundled with vim)
    • vim-gitgutter (Git gutter markings and diff navigation)
    • vim-mucomplete (automatic omnicompletion )
    • vim-repeat (repeating actions)
    • vim-surround (easily surrounding text)
    • vim-unimpaired (several useful mappings, I use [<space> and ]<space> often to add lines)