This gist is a list of options and tricks to make the amazing neovim work on OSX, from a former long time vim user.
Last active
October 30, 2024 17:30
-
Star
(178)
You must be signed in to star a gist -
Fork
(33)
You must be signed in to fork a gist
-
-
Save celso/6cefedb9fce92827ee38e8f7411b8b30 to your computer and use it in GitHub Desktop.
Neovim setup for OSX users
This file contains 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
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' |
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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 missingpip
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 thatpip
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