Commit dae7caf2 authored by Hermann Mayer's avatar Hermann Mayer

VimRC: Sourced php syntax out in favor for a bundle. BashRC: Added development…

VimRC: Sourced php syntax out in favor for a bundle. BashRC: Added development function to generate a MAC address.
parent 07811649
Configuration
=============
Have a look at the ~/.bashrc.d/exports.conf file. There you can
enable/disable components and set for your setup specific settings.
Getting Started
===============
# Linux Environment
The Linux environment project is a complete bootstrap boilerplate for a
common developer / admin system. It ships a big but flexible bash library
for almost all known shell tasks which are usefull for a day to day basis.
A configurable vim environment is shipped as well. You can setup vim as an
IDE or as a minimal editor.
For [this blog post](http://hermann-mayer.net/blog/bash-als-power-shell-und-vim-als-ide) for screenshots.
## Getting started
The installation of the environment can be done with two different ways. The
easy way with the curl/dialog based installation - you just need the ``curl``
and ``dialog`` binaries. You also can choose the hard way with a step by step
installation.
### Curl / Dialog installation
Just run the following command to start the interactive installation:
```bash
$ curl http://code.jity.de/Jack12816/linux-environment/raw/master/install.sh | bash
```
### Step by step installation
First of all just clone the git repository to a persistent location. :)
cd /opt
git clone git://gitorious.hermann-mayer.net/linux-environment/vim-config.git && cd vim-config
```bash
$ cd /opt
$ git clone git://gitorious.hermann-mayer.net/linux-environment/vim-config.git
$ cd vim-config
```
Create a configuration directory for the BashRC project inside your $HOME.
And copy all distributed configurations to the new config directory.
mkdir -p ~/.bashrc.d
eval `find config/*.dist | awk '{printf "cp -T " $0; gsub(/\.dist|config\//,""); print " ~/.bashrc.d/" $0 ";"}'`
```bash
$ mkdir -p ~/.bashrc.d
$ eval `find config/*.dist | awk '{printf "cp -T " $0; gsub(/\.dist|config\//,""); print " ~/.bashrc.d/" $0 ";"}'`
```
Link all BashRC dot-files to your $HOME to getting everything up and running.
cd dot && cp `pwd`/.* ~; cd -
cd dotrc && ln -s `pwd`/.* ~; cd -
```bash
$ cd dot && cp `pwd`/.* ~; cd -
$ cd dotrc && ln -s `pwd`/.* ~; cd -
```
After these steps you got a new git-config (.gitconfig.dist) file inside your $HOME.
Rename it to .gitconfig and change your name and email address.
......@@ -26,69 +57,125 @@ run the following command to setup the font for your system account. Afterwards
you need to restart your terminal emulator and pick the new installed font.
(LiberationMono-Regular-Powerline || SourceCodePro-Regular-Powerline)
fc-cache -fr
```bash
$ fc-cache -fr
```
At this point you can choice which version of vim you are going to install.
There is a minimal(-non-IDE) version and a full-featured(-IDE) version.
If your are going to install this on a server system is usefuller to choose
the minimal version, unless you develop on the server system.
## Bash
Have a look at the ~/.bashrc.d/exports.conf file. There you can
enable/disable components and set for your setup specific settings.
## Vim
You can choice which version of vim you are going to install. There is a
minimal(-non-IDE) version and a full-featured(-IDE) version. If your are going
to install this on a server system is usefuller to choose the minimal version,
unless you develop on the server system.
Have a look at the $HOME/.bashrc.d/vim.conf and modify it to fit your needs.
The default setting is the minimal mode.
```vimscript
" # +-------------------------------------------------
" # | Vim Config
" # +-------------------------------------------------
" Enable specific bundles
" As the default only the VimRCBundlesMisc will be enabled.
" If you wish more features just enabled the bundle group.
let VimRCBundlesDevel = 1
let VimRCBundlesSysAdmin = 1
let VimRCBundlesHTML = 1
" let VimRCBundlesPython = 1
let VimRCBundlesPHP = 1
" let VimRCBundlesJava = 1
let VimRCBundlesJavaScript = 1
" Enable VimRC functionality loading
" As the default settings all parts of the VimRC are enabled.
" You can easily disable the parts you didn't like.
" let VimRCMisc = 0
" let VimRCFiletypes = 0
" let VimRCFunctions = 0
" let VimRCKeymap = 0
" let VimRCBundlesOptions = 0
```
After you choose a version, just startup vim for the first time. It will load
all required packages/bundles according to the configured version. After all
bundles are processed, there may be an error about "close-duplicate-tabs".
You can safely ignore it and just press enter. When all is done, just close
vim with :qa! and everything is ready for production.
bundles are processed, there may be an error about "close-duplicate-tabs". You
can safely ignore it and just press enter. When all is done, just close vim
with :qa! and everything is ready for production.
vim
```bash
$ vim
```
### PHP support
On the full-featured(-IDE) version you may want to install a better
tagbar support for PHP. So just run these commands:
cd /opt/vim-config/dotrc/.vim/tools
git clone https://github.com/techlivezheng/phpctags.git && cd phpctags
curl -s http://getcomposer.org/installer | php
php composer.phar install
```bash
$ cd /opt/vim-config/dotrc/.vim/tools
$ git clone https://github.com/techlivezheng/phpctags.git && cd phpctags
$ curl -s http://getcomposer.org/installer | php
$ php composer.phar install
```
Another usefull thing to install is the PHP documentation if you need it.
Just run the following:
cd /opt/vim-config/dotrc/.vim/doc
wget http://www.php.net/get/php_manual_en.tar.gz/from/de1.php.net/mirror -O php_manual_en.tar.gz
mkdir php-manual && tar xfv php_manual_en.tar.gz -C php-manual --strip-components=1
```bash
$ cd /opt/vim-config/dotrc/.vim/doc
$ wget http://www.php.net/get/php_manual_en.tar.gz/from/de1.php.net/mirror -O php_manual_en.tar.gz
$ mkdir php-manual
$ tar xfv php_manual_en.tar.gz -C php-manual --strip-components=1
```
### JavaScript/Node.js support
For a nice Javascript/Node.js integration I added jsctags to the default vim
toolset. To get a nice syntax/coding-standard check for Javascript install
jslint and jshint via node's package manager - npm. After this you can check
your active buffers with <F11>.
npm install jslint jshint -g
```bash
$ npm install jslint jshint -g
```
To fetch all needed files for spellchecking just run these commands
and edit it for your needs:
### Common stuff
For english support:
for i in "en.ascii.spl" "en.ascii.sug" "en.latin1.spl" "en.latin1.sug" "en.utf-8.spl" "en.utf-8.sug"; do
cd ~/.vim/spell/ && wget "ftp://ftp.vim.org/pub/vim/runtime/spell/${i}"
done
```bash
$ for i in "en.ascii.spl" "en.ascii.sug" "en.latin1.spl" "en.latin1.sug" "en.utf-8.spl" "en.utf-8.sug"; do \
cd ~/.vim/spell/ && wget "ftp://ftp.vim.org/pub/vim/runtime/spell/${i}"; \
done
```
For german support:
for i in "de.utf-8.sug" "de.utf-8.spl" "de.latin1.sug" "de.latin1.spl"; do
cd ~/.vim/spell/ && wget "ftp://ftp.vim.org/pub/vim/runtime/spell/${i}"
done
```bash
$ for i in "de.utf-8.sug" "de.utf-8.spl" "de.latin1.sug" "de.latin1.spl"; do \
cd ~/.vim/spell/ && wget "ftp://ftp.vim.org/pub/vim/runtime/spell/${i}"; \
done
```
Nice! You made it. Now everything should work!
Known Issues
============
## Known Issues
The vim-powerline project was deprecated but can used further by
running the following: (The new is a python package, so we will switch sometimes)
cd ~/.vim/bundle/vim-powerline
git checkout develop
```bash
$ cd ~/.vim/bundle/vim-powerline
$ git checkout develop
```
......@@ -7,6 +7,7 @@
" If you wish more features just enabled the bundle group.
" let VimRCBundlesDevel = 1
" let VimRCBundlesSysAdmin = 1
" let VimRCBundlesHTML = 1
" let VimRCBundlesPython = 1
" let VimRCBundlesPHP = 1
......
......@@ -135,7 +135,7 @@ done
# | Binding Bash Events
# +-------------------------------------------------
# rebind enter key to insert newline before command output
# Rebind enter key to insert newline before command output
trap 'echo' DEBUG
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
......
This diff is collapsed.
<?php
/**
* Script to gather up all native functions, classes, and interfaces from any release of
* PHP for the purposes of updating the VIM syntax file.
*
* @author Paul Garvin <paul@paulgarvin.net>
* @copyright Copyright 2009 Paul Garvin
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
/**
* This script works by loading up PHP extensions and using reflection to pull
* the functions, classes, and constants out of those extesions. The list of extensions
* below are ones included with PHP 5.3 source code. The ones commented out depend on
* an external library being installed, are Unix specific, or just not commonly used.
*
* Add, comment, or uncomment to fit your needs or particular PHP installation.
* Remember that some of these extensions are likely shared extensions and must be
* enabled in your php.ini file.
*
* NOTE: mysqlnd is not included because it exposes no functions, classes, or constants.
* The pdo_* extensions are not included in the list because they do not expose any
* functions, classes, or constants themselves. The constants and methods specific
* to that driver are exposed though the PDO extension itself. The pdo_* extensions
* must still be enabled (compiled in or loaded as shared) for these constants to show up.
*/
$extensions = array(
'core', 'bcmath', 'bz2', 'calendar', 'com_dotnet',
'ctype', 'curl', 'date', 'dba', 'dom',
'enchant', 'ereg', 'exif', 'fileinfo', 'filter',
'ftp', 'gd', 'gettext', 'gmp', 'hash',
'iconv', 'imap', /*'interbase',*/ 'intl', 'json',
'ldap', 'libxml', 'mbstring', 'mcrypt', 'mhash',
/*'mssql',*/ 'mysql', 'mysqli', 'oci8', 'oci8_11g',
'odbc', 'openssl', 'pcntl', 'pcre', 'pdo',
'pgsql', 'phar', 'posix', 'pspell', 'readline',
'recode', 'reflection', 'session', 'shmop', 'simplexml',
'snmp', 'soap', 'sockets', 'spl', 'standard',
'sqlite', 'sqlite3', 'sybase_ct', 'sysvmsg', 'sysvsem', 'sysvshm',
'tidy', 'tokenizer', 'xml', 'xmlreader', 'xmlwriter',
'xmlrpc', 'xsl', /*'wddx',*/ 'zip', 'zlib',
'yaf', 'yar', 'taint',
);
$out_file = 'php_vimgen_out.vim'; // Pick your output file & location.
$out_str = '';
$store = array();
$errors = array();
foreach ($extensions as $ext) {
echo "Processing extension '$ext'." . PHP_EOL;
try {
$extension = new ReflectionExtension($ext);
$ext_info = array();
$ext_info['name'] = $extension->getName();
$ext_functions = array_keys($extension->getFunctions());
$ext_constants = array_keys($extension->getConstants());
$classes = $extension->getClasses();
$ext_classes = array();
foreach ($classes as $class) {
$ext_classes[] = $class->getName();
$ext_constants = array_merge($ext_constants, array_keys($class->getConstants()));
}
$ext_constants = array_unique($ext_constants);
if (count($ext_functions)) {
$ext_info['functions'] = implode(' ', $ext_functions);
}
if (count($ext_constants)) {
$ext_info['constants'] = implode(' ', $ext_constants);
}
if (count($ext_classes)) {
$ext_info['classes'] = implode(' ', $ext_classes);
}
} catch (Exception $e) {
$errors[] = "\"Error: '$ext' " . $e->getMessage() . "\n";
echo 'Error Encountered.' . PHP_EOL;
}
$store[$ext] = $ext_info;
}
$out_str .= "syn case match\n\n";
foreach ($store as $ext) {
if (isset($ext['constants'])) {
$out_str .= '" ' . $ext['name'] . "\n";
$out_str .= 'syn keyword phpConstants ' . $ext['constants'] . " contained\n\n";
}
}
$out_str .= "syn case ignore\n\n";
foreach ($store as $ext) {
$out_str .= '" ' . $ext['name'] . "\n";
if (isset($ext['functions'])) {
$out_str .= 'syn keyword phpFunctions ' . $ext['functions'] . " contained\n";
}
if (isset($ext['classes'])) {
$out_str .= 'syn keyword phpClasses ' . $ext['classes'] . " contained\n\n";
}
}
foreach ($errors as $error) {
$out_str .= "$error\n";
}
file_put_contents($out_file, $out_str);
?>
......@@ -230,6 +230,10 @@ if 1 == VimRCBundlesDevel
" Close vim if the only window left open is a NERDTree
" autocmd BufEnter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
" User-defined surroundings
let g:surround_113 = "'\r'" " q - like quotes
let g:surround_100 = "\"\r\"" " d - like doublequotes
" User-defined snippets
let g:snipMate = {}
let g:snipMate['snippet_dirs']
......
......@@ -3,6 +3,8 @@
" +-----------------------------------------------
if 1 == VimRCBundlesMisc
" Enable editorconfig
Bundle 'editorconfig/editorconfig-vim'
" Enable alignment of any characters
Bundle 'Align'
" Auto alignment while typing
......@@ -109,6 +111,8 @@ if 1 == VimRCBundlesPython
endif
if 1 == VimRCBundlesPHP
" PHP syntax bundle
Bundle 'StanAngeloff/php.vim'
" Usefull offline documentations (eg. php.net)
Bundle 'thinca/vim-ref.git'
" Nice php completion
......@@ -141,3 +145,8 @@ if 1 == VimRCBundlesJavaScript
Bundle 'moll/vim-node'
endif
if 1 == VimRCBundlesSysAdmin
" Varnish highlighting
Bundle 'pld-linux/vim-syntax-vcl'
endif
......@@ -25,7 +25,7 @@ autocmd FileType tex setlocal tw=80
" Reset filetypes on special file extensions
autocmd BufNewFile,BufRead *.dump set filetype=sql
autocmd BufNewFile,BufRead *.vcl set filetype=cpp
autocmd BufNewFile,BufRead *.vcl set filetype=conf
" Other stuff
" autocmd FileType xhtml,xml,ant,wsdl so ~/.vim/bundle/HTML-AutoCloseTag/ftplugin/html_autoclosetag.vim
......
......@@ -15,6 +15,7 @@ set nocompatible
" Default configuration
let VimRCBundlesMisc = 1
let VimRCBundlesDevel = 0
let VimRCBundlesSysAdmin = 0
let VimRCBundlesHTML = 0
let VimRCBundlesPython = 0
let VimRCBundlesPHP = 0
......
......@@ -182,3 +182,8 @@ function git-log-full()
git log --decorate --stat --graph --pretty=format:"%d %Cgreen%h%Creset (%ar - %Cred%an%Creset), %s%n"
}
function generateMAC()
{
echo $(dd bs=1 count=6 if=/dev/random 2>/dev/null |hexdump -v -e '/1 "-%02X"' | sed 's/^-//g')
}
Features
========
# Vim
##CTags
## CTags
Just run the following command inside your project path:
......@@ -17,7 +16,7 @@ And you could start vim:
(We assume here you got a "TagController" :))
##Common
## Common
* Plugins managed using Vundle
* Smart autocompletition as you type
......@@ -59,8 +58,7 @@ And you could start vim:
gC{motion} :: Comment region
gCc :: Comment the current line
Sources
=======
# Sources
* https://github.com/Shougo/neocomplcache
* https://github.com/thinca/vim-ref
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment