Neovim – Next Generation Vim

NeoVim is a great tool and my goto editor even on large projects, but it needs proper config.

filetype plugin indent on
syntax on
set number
"set relativenumber

set incsearch
set ignorecase
set smartcase

set t_Co=256
"colorscheme molokai
hi Comment ctermfg=DarkGray ctermbg=black cterm=italic

set tabstop=4
set softtabstop=0
set shiftwidth=4
set noexpandtab
"set copyindent
"set preserveindent
set listchars=tab:\·\ ,trail:·
set list

set nobackup
set noswapfile
set nowrap

" Offset from bottom/top
set scrolloff=3

set cursorline
"set cursorcolumn

" Make Y yank everything from the cursor to the end of the line. This makes Y
" act more like C or D because by default, Y yanks the current line (i.e. the
" same as yy).
noremap Y y$

set autochdir

map <A-s> :set scrollbind!<CR>

" use zr to reduce folds and zm for more folds
map <A-f> :set foldmethod=indent<cr>

" ALT plus left or right changes tabs
map <A-Right> gt
map <A-Left> gT
map <A-t> :tab split<cr>
map <A-c> :close<cr>
map <A-o> :Explore<cr>

map <A-.> :bNext<cr>
map <A-,> :bprevious<cr>

map <A-q> :qall<cr>
map <A-w> :write<cr>
map <A-v> :vsplit<cr>
map <A-h> :split<cr>

map <C-Right> <C-w><Right>
map <C-Left> <C-w><Left>
map <C-Up> <C-w><Up>
map <C-Down> <C-w><Down>

map <A-:> gt
map <A-;> gT

" Switch buffers and files
map <A-b> :buffers<CR>:b
map <Tab> :Lex<CR>
let g:netrw_winsize = 15

map <A-Space> :Lex<CR>

nmap S :%s///g<LEFT><LEFT><LEFT>

"Tree view in file browser
let g:netrw_liststyle = 3

" Open files in previous window
" 1 - open files in a new horizontal split
" 2 - open files in a new vertical split
" 3 - open files in a new tab
" 4 - open in previous window
let g:netrw_browse_split = 4

" Docblock
imap /** /** */<left><left><left>
imap @au @author Nimpen J. Nordström <>
imap @co @copyright 2018 ASBRA AB

" STATUSLINE (:help statusline) for more info
set laststatus=2
set statusline=
set statusline+=[%n]\ " Buffer
set statusline+=%.50F\ %m%r\ \ " Full filename, modified and read-only
set statusline+=%= " left/right separator
set statusline+=[ENC:%{strlen(&fenc)?&fenc:'none'}],\ " File encoding
set statusline+=[FORMAT:%{&ff}]\ \ \ " File format

set statusline+=X:%c,\ " Column
set statusline+=Y:%l/%L " Line/total lines

" Statusline Color, green in Input and red in Command Mode
if version >= 700
hi StatusLine ctermfg=1 ctermbg=7
au InsertEnter * hi StatusLine ctermfg=2 ctermbg=7
au InsertLeave * hi StatusLine ctermfg=1 ctermbg=7

filetype plugin on
au FileType php setl ofu=phpcomplete#CompletePHP
au FileType html,xhtml setl ofu=htmlcomplete#CompleteTags
au FileType css setl ofu=csscomplete#CompleteCSS

colorscheme default

Leave a comment

Your email address will not be published. Required fields are marked *