yveslange icon

NVIM

yveslange | PRO | 11/23/18 10:34:25 AM UTC | 0 ⭐ | 5532 👁️ | Never ⏰ | []
VIM |

4.08 KB

|

None

|

0 👍

/

0 👎

let mapleader=","                " Map the leader key to comma.
 
 
""" PLUGINS
call plug#begin('~/.local/share/nvim/plugged')
 
  " Colorschemes collection
  Plug 'morhetz/gruvbox'
  set background=dark
 
  " File explorer
  Plug 'scrooloose/nerdtree', { 'on':  'NERDTreeToggle' }
  Plug 'Xuyuanp/nerdtree-git-plugin', { 'on': 'NERDTreeToggle' }
  nnoremap <Leader>e :NERDTreeToggle<CR>
 
  " Comment functions
  Plug 'tomtom/tcomment_vim'
  map <Leader>c :TComment<CR>
 
  " Javascript
  Plug 'pangloss/vim-javascript'
  Plug 'othree/javascript-libraries-syntax.vim'
  Plug 'othree/html5.vim'
  Plug 'kchmck/vim-coffee-script'
 
call plug#end()
 
""" OPTIONS
  colorscheme gruvbox
  set nowrap                       " Do not wrap the text
  set linebreak                    " Wrap lines at convenient points
  set mouse=a                      " Enable mouse interactivity.
  set showmatch                    " Show matching brackets.
  set number                       " Show the line numbers on the left.
  set formatoptions+=o             " Continue comment marker in new line.
  set expandtab                    " Insert spaces when TAB is pressed.
  set tabstop=2                    " Render TABs using this many spaces.
  set shiftwidth=2                 " Indenfation amount for < and > commands.
  set ignorecase                   " Make searching case insensitive.
  set smartcase                    " ... unless the search query has capital letters.
  set gdefault                     " Use 'g' flag by default with :s/foo/bar/.
  set cursorline                   " Highlight current line
  set synmaxcol=200                " Use syntax highlighting only for 128 columns. Note: changing this with cursoline enabled can make scroll choppy
  set timeoutlen=900 ttimeoutlen=0 " Reduce Command timeout for faster escape and O
  set splitright                   " Set up new vertical splits positions
  set splitbelow                   " Set up new horizontal splits positions
  set lazyredraw                   " Do not redraw on registers and macros
  set updatetime=500               " Cursor hold timeout
  command! W  write                " :W will work like :w
  command! Q  close                " :Q will work like :q
 
  " Turn of swap files
  set noswapfile nobackup nowb
 
  " Keep undo history across sessions, by storing in file.
  silent !mkdir ~/.config/nvim/backups > /dev/null 2>&1
  set undodir=~/.config/nvim/backups undofile
 
  if has("autocmd")
    " au vimrc FocusGained,BufEnter * checktime             " Refresh file when vim gets focus
    au BufWinEnter * syntax sync minlines=3000              " Sync syntax highlighting
    au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif " Jump to previous position
  endif
 
""" KEYBINDINGS
  " Redraw screen
  nnoremap <Leader>r :redraw<CR>
 
  " Toggle number
  nnoremap <Leader>n :setlocal number!<CR>
 
  " Toggle paste
  nnoremap <Leader>p :set paste!<CR>       " Toggle paste mode
 
  " Search and replace
  nnoremap <Leader>s :%s/\<<C-r><C-w>\>//cg<Left><Left><Left>
 
  " Navigation through splits (not working with TMUX)
  nnoremap <A-Right> <C-w><Right>
  nnoremap <A-Left> <C-w><Left>
  inoremap <A-Right> <Esc><C-w><Right>i
  inoremap <A-Left> <Esc><C-w><Left>i
  nnoremap <A-Up> <C-w><Up>
  nnoremap <A-Down> <C-w><Down>
  inoremap <A-Up> <Esc><C-w><Up>i
  inoremap <A-Down> <Esc><C-w><Down>i
 
  " Tabs navigation and move
  map <C-S-Down> <Esc>:m +1<CR>
  map <C-S-Up> <Esc>:m -2<CR>
  map <A-S-Left> <Esc>:tabm -1<CR>
  map <A-S-Right> <Esc>:tabm +1<CR>
  map <C-A-Right> <Esc>:tabn<CR>
  map <C-A-Left> <Esc>:tabp<CR>
  imap <C-A-Right> <Esc>:tabn<CR>i
  imap <C-A-Left> <Esc>:tabp<CR>i
 
  " Allow saving of files as sudo when I forgot to start vim using sudo.
  cmap w!! w !sudo tee > /dev/null %
 
  " Map save to Ctrl + S
  map <c-s> :w<CR>
  imap <c-s> <C-o>:w<CR>
  nnoremap <Leader>s :w<CR>
 
  " Redo shortcut
  map <c-r> <Nop>
  map <c-u> <Esc>:redo<CR>
  map <s-u> <Esc>:redo<CR>
 
  "make < > shifts keep selection
  vnoremap < <gv
  vnoremap > >gv

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎