easy vim session management

Disclaimer: This content is not owned by the current webmaster nor do we claim the credit.  Ownership of this domain has changed hands. This URL however as a courtesy to web users is a  historic copy of what was originally published.

Conner Mcdaniel has created a new blog at https://connermcd.wordpress.com You can find all of his current publication there.

Easy vim session management
Mar 11, 2013

Until recently I haven’t really harnessed the power of vim’s session management capabilities. It can be a hassle somewhat to always use :mksession and :source, so I usually just neglect to do it; however, if you’re commonly working with large projects then it can be very useful to drop a session file into the root directory and make use of it. To aid me in utilizing this feature I added some customizations to my ~/.vimrc:

command! Mks let g:session = getcwd() call Mks(g:session)

augroup vimrc
au!
au BufRead *.session let g:session = expand(‘%:p:h’) | so % | bd #
au VimLeave * if exists(‘g:session’) | call Mks(g:session) | endif
augroup end

fun! Mks(path)
exe “mksession! “.a:path.”/”.fnamemodify(a:path, ‘:t’).”.session”
endfun
First, this sets a new custom user command called :Mks which will make a session file based on the current working directory. For instance, if :pwd is /home/connermcd/.bin/project/ then this will make a file inside that folder called project.session. It also sets a global variable (g:session) to the current working directory so that it can save the session here later. In the augroup a couple of autocommands are set. The first one (BufRead) executes when you open a file with the .session extension. This will set the g:session variable, source the session file, and delete it from the buffer list. The second one (VimLeave) executes when you close vim. If a g:session variable is found then it will override the session file with the new information. That’s pretty much it!

This works best if you aren’t using the autochdir option. I find that with it turned off it makes project navigation much more simple. Now when you create a new project just run the :Mks command to start session tracking, and when you want to access it later just open the .session file with vim.

pandoc table editing in vim

Disclaimer: This content is not owned by the current webmaster nor do we claim the credit.  Ownership of this domain has changed hands. This URL however as a courtesy to web users is a  historic copy of what was originally published.

Conner Mcdaniel has created a new blog athttps://connermcd.wordpress.com You can find all of his current publication there.

Pandoc table editing in vim
May 20, 2012

I’ve been itching for a way to get more efficient at creating pandoc tables ever since I started writing my notes in pandoc. Perhaps the only thing I’ve ever been jealous of emacs about is a video I saw using it’s orgtable mode. I haven’t quite adapted vim to work as emacs shows in this video. I’m convinced that it’s possible but also believe that the spreadsheet functionality shown is overkill. I don’t need my tables to do any math anyway; I just need them to be fast and seamless. To accomplish this, I turned to tabular. I originally got the idea while watching a vimcast on tabular that seemed to be behaving similarly to the emacs video. It uses a gist written by Tim Pope that executes :Tabularize every time you enter a pipe symbol. The code is provided in the show notes of the video, so you can easily copy that to your .vimrc. You can use this create a basic table structure dynamically, which ends up looking something like this:

| Fruit | Amount | Price | Total |
| Apple | 2 | $2.00 | $4.00 |
| Banana | 3 | $1.00 | $3.00 |
| Kiwi | 5 | $0.50 | $2.50 |
Well, that’s nice and all, but this is not a pandoc table. I wrote a simple (probably imperfect) function to convert this into a standard pandoc table:

Fruit Amount Price Total
—— —— —– —–
Apple 2 $2.00 $4.00
Banana 3 $1.00 $3.00
Kiwi 5 $0.50 $2.50
It works by visually selecting the lines and executing :Tabularize one last time in case there is any remaining misalignment.

vnoremap t :call table()
function! s:table() range
exe “‘<,’>Tab /|”
let hsepline= substitute(getline(“.”),'[^|]’,’-‘,’g’)
exe “norm! o” . hsepline
exe “‘<,’>s/-|/ |/g”
exe “‘<,’>s/|-/| /g”
exe “‘<,’>s/^| \\|\\s*|$\\||//g”
endfunction
There is another type of pandoc table, called a grid table. You can easily convert the markdown table into a grid table using pandoc itself like this:

command! -range=% Rst :’<,’>!pandoc -f markdown -t rst
Just select the pandoc table and run :Rst to convert it into a grid table like this:

+———-+———-+———+———+
| Fruit | Amount | Price | Total |
+==========+==========+=========+=========+
| Apple | 2 | $2.00 | $4.00 |
+———-+———-+———+———+
| Banana | 3 | $1.00 | $3.00 |
+———-+———-+———+———+
| Kiwi | 5 | $0.50 | $2.50 |
+———-+———-+———+———+

sync your desktop with dropbox

I generally have two locations where I put things requiring action from me: my email inbox and my computer’s desktop. Once I’ve dealt with emails I archive them so my inbox is always kept clean except for things requiring my action. Likewise I either delete or organize documents that have been on my desktop once I’m done with them. It’s always bothered me however, that once I turn my computer off I can’t get to those files on my phone or other computers. If you try to make an alias of your Desktop and put it into Dropbox it won’t work. Thankfully, there is a way using symlinks. Open up Applications→Utilities→Terminal and type in:

cd ~/Dropbox
ln -s ~/Desktop Desktop

Now you’ll have a folder in your Dropbox folder that is kept in sync with your desktop. You can do this on other computers as well to keep your desktop synced across multiple computers!

a vim setup for octopress

Disclaimer: This content is not owned by the current webmaster nor do we claim the credit.  Ownership of this domain has changed hands. This URL however as a courtesy to web users is a  historic copy of what was originally published.

Conner Mcdaniel has created a new blog athttps://connermcd.wordpress.com You can find all of his current publication there.

A vim setup for octopress
Jul 15, 2012

There’s been plenty of posts out there discussing the pros and cons of octopress and other static site generators, so I’m not going to add to the list. I will say that from my personal experience the transition was relatively smooth and that octopress happened to have the necessary features, plugins, and community I needed to get the website I wanted. This certainly may not be the case for everyone, but I am pleased with the overall result so far. Octopress probably does require a bit of web development experience, which I’m fortunate to have. For users without that knowledge base, wordpress is very friendly. However, my needs in a personal webpage are simplistic, and wordpress is just a little too much overkill. It has also become rather mainstream and uses a lot of PHP, which makes it a potential security threat — especially with a lot of (often shady) plugins. I enjoyed working with vimrepress, but since I’m moving away from wordpress, I won’t be developing on it anymore. I did learn something about python-based vim plugins from the experience though.

I wanted a similar vim setup for my new octopress blog. I read another post belaboring this as a lacking feature that ultimately moved them back to wordpress. I was confused by that, since making a decent workflow in octopress is not all that difficult. Here’s the steps I took:

nnoremap ‘bn :NewPost
command! -nargs=1 NewPost call NewPost(““)
fun! NewPost(args)
let file = “/web/octopress/source/_posts/” . strftime(“%Y-%m-%d”) . “-” . tolower(substitute(a:args, ” “, “-“, “g”)) . “.markdown”
exe “e!” . file
let g:post_title = a:args
endfun

nnoremap ‘bs :SavePost
command! -nargs=1 SavePost call SavePost(““)
fun! SavePost(args)
let file = “/web/octopress/source/_posts/” . strftime(“%Y-%m-%d”) . “-” . tolower(substitute(a:args, ” “, “-“, “g”)) . “.markdown”
exe “w!” . file
let g:post_title = a:args
endfun
The :NewPost command will allow you to quickly make a new file in the appropriate directory with the appropriate name. The :SavePost command does essentially the same thing except that it uses the buffer you’re currently working with instead of making a new one. There might be a better approach than this, but this is just my first go at a solution. Both of the functions set a variable, g:post_title, which I then use in a snipmate snippet file like this:

snippet b

date: `strftime(“%Y-%m-%d %T”)`
layout: post
slug: `tolower(substitute(g:post_title, ” “, “-“, “g”))`
title: `g:post_title`
categories:
– ${1}

${2}
That way I can press ib in the new file to get the appropriate front matter. The next thing I wanted was tag and category completion like vimrepress had, so I solved that using these in my ~/.vimrc:

au BufNewFile,BufRead /web/octopress/source/_posts/*.markdown setl completefunc=TagComplete | cd /web/octopress/source
fun! TagComplete(findstart, base)
if a:findstart
” locate the start of the word
let line = getline(‘.’)
let start = col(‘.’) – 1
while start > 0 && line[start – 1] =~ ‘\a’
let start -= 1
endwhile
return start
else
let tags = split(system(“ls /web/octopress/public/blog/tags”), “\n”)
let cats = split(system(“ls /web/octopress/public/blog/categories”), “\n”)
return tags + cats
endif
endfun
You’ll have to change the appropriate directories of course. This allows you to use for tag and category completion and changes the directory automatically when you use the :NewPost command. I might modify these some in the future and update this post, but for now this solution is working for me.

SEO Companies In Michigan and Installing Arch Linux on Raspberry Pi

SEO Companies and Michigan Based Digital Marketing

Marketing you business in Michigan can prove to be difficult with all the increased levels of competition in today’s online ecosystem.  If you have ever thought about digital marketing or wanted to take advantage of its benefits you probably become overwhelmed with all the different aspects.

You may wonder to yourself; should you or how do you participate in Social Media PPC advertising,  is Google Adwords right for you, or will SEO really pay off?

As a Michigan-based SEO and Web Design Company, Web Flux can help with these unknown variables.  We meet with many different businesses that offer a variety of services.  Not every business is the same and each will need its own unique pack of Digital Marketing Services.

Web Site Design Goals and PPC Strategies

After we meet with business, discuss their goals and web design needs we build out a custom proposal that is based on your timeline for desired success.  SEO doesn’t happen overnight.  PPC Managment and result, on the other hand, can be achieved much faster.

We generally recommend businesses to jump stare their website marketing with Google Adwords PPC then over a monthly basis drip in quality search engine optimized pages and blog post.

With this type of approach, your business will be better balanced for achieving long-term online success.

 

Installing Arch Linux on Raspberry Pi

Disclaimer: This content is not owned by the current webmaster nor do we claim the credit.  Ownership of this domain has changed hands. This URL however as a courtesy to web users is a  historic copy of what was originally published.

Conner Mcdaniel has created a new blog athttps://connermcd.wordpress.com You can find all of his current publication there.

 

 

 

using-vim-in-place-of-writeroom.html

blog/2011/10/12/using-vim-in-place-of-writeroom.html

Disclaimer: This content is not owned by the current webmaster nor do we claim the credit.  Ownership of this domain has changed hands. This URL however as a courtesy to web users is a  historic copy of what was originally published.

Conner Mcdaniel has created a new blog athttps://connermcd.wordpress.com You can find all of his current publication there.

Using vim in place of WriteRoom
Oct 12, 2011

Fullscreen editors, also called distraction-free editors, have become popular lately. It’s appealing to have nothing but the words you’re editing before you. However, these editors are often lacking some of the most elemental of features and sometimes cost money. Fortunately, it’s pretty easy to make MacVim into an exact replica of WriteRoom (or gVim into DarkRoom on Windows). Put the following into your .vimrc:

let g:writeroom = 0
let g:transparency = &transparency
function! WriteRoom()
if has(“gui_running”)
if g:writeroom == 0
let g:writeroom = 1
set columns=80
set fullscreen
set linebreak
set nocursorline
set nolist
set nonumber
set noshowmode
set rulerformat=%{strftime(‘%b %e %I:%M %p’)}
set transparency=0
hi NonText guifg=bg
else
let g:writeroom = 0
set cursorline
set list
set nofullscreen
set nolinebreak
set number
set rulerformat=
set showmode
let &transparency=g:transparency
hi clear
endif
endif
endfunction
This creates a function that you can execute to put MacVim into WriteRoom mode. If you don’t want the clock display then you can comment out the lines about rulerformat. Personally, I like to keep track of time when I’m in fullscreen mode. You can also change the lines and columns to best fit your screen size. Then, you can map a shortcut to execute the function. I use gw for normal mode and \w for insert mode.

nmap gw :exe WriteRoom()
imap w :exe WriteRoom()i
It’s pretty easy to make vim look however you want. If you happened to have some secret passion for notepad then it wouldn’t be difficult to make vim look that way either.

blog/2014/01/28/getting-things-done.html

Disclaimer: This content is not owned by the current webmaster nor do we claim the credit.  Ownership of this domain has changed hands. This URL however as a courtesy to web users is a  historic copy of what was originally published.

Conner Mcdaniel has created a new blog athttps://connermcd.wordpress.com You can find all of his current publication there.

Getting things done
Jan 28, 2014

Sometimes it’s difficult being productive. Procrastination can be a nasty problem. So, to help, I’ve made a simple script to keep me on track. It’s much like the pomodoro technique but without all the excess theory and pretense. It’s really just a command line egg timer that integrates with tmux, mpd, libnotify, espeak and any other custom commands you might like. It would not be difficult to extend its functionality either. The basic usage looks like this:

USAGE:

gtd [ -bcmnst ] [ work length ] [ break length ]

OPTIONS:

-b : start on a break
-c : custom command (defaults to “clear”)
-m : toggle MPD on change
-n : notify on change
-s : speak command
-t : show time in tmux status bar
The tmux integration really just updates a temporary file with the time remaining on the timer and refreshes your tmux session. You could use this in your tmux status bar like this for example:

set-option -g status-right “#(cat /tmp/gtd)#[fg=colour15,noreverse,bg=colour233] #(date ‘+%a %m/%d %I:%M %P’) ”
This sets the right side of your status bar to the time remaining in the timer (if the timer is on) and then the date and time. You could just as easily read this into conky or GeekTool (the OSX equivalent).

You can find the project here and add any suggestions to the issue tracker. Hope it helps someone else!