Skip to content

Instantly share code, notes, and snippets.

@junegunn
junegunn / vimawesome.vim
Last active May 10, 2023 15:50
Plugin completion using VimAwesome API
" ----------------------------------------------------------------------------
" vimawesome.com
" ----------------------------------------------------------------------------
function! VimAwesomeComplete() abort
let prefix = matchstr(strpart(getline('.'), 0, col('.') - 1), '[.a-zA-Z0-9_/-]*$')
echohl WarningMsg
echo 'Downloading plugin list from VimAwesome'
echohl None
ruby << EOF
require 'json'
@svermeulen
svermeulen / cleverVariableArgs.vim
Created January 29, 2015 01:54
Clever alternative way of declaring optional parameters in vimscript
" Normal way of declaring variable arguments with default values:
function! ExampleFunc1(fix1, fix2, ...)
let var1 = a:0 > 0 ? a:1 : 'defaultVal1'
let var2 = a:0 > 1 ? a:2 : 5
echo a:fix1 .','. a:fix2 .','. var1 .','. var2
endfunction
" Alternative approach using a command:
@gridaphobe
gridaphobe / god-state.el
Last active November 21, 2016 14:21
evil-mode god state
(evil-define-state god
"God state."
:tag " <G> "
:message "-- GOD MODE --"
:entry-hook (evil-god-start-hook)
:exit-hook (evil-god-stop-hook)
:input-method t
:intercept-esc nil)
(defun evil-god-start-hook ()
@Soft
Soft / .XCompose
Last active December 22, 2015 23:49
<Multi_key> <N> <b>: "#" U0023
<Multi_key> <D> <O>: "$" U0024
<Multi_key> <A> <t>: "@" U0040
<Multi_key> <less> <parenleft>: "[" U005B
<Multi_key> <slash> <slash>: "\" U005C
<Multi_key> <parenright> <greater>: "]" U005D
<Multi_key> <apostrophe> <greater>: "^" U005E
<Multi_key> <apostrophe> <exclam>: "`" U0060
<Multi_key> <parenleft> <exclam>: "{" U007B
<Multi_key> <exclam> <exclam>: "|" U007C

Boxen uses a bunch of shellscripts to insert itself into your environment on shell load.

These assume a POSIX shell, which fish is not.

Run this script to generate a fish-compatible config file in ~/.config/fish/boxen.fish, which you can source at the end of your ~/.config/fish/config.fish.

@areina
areina / emacs-email-setup.md
Created October 12, 2012 15:00
Manage your email in emacs with mu4e

Manage your gmail account in emacs with mu4e

There're a lot of combinations to manage your email with emacs, but this works for me. I've a backup and I can manage my daily email.

The stack:

  • emacs
  • offlineimap
  • mu
  • mu4e
@tpope
tpope / gist:2999229
Created June 26, 2012 21:26
Environment variable overrides in Rails
# Add config/overrides/*.yml to .gitignore
# and this near the top of application.rb
%w(defaults overrides).each do |type|
path = File.expand_path("../#{type}/#{Rails.env}.yml", __FILE__)
ENV.update(YAML.load_file(path)) if File.exist?(path)
end
# For things that are sensitive or developer dependent:
# config/overrides/{development,test}.yml
# For everything else:
@zeelot
zeelot / classes-view-page-browse.php
Created March 27, 2012 04:17
Top navigation with selected status (change dashes for slashes as gists do not allow directories)
<?php
Class View_Page_Browse extends View_Page {
// On this page, 'browse' tab is selected
protected $_selected_top_nav_item = 'browse';
}
diff --git a/classes/kohana/view.php b/classes/kohana/view.php
index 5427ad9..dbd5261 100644
--- a/classes/kohana/view.php
+++ b/classes/kohana/view.php
@@ -41,7 +41,7 @@ class Kohana_View {
* @param array $kohana_view_data variables
* @return string
*/
- protected static function capture($kohana_view_filename, array $kohana_view_data)
+ protected function capture($kohana_view_filename, array $kohana_view_data)
@meleyal
meleyal / macvim-padding
Created February 24, 2012 18:42
Add padding to MacVim windows
defaults write org.vim.MacVim MMTextInsetTop '10'
defaults write org.vim.MacVim MMTextInsetLeft '10'
defaults write org.vim.MacVim MMTextInsetBottom '10'
defaults write org.vim.MacVim MMTextInsetRight '10'