From 5b7c268d1cf1f71a1f2f837a0ed850fe6fbf09c4 Mon Sep 17 00:00:00 2001
From: Luca Bilke <luca@gmail.com>
Date: Tue, 27 Sep 2022 18:34:12 +0200
Subject: [PATCH 1/2] more work on vim

---
 .config/nvim/lua/lualine-conf.lua | 215 ++++++++++++++++++++++++++++++
 .config/nvim/lua/options.lua      |  22 +--
 .config/nvim/lua/plugins.lua      |  63 +++++++--
 3 files changed, 277 insertions(+), 23 deletions(-)
 create mode 100644 .config/nvim/lua/lualine-conf.lua

diff --git a/.config/nvim/lua/lualine-conf.lua b/.config/nvim/lua/lualine-conf.lua
new file mode 100644
index 00000000..b14f3112
--- /dev/null
+++ b/.config/nvim/lua/lualine-conf.lua
@@ -0,0 +1,215 @@
+local lualine = require('lualine')
+local colors = require("tokyonight.colors").setup({ transform = true })
+local config = require("tokyonight.config").options
+local theme = {}
+theme.normal = {
+  a = { bg = colors.blue, fg = colors.black },
+  b = { bg = colors.fg_gutter, fg = colors.blue },
+  c = { bg = colors.bg_statusline, fg = colors.fg_sidebar },
+}
+theme.insert = {
+  a = { bg = colors.green, fg = colors.black },
+  b = { bg = colors.fg_gutter, fg = colors.green },
+}
+theme.command = {
+  a = { bg = colors.yellow, fg = colors.black },
+  b = { bg = colors.fg_gutter, fg = colors.yellow },
+}
+theme.visual = {
+  a = { bg = colors.magenta, fg = colors.black },
+  b = { bg = colors.fg_gutter, fg = colors.magenta },
+}
+theme.replace = {
+  a = { bg = colors.red, fg = colors.black },
+  b = { bg = colors.fg_gutter, fg = colors.red },
+}
+theme.inactive = {
+  a = { bg = colors.bg_statusline, fg = colors.blue },
+  b = { bg = colors.bg_statusline, fg = colors.fg_gutter, gui = "bold" },
+  c = { bg = colors.bg_statusline, fg = colors.fg_gutter },
+}
+if config.lualine_bold then
+  for _, mode in pairs(theme) do
+    mode.a.gui = "bold"
+  end
+end
+
+local conditions = {
+  buffer_not_empty = function()
+    return vim.fn.empty(vim.fn.expand('%:t')) ~= 1
+  end,
+  hide_in_width = function()
+    return vim.fn.winwidth(0) > 80
+  end,
+  check_git_workspace = function()
+    local filepath = vim.fn.expand('%:p:h')
+    local gitdir = vim.fn.finddir('.git', filepath .. ';')
+    return gitdir and #gitdir > 0 and #gitdir < #filepath
+  end,
+}
+
+lualine.options = {
+  component_separators = '',
+  section_separators = '',
+  theme = theme
+}
+lualine.sections = {
+  lualine_a = {},
+  lualine_b = {},
+  lualine_y = {},
+  lualine_z = {},
+  lualine_c = {},
+  lualine_x = {},
+}
+lualine.inactive_sections = {
+  lualine_a = {},
+  lualine_b = {},
+  lualine_y = {},
+  lualine_z = {},
+  lualine_c = {},
+  lualine_x = {},
+}
+
+local function ins_left(component)
+  table.insert(lualine.sections.lualine_c, component)
+end
+
+local function ins_right(component)
+  table.insert(lualine.sections.lualine_x, component)
+end
+
+local function mode_color()
+  local color = {
+    n = colors.red,
+    i = colors.green,
+    v = colors.magenta,
+    [''] = colors.magenta,
+    V = colors.magenta,
+    c = colors.blue,
+    no = colors.red,
+    s = colors.orange,
+    S = colors.orange,
+    [''] = colors.orange,
+    ic = colors.yellow,
+    R = colors.violet,
+    Rv = colors.violet,
+    cv = colors.red,
+    ce = colors.red,
+    r = colors.cyan,
+    rm = colors.cyan,
+    ['r?'] = colors.cyan,
+    ['!'] = colors.red,
+    t = colors.red,
+  }
+  return { fg = color[vim.fn.mode()] }
+end
+
+ins_left {
+  function()
+    return '▊'
+  end,
+  color = function ()
+    return mode_color()
+  end,
+  padding = { right = 1 },
+}
+
+ins_left {
+  function()
+    local msg = 'No Active Lsp'
+    local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype')
+    local clients = vim.lsp.get_active_clients()
+    if next(clients) == nil then
+      return msg
+    end
+    for _, client in ipairs(clients) do
+      local filetypes = client.config.filetypes
+      if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
+        return client.name
+      end
+    end
+    return msg
+  end,
+  icon = ' LSP:',
+  color = { fg = colors.white },
+}
+
+ins_left {
+  'diagnostics',
+  sources = { 'nvim_diagnostic' },
+  symbols = { error = ' ', warn = ' ', info = ' ' },
+  diagnostics_color = {
+    color_error = { fg = colors.red },
+    color_warn = { fg = colors.yellow },
+    color_info = { fg = colors.cyan },
+  },
+}
+
+ins_left {
+  function()
+    return '%='
+  end,
+}
+
+ins_left {
+  'filename',
+  cond = conditions.buffer_not_empty,
+  color = { fg = colors.magenta, gui = 'bold' },
+}
+
+ins_left {
+  function()
+    local current_line = vim.fn.line "."
+    local total_lines = vim.fn.line "$"
+    local chars = { "", "", "", "", "", "", "", "", "", "", "", "", "" }
+    local line_ratio = current_line / total_lines
+    local index = math.ceil(line_ratio * #chars)
+    return chars[index]
+  end,
+  color = { fg = colors.yellow }
+}
+
+ins_left {
+  '%04l:%04c',
+}
+
+ins_right {
+  'o:encoding',
+  fmt = string.upper,
+  cond = conditions.hide_in_width,
+  color = { fg = colors.green, gui = 'bold' },
+}
+
+ins_right {
+  'fileformat',
+  fmt = string.upper,
+  icons_enabled = false,
+  color = { fg = colors.green, gui = 'bold' },
+}
+
+ins_right {
+  'branch',
+  icon = '',
+  color = { fg = colors.violet, gui = 'bold' },
+}
+
+ins_right {
+  'diff',
+  symbols = { added = ' ', modified = '柳 ', removed = ' ' },
+  diff_color = {
+    added = { fg = colors.green },
+    modified = { fg = colors.orange },
+    removed = { fg = colors.red },
+  },
+  cond = conditions.hide_in_width,
+}
+
+ins_right {
+  function()
+    return '▊'
+  end,
+  color = function ()
+    return mode_color()
+  end,
+  padding = { left = 1 },
+}
diff --git a/.config/nvim/lua/options.lua b/.config/nvim/lua/options.lua
index f1f5af20..51b7a551 100644
--- a/.config/nvim/lua/options.lua
+++ b/.config/nvim/lua/options.lua
@@ -1,10 +1,14 @@
-vim.opt.undodir                           = vim.fn.stdpath "cache" .. "/undo"
-vim.opt.undofile                          = true
-vim.opt.titlestring                       = " %t"
-vim.opt.termguicolors                     = true
-vim.opt.timeoutlen                        = 500
-vim.opt.foldmethod                        = "expr"
-vim.opt.foldlevelstart                    = 99
-vim.opt.foldexpr                          = "nvim_treesitter#foldexpr()"
+vim.g.loaded             = 1
+vim.g.loaded_netrwPlugin = 1
+vim.g.tokyonight_style   = "night"
 
-vim.g.tokyonight_style                    = "night"
+vim.opt.undodir          = vim.fn.stdpath "cache" .. "/undo"
+vim.opt.undofile         = true
+vim.opt.titlestring      = " %t"
+vim.opt.termguicolors    = true
+vim.opt.timeoutlen       = 500
+vim.opt.foldmethod       = "expr"
+vim.opt.foldlevelstart   = 99
+vim.opt.foldexpr         = "nvim_treesitter#foldexpr()"
+
+vim.cmd[[colorscheme tokyonight]]
diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua
index 042ce828..c191a3c5 100644
--- a/.config/nvim/lua/plugins.lua
+++ b/.config/nvim/lua/plugins.lua
@@ -13,33 +13,59 @@ local packer_bootstrap = ensure_packer()
 
 return require('packer').startup(function(use)
   use 'wbthomason/packer.nvim'
-  use 'williamboman/mason.nvim'
-  use { 'williamboman/mason-lspconfig.nvim',
-    requires = 'neovim/nvim-lspconfig'
-  }
-
   use 'fladson/vim-kitty'
   use 'folke/lua-dev.nvim'
   use 'tpope/vim-surround'
   use 'tpope/vim-repeat'
-  use 'folke/tokyonight.nvim'
   use 'vimwiki/vimwiki'
-  use { 'nvim-treesitter/nvim-treesitter',
+  use 'kyazdani42/nvim-web-devicons'
+  use 'nvim-lualine/lualine.nvim'
+  -- setup handled in lualine-conf.lua
+  use {
+    'akinsho/bufferline.nvim',
+    config = function()
+      require('bufferline').setup()
+    end
+  }
+  use {
+    'nvim-treesitter/nvim-treesitter',
     run = ':TSUpdate'
   }
-  use { 'felipec/vim-sanegx',
+  use {
+    'kyazdani42/nvim-tree.lua',
+    config = function()
+      require('nvim-tree').setup()
+    end
+  }
+  use {
+    'felipec/vim-sanegx',
     event = 'BufRead',
   }
-  use { 'ptzz/lf.vim',
-    requires = 'voldikss/vim-floaterm',
-  }
-  use { 'sindrets/diffview.nvim',
+  use {
+    'sindrets/diffview.nvim',
     requires = 'nvim-lua/plenary.nvim',
     event = 'BufRead'
   }
-  use { 'norcalli/nvim-colorizer.lua',
+  use {
+    'williamboman/mason.nvim',
     config = function()
-      require('colorizer').setup({ '*' }, {
+      require('mason').setup()
+    end
+  }
+  use {
+    'williamboman/mason-lspconfig.nvim',
+    requires = 'neovim/nvim-lspconfig'
+  }
+  use {
+    'lewis6991/gitsigns.nvim',
+    config = function()
+      require('gitsigns').setup()
+    end
+  }
+  use {
+    'norcalli/nvim-colorizer.lua',
+    config = function()
+      require('colorizer').setup({'*'}, {
         RGB = true, -- #RGB hex codes
         RRGGBB = true, -- #RRGGBB hex codes
         RRGGBBAA = true, -- #RRGGBBAA hex codes
@@ -50,6 +76,15 @@ return require('packer').startup(function(use)
       })
     end,
   }
+  use {
+    'folke/tokyonight.nvim',
+    config = function()
+      require("tokyonight").setup({
+        style = "night",
+        transparent = true,
+      })
+    end,
+  }
   if packer_bootstrap then
     require('packer').sync()
   end

From 17b03d096baf15738c7ba7603dcb222f67bbc228 Mon Sep 17 00:00:00 2001
From: Luca Bilke <luca@gmail.com>
Date: Tue, 27 Sep 2022 18:34:34 +0200
Subject: [PATCH 2/2] small additions

---
 .config/nvim/init.lua | 1 +
 .config/shell/aliasrc | 5 +++++
 .local/bin/remaps     | 2 +-
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua
index ce7bddd6..fff35518 100644
--- a/.config/nvim/init.lua
+++ b/.config/nvim/init.lua
@@ -2,3 +2,4 @@ require('plugins')
 require('options')
 require('keybinds')
 require('autocmds')
+require('lualine-conf')
diff --git a/.config/shell/aliasrc b/.config/shell/aliasrc
index 370377c5..5bdb639b 100644
--- a/.config/shell/aliasrc
+++ b/.config/shell/aliasrc
@@ -57,3 +57,8 @@ alias \
   xpick=" xprop | awk '     
         /^WM_CLASS/{sub(/.* =/, \"instance:\"); sub(/,/, \"\nclass:\"); print}
         /^WM_NAME/{sub(/.* =/, \"title:\"); print}'"
+
+# Functions
+whed () {
+  $EDITOR "$(which "$1")"
+}
diff --git a/.local/bin/remaps b/.local/bin/remaps
index 8e1bd7d9..145c7e92 100755
--- a/.local/bin/remaps
+++ b/.local/bin/remaps
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-setxkbmap -layout de,us -variant nodeadkeys,dvp -option caps:super -option terminate:ctrl_alt_bksp
+setxkbmap -layout de,us -variant nodeadkeys,dvorak -option caps:super -option terminate:ctrl_alt_bksp
 xset r rate 300 50
 killall xcape 2>/dev/null ; xcape -e 'Super_L=Escape'
 xset -q | grep "Caps Lock:\s*on" && xdotool key Caps_Lock