Aloha,
I took the plunge to start using vim as my main editor. I'm a week in, and beginning to see the beauty of it. It's now the only editor I use already.
Anyhoot - I found a very useful mapping on stackoverflow that lets me run python files within vim. The only issue is that it only works on the first file I open. If I use :tabe myfile.py
to open another python file, pressing the F7 key binding doesn't work on the newly opened tab. Any way to make F7 work for all open tabs?
Edit: And just in case it's needed, here is my complete .vimrc file:
""""""""""' VUNDLE SETTINGS AND PLUGINS '""""""""""
"""""""""""""""""""""""""""
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 'scrooloose/nerdtree'
Plugin 'tpope/vim-fugitive'
Plugin 'jmcantrell/vim-virtualenv'
call vundle#end()
""""""""""' COLOR SCHEME SETTINGS '"""""""""
"""""""""""""""""""""
syntax on
colorscheme skittles_autumn
""""""""""' PYTHON SETTINGS '""""""""""
"""""""""""""""
let python_highlight_all=1
syntax on
"Run python script with F7
nnoremap <buffer> <F7> :exec '!python' shellescape(@%, 1)<cr>
""""""""""' KEY BINDINGS VANILLA VIM '"""""""""
""""""""""""""""""""""""
"split screen navigations
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
inoremap jj <ESC>
""""""""""' SETTINGS VANILLA VIM '""""""""""
""""""""""""""""""""
set number
set undofile
let mapleader=" "
" Set tabs to 4 spaces and stuff
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set wrap
set textwidth=79
set formatoptions=qrn1
set colorcolumn=79
set list
"Use the same symbols as TextMate for tabstops and EOLs
set listchars=tab:▸\ ,eol:¬
" Disable arrow keys
nnoremap <up> <nop>
nnoremap <down> <nop>
nnoremap <left> <nop>
nnoremap <right> <nop>
inoremap <up> <nop>
inoremap <down> <nop>
inoremap <left> <nop>
inoremap <right> <nop>
" j,k move by screen line instead of file line
nnoremap j gj
nnoremap k gk
nmap <silent> <F3> :NERDTreeToggle<CR>
"Show hidden files in NerdTree
let NERDTreeShowHidden=1
" Open up current file in web browsers
nnoremap <C-g> :!google-chrome %<CR> " browser preview with ctrl-p
nnoremap <C-f> :!firefox %<CR> " browser preview with ctrl-o
nnoremap <C-c> :!chromium-browser %<CR> " browser preview with ctrl-c
" Go to tab by number
noremap <leader>1 1gt
noremap <leader>2 2gt
noremap <leader>3 3gt
noremap <leader>4 4gt
noremap <leader>5 5gt
noremap <leader>6 6gt
noremap <leader>7 7gt
noremap <leader>8 8gt
noremap <leader>9 9gt
noremap <leader>0 :tablast<cr>