diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2020-03-15 11:35:00 +0100 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2020-03-15 11:35:00 +0100 |
commit | 7b7be7912c3e974b4a13e803a402b3dfb5a4d0dc (patch) | |
tree | 643c55bdedd11720f26f760403b4379d7a0b582b | |
download | nvimrc-7b7be7912c3e974b4a13e803a402b3dfb5a4d0dc.tar.gz nvimrc-7b7be7912c3e974b4a13e803a402b3dfb5a4d0dc.tar.bz2 nvimrc-7b7be7912c3e974b4a13e803a402b3dfb5a4d0dc.zip |
Initial neovim setup.
-rw-r--r-- | init.vim | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/init.vim b/init.vim new file mode 100644 index 0000000..05e4b79 --- /dev/null +++ b/init.vim @@ -0,0 +1,69 @@ +filetype on +syntax on +colorscheme nord "substrata +set number +filetype indent on +set nowrap +set tabstop=2 +set shiftwidth=2 +set expandtab +set smartindent +set autoindent +set guioptions-=T +set statusline=%q%m%r\ %f%=%y\ %c,%l/%L\ %{FugitiveStatusline()} + +" highlight cursor line +set cursorline + +" highlight search matches +set hlsearch + +" show matching parenthesis/brackets +set showmatch + +" remove whitespace on write +autocmd BufWritePre * :%s/\s\+$//e + +" press esc to cancel search +noremap <silent> <Esc> :nohlsearch<Bar>:echo<CR> + +" Arrow keys move visually up/down. +noremap <up> gk +noremap <down> gj + +" toggle nerdtree with ctrl-o +map <C-o> :NERDTreeToggle<CR> + +" Toggle word-wrap mode +" This will also fix movement keys so they move by visual +" lines instead of physical lines in word-wrap mode. +" See https://vim.fandom.com/wiki/Move_cursor_by_display_lines_when_wrapping +noremap <silent> <leader>w :call ToggleWrap()<CR> +function ToggleWrap() + if &wrap + echo "Wrap OFF" + setlocal nowrap + set virtualedit=all + silent! nunmap <buffer> <Up> + silent! nunmap <buffer> <Down> + silent! nunmap <buffer> <Home> + silent! nunmap <buffer> <End> + silent! iunmap <buffer> <Up> + silent! iunmap <buffer> <Down> + silent! iunmap <buffer> <Home> + silent! iunmap <buffer> <End> + else + echo "Wrap ON" + setlocal wrap linebreak nolist + set virtualedit= + setlocal display+=lastline + noremap <buffer> <silent> <Up> gk + noremap <buffer> <silent> <Down> gj + noremap <buffer> <silent> <Home> g<Home> + noremap <buffer> <silent> <End> g<End> + inoremap <buffer> <silent> <Up> <C-o>gk + inoremap <buffer> <silent> <Down> <C-o>gj + inoremap <buffer> <silent> <Home> <C-o>g<Home> + inoremap <buffer> <silent> <End> <C-o>g<End> + endif +endfunction |