Blog by Daniel Hauck. Sysadmin, Developer, Blogger.

TAG: cli

Prepare Vim for Writing

This is the first part of the Series New Series: Writing and Publishing for Command Line Users.

As I am writing on my first book I recognized,ย I need a different environment than for coding.

While coding python or C I got my autoindentation, syntaxhighlighting, line numbers and a lot of stuff that becomes disturbing while writing.
I need to turn it off.

The first attempt was the following:
Create a separate .vimrc for writing.
So I created a file .writing_vimrc and added an alias
alias wvim="vim -u BRALALALA"

Vim has so many nice features, so don’t waste your time with bullshit like that.

My second attempt was better. I write my book, notes and blog posts in markdown all the time.
If you got “filetype on”, vim already knows that it’s markdown, so why don’t use this?

So I created an autocmd for markdown files, which works like this:

autocmd FileType markdown call Writing()

What happens here is, vim runs the command “call Writing()” everytime it recognizes the filetype ‘markdown’.
Of course you need to define a function called “Writing()” where you declare, what should happen, to get a noisefree workspace in vim.

Here’s mine for example:

Now you got a clean vim environment.

If you questions just drop a line in the comments.

Have Fun!

Interested in a book about a productive workflow on the command line? Sign up for my book!

Get Your Owncloud / Caldav Calendar Into Tmux

In my previous postย I promised you that I will show you how to get you owncloud calendar into tmux status bar. Since owncloud uses the caldav protocol, this post should fit for most caldav servers.

To accomplish this task I will use the python library caldav, which latest version is 0.4.0. You can easily install it via pip:

pip install caldav

If pip is not available, install it with your package manager, i.e. apt:

apt-get install python-pip python-dev

Ok, you got everything setup. Let’s start.

First you need to grab the url from your owncloud web interface. Therefore login to owncloud click on the dropdown at the top left and select calendar.

On the left side you can see your calendar(or multiple ones), which default name is personal. Next to it there is a hyperlink symbol(as you see in the screenshot).


Selection_001Below there appears a link to the caldav api of owncloud. Just copy it for later.

Now we got every information we need. Let’s have a look at the python script I have prepared:

If you got any suggestions how to make the short script better, please use the comments ๐Ÿ˜‰

The script prints out your next appointment in your calendar, so we can directly call it in tmux, no sed or else is required.
So save the script, for example to ~/bin/ or /usr/local/bin/ and make it executable:

chmod +x ~/bin/

And call it from you ~/.tmux.conf:

set -g status-right '๐Ÿ“… #(~/bin/'

Voila! Your next appointment appears in tmux ๐Ÿ™‚

Screenshot from 2015-07-07 08:51:40

If you got any questions, suggestions or wishes, please use the comments here on the blog. Otherwise they will be scattered at G+, Twitter and reddit.

You want to learn more about an effective workflow with tmux? Sign up for my book, of course you will get a discount with the newsletter ๐Ÿ˜‰

There are no more results.