Skip to content

Instantly share code, notes, and snippets.

@mutcianm
Created January 29, 2020 12:36
Show Gist options
  • Save mutcianm/fa7e4ffaae57291ad29c35823dc1af74 to your computer and use it in GitHub Desktop.
Save mutcianm/fa7e4ffaae57291ad29c35823dc1af74 to your computer and use it in GitHub Desktop.
neovim config ( '~/.config/nvim/init.vim')
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Plugins Setup
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
call plug#begin('~/.vim/plugged')
Plug 'amcsi/auto-pairs' " auto close braces and stuff
Plug 'preservim/nerdcommenter' " toggle comments with <leader>+c+<space>
Plug 'scrooloose/nerdTree' " <F3> to toggle file browser
Plug 'airblade/vim-gitgutter' " show git file changes in gutter
Plug 'bling/vim-airline' " fancy statusbar and tabbar(bufferbar)
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } " completion engine
Plug 'dense-analysis/ale' " language support magic(smart completion et al)
Plug 'vimwiki/vimwiki' " persoanl wiki, open with <leader>ww
call plug#end()
" Plugin settings
map <F3> :NERDTreeToggle<CR>
autocmd BufEnter * lcd %:p:h " Auto change working dir to the one of currently opened file
let g:airline_powerline_fonts = 1 " Add fancy arrow sybbols
let g:airline#extensions#tabline#enabled = 1 " Show buffers as tabs on the top
let g:deoplete#enable_at_startup = 1
let g:vimwiki_list = [{'path': '~/.vimwiki/', 'syntax': 'markdown', 'ext': '.md'}]
highlight clear SignColumn " Set signcolumn color same as line number
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => General
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" fix mouse when running in tmux
set mouse=a
" Fast saving
map <F2> :w! <CR>
" Auto set working directory
set autochdir
" enable hidden buffers: allow switching with unsaved changes
set hidden
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => VIM user interface
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Set 7 lines to the cursor - when moving vertically using j/k
set so=7
" Ignore compiled files
set wildignore=*.o,*~,*.pyc
" Ignore case when searching
set ignorecase
" When searching try to be smart about cases
set smartcase
" Don't redraw while executing macros (good performance config)
set lazyredraw
" For regular expressions turn magic on
set magic
" Show matching brackets when text indicator is over them ()
set showmatch
" No annoying sound on errors
set noerrorbells
set novisualbell
set t_vb=
set tm=500
" Enable gutter line numbering in relative mode
set nu
set rnu
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Colors and Fonts
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
colorscheme koehler
set background=dark
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Files, backups and undo
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Turn backup off, since most stuff is in SVN, git et.c anyway...
set nobackup
set nowb
set noswapfile
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Text, tab and indent related
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Use spaces instead of tabs
set expandtab
" Be smart when using tabs ;)
set smarttab
" 1 tab == 2 spaces
set shiftwidth=2
set tabstop=2
" Show 100 char line limiter
set colorcolumn=100
" Linebreak on 500 characters
set lbr
set tw=500
set si "Smart indent
set wrap "Wrap lines
" Show trailing spaces and eols
set listchars=tab:↦→,trail:↵
set list
""""""""""""""""""""""""""""""
" => Visual mode related
""""""""""""""""""""""""""""""
" Visual mode pressing * or # searches for the current selection
" Super useful! From an idea by Michael Naumann
vnoremap <silent> * :call VisualSelection('f')<CR>
vnoremap <silent> # :call VisualSelection('b')<CR>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Moving around, tabs, windows and buffers
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Disable highlight when <leader><cr> is pressed
map <silent> <leader><cr> :noh<cr>
" Navigate buffers as (common sense) tabs
map <C-k> :bnext<cr>
map <C-j> :bprevious<cr>
map <C-l> :bdel<cr>
map <C-h> :new<cr>
" Return to last edit position when opening files (You want this!)
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment