Last active
October 22, 2017 19:36
-
-
Save pradeepvrd/5b5c55af660089e8d87f5a87617023be to your computer and use it in GitHub Desktop.
My nvim settings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| " An example for a vimrc file. | |
| " | |
| " To use it, copy it to | |
| " for Unix: $HOME/.config/nvim/init.vim | |
| " for Windows: %LOCALAPPDATA%\nvim\init.vim | |
| set backup " keep a backup file (restore to previous version) | |
| set undofile " keep an undo file (undo changes after closing) | |
| set ruler " show the cursor position all the time | |
| set showcmd " display incomplete commands | |
| " Don't use Ex mode, use Q for formatting | |
| noremap Q gq | |
| " CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo, | |
| " so that you can undo CTRL-U after inserting a line break. | |
| inoremap <C-U> <C-G>u<C-U> | |
| " Automatic reloading of init.vim | |
| autocmd! bufwritepost init.vim source ~/.config/nvim/init.vim | |
| " Mouse and backspace | |
| set mouse=a " on OSX press ALT and click | |
| set bs=2 " make backspace behave like normal again | |
| " Rebind <Leader> key | |
| let mapleader = "," | |
| " Bind nohl | |
| " Removes highlight of your last search | |
| " ``<C>`` stands for ``CTRL`` and therefore ``<C-n>`` stands for ``CTRL+n`` | |
| noremap <C-n> :nohl<CR> | |
| vnoremap <C-n> :nohl<CR> | |
| inoremap <C-n> :nohl<CR> | |
| " bind Ctrl+<movement> keys to move around the windows, instead of using Ctrl+w + <movement> | |
| " Every unnecessary keystroke that can be saved is good for your health :) | |
| map <c-j> <c-w>j | |
| map <c-k> <c-w>k | |
| map <c-l> <c-w>l | |
| map <c-h> <c-w>h | |
| " easier moving between tabs | |
| map <Leader>n <esc>:tabprevious<CR> | |
| map <Leader>m <esc>:tabnext<CR> | |
| " map sort function to a key | |
| vnoremap <Leader>s :sort<CR> | |
| " Switch syntax highlighting on | |
| syntax on | |
| " Showing line numbers and length | |
| set number " show line numbers | |
| set tw=79 " width of document (used by gd) | |
| set nowrap " don't automatically wrap on load | |
| set fo-=t " don't automatically wrap text when typing | |
| set colorcolumn=80 | |
| highlight ColorColumn ctermbg=233 | |
| " Also switch on highlighting the last used search pattern. | |
| set hlsearch | |
| set incsearch | |
| set ignorecase | |
| set smartcase | |
| " I like highlighting strings inside C comments. | |
| let c_comment_strings=1 | |
| " Enable file type detection. | |
| " Use the default filetype settings, so that mail gets 'textwidth' set to 72, | |
| " 'cindent' is on in C files, etc. | |
| " Also load indent files, to automatically do language-dependent indenting. | |
| filetype plugin indent on | |
| " Put these in an autocmd group, so that we can delete them easily. | |
| augroup vimrcEx | |
| autocmd! | |
| " For all text files set 'textwidth' to 78 characters. | |
| autocmd FileType text setlocal textwidth=78 | |
| " When editing a file, always jump to the last known cursor position. | |
| " Don't do it when the position is invalid or when inside an event handler | |
| autocmd BufReadPost * | |
| \ if line("'\"") >= 1 && line("'\"") <= line("$") | | |
| \ execute "normal! g`\"" | | |
| \ endif | |
| augroup END | |
| " Convenient command to see the difference between the current buffer and the | |
| " file it was loaded from, thus the changes you made. | |
| " Only define it when not defined already. | |
| if !exists(":DiffOrig") | |
| command DiffOrig vert new | set buftype=nofile | read ++edit # | 0d_ | diffthis | |
| \ | wincmd p | diffthis | |
| endif | |
| " Python Configuration | |
| let g:python2_host_prog = '/Users/pvaradharajan/.pyenv/shims/python2' | |
| let g:python3_host_prog = '/Users/pvaradharajan/.pyenv/shims/python3' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment