Wikia

Vim Tips Wiki

Changes: Function to use Sweyla's Color Theme Generator

Edit

Back to page

(Insert TipProposed template + minor manual clean)
(Updated the URL to the color theme generator)
 
Line 11: Line 11:
 
|category2=
 
|category2=
 
}}
 
}}
Sweyla has a [http://themes.sweyla.com/ color theme generator]. Here is a simple function and some mappings to download a theme from Swelya.
+
Sweyla has a [http://sweyla.com/themes/ color theme generator]. Here is a simple function and some mappings to download a theme from Swelya.
 
<pre>
 
<pre>
 
function! s:UpdateSweyla(...)
 
function! s:UpdateSweyla(...)
Line 20: Line 20:
 
endif
 
endif
 
let l:timestamp = substitute(l:timestamp, "\n$", "", "g")
 
let l:timestamp = substitute(l:timestamp, "\n$", "", "g")
let l:return = system("wget -q -O $HOME/.vim/colors/sweyla.vim http://themes.sweyla.com/vim/sweyla" . l:timestamp . ".vim")
+
let l:return = system("wget -q -O $HOME/.vim/colors/sweyla.vim http://sweyla.com/themes/vim/sweyla" . l:timestamp . ".vim")
 
colorscheme sweyla
 
colorscheme sweyla
 
endfunction
 
endfunction

Latest revision as of 22:03, July 14, 2013

Proposed tip Please edit this page to improve it, or add your comments below (do not use the discussion page).

Please use new tips to discuss whether this page should be a permanent tip, or whether it should be merged to an existing tip.
created July 27, 2012 · complexity basic · version 7.0

Sweyla has a color theme generator. Here is a simple function and some mappings to download a theme from Swelya.

function! s:UpdateSweyla(...)
  if a:0 > 0
    let l:timestamp = a:1
  else
    let l:timestamp = system("date +%s")
  endif
  let l:timestamp = substitute(l:timestamp, "\n$", "", "g")
  let l:return = system("wget -q -O $HOME/.vim/colors/sweyla.vim http://sweyla.com/themes/vim/sweyla" . l:timestamp . ".vim")
  colorscheme sweyla
endfunction
command! -nargs=? Sweyla call s:UpdateSweyla(<args>)
nnoremap <Leader>w :Sweyla<CR>

CommentsEdit

If this is kept (what exactly does it do?), should replace the timestamp stuff with the builtin function (see Insert current date or time). Clarify that tip contains a path which would need to be modified on some systems. My personal opinion is that simplifying the job of downloading and running a script is not always desirable. Who controls sweyla.com? JohnBot (talk) 04:48, July 30, 2012 (UTC)

Around Wikia's network

Random Wiki