This gist is a list of options and tricks to make the amazing neovim work on OSX, from a former long time vim user.
-
-
Save celso/6cefedb9fce92827ee38e8f7411b8b30 to your computer and use it in GitHub Desktop.
syntax on | |
set ruler " Show the line and column numbers of the cursor. | |
set formatoptions+=o " Continue comment marker in new lines. | |
set textwidth=0 " Hard-wrap long lines as you type them. | |
set modeline " Enable modeline. | |
set esckeys " Cursor keys in insert mode. | |
set linespace=0 " Set line-spacing to minimum. | |
set nojoinspaces " Prevents inserting two spaces after punctuation on a join (J) | |
" More natural splits | |
set splitbelow " Horizontal split below current. | |
set splitright " Vertical split to right of current. | |
if !&scrolloff | |
set scrolloff=3 " Show next 3 lines while scrolling. | |
endif | |
if !&sidescrolloff | |
set sidescrolloff=5 " Show next 5 columns while side-scrolling. | |
endif | |
set display+=lastline | |
set nostartofline " Do not jump to first character with page commands. | |
set noerrorbells " No beeps | |
set backspace=indent,eol,start " Makes backspace key more powerful. | |
set showcmd " Show me what I'm typing | |
set showmode " Show current mode. | |
set noswapfile " Don't use swapfile | |
set nobackup " Don't create annoying backup files | |
set encoding=utf-8 " Set default encoding to UTF-8 | |
set autowrite " Automatically save before :next, :make etc. | |
set autoread " Automatically reread changed files without asking me anything | |
set laststatus=2 | |
set fileformats=unix,dos,mac " Prefer Unix over Windows over OS 9 formats | |
set showmatch " Do not show matching brackets by flickering | |
set incsearch " Shows the match while typing | |
set hlsearch " Highlight found searches | |
set ignorecase " Search case insensitive... | |
set smartcase " ... but not when search pattern contains upper case characters | |
set autoindent | |
set tabstop=4 shiftwidth=4 expandtab | |
set gdefault " Use 'g' flag by default with :s/foo/bar/. | |
set magic " Use 'magic' patterns (extended regular expressions). | |
" Use <C-L> to clear the highlighting of :set hlsearch. | |
if maparg('<C-L>', 'n') ==# '' | |
nnoremap <silent> <C-L> :nohlsearch<CR><C-L> | |
endif | |
" Search and Replace | |
nmap <Leader>s :%s//g<Left><Left> | |
" Leader key is like a command prefix. | |
let mapleader='z' | |
let maplocalleader='\' | |
let g:python_host_prog="/usr/local/bin/python2.7" | |
let g:session_autosave = 'yes' | |
let g:session_autoload = 'yes' | |
let g:session_default_to_last = 1 | |
" set cursorcolumn | |
nmap <Space> <PageDown> | |
vmap <BS> x | |
" cd ~/.config/nvim/spell | |
" wget http://ftp.vim.org/vim/runtime/spell/pt.utf-8.spl | |
" set spell spelllang=pt_pt | |
" zg to add word to word list | |
" zw to reverse | |
" zug to remove word from word list | |
" z= to get list of possibilities | |
" set spellfile=~/.config/nvim/spellfile.add | |
set nospell | |
" Plugins here | |
call plug#begin('~/.config/nvim/plugged') | |
Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets' | |
" Plug 'Shougo/deoplete.nvim' | |
Plug 'Valloric/YouCompleteMe' | |
Plug 'vim-airline/vim-airline' | |
Plug 'vim-airline/vim-airline-themes' | |
Plug 'Chiel92/vim-autoformat' | |
Plug 'scrooloose/nerdtree' | |
Plug 'terryma/vim-multiple-cursors' | |
call plug#end() | |
" deoplete config | |
let g:deoplete#enable_at_startup = 1 | |
let g:deoplete#disable_auto_complete = 1 | |
if has("gui_running") | |
inoremap <silent><expr><C-Space> deoplete#mappings#manual_complete() | |
else | |
inoremap <silent><expr><C-@> deoplete#mappings#manual_complete() | |
endif | |
" UltiSnips config | |
inoremap <silent><expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>" | |
let g:UltiSnipsExpandTrigger="<tab>" | |
let g:UltiSnipsJumpForwardTrigger="<tab>" | |
let g:UltiSnipsJumpBackwardTrigger="<s-tab>" | |
" Tell Vim which characters to show for expanded TABs, | |
" trailing whitespace, and end-of-lines. VERY useful! | |
if &listchars ==# 'eol:$' | |
" set listchars=tab:>\ ,trail:-,extends:>,precedes:<,nbsp:+ | |
set listchars=tab:>\ ,extends:>,precedes:<,nbsp:+ | |
endif | |
" nerdtree config | |
map <C-n> :NERDTreeToggle<CR> | |
" airline settings | |
let g:airline#extensions#tabline#enabled = 2 | |
let g:airline#extensions#tabline#fnamemod = ':t' | |
let g:airline#extensions#tabline#left_sep = ' ' | |
let g:airline#extensions#tabline#left_alt_sep = '|' | |
let g:airline#extensions#tabline#right_sep = ' ' | |
let g:airline#extensions#tabline#right_alt_sep = '|' | |
let g:airline_powerline_fonts=1 | |
let g:airline_left_sep = ' ' | |
let g:airline_left_alt_sep = '|' | |
let g:airline_right_sep = ' ' | |
let g:airline_right_alt_sep = '|' | |
let g:airline_powerline_fonts=1 | |
let g:airline_theme='molokai' | |
" Multicursor | |
let g:multi_cursor_use_default_mapping=0 | |
let g:multi_cursor_next_key='<C-e>' | |
let g:multi_cursor_quit_key='<Esc>' | |
let g:multi_cursor_quit_key='<Esc>' | |
" YouCompleteMe | |
let g:ycm_autoclose_preview_window_after_completion = 1 | |
let g:ycm_min_num_of_chars_for_completion = 1 | |
" Other | |
set mouse= | |
set list | |
" Theme | |
colorscheme molokai256 | |
highlight SignColumn guibg=#272822 | |
let g:rehash256 = 1 | |
let g:molokai_original=1 | |
let NERDTreeIgnore = ['_site'] | |
" Buffer handling | |
nmap L :let &number=1-&number<CR> | |
nmap <leader>l :bnext<CR> | |
nmap <c-h> :bprevious<CR> | |
nmap <leader>bq :bp <BAR> bd #<CR> | |
nmap <leader>bl :ls<CR> | |
nmap <leader>0 :set invnumber<CR> | |
" map :q to byffer delete | |
" http://stackoverflow.com/questions/7513380/vim-change-x-function-to-delete-buffer-instead-of-save-quit | |
cnoreabbrev <expr> q getcmdtype() == ":" && (getcmdline() == 'q' && len(filter(range(1, bufnr('$')), 'buflisted(v:val)')) > 1) ? 'bd' : 'q' |
celso
commented
Oct 22, 2016
To trim a few lines from the init.vim
, check :help nvim-defaults
.
It's also a good idea to run :CheckHealth
after a new install or upgrade.
@justinmk done. tks
@celso Many thanks for this. It is working like a charm. I have a question for line 53
are you setting this to work only for 2.7 python version? Is this a configuration that I need to take into account and update soon?
@celso Sorry but what is the font you use in your image?
@celso Cannot found molokai256
. Could u share how did you setup molokai256
?
@celso Cannot found
molokai256
. Could u share how did you setupmolokai256
?
I'm having the same issue
@amadeu01 @rsoc39 I'm guessing it's tomasr/molokai colorscheme. You'd install it like any other plugin with vim-plug:
" Plugins here
call plug#begin('~/.config/nvim/plugged')
Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
...
...
Plug 'terryma/vim-multiple-cursors'
Plug 'tomasr/molokai'
call plug#end()
@ipwnponies thanks!
For those who can't get pip installed once doing brew install python
, you can use sudo easy_install pip
(to install pip in /usr/local/bin
) to make the subsequent commands work.
For those who can't get pip installed once doing
brew install python
, you can usesudo easy_install pip
(to install pip in/usr/local/bin
) to make the subsequent commands work.
TLDR; no one should need to be concerned about installing pip
in 2020. These instructions are very dated, probably back to pre-2016. Update your system and python installation first.
pip
has been bundled with python since 3.4. The oldest supported version of Python (as of this writing) is 3.6. Before you start working around a missing pip
installation, I implore you to ensure your system is up-to-date and you're working with modern versions of python. If you have the misfortune of being constrained to python 2.7, note that pip
has been bundled since 2.7.9.
If you've heeded my warnings and are moving forward with manually installing pip
, the correct command is
python -m ensurepip --default-pip
I believe some kind of system clipboard sync is also desirable
like set clipboard+=unnamedplus
set esckeys
is no longer supported
If you've heeded my warnings and are moving forward with manually installing
pip
, the correct command is
Might also just be called pip3
, so pip3 install neovim
. It whines a lot about deprecation and stuff though.