Skip to content

Instantly share code, notes, and snippets.

@samiron
Last active March 24, 2017 12:50
Show Gist options
  • Save samiron/00100e9f2e1fc06dc5c62a7c27775cc3 to your computer and use it in GitHub Desktop.
Save samiron/00100e9f2e1fc06dc5c62a7c27775cc3 to your computer and use it in GitHub Desktop.
My personal bare bone vimrc file
set nu
set autoindent
set winheight=999
set bg=dark
set ts=4
set shiftwidth=4
set expandtab
" make searches case-insensitive, unless they contain upper-case letters:
set ignorecase
set smartcase
set hlsearch
set showmatch showcmd ruler hidden incsearch ai
set nosmartindent nojoinspaces notextmode nocompatible
" assume the /g flag on :s substitutions to replace all matches in a line:
" set gdefault
set wildmenu
set wildmode=full:longest
function! SWITCH_current_dir()
let s:path = expand('%:p:h')
let s:aroot = PROCESS_filename(s:path)
exe "lcd " . s:aroot
endfunction
autocmd BufEnter * call SWITCH_current_dir()
function! PROCESS_filename(package)
" let s:path = '/opt/ardome/lib/perl/' . a:package
" ardroot is an executable which determines the project root from a
" given file of that project. This is strictly related with the
" project I work on.
let s:path = system('ardroot ' . a:package)
return s:path
endfunction
function! s:VOPEN_perl_package(package)
let s:path = PROCESS_filename(a:package)
exe "vsp " . s:path
call SWITCH_current_dir()
endfunction
function! s:OPEN_perl_package(package)
let s:path = PROCESS_filename(a:package)
exe "sp " . s:path
call SWITCH_current_dir()
endfunction
function! s:TOPEN_perl_package(package)
let s:path = PROCESS_filename(a:package)
exe "tabe " . s:path
call SWITCH_current_dir()
endfunction
command! -nargs=1 Asp call s:OPEN_perl_package(<f-args>)
command! -nargs=1 Avsp call s:VOPEN_perl_package(<f-args>)
command! -nargs=1 Atabe call s:TOPEN_perl_package(<f-args>)
let mapleader = ","
map <leader>p :!perl -c %<CR>
map <leader>n :!python -m py_compile %<CR>
map <leader>g :echo expand('%:p')<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment