Skip to content

My dotfiles (tmux, vim, fzf, etc.) for Ubuntu and MacOS. Deployed using "Yasli" framework.

License

Notifications You must be signed in to change notification settings

agronskiy/dotfiles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

My dotfiles and configs

license uses Ubuntu Test Install Macod Test Install

Some bits and pieces of the bashrc used here and there across my (Ubuntu/macos) machines, e.g. for prompt and commands.

Features

Along with many very personal features there are several which might be useful for common use-cases.

Nested tmux

Pressing F12 allows to dynamically switch off the prefix for outer tmux when logging in to a remote ssh with another (inner) tmux. The status bar is greyed out and the prefix is propagated to the inner tmux.

Local machine tmux only:

Local and remote, with local no receiving prefix:

Installation

Clone this repo into ~/.dotfiles, clone YASLI Framework to .yasli, and run yasli-main:

git clone https://github.com/agronskiy/configs.git $HOME/.dotfiles
git clone https://github.com/agronskiy/yasli.git $HOME/.yasli
~/.yasli/yasli-main

This would 99% smoothly install everything in a "Darwin" <-> "Ubuntu" cross-platform manner.

Some things one does manually

  • install nerd fonts
  • check latest neovim

Trivia

Caveat: Git autocompletion with git homebrew

See SO thread:

  • Git from brew installs its own version of git completions which a) is less powerful and b) comes first on $fpath:
ls ${^fpath}/_git(N)

In the homebrew case that can be the violating path:

> ll /usr/local/share/zsh/site-functions/_git

/usr/local/share/zsh/site-functions/_git@ -> ../../../Cellar/git/2.30.1/share/zsh/site-functions/_git

Need to delete that one and, assuming oh-my-zsh is installed, one gets the right one.

Snippets

Highlight groups for lighter background

highlights = {
  init = {
    -- `NC` are non-current. The color corresponds to my unfocused color for
    -- e.g. tmux panes etc.
    NormalNC = {
      bg = inactiveBgColor,
    },
    WinBarNC = {
      bg = inactiveBgColor,
    },
    NormalFloat = { -- overrides the floating windows
      bg = activeBgColor,
    },
    TelescopeBorder = {
      bg = activeBgColor,
    },
    TelescopeNormal = {
      bg = activeBgColor,
    },
    TelescopePromptBorder = {
      bg = activeBgColor,
    },
    TelescopePromptNormal = {
      bg = activeBgColor,
    },
    TelescopeResultsBorder = {
      bg = activeBgColor,
    },
    TelescopeResultsNormal = {
      bg = activeBgColor,
    },
    TelescopePreviewBorder = {
      bg = activeBgColor,
    },
    TelescopePreviewNormal = {
      bg = activeBgColor,
    },
  }
},

nvim-cmp setup for darker background

cmp = function(opts)
  -- opts parameter is the default options table
  -- the function is lazy loaded so cmp is able to be required
  local cmp = require "cmp"
  -- https://www.reddit.com/r/neovim/comments/yo77q6/comment/j6rr9kc/?utm_source=share&utm_medium=web2x&context=3
  vim.api.nvim_set_hl(0, "CustomCmpBG", { bg = activeBgColor })

  local border_opts = {
    border = "single",
    winhighlight = "Normal:CustomCmpBG,FloatBorder:CustomCmpBG,CursorLine:Visual,Search:None",
  }
  opts.window.completion = cmp.config.window.bordered(border_opts)
  opts.window.documentation = cmp.config.window.bordered(border_opts)
  -- return the new table to be used
  return opts
end,

Setup of telescope before switch to lua-fzf

  -- Fuzzy Finder (files, lsp, etc)
  {
    "nvim-telescope/telescope.nvim",
    dependencies = {
      "nvim-lua/plenary.nvim",
      { "nvim-telescope/telescope-fzf-native.nvim", enabled = vim.fn.executable "make" == 1, build = "make" },
      { "cbochs/grapple.nvim" },
      { "reaz1995/telescope-vim-bookmarks.nvim" },
    },
    cmd = "Telescope",
    opts = function()
      local actions = require "telescope.actions"
      local layout_actions = require("telescope.actions.layout")
      local common_settings = {
        w = 0.95,
        h = 0.9,
        vert_lines_cutoff = 20,
      }
      return {
        defaults = {
          git_worktrees = vim.g.git_worktrees,
          path_display = { "truncate" },
          sorting_strategy = "ascending",
          layout_strategy = "horizontal",
          layout_config = {
            horizontal = { prompt_position = "top", preview_width = 0.55 },
            preview_cutoff = 120,
            width = common_settings.h,
            height = common_settings.h,
            vertical = {
              mirror = true,
              prompt_position = "top",
              preview_cutoff = common_settings.vert_lines_cutoff,
              -- :h telescope.resolve
              preview_height = function(_, _, max_lines)
                -- Logic: keep preview dynamically changing in order to fix results
                -- height fixed
                if max_lines < common_settings.vert_lines_cutoff then
                  return math.ceil(max_lines * common_settings.h) - 6
                end
                return math.ceil(max_lines * common_settings.h) - 12
              end,
            }
          },
          mappings = {
            i = {
              ["jk"] = actions.close,
              ["<F2>"] = layout_actions.toggle_preview,
              ["<C-f>"] = actions.to_fuzzy_refine,
              ["jl"] = false,
              ["jj"] = false,
              ["<C-n>"] = actions.cycle_history_next,
              ["<C-p>"] = actions.cycle_history_prev,
              ["<C-j>"] = actions.move_selection_next,
              ["<C-k>"] = actions.move_selection_previous,
              ["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
            },
            n = { q = actions.close },
          },
        },
        pickers = {
          find_files = {
            preview = {
              hide_on_startup = true, -- long paths friendly
            }
          },
          buffers = {
            preview = {
              hide_on_startup = true, -- long paths friendly
            },
            layout_config = {
              width = 0.5,
              height = 15,
            }
          },
          oldfiles = {
            preview = {
              hide_on_startup = true, -- long paths friendly
            }
          },
          lsp_references = {
            fname_width = 80,
          },
          lsp_document_symbols = {
            fname_width = 80,
            symbol_width = 35,
          },
          lsp_workspace_symbols = {
            fname_width = 80,
            symbol_width = 35,
          },
        },
      }
    end,
    config = function(_, opts)
      -- Enable telescope fzf native, if installed
      require("telescope").setup(opts)
      pcall(require("telescope").load_extension, "fzf")     -- might be unavailable, hence pcall
      pcall(require("telescope").load_extension, "grapple") -- might be unavailable, hence pcall
    end,
  },

Acknowledgements

This started as a heavily adjusted version by @holman, inspiration from @AndreiBarsan and @samoshkin.

Uses Material Icons

About

My dotfiles (tmux, vim, fzf, etc.) for Ubuntu and MacOS. Deployed using "Yasli" framework.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published