mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-14 14:12:41 +00:00
Adds zsh functions, needs work on moving some items
This commit is contained in:
@@ -53,7 +53,11 @@ vim.cmd('autocmd! TermOpen term://* lua set_terminal_keymaps()')
|
|||||||
keymap('n', '<leader>f', '<cmd>:Format<CR>', default_options)
|
keymap('n', '<leader>f', '<cmd>:Format<CR>', default_options)
|
||||||
keymap('n', '<leader>F', '<cmd>:FormatWrite<CR>', default_options)
|
keymap('n', '<leader>F', '<cmd>:FormatWrite<CR>', default_options)
|
||||||
|
|
||||||
-- Finds
|
-- Telescope keymaps
|
||||||
|
vim.keymap.set('n', '<leader>ff', telescope.find_files, {})
|
||||||
|
vim.keymap.set('n', '<leader>fg', telescope.live_grep, {})
|
||||||
|
vim.keymap.set('n', '<leader>fb', telescope.buffers, {})
|
||||||
|
vim.keymap.set('n', '<leader>fh', telescope.help_tags, {})
|
||||||
|
|
||||||
-- Find espanso config files.
|
-- Find espanso config files.
|
||||||
keymap('n', '<leader>fe', function()
|
keymap('n', '<leader>fe', function()
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ return {
|
|||||||
config = function()
|
config = function()
|
||||||
require("go").setup()
|
require("go").setup()
|
||||||
end,
|
end,
|
||||||
event = {"CmdlineEnter"},
|
--event = {'BufReadPre', 'BufNewFile'},
|
||||||
ft = {"go", 'gomod'},
|
ft = {"go", 'gomod'},
|
||||||
build = ':lua require("go.install").update_all_sync()' -- if you need to install/update all binaries
|
build = ':lua require("go.install").update_all_sync()' -- if you need to install/update all binaries
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,9 @@ return {
|
|||||||
enable_diagnostics = true,
|
enable_diagnostics = true,
|
||||||
filesystem = {
|
filesystem = {
|
||||||
always_show = {
|
always_show = {
|
||||||
"plugins"
|
"plugins",
|
||||||
|
".zshrc",
|
||||||
|
".zshenv"
|
||||||
},
|
},
|
||||||
filtered_items = {
|
filtered_items = {
|
||||||
hide_dotfiles = false
|
hide_dotfiles = false
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ return {
|
|||||||
dependencies = {
|
dependencies = {
|
||||||
'akinsho/toggleterm.nvim'
|
'akinsho/toggleterm.nvim'
|
||||||
},
|
},
|
||||||
event = { 'BufReadPre', 'BufNewFile' },
|
ft = { 'swfit' },
|
||||||
config = function()
|
config = function()
|
||||||
require('swift').setup()
|
require('swift').setup()
|
||||||
local default_options = { noremap = true, silent = true }
|
local default_options = { noremap = true, silent = true }
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ return {
|
|||||||
dependencies = {
|
dependencies = {
|
||||||
'nvim-lua/plenary.nvim'
|
'nvim-lua/plenary.nvim'
|
||||||
},
|
},
|
||||||
|
lazy = true,
|
||||||
config = function()
|
config = function()
|
||||||
local actions = require('telescope.actions')
|
local actions = require('telescope.actions')
|
||||||
|
|
||||||
@@ -67,12 +68,5 @@ return {
|
|||||||
buffer_previewer_maker = require'telescope.previewers'.buffer_previewer_maker
|
buffer_previewer_maker = require'telescope.previewers'.buffer_previewer_maker
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
local builtin = require('telescope.builtin')
|
|
||||||
-- Telescope keymaps
|
|
||||||
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
|
|
||||||
vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
|
|
||||||
vim.keymap.set('n', '<leader>fb', builtin.buffers, {})
|
|
||||||
vim.keymap.set('n', '<leader>fh', builtin.help_tags, {})
|
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
return {
|
return {
|
||||||
'akinsho/toggleterm.nvim',
|
'akinsho/toggleterm.nvim',
|
||||||
enable = true,
|
enable = true,
|
||||||
|
lazy = true,
|
||||||
opts = {
|
opts = {
|
||||||
size = 20,
|
size = 20,
|
||||||
open_mapping = [[<c-\>]],
|
open_mapping = [[<c-\>]],
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ bind -n M-h previous-window
|
|||||||
bind -n M-L next-window
|
bind -n M-L next-window
|
||||||
bind C-l send-keys 'C-l'
|
bind C-l send-keys 'C-l'
|
||||||
|
|
||||||
|
|
||||||
bind-key -r f run-shell "tmux neww ~/.local/scripts/tmux-sessionator"
|
bind-key -r f run-shell "tmux neww ~/.local/scripts/tmux-sessionator"
|
||||||
bind-key -r C run-shell "tmux neww ~/.local/scripts/tmux-sessionator ~/.dotfiles"
|
bind-key -r C run-shell "tmux neww ~/.local/scripts/tmux-sessionator ~/.dotfiles"
|
||||||
bind-key -r S run-shell -b "~/.config/tmux/plugins/tmux-fzf/scripts/session.sh switch"
|
bind-key -r S run-shell -b "~/.config/tmux/plugins/tmux-fzf/scripts/session.sh switch"
|
||||||
|
|||||||
@@ -32,17 +32,6 @@ export LESSHISTFILE="-"
|
|||||||
|
|
||||||
#------------------------------ path ------------------------------
|
#------------------------------ path ------------------------------
|
||||||
|
|
||||||
path_append() {
|
|
||||||
declare arg
|
|
||||||
for arg in "$@"; do
|
|
||||||
test -d "$arg" || continue
|
|
||||||
PATH=${PATH//":$arg:"/:}
|
|
||||||
PATH=${PATH/#"$arg:"/}
|
|
||||||
PATH=${PATH/%":$arg"/}
|
|
||||||
export PATH="${PATH:+"$PATH:"}$arg"
|
|
||||||
done
|
|
||||||
} && export path_append
|
|
||||||
|
|
||||||
path_prepend() {
|
path_prepend() {
|
||||||
declare arg
|
declare arg
|
||||||
for arg in "$@"; do
|
for arg in "$@"; do
|
||||||
@@ -76,12 +65,6 @@ path_prepend \
|
|||||||
"$HOME/.local/bin" \
|
"$HOME/.local/bin" \
|
||||||
"$SCRIPTS"
|
"$SCRIPTS"
|
||||||
|
|
||||||
fpath_prepend \
|
|
||||||
"$(brew --prefix)/share/zsh/site-functions" \
|
|
||||||
"$(brew --prefix)/share/zsh-completions" \
|
|
||||||
"$ZDOTDIR/completions" \
|
|
||||||
"$HOME/.local/completions"
|
|
||||||
|
|
||||||
#------------------------------ history ------------------------------
|
#------------------------------ history ------------------------------
|
||||||
setopt appendhistory # append to history
|
setopt appendhistory # append to history
|
||||||
setopt sharehistory # share history across multiple sessions
|
setopt sharehistory # share history across multiple sessions
|
||||||
@@ -166,24 +149,22 @@ alias tss='~/.local/scripts/tmux-sessionator --choose'
|
|||||||
alias tls='tmux list-sessions'
|
alias tls='tmux list-sessions'
|
||||||
alias temp='cd $(mktemp -d)'
|
alias temp='cd $(mktemp -d)'
|
||||||
alias vi='nvim'
|
alias vi='nvim'
|
||||||
alias n='unset VIMINIT && unset MYVIMRC && nvim'
|
|
||||||
alias nvim='unset VIMINIT && unset MYVIMRC && nvim'
|
alias nvim='unset VIMINIT && unset MYVIMRC && nvim'
|
||||||
alias nvim-mhoush='NVIM_APPNAME=m-housh && nvim'
|
alias nvim-mhoush='NVIM_APPNAME=m-housh && nvim'
|
||||||
alias nvim-kickstart='NVIM_APPNAME=kickstart nvim'
|
alias nvim-kickstart='NVIM_APPNAME=kickstart nvim'
|
||||||
alias nvim-lazy='NVIM_APPNAME=lazy nvim'
|
alias nvim-lazy='NVIM_APPNAME=lazy nvim'
|
||||||
|
|
||||||
|
|
||||||
#------------------------------ functions ------------------------------
|
|
||||||
|
|
||||||
# Create a directory and move into it.
|
|
||||||
mkcd() {
|
|
||||||
local dir="$1"
|
|
||||||
mkdir -p "$dir" && cd "$dir"
|
|
||||||
} && export mkcd
|
|
||||||
|
|
||||||
#------------------------------ local configs ------------------------------
|
#------------------------------ local configs ------------------------------
|
||||||
_source_if "$ZDOTDIR/.zshrc-local"
|
_source_if "$ZDOTDIR/.zshrc-local"
|
||||||
|
|
||||||
# [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
|
#------------------------------ functions ------------------------------
|
||||||
|
fpath_prepend \
|
||||||
|
"$(brew --prefix)/share/zsh/site-functions" \
|
||||||
|
"$(brew --prefix)/share/zsh-completions" \
|
||||||
|
"$ZDOTDIR/completions" \
|
||||||
|
"$HOME/.local/completions" \
|
||||||
|
"$ZDOTDIR/functions"
|
||||||
|
|
||||||
|
autoload -Uz $fpath[1]/*(.:t)
|
||||||
|
|
||||||
|
|
||||||
#test -d "$HOME/.tea" && source <("$HOME/.tea/tea.xyz/v*/bin/tea" --magic=zsh --silent)
|
|
||||||
|
|||||||
17
zsh/config/functions/n
Executable file
17
zsh/config/functions/n
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
|
# Open's neovim.
|
||||||
|
#
|
||||||
|
# If the argument passed in is a directory or not supplied, then
|
||||||
|
# open neovim with telescope find files opened. Otherwise open the
|
||||||
|
# file that is supplied.
|
||||||
|
#
|
||||||
|
|
||||||
|
function n() {
|
||||||
|
[ -d "$1" ] || [ -z "$1" ] \
|
||||||
|
&& nvim -c ":Telescope find_files" \
|
||||||
|
&& return 0
|
||||||
|
|
||||||
|
nvim "$1"
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user