You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function find_up
set path (pwd)
while test $path != "/"
and not test -e "$path/$argv[1]"
set path (dirname $path)
end
if test -e "$path/$argv[1]"
echo $path
else
echo ""
end
end
function __check_nvm --on-variable PWD
if status --is-command-substitution
return
end
set nvm_path (find_up ".nvmrc" | tr -d '[:space:]')
if test "$nvm_path" != ""
set nvmrc_node_version (nvm version (cat "$nvm_path/.nvmrc"))
if test "$nvmrc_node_version" = "N/A"
# echo "Installing node version "(cat "$nvm_path/.nvmrc")
nvm install
set nvm_node_version (nvm version)
else if test "$nvmrc_node_version" != (nvm version)
# echo "Changing node version to $nvmrc_node_version"
nvm use
set nvm_node_version (nvm version)
end
# echo "$nvm_path/.nvmrc"
else if test (nvm version) = "none"
nvm use default --silent
else if test (nvm version) != (nvm version default)
echo "Reverting node version to default"
nvm use default
end
end
__check_nvm
Fish aliases
To create and save aliases, enter the following pattern:
alias <shorthand> "<text your would like to be run>"
funcsave <shorthand>
e.g.
alias gs "git status"
funcsave gs
alias gs "git status"; and funcsave gs
alias ga "git add"; and funcsave ga
alias gba "git branch -a"; and funcsave gba
alias gbd "git branch -D"; and funcsave gbd
alias gcm "git commit -m"; and funcsave gcm
alias gcam "git commit -am"; and funcsave gcam
alias gd "git diff"; and funcsave gd
alias gdw "git diff --word-diff"; and funcsave gdw
alias gds "git diff --staged"; and funcsave gds
alias gdsw "git diff --staged --word-diff"; and funcsave gdsw
alias gco "git checkout"; and funcsave gco
alias gl "git log --oneline"; and funcsave gl
alias gps "git push"; and funcsave gps
alias gpu "git push -u origin"; and funcsave gpu
alias gpl "git pull"; and funcsave gpl
alias gm "git merge"; and funcsave gm
alias dcdown "docker-compose down"; and funcsave dcdown
alias dcup "docker-compose up -d --build --remove-orphans"; and funcsave dcup
alias ys "yarn start"; and funcsave ys
alias yi "yarn"; and funcsave yi
alias uis "yarn upgrade; and yarn; and yarn start"; and funcsave uis
If you get this error gpg: keyserver receive failed: No route to host, runcurl -sSL https://rvm.io/mpapis.asc | gpg --import - then try again (Reference)
Download the fish functions from GitHub curl -L --create-dirs -o ~/.config/fish/functions/rvm.fish https://raw.github.com/lunks/fish-nuggets/master/functions/rvm.fish
And activate the default Ruby manually in your config.fish file: echo "rvm default" >> ~/.config/fish/config.fish
Test it with rvm -v and ruby -v
Composer
M1 macs don't come with PHP, so install it brew install php (Terminus 2 doesn't work with 8, so you may need to install [email protected])
Formatting Toggle (Gives you a button in the bottom bar to disable formatting. Useful when your linting rules should be ignored for a particular file, but you don't want to add ignore code.)
Live Preview (Live preview, useful for projects that don't have a local server running.)
Package ++ (A collection of extensions to "Boost your Visual Studio code, individually chosen extensions, to help the day to day programmer." Includes the following:)
Auto Rename Tag (Automatically rename closing - or opening - tags when you edit one of them.)
Bookmarks (If you have a piece of code that you want to consult in the future, you can use the bookmark, it is very useful to consult a line that you found interesting in the debugger)
Path Intellisense (Visual Studio Code plugin that autocompletes filenames.)
Quokka (No more console.log, this tool gives you the result, in real time without executing the code, knowing exactly what that function will return as soon as you call it)
TabNine (This extension is great for auto completing codes, the tool has an intelligence that helps you along the development)
Todo Highlight (That TO DO or FIX ME in the comment, remember? So this extension makes it very elegant in your comment and with a highlight for you to remember that adjustment in the code)
Install shell extension
Open Visual Studio Code and access the Command Palette (⇧⌘P) and start typing "shell command" and select option "Shell Command: Install ‘code’ command in PATH".
After that you’re able to start a new terminal window, change into your project directory and use code . to open the current directory in Visual Studio Code.
{
//--------------------------//
// VS Code Interface Tweaks //
//--------------------------//
// Disable breadcrumbs
"breadcrumbs.enabled": false,
// Make the cursor solid at all times (disables blinking)
"editor.cursorBlinking": "solid",
// Disable the minimap
"editor.minimap.enabled": false,
// Show rulers at 80 and 100 character
"editor.rulers": [80, 100],
// Always show the folding controls
"editor.showFoldingControls": "always",
// Hide the Editor, Search, Extenstions, etc. bar.
// You can still get to them via hot-keys or the "View" menu
"workbench.activityBar.visible": false,
// My preferred theme
"workbench.colorTheme": "One Dark Pro",
// Hide the close button on tabs to condense them a bit
"workbench.editor.tabCloseButton": "off",
// Condense the tabs at the top just a bit
"workbench.editor.tabSizing": "shrink",
// Material theme icons
"workbench.iconTheme": "material-icon-theme",
// Enables horizontal scrolling in the sidebar
"workbench.list.horizontalScrolling": true,
// Add the path to the file in the window title
"window.title": "${activeEditorMedium}${separator}${rootName}",
// Starts up new windows with a new untitled file
"workbench.startupEditor": "newUntitledFile",
// Focus on files in the sidebar when selected in the main editor window
// But don't move the sidebar scroll position to them
"explorer.autoReveal": "focusNoScroll",
// UI (font) size
"window.zoomLevel": 0,
//----------------------//
// Code Writing Helpers //
//----------------------//
// Enable auto-closing of tags in all file types
"auto-close-tag.activationOnLanguage": ["*"],
// Set tabs to equal two spaces
"editor.tabSize": 2,
// Tell emmet to work on .js files (not just when specified as react)
"emmet.includeLanguages": {
"javascript": "javascriptreact",
"twig": "html"
},
// Tell emmet to use single quotes
"emmet.syntaxProfiles": {
"jsx": {
"attr_quotes": "single"
}
},
//-----------------------------//
// Code Linting and Formatting //
//-----------------------------//
// Associate extensions with languates
"files.associations": {
"*.theme": "php",
"*.module": "php",
"*.inc": "php",
"*.install": "php",
"*.html": "twig"
},
// Style linting //
// Disable VS Code's validation of css, less, and scss because we're using Stylelint
// (This just prevents duplicate reports in the log)
"css.validate": false,
"less.validate": false,
"scss.validate": false,
// Turn on Auto Fix for all providers (including eslint)
"editor.codeActionsOnSave": {
"source.fixAll": true
},
// Use prettier to format code
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[scss]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
// Format json with the json formatter
"[json]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
// General linting/formatting
// Format on Paste
"editor.formatOnPaste": true,
// Format on Save
"editor.formatOnSave": true,
// Format on Type
"editor.formatOnType": true,
// Insert a final newline
"files.insertFinalNewline": true,
// Remove additional newlines after the "final" one
"files.trimFinalNewlines": true,
// Trim any whitespace at the end of lines
"files.trimTrailingWhitespace": true,
//------------------//
// User Preferences //
//------------------//
// Custom dictionary
"cSpell.userWords": [
"Contentful",
"Coronavirus",
"Covid",
"Gladwell",
"Infographics",
"Inveniem",
"Invision",
"Kalamuna",
"Promet",
"Theming",
"airbnb",
"analytes",
"audiobooks",
"browserslistrc",
"commitlint",
"confex",
"confim",
"contactless",
"contenteditable",
"drush",
"endblock",
"endembed",
"endfor",
"kint",
"lando",
"lightbox",
"mixins",
"roadmap",
"spbb",
"sqaush",
"srcset",
"stylelint",
"stylelintrc",
"swiper",
"tabindex",
"twatch",
"updb"
],
// Don't confirm when deleting files in the explorer
"explorer.confirmDelete": false,
// Don't confirm when dragging and dropping files in the explorer
"explorer.confirmDragAndDrop": false,
// Use iTerm when opening current project in terminal (Cmd + Shift + C)
"terminal.external.osxExec": "iTerm.app",
// Liveshare auth provider
"liveshare.authenticationProvider": "GitHub"
}
Follow the next steps for each version of Drush you need to install
cd /usr/local/bin
mkdir drush-9
cd drush-9
composer require drush/drush:^9
cd ..
ln -s drush-9/vendor/bin/drush drush9
If you do this for versions 7-9, you'll be able to run any of the following:
drush7 statusdrush8 statusdrush9 status
Create Shell Script to Automatically Select Drush Version Based on Git Config
cd /usr/local/bin
vi drush
paste the following
#!/bin/sh
version=$(git config --get drush.version)
if [ "$version" = '7' ];
then
drush7 "$@"
elif [ "$version" = '8' ];
then
drush8 "$@"
else
drush9 "$@"
fi
Save the file
Make the script executable chmod +x drush
This makes drush 9 the default when we type a command like "drush --version". In order to use Drush 7 (or 8), we need to set a configuration variable in the git repo of the project that should use it.
Set Drush 7 (or 8) as the Required Version for a Project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters