diff options
Diffstat (limited to 'private_dot_config')
| -rw-r--r-- | private_dot_config/nvim/init.lua | 12 | ||||
| -rw-r--r-- | private_dot_config/nvim/lua/evil_lualine.lua | 152 | ||||
| -rw-r--r-- | private_dot_config/nvim/lua/lsp_conf.lua | 12 | 
3 files changed, 168 insertions, 8 deletions
diff --git a/private_dot_config/nvim/init.lua b/private_dot_config/nvim/init.lua index 092d647..b8c51a5 100644 --- a/private_dot_config/nvim/init.lua +++ b/private_dot_config/nvim/init.lua @@ -50,6 +50,11 @@ require('packer').startup(function(use)      use 'koraa/proverif.vim' +    use { +      'nvim-lualine/lualine.nvim', +      requires = { 'nvim-tree/nvim-web-devicons', opt = true } +    } +      -- Automatically set up the configuration after cloning packer.nvim      if packer_bootstrap then          require('packer').sync() @@ -172,6 +177,7 @@ vim.cmd [[      highlight LineNr guibg=NONE      highlight CursorLine guibg=NONE      highlight CursorLineNr guibg=NONE guifg=Yellow +    highlight StatusLineNC guibg=#0d1117 guifg=#cacaca      highlight Error guibg=red guifg=#000000      "highlight StatusLine guibg=#000000 guifg=Yellow      "highlight StatusLineNC guibg=#000000 guifg=Yellow @@ -201,7 +207,7 @@ vim.api.nvim_set_keymap('n', '<A-t>', ':NvimTreeToggle<CR>', { noremap = true })  vim.api.nvim_set_keymap('n', '<leader>pa', ':set paste<CR>', { noremap = true })  -- Enable paste mode  vim.api.nvim_set_keymap('n', '<leader>npa', ':set nopaste<CR>', { noremap = true })  -- Disable paste mode  vim.api.nvim_set_keymap('n', '<leader>cr', ':Cargo run<CR>', { noremap = true })  -- Run `cargo run` for Rust projects -vim.api.nvim_set_keymap('n', '<leader>xx', '<cmd>TroubleToggle<cr>', { noremap = true })  -- Toggle Trouble diagnostic window +vim.api.nvim_set_keymap('n', '<space>d', '<cmd>Trouble diagnostics<cr>', { noremap = true })  -- Toggle Trouble diagnostic window  vim.api.nvim_set_keymap('n', '<leader>ff', '<cmd>Telescope find_files<cr>', { noremap = true })  -- Find files with Telescope  vim.api.nvim_set_keymap('n', '<leader>fg', '<cmd>Telescope live_grep<cr>', { noremap = true })  -- Live grep with Telescope  vim.api.nvim_set_keymap('n', '<leader>fh', '<cmd>Telescope help_tags<cr>', { noremap = true })  -- Search help tags with Telescope @@ -219,13 +225,15 @@ require('todo-comments').setup {}  require('crates').setup {}  require('nvim-treesitter.configs').setup { highlight = { enable = true } }  require('lsp-colors').setup {} +require('Comment').setup()  -- require("ibl").setup { indent = {char = "¦"} }  -- vim.cmd.highlight('clear @ibl.scope.underline.1') --- General settings +-- General settings from ~/.config/nvim/lua/  require('git')  -- Load git-related settings  require('lsp_conf')  -- Load LSP configuration  require('dap_conf') +require('evil_lualine')  -- Set up language client for Go  vim.g.LanguageClient_serverCommands = { go = { 'gopls' } } diff --git a/private_dot_config/nvim/lua/evil_lualine.lua b/private_dot_config/nvim/lua/evil_lualine.lua new file mode 100644 index 0000000..b38e283 --- /dev/null +++ b/private_dot_config/nvim/lua/evil_lualine.lua @@ -0,0 +1,152 @@ +-- Eviline config for lualine +-- Author: shadmansaleh +-- Credit: glepnir +local lualine = require('lualine') + +-- Color table for highlights +-- stylua: ignore +local colors = { +  bg       = '#202328', +  fg       = '#bbc2cf', +  yellow   = '#ECBE7B', +  cyan     = '#008080', +  darkblue = '#081633', +  green    = '#98be65', +  orange   = '#FF8800', +  violet   = '#a9a1e1', +  magenta  = '#c678dd', +  blue     = '#51afef', +  red      = '#ec5f67', +} + +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, +} + +-- Config +local config = { +  options = { +    -- Disable sections and component separators +    component_separators = '', +    section_separators = '', +    theme = { +      -- We are going to use lualine_c an lualine_x as left and +      -- right section. Both are highlighted by c theme .  So we +      -- are just setting default looks o statusline +      normal = { c = { fg = colors.fg, bg = colors.bg } }, +      inactive = { c = { fg = colors.fg, bg = colors.bg } }, +    }, +  }, +  sections = { +    -- these are to remove the defaults +    lualine_a = {}, +    lualine_b = {}, +    lualine_y = {}, +    lualine_z = {}, +    -- These will be filled later +    lualine_c = {}, +    lualine_x = {}, +  }, +  inactive_sections = { +    -- these are to remove the defaults +    lualine_a = {}, +    lualine_b = {}, +    lualine_y = {}, +    lualine_z = {}, +    lualine_c = {}, +    lualine_x = {}, +  }, +} + +-- Inserts a component in lualine_c at left section +local function ins_left(component) +  table.insert(config.sections.lualine_c, component) +end + +-- Inserts a component in lualine_x at right section +local function ins_right(component) +  table.insert(config.sections.lualine_x, component) +end + +ins_left { +  'filename', +  cond = conditions.buffer_not_empty, +  path = 3, +  color = { fg = colors.magenta, gui = 'bold' }, +} + +ins_left { +  -- filesize component +  'filesize', +  cond = conditions.buffer_not_empty, +} + +ins_left { 'location' } + +ins_left { 'progress', color = { fg = colors.fg, gui = 'bold' } } +ins_left { +  'diagnostics', +  sources = { 'nvim_diagnostic' }, +  symbols = { error = ' ', warn = ' ', info = ' ' }, +  diagnostics_color = { +    error = { fg = colors.red }, +    warn = { fg = colors.yellow }, +    info = { fg = colors.cyan }, +  }, +} + +-- Insert mid section. You can make any number of sections in neovim :) +-- for lualine it's any number greater then 2 +ins_left { +  function() +    return '%=' +  end, +} + +-- Add components to right sections +ins_right { 'lsp_status' } + +ins_right { +  'o:encoding', -- option component same as &encoding in viml +  fmt = string.upper, -- I'm not sure why it's upper case either ;) +  cond = conditions.hide_in_width, +  color = { fg = colors.green, gui = 'bold' }, +} + +ins_right { +  'fileformat', +  fmt = string.upper, +  icons_enabled = false, -- I think icons are cool but Eviline doesn't have them. sigh +  color = { fg = colors.green, gui = 'bold' }, +} + +ins_right { +  'branch', +  icon = '', +  color = { fg = colors.violet, gui = 'bold' }, +} + +ins_right { +  'diff', +  -- Is it me or the symbol for modified us really weird +  symbols = { added = ' ', modified = ' ', removed = ' ' }, +  diff_color = { +    added = { fg = colors.green }, +    modified = { fg = colors.orange }, +    removed = { fg = colors.red }, +  }, +  cond = conditions.hide_in_width, +} + +-- Now don't forget to initialize lualine +lualine.setup(config) diff --git a/private_dot_config/nvim/lua/lsp_conf.lua b/private_dot_config/nvim/lua/lsp_conf.lua index 1aeefbf..60ee126 100644 --- a/private_dot_config/nvim/lua/lsp_conf.lua +++ b/private_dot_config/nvim/lua/lsp_conf.lua @@ -4,12 +4,12 @@ local trouble = require("trouble")  local capabilities = require("cmp_nvim_lsp").default_capabilities()  -- Redefine LSP diagnostic signs -local signs = { Error = 'E', Warning = 'W', Hint = 'H', Information = 'I' } - -for type, icon in pairs(signs) do -  local hl = 'DiagnosticSign' .. type -  vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = '' }) -end +-- local signs = { Error = 'E', Warning = 'W', Hint = 'H', Information = 'I' } +-- +-- for type, icon in pairs(signs) do +--   local hl = 'DiagnosticSign' .. type +--   vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = '' }) +-- end  local opts = { noremap=true, silent=true }  |