mirror of
https://github.com/davegallant/nix-config
synced 2025-08-07 09:12:28 +00:00
Map gx in nvim to xdg-open/open
This commit is contained in:
@@ -47,7 +47,6 @@ in
|
|||||||
# productivity
|
# productivity
|
||||||
bat
|
bat
|
||||||
colordiff
|
colordiff
|
||||||
direnv
|
|
||||||
exa
|
exa
|
||||||
fd
|
fd
|
||||||
jq
|
jq
|
||||||
|
@@ -39,6 +39,8 @@ in
|
|||||||
|
|
||||||
home-manager.enable = true;
|
home-manager.enable = true;
|
||||||
|
|
||||||
|
direnv.enable = true;
|
||||||
|
|
||||||
git = {
|
git = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
@@ -116,18 +118,18 @@ in
|
|||||||
ZSH_DISABLE_COMPFIX = "true";
|
ZSH_DISABLE_COMPFIX = "true";
|
||||||
};
|
};
|
||||||
|
|
||||||
initExtra = ''
|
envExtra = ''
|
||||||
export PATH=$PATH:~/.cargo/bin
|
|
||||||
export PATH=$PATH:~/.local/bin
|
|
||||||
export PAGER=less
|
export PAGER=less
|
||||||
export EDITOR=vim
|
export EDITOR=vim
|
||||||
|
|
||||||
|
export PATH=$PATH:~/.cargo/bin
|
||||||
|
export PATH=$PATH:~/.local/bin
|
||||||
export GOPATH=~/go
|
export GOPATH=~/go
|
||||||
export GOBIN=$GOPATH/bin
|
export GOBIN=$GOPATH/bin
|
||||||
export PATH=$PATH:$GOBIN
|
export PATH=$PATH:$GOBIN
|
||||||
|
'';
|
||||||
|
|
||||||
eval "$(direnv hook zsh)"
|
initExtra = ''
|
||||||
|
|
||||||
setopt noincappendhistory
|
setopt noincappendhistory
|
||||||
|
|
||||||
source $HOME/.zsh-work
|
source $HOME/.zsh-work
|
||||||
@@ -135,6 +137,8 @@ in
|
|||||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
export PATH="$(brew --prefix)/opt/gnu-tar/libexec/gnubin:$PATH"
|
export PATH="$(brew --prefix)/opt/gnu-tar/libexec/gnubin:$PATH"
|
||||||
export PATH="$(brew --prefix)/opt/gnu-sed/libexec/gnubin:$PATH"
|
export PATH="$(brew --prefix)/opt/gnu-sed/libexec/gnubin:$PATH"
|
||||||
|
|
||||||
|
alias xdg-open=open
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
-------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- Options {{{1 ---------------------------------------------------------------
|
-- Options {{{1 ---------------------------------------------------------------
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
vim.opt.autoindent = true -- maintain indent of current line
|
vim.opt.autoindent = true -- maintain indent of current line
|
||||||
@@ -58,7 +58,7 @@ vim.opt.sidescroll = 0 -- sidescroll in jumps because t
|
|||||||
vim.opt.sidescrolloff = 3 -- same as scrolloff, but for columns
|
vim.opt.sidescrolloff = 3 -- same as scrolloff, but for columns
|
||||||
vim.opt.smarttab = true -- <tab>/<BS> indent/dedent in leading whitespace
|
vim.opt.smarttab = true -- <tab>/<BS> indent/dedent in leading whitespace
|
||||||
|
|
||||||
-- Custom Commands
|
-- Format JSON
|
||||||
vim.cmd[[command! JsonFormat execute "::%!jq '.'"]]
|
vim.cmd[[command! JsonFormat execute "::%!jq '.'"]]
|
||||||
|
|
||||||
-- Tab shortcuts
|
-- Tab shortcuts
|
||||||
@@ -66,31 +66,45 @@ vim.api.nvim_set_keymap("n", "<C-n>", "<cmd>tabnew<cr>",
|
|||||||
{noremap = true}
|
{noremap = true}
|
||||||
)
|
)
|
||||||
|
|
||||||
-- copy to OS clipboard
|
-- Copy to OS clipboard
|
||||||
vim.api.nvim_set_keymap("v", "<leader>y", "\"+y",
|
vim.api.nvim_set_keymap("v", "<leader>y", "\"+y",
|
||||||
{noremap = true}
|
{noremap = true}
|
||||||
)
|
)
|
||||||
|
|
||||||
-- NvimTreeToggle
|
|
||||||
vim.api.nvim_set_keymap("n", "<leader>n", "<cmd>NvimTreeToggle<cr>",
|
|
||||||
{noremap = true}
|
|
||||||
)
|
|
||||||
vim.api.nvim_set_keymap("n", "<leader>r", "<cmd>NvimTreeRefresh<cr>",
|
|
||||||
{noremap = true}
|
|
||||||
)
|
|
||||||
vim.api.nvim_set_keymap("n", "<leader>nf", "<cmd>NvimTreeFindFile<cr>",
|
|
||||||
{noremap = true}
|
|
||||||
)
|
|
||||||
|
|
||||||
-- Folding
|
-- Folding
|
||||||
vim.api.nvim_set_keymap("n", "<space>", "za",
|
vim.api.nvim_set_keymap("n", "<space>", "za",
|
||||||
{silent = true, noremap = true}
|
{silent = true, noremap = true}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
-- Map gx to xdg-open
|
||||||
|
vim.api.nvim_set_keymap("n", "gx", ":execute 'silent! !xdg-open ' . shellescape(expand('<cWORD>'), 1)<cr>",
|
||||||
|
{silent = true, noremap = true}
|
||||||
|
)
|
||||||
|
|
||||||
--Set colorscheme
|
--Set colorscheme
|
||||||
vim.o.termguicolors = true
|
vim.o.termguicolors = true
|
||||||
vim.cmd[[colorscheme gruvbox]]
|
vim.cmd[[colorscheme gruvbox]]
|
||||||
|
|
||||||
|
-- Use tab as trigger keys
|
||||||
|
vim.cmd[[imap <tab> <Plug>(completion_smart_tab)]]
|
||||||
|
vim.cmd[[imap <s-tab> <Plug>(completion_smart_s_tab)]]
|
||||||
|
|
||||||
|
-- Remember line number
|
||||||
|
vim.cmd[[au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif]]
|
||||||
|
|
||||||
|
-- Replace visual selection
|
||||||
|
vim.cmd[[vnoremap <C-r> "hy:%s/<C-r>h//g<left><left>]]
|
||||||
|
|
||||||
|
-- Indent YAML
|
||||||
|
vim.cmd[[au FileType yaml setlocal ts=2 sts=2 sw=2 expandtab]]
|
||||||
|
|
||||||
|
-- Indent Python
|
||||||
|
vim.cmd[[au BufNewFile,BufRead *.py set tabstop=4 softtabstop=4 shiftwidth=4 textwidth=79 expandtab autoindent fileformat=unix]]
|
||||||
|
|
||||||
|
-- Highlight whitespace
|
||||||
|
vim.cmd[[highlight ExtraWhitespace ctermbg=red guibg=red]]
|
||||||
|
vim.cmd[[match ExtraWhitespace /\s\+$/]]
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
-- LSP {{{1 -------------------------------------------------------------------
|
-- LSP {{{1 -------------------------------------------------------------------
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@@ -303,6 +317,17 @@ vim.api.nvim_set_keymap("n", "<leader>fg", "<cmd>Telescope live_grep<cr>",
|
|||||||
{silent = true, noremap = true}
|
{silent = true, noremap = true}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
-- NvimTree
|
||||||
|
vim.api.nvim_set_keymap("n", "<leader>n", "<cmd>NvimTreeToggle<cr>",
|
||||||
|
{noremap = true}
|
||||||
|
)
|
||||||
|
vim.api.nvim_set_keymap("n", "<leader>r", "<cmd>NvimTreeRefresh<cr>",
|
||||||
|
{noremap = true}
|
||||||
|
)
|
||||||
|
vim.api.nvim_set_keymap("n", "<leader>nf", "<cmd>NvimTreeFindFile<cr>",
|
||||||
|
{noremap = true}
|
||||||
|
)
|
||||||
|
|
||||||
-- syntastic
|
-- syntastic
|
||||||
vim.g.syntastic_always_populate_loc_list = 1
|
vim.g.syntastic_always_populate_loc_list = 1
|
||||||
vim.g.syntastic_auto_loc_list = 1
|
vim.g.syntastic_auto_loc_list = 1
|
||||||
@@ -312,23 +337,3 @@ vim.g.syntastic_check_on_wq = 0
|
|||||||
-- completion-nvim
|
-- completion-nvim
|
||||||
vim.cmd[[autocmd BufEnter * lua require'completion'.on_attach()]]
|
vim.cmd[[autocmd BufEnter * lua require'completion'.on_attach()]]
|
||||||
|
|
||||||
-- use tab as trigger keys
|
|
||||||
vim.cmd[[imap <tab> <Plug>(completion_smart_tab)]]
|
|
||||||
vim.cmd[[imap <s-tab> <Plug>(completion_smart_s_tab)]]
|
|
||||||
|
|
||||||
-- Remember line number
|
|
||||||
vim.cmd[[au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif]]
|
|
||||||
|
|
||||||
--Replace visually selected
|
|
||||||
vim.cmd[[vnoremap <C-r> "hy:%s/<C-r>h//g<left><left>]]
|
|
||||||
|
|
||||||
-- Indent YAML
|
|
||||||
vim.cmd[[au FileType yaml setlocal ts=2 sts=2 sw=2 expandtab]]
|
|
||||||
|
|
||||||
-- Python indentation
|
|
||||||
vim.cmd[[au BufNewFile,BufRead *.py set tabstop=4 softtabstop=4 shiftwidth=4 textwidth=79 expandtab autoindent fileformat=unix]]
|
|
||||||
|
|
||||||
-- Highlight whitespace
|
|
||||||
vim.cmd[[highlight ExtraWhitespace ctermbg=red guibg=red]]
|
|
||||||
vim.cmd[[match ExtraWhitespace /\s\+$/]]
|
|
||||||
|
|
||||||
|
@@ -17,6 +17,5 @@
|
|||||||
enableCompletion = false;
|
enableCompletion = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Used for backwards compatibility, please read the changelog before changing.
|
|
||||||
system.stateVersion = 4;
|
system.stateVersion = 4;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user