diff options
-rw-r--r-- | .config/nvim/init.lua | 2 | ||||
-rw-r--r-- | .config/nvim/lua/justsaumit/bufferline-config.lua | 67 | ||||
-rw-r--r-- | .config/nvim/lua/justsaumit/colorscheme.lua | 4 | ||||
-rw-r--r-- | .config/nvim/lua/justsaumit/keymaps.lua | 3 | ||||
-rw-r--r-- | .config/nvim/lua/justsaumit/lualine-config.lua | 40 | ||||
-rw-r--r-- | .config/nvim/lua/justsaumit/options.lua | 19 | ||||
-rw-r--r-- | .config/nvim/lua/justsaumit/plugins.lua | 8 | ||||
-rw-r--r-- | .config/nvim/plugin/packer_compiled.lua | 24 |
8 files changed, 158 insertions, 9 deletions
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 2223b08..b6a98f3 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -3,4 +3,6 @@ require("justsaumit.keymaps") require("justsaumit.plugins") require("justsaumit.colorscheme") require("justsaumit.treesitter-config") +require("justsaumit.lualine-config") +require("justsaumit.bufferline-config") print ("while ( !(success = try() );") diff --git a/.config/nvim/lua/justsaumit/bufferline-config.lua b/.config/nvim/lua/justsaumit/bufferline-config.lua new file mode 100644 index 0000000..8430154 --- /dev/null +++ b/.config/nvim/lua/justsaumit/bufferline-config.lua @@ -0,0 +1,67 @@ +--vim.opt.termguicolors = true + +local status, bufferline = pcall(require, "bufferline") +if not status then + return +end + +require('bufferline').setup { + options = { + mode = "buffers", + numbers = "none", + close_command = "bdelete! %d", -- can be a string | function, see "Mouse actions" + right_mouse_command = "bdelete! %d", -- can be a string | function, see "Mouse actions" + left_mouse_command = "buffer %d", -- can be a string | function, see "Mouse actions" + middle_mouse_command = nil, -- can be a string | function, see "Mouse actions" + indicator = { + icon = '▎', + style = 'icon', + }, + buffer_close_icon = '', + modified_icon = '●', + close_icon = '', + -- close_icon = '', + left_trunc_marker = '', + right_trunc_marker = '', + max_name_length = 30, + max_prefix_length = 30, -- prefix used when a buffer is de-duplicated + tab_size = 22, + diagnostics = false, + diagnostics_update_in_insert = false, + offsets = { { filetype = "NvimTree", text = "", padding = 1 } }, + color_icons = true, + show_buffer_icons = true, + show_buffer_close_icons = true, + show_close_icon = true, + show_tab_indicators = true, + persist_buffer_sort = true, + separator_style = "thin", -- | "thick" | "thin" | slant, + enforce_regular_tabs = true, + always_show_bufferline = true, + name_formatter = function(buf) -- buf contains a "name", "path" and "bufnr" + -- remove extension from markdown files for example + if buf.name:match('%.md') then + return vim.fn.fnamemodify(buf.name, ':t:r') + end + end + } +} + +local opts = { noremap = true, silent = true } +local keymap = vim.keymap.set +keymap("", "<Space>", "<Nop>", opts) +vim.g.mapleader = " " +vim.g.maplocalleader = " " + +--Leader+number -> tab change +for i = 1, 9 do + keymap("n", "<leader>" .. i, function() + require("bufferline").go_to_buffer(i, true) + end, opts) +end + +--Tab or Ctrl+Tab for Forward Cycle //terminals don't see a difference between <Tab> and <C-Tab> +--Shift+Tab for Backward Cycle +keymap("n", "<Tab>", ":BufferLineCycleNext<CR>", opts) +keymap("n", "<S-Tab>", ":BufferLineCyclePrev<CR>", opts) + diff --git a/.config/nvim/lua/justsaumit/colorscheme.lua b/.config/nvim/lua/justsaumit/colorscheme.lua index 02f84b9..5989f66 100644 --- a/.config/nvim/lua/justsaumit/colorscheme.lua +++ b/.config/nvim/lua/justsaumit/colorscheme.lua @@ -1,9 +1,11 @@ --protected call local colorscheme = "tokyonight" +local pywal = require('pywal') local status_ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme) if not status_ok then - vim.notify("colorscheme " .. colorscheme .. "notfound!") + vim.notify("colorscheme " .. colorscheme .. " not found! :(") + pywal.setup() return end diff --git a/.config/nvim/lua/justsaumit/keymaps.lua b/.config/nvim/lua/justsaumit/keymaps.lua index 5445963..76bd4b9 100644 --- a/.config/nvim/lua/justsaumit/keymaps.lua +++ b/.config/nvim/lua/justsaumit/keymaps.lua @@ -16,6 +16,9 @@ vim.g.maplocalleader = " " -- command_mode = "c", -- Normal -- +--Save file with Ctrl+S +keymap("n", "<C-s>", ":w<CR>", opts) + -- Better window navigation for split keymap("n", "<C-h>", "<C-w>h", opts) keymap("n", "<C-j>", "<C-w>j", opts) diff --git a/.config/nvim/lua/justsaumit/lualine-config.lua b/.config/nvim/lua/justsaumit/lualine-config.lua new file mode 100644 index 0000000..56c426a --- /dev/null +++ b/.config/nvim/lua/justsaumit/lualine-config.lua @@ -0,0 +1,40 @@ +require('lualine').setup { + options = { + icons_enabled = true, + theme = 'auto', + component_separators = { left = '', right = ''}, + section_separators = { left = '', right = ''}, + disabled_filetypes = { + statusline = {}, + winbar = {}, + }, + ignore_focus = {}, + always_divide_middle = true, + globalstatus = false, + refresh = { + statusline = 1000, + tabline = 1000, + winbar = 1000, + } + }, + sections = { + lualine_a = {'mode'}, + lualine_b = {'branch', 'diff', 'diagnostics'}, + lualine_c = {'filename'}, + lualine_x = {'encoding', 'fileformat', 'filetype'}, + lualine_y = {'progress'}, + lualine_z = {'location'} + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = {'filename'}, + lualine_x = {'location'}, + lualine_y = {}, + lualine_z = {} + }, + tabline = {}, + winbar = {}, + inactive_winbar = {}, + extensions = {} +} diff --git a/.config/nvim/lua/justsaumit/options.lua b/.config/nvim/lua/justsaumit/options.lua index 3496b2c..51caecc 100644 --- a/.config/nvim/lua/justsaumit/options.lua +++ b/.config/nvim/lua/justsaumit/options.lua @@ -2,14 +2,20 @@ local options = { number=true, -- Shows absolute linenumber relativenumber=true, -- Shows linenumber relative to cursor --combination of both^ for hybrid linenumber - showbreak="+++", -- wrap broken line prefix textwidth=100, numberwidth=4, scrolloff=8, -- keeps cursor in middle of screen/scrolls 8lines in advance + sidescroll=18, mouse="a", -- enable mouse support - splitbelow=true, - splitright=true, - clipboard="unnamedplus", -- allows neovim to access system clipboard + splitbelow=true, -- on horizontal split instead of opening window to left open it at right + splitright=true, -- on vertical split instead of opening window to left open it at right + termguicolors=true, + showmode=false, -- lualine does the job + cmdheight=1, + wrap=false, + whichwrap='b,s,<,>,[,],h,l', + clipboard="unnamedplus", -- allows neovim to access system clipboard using yank + fileencoding="UTF-8", --spaces/tabs/indents softtabstop=4, -- No. of spaces per tab shiftwidth=4, -- No. of auto-indent space @@ -22,13 +28,14 @@ local options = { hlsearch=false, -- no perma highlight post search incsearch=true, -- searches for strings incrementally showmatch=true, -- Highlight matching braces - --git integration/lsp - --signcolumn=true, + --git integration/lsp/diagnostic + signcolumn="yes", --undo/backup backup=false, swapfile=false, undodir=os.getenv("HOME") .. "/.local/state/nvim/undodir", undofile=true +-- showbreak="+++", -- wrap broken line prefix } --forloop for table 'options' for key, value in pairs(options) do diff --git a/.config/nvim/lua/justsaumit/plugins.lua b/.config/nvim/lua/justsaumit/plugins.lua index d9cdd19..95c8ae0 100644 --- a/.config/nvim/lua/justsaumit/plugins.lua +++ b/.config/nvim/lua/justsaumit/plugins.lua @@ -15,7 +15,7 @@ if fn.empty(fn.glob(install_path)) > 0 then vim.cmd [[packadd packer.nvim]] end --- Autocommand that reloads neovim whenever you save the plugins.lua file +-- Autocommand that reloads neovim whenever you save (:w) the plugins.lua file vim.cmd [[ augroup packer_user_config autocmd! @@ -49,7 +49,11 @@ return packer.startup(function(use) use {'nvim-treesitter/nvim-treesitter',run = ':TSUpdate'} --ColorSchemes use "folke/tokyonight.nvim" - + use { 'AlphaTechnolog/pywal.nvim', as = 'pywal' } +--Lualine + use {'nvim-lualine/lualine.nvim',requires = { 'kyazdani42/nvim-web-devicons', opt = true }} +--Bufferline + use {'akinsho/bufferline.nvim', tag = "v2.*", requires = 'kyazdani42/nvim-web-devicons'} -- Automatically set up your configuration after cloning packer.nvim -- Put this at the end after all plugins if PACKER_BOOTSTRAP then diff --git a/.config/nvim/plugin/packer_compiled.lua b/.config/nvim/plugin/packer_compiled.lua index b37914c..7297656 100644 --- a/.config/nvim/plugin/packer_compiled.lua +++ b/.config/nvim/plugin/packer_compiled.lua @@ -41,6 +41,9 @@ local function save_profiles(threshold) results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms' end end + if threshold then + table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)') + end _G._packer.profile_output = results end @@ -71,11 +74,27 @@ end time([[try_loadstring definition]], false) time([[Defining packer_plugins]], true) _G.packer_plugins = { + ["bufferline.nvim"] = { + loaded = true, + path = "/home/saumit/.local/share/nvim/site/pack/packer/start/bufferline.nvim", + url = "https://github.com/akinsho/bufferline.nvim" + }, + ["lualine.nvim"] = { + loaded = true, + path = "/home/saumit/.local/share/nvim/site/pack/packer/start/lualine.nvim", + url = "https://github.com/nvim-lualine/lualine.nvim" + }, ["nvim-treesitter"] = { loaded = true, path = "/home/saumit/.local/share/nvim/site/pack/packer/start/nvim-treesitter", url = "https://github.com/nvim-treesitter/nvim-treesitter" }, + ["nvim-web-devicons"] = { + loaded = false, + needs_bufread = false, + path = "/home/saumit/.local/share/nvim/site/pack/packer/opt/nvim-web-devicons", + url = "https://github.com/kyazdani42/nvim-web-devicons" + }, ["packer.nvim"] = { loaded = true, path = "/home/saumit/.local/share/nvim/site/pack/packer/start/packer.nvim", @@ -91,6 +110,11 @@ _G.packer_plugins = { path = "/home/saumit/.local/share/nvim/site/pack/packer/start/popup.nvim", url = "https://github.com/nvim-lua/popup.nvim" }, + pywal = { + loaded = true, + path = "/home/saumit/.local/share/nvim/site/pack/packer/start/pywal", + url = "https://github.com/AlphaTechnolog/pywal.nvim" + }, ["tokyonight.nvim"] = { loaded = true, path = "/home/saumit/.local/share/nvim/site/pack/packer/start/tokyonight.nvim", |