diff --git a/common/packages.nix b/common/packages.nix index 4aa9f62..79ae915 100644 --- a/common/packages.nix +++ b/common/packages.nix @@ -47,7 +47,6 @@ in # productivity bat colordiff - direnv exa fd jq diff --git a/home/default.nix b/home/default.nix index 0cda8d7..c981534 100644 --- a/home/default.nix +++ b/home/default.nix @@ -39,6 +39,8 @@ in home-manager.enable = true; + direnv.enable = true; + git = { enable = true; @@ -116,18 +118,18 @@ in ZSH_DISABLE_COMPFIX = "true"; }; - initExtra = '' - export PATH=$PATH:~/.cargo/bin - export PATH=$PATH:~/.local/bin + envExtra = '' export PAGER=less export EDITOR=vim + export PATH=$PATH:~/.cargo/bin + export PATH=$PATH:~/.local/bin export GOPATH=~/go export GOBIN=$GOPATH/bin export PATH=$PATH:$GOBIN + ''; - eval "$(direnv hook zsh)" - + initExtra = '' setopt noincappendhistory source $HOME/.zsh-work @@ -135,6 +137,8 @@ in if [[ "$OSTYPE" == "darwin"* ]]; then export PATH="$(brew --prefix)/opt/gnu-tar/libexec/gnubin:$PATH" export PATH="$(brew --prefix)/opt/gnu-sed/libexec/gnubin:$PATH" + + alias xdg-open=open fi ''; diff --git a/home/nvim/lua/init.lua b/home/nvim/lua/init.lua index 7101173..0e3b3de 100644 --- a/home/nvim/lua/init.lua +++ b/home/nvim/lua/init.lua @@ -1,4 +1,4 @@ -------------------------------------------------------------------------------- +----------------------------------------------------------------------------- -- Options {{{1 --------------------------------------------------------------- ------------------------------------------------------------------------------- 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.smarttab = true -- / indent/dedent in leading whitespace --- Custom Commands +-- Format JSON vim.cmd[[command! JsonFormat execute "::%!jq '.'"]] -- Tab shortcuts @@ -66,31 +66,45 @@ vim.api.nvim_set_keymap("n", "", "tabnew", {noremap = true} ) --- copy to OS clipboard +-- Copy to OS clipboard vim.api.nvim_set_keymap("v", "y", "\"+y", {noremap = true} ) --- NvimTreeToggle -vim.api.nvim_set_keymap("n", "n", "NvimTreeToggle", - {noremap = true} -) -vim.api.nvim_set_keymap("n", "r", "NvimTreeRefresh", - {noremap = true} -) -vim.api.nvim_set_keymap("n", "nf", "NvimTreeFindFile", - {noremap = true} -) - -- Folding vim.api.nvim_set_keymap("n", "", "za", {silent = true, noremap = true} ) +-- Map gx to xdg-open +vim.api.nvim_set_keymap("n", "gx", ":execute 'silent! !xdg-open ' . shellescape(expand(''), 1)", + {silent = true, noremap = true} +) + --Set colorscheme vim.o.termguicolors = true vim.cmd[[colorscheme gruvbox]] +-- Use tab as trigger keys +vim.cmd[[imap (completion_smart_tab)]] +vim.cmd[[imap (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 "hy:%s/h//g]] + +-- 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 ------------------------------------------------------------------- ------------------------------------------------------------------------------- @@ -303,6 +317,17 @@ vim.api.nvim_set_keymap("n", "fg", "Telescope live_grep", {silent = true, noremap = true} ) +-- NvimTree +vim.api.nvim_set_keymap("n", "n", "NvimTreeToggle", + {noremap = true} +) +vim.api.nvim_set_keymap("n", "r", "NvimTreeRefresh", + {noremap = true} +) +vim.api.nvim_set_keymap("n", "nf", "NvimTreeFindFile", + {noremap = true} +) + -- syntastic vim.g.syntastic_always_populate_loc_list = 1 vim.g.syntastic_auto_loc_list = 1 @@ -312,23 +337,3 @@ vim.g.syntastic_check_on_wq = 0 -- completion-nvim vim.cmd[[autocmd BufEnter * lua require'completion'.on_attach()]] --- use tab as trigger keys -vim.cmd[[imap (completion_smart_tab)]] -vim.cmd[[imap (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 "hy:%s/h//g]] - --- 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\+$/]] - diff --git a/machines/demeter/configuration.nix b/machines/demeter/configuration.nix index 8547943..5ba4ace 100644 --- a/machines/demeter/configuration.nix +++ b/machines/demeter/configuration.nix @@ -17,6 +17,5 @@ enableCompletion = false; }; - # Used for backwards compatibility, please read the changelog before changing. system.stateVersion = 4; }