Skip to content

Instantly share code, notes, and snippets.

@gabbork
Last active November 10, 2017 18:21
Show Gist options
  • Save gabbork/f64a46006ad9e7a3d217f71f955552da to your computer and use it in GitHub Desktop.
Save gabbork/f64a46006ad9e7a3d217f71f955552da to your computer and use it in GitHub Desktop.
My vim configuration on macOS Sierra, mainly used for python3
" memo: howto install everything
" 1. you have python3, vim and brew already installed
" 2. install Vundle: https://github.com/VundleVim/Vundle.vim
" 3. install flake8 with: pip3 install flake8
" 4. install your favourite plugins with https://vimawesome.com and use this ~/.vimrc config file
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'davidhalter/jedi-vim'
Plugin 'nvie/vim-flake8'
Plugin 'flazz/vim-colorschemes'
Plugin 'altercation/vim-colors-solarized'
Plugin 'scrooloose/nerdtree'
"" The following are examples of different formats supported.
"" Keep Plugin commands between vundle#begin/end.
"" plugin on GitHub repo
"Plugin 'tpope/vim-fugitive'
"" plugin from http://vim-scripts.org/vim/scripts.html
"" Plugin 'L9'
"" Git plugin not hosted on GitHub
"Plugin 'git://git.wincent.com/command-t.git'
"" git repos on your local machine (i.e. when working on your own plugin)
"Plugin 'file:///home/gmarik/path/to/plugin'
"" The sparkup vim script is in a subdirectory of this repo called vim.
"" Pass the path to set the runtimepath properly.
"Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
"" Install L9 and avoid a Naming conflict if you've already installed a
"" different version somewhere else.
"" Plugin 'ascenator/L9', {'name': 'newL9'}
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
set ai " set auto-indenting on for programming
set showmatch " automatically show matching brackets. works like it does in bbedit.
set vb " turn on the 'visual bell' - which is much quieter than the 'audio blink'
set number " show line numbers on the left
set cursorline " highlight current line
set ruler " show the cursor position all the time
set laststatus=2 " make the last line where the status is two lines deep so you can see status always
set background=dark " Use colours that work well on a dark background (Console is usually black)
set showmode " show the current mode
set clipboard=unnamed " set clipboard to unnamed to access the system clipboard under windows
" for mac OS: http://www.markcampbell.me/2016/04/12/setting-up-yank-to-clipboard-on-a-mac-with-vim.html
set tabstop=4 " show existing tabs with 4 spaces with
set softtabstop=4 " from the doc: Number of spaces that a <Tab> counts for while performing -->
" --> editing operations, like inserting a <Tab> or using <BS>.
set expandtab " on pressing tab, insert spaces instead
set shiftwidth=4 " when indenting with '>', use 4 spaces with
set list " show tabs
set listchars=tab:>- " show tabs as >-
" set smarttab
set viminfo='20,<2000,s2000 " set yank limit to 20 files, 2000 lines, 2000kb instead of default 50 lines
set undofile " Maintain undo history between sessions in .un~ files
syntax on " turn syntax highlighting on by default
colorscheme molokai
autocmd BufWritePost *.py call Flake8() " Enable Flake8 automatically
" flake8 config in ~/.config/flake8
" How can I open NERDTree automatically when vim starts up on opening a directory?
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif
" How can I close vim if the only window left open is a NERDTree?
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" NERDTree show hidden files
let NERDTreeShowHidden=1
" memo
" switching windows: ctrl+W followed by W (toggle) or arrows
" ':set paste' to easily cut and paste code, then ':set nopaste'
" comment a line with ' # noqa' to skip flake8 check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment