pull/945/head
Neeraj 2 years ago
parent 72364ad9ac
commit d708bfce70

@ -0,0 +1,107 @@
vim.opt.relativenumber = true
vim.opt.cursorline = true
vim.opt.colorcolumn = '120'
vim.keymap.set('n', '<leader>e', ':NvimTreeToggle<CR>')
vim.keymap.set('n', '<leader>f', ':NvimTreeFindFile<CR>')
-- indent via Tab
vim.keymap.set('n', '<Tab>', '>>_')
vim.keymap.set('n', '<S-Tab>', '<<_')
vim.keymap.set('v', '<Tab>', '>>_')
vim.keymap.set('v', '<S-Tab>', '<<_')
vim.keymap.set('i', '<Tab>', '\t')
vim.keymap.set('i', '<S-Tab>', '\b')
-- Mapping U to Redo.
vim.keymap.set('', 'U', '<C-r>')
vim.keymap.set('', '<C-r>', '<NOP>')
vim.keymap.set('i', 'jk', '<ESC>')
vim.keymap.set('i', 'kj', '<ESC>')
vim.keymap.set('i', 'jj', '<ESC>')
vim.keymap.set('i', 'kk', '<ESC>')
-- fast scrolling
vim.keymap.set('n', '<leader>n', '20j')
vim.keymap.set('n', '<leader>u', '20k')
vim.keymap.set('v', '<leader>n', '20j')
vim.keymap.set('v', '<leader>u', '20k')
-- Alternate way to save
vim.cmd('nnoremap <C-s> :w!<CR>')
vim.cmd('inoremap <C-s> <ESC> :w!<CR>')
-- Alternate way to quit
vim.cmd('nnoremap <S-c> :q!<CR>')
-- ================= File management ================= --
-- swapfile has global & local config, eventhough help says otherwise
vim.o.swapfile = false -- can open already open files
vim.bo.swapfile = false
vim.o.backup = false
vim.o.writebackup = false
vim.o.autoread = true -- auto file change detection
-- ================= Scrolling ================= --
vim.o.scrolloff = 999 -- start scrolling when 8 lines away from margins
-- ================= Indentation ================= --
-- pay attention to 'vim.bo' (buffer local options) and 'vim.o' (global options)
-- see :help options.txt
-- for some reason these values need to be set in both o and bo objects
-- eventhough these options are supposed to be local to buffer
vim.o.tabstop = 4 -- maximum width of tab character (measured in spaces)
vim.bo.tabstop = 4
vim.o.shiftwidth = 4 -- size of indent (measured in spaces), should equal tabstop
vim.bo.shiftwidth = 4
vim.o.softtabstop = 4 -- should be the same as the other two above
vim.bo.softtabstop = 4
vim.o.expandtab = true -- expand tabs to spaces
vim.bo.expandtab = true -- expand tabs to spaces
vim.o.smartindent = true -- smart indenting on new line for C-like programs
vim.bo.smartindent = true
vim.o.autoindent = true -- copy the indentation from previous line
vim.bo.autoindent = true
vim.o.smarttab = true -- tab infront of a line inserts blanks based on shiftwidth
-- ================= Search ================= --
vim.o.ignorecase = true -- Ignorecase when searching
vim.o.incsearch = true -- start searching on each keystroke
vim.o.smartcase = true -- ignore case when lowercase, match case when capital case is used
vim.o.hlsearch = true -- highlight the search results
-- ================= Performance ================= --
vim.o.lazyredraw = true -- useful for when executing macros.
vim.o.ttimeoutlen = 10 -- ms to wait for a key code seq to complete
-- ================= Misc ================= --
vim.wo.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time
vim.wo.wrap = false -- don't wrap long text into multiple lines
vim.o.history = 10000 -- numbers of entries in history for ':' commands and search patterns (10000 = max)
vim.o.updatetime = 300 -- used for CursorHold event (for document highlighting detection)
vim.o.mouse = 'nv' -- allow mose in normal & visual mode
-- better autocomplete behaviour
-- menuone - show popup menu also when there is only one match available
-- preview - show extra information about currently selected completion
-- noinsert - do not insert any text for match until the user selects it from the menu
vim.o.completeopt = 'menuone,preview,noinsert'
-- allows hidden buffers
-- this means that a modified buffer doesn't need to be saved when changing
-- tabs/windows.
vim.o.hidden = true
-- Copy paste between vim and everything else
vim.o.clipboard = "unnamedplus"

@ -353,7 +353,7 @@ require('nvim-treesitter.configs').setup {
-- Diagnostic keymaps
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float)
-- vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float)
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist)
-- LSP settings.
@ -384,7 +384,7 @@ local on_attach = function(_, bufnr)
nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
-- See `:help K` for why this keymap
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
-- nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
-- Lesser used LSP functionality
@ -411,7 +411,7 @@ local servers = {
-- gopls = {},
-- pyright = {},
-- rust_analyzer = {},
-- tsserver = {},
tsserver = {},
lua_ls = {
Lua = {

@ -0,0 +1,10 @@
return {
'romgrk/barbar.nvim',
dependencies = 'nvim-tree/nvim-web-devicons',
config = function ()
vim.keymap.set('', 'J', '<Cmd>BufferPrevious<CR>')
vim.keymap.set('', 'K', '<Cmd>BufferNext<CR>')
vim.keymap.set('', 'X', '<Cmd>BufferClose<CR>')
end
}

@ -0,0 +1,6 @@
return {
"rmehri01/onenord.nvim",
config = function ()
vim.cmd.colorscheme 'onenord'
end
}

@ -0,0 +1,26 @@
return {
'onsails/lspkind.nvim',
config = function ()
local lspkind = require'lspkind'
-- nvim-cmp setup
local cmp = require 'cmp'
cmp.setup {
formatting = {
format = lspkind.cmp_format({
mode = 'symbol_text', -- show only symbol annotations
maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)
ellipsis_char = '...', -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first)
-- The function below will be called before any actual modifications from lspkind
-- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30))
before = function (entry, vim_item)
return vim_item
end
})
}
}
end
}

@ -0,0 +1,41 @@
return {
'nvim-lualine/lualine.nvim',
opts = {
options = {
theme = 'onenord',
icons_enabled = true,
component_separators = {left = '', right = ''},
section_separators = {left = '', right = ''},
disabled_filetypes = {},
always_divide_middle = true
},
sections = {
lualine_a = {'mode'},
lualine_b = {'branch', 'diff', 'diagnostics'},
-- lualine_c = {'filename'},
lualine_c = {
{
'filename',
file_status = true, -- Displays file status (readonly status, modified status)
path = 1, -- 0: Just the filename
-- 1: Relative path
-- 2: Absolute path
shorting_target = 40 -- Shortens path to leave 40 spaces in the window
-- for other components. (terrible name, any suggestions?)
}
},
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 = {}
},
},
}

@ -0,0 +1,28 @@
return {
'nvim-tree/nvim-tree.lua',
requires = {
'nvim-tree/nvim-web-devicons', -- optional, for file icons
},
config = function ()
local nvim_tree_events = require('nvim-tree.events')
local bufferline_api = require('bufferline.api')
local function get_tree_size()
return require'nvim-tree.view'.View.width
end
nvim_tree_events.subscribe('TreeOpen', function()
bufferline_api.set_offset(get_tree_size())
end)
nvim_tree_events.subscribe('Resize', function()
bufferline_api.set_offset(get_tree_size())
end)
nvim_tree_events.subscribe('TreeClose', function()
bufferline_api.set_offset(0)
end)
require("nvim-tree").setup()
end
}

@ -0,0 +1,3 @@
return {
'mhinz/vim-startify'
}
Loading…
Cancel
Save