Skip to content

Commit

Permalink
feat: add functions for handling common nvim typos and PR management (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
dgokcin authored Jul 16, 2024
1 parent a01a5eb commit b2fd490
Showing 1 changed file with 27 additions and 9 deletions.
36 changes: 27 additions & 9 deletions .functions
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@ function bi () {
vi $1
}

# For handling common nvim typos
function nvmi() {
nvim $1
}

function nbim() {
nvim $1
}

function ncim() {
nvim $1
}

# Extract most know archives with one command
function extract()
{
Expand Down Expand Up @@ -87,12 +100,25 @@ function move_env_file() {
fi
}


# a function to kill all processes on a given port
function killport() {
lsof -t -i tcp:$1 | xargs kill
}

# Function to create a pull request with the base branch set to the current main branch of the repository
function create_pr() {
# Get the current main branch of the repository
current_main_branch=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')

# Execute the gh pr create command with the base set to the current main branch
gh pr create --base "$current_main_branch"
}

# Function to view the current pull request
function view_pr() {
gh pr view --web
}

# Functions needed for the copilot aliases to work
eval_git_question() {
eval "gh copilot suggest -t git \"$1\""
Expand All @@ -106,11 +132,3 @@ eval_shell_question() {
eval "gh copilot suggest -t shell \"$1\""
}

# Function to create a pull request with the base branch set to the current main branch of the repository
function create_pr() {
# Get the current main branch of the repository
current_main_branch=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')

# Execute the gh pr create command with the base set to the current main branch
gh pr create --base "$current_main_branch"
}

0 comments on commit b2fd490

Please sign in to comment.