Linux Environment

Linux Environment

A nice vim and bash config

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 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:

$ curl http://code.jity.de/Jack12816/linux-environment/raw/master/install.sh | bash

Step by step installation

This procedure is for installing the project system wide.

First of all just clone the git repository to a persistent location. :)

$ cd /opt
$ git clone http://code.jity.de/Jack12816/linux-environment.git
$ cd linux-environment

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 ";"}'`

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 -

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.

I recommend you to use the patched font with your terminal emulator to get the best results. You have linked the .fonts directory already to your $HOME, so just 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

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.

" # +-------------------------------------------------
" # | 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.

$ 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/linux-environment/dotrc/.vim/tools
$ git clone https://github.com/techlivezheng/phpctags.git && cd phpctags
$ make

Another usefull thing to install is the PHP documentation if you need it. Just run the following:

$ cd /opt/linux-environment/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 .

$ 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

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

Nice! You made it. Now everything should work!

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