Skip to content

Commit

Permalink
feat(core): updated core configs for default and options
Browse files Browse the repository at this point in the history
  • Loading branch information
umgbhalla committed Feb 12, 2022
1 parent fc9378f commit 763baa0
Show file tree
Hide file tree
Showing 5 changed files with 115 additions and 42 deletions.
13 changes: 10 additions & 3 deletions lua/core/autocmds.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
-- vim.cmd [[ autocmd BufEnter * if &buftype != "terminal" | lcd %:p:h | endif ]]

-- Use relative & absolute line numbers in 'n' & 'i' modes respectively
vim.cmd([[ au InsertLeave * set relativenumber ]])
vim.cmd([[ au InsertEnter * set norelativenumber ]])
-- vim.cmd([[ au InsertLeave * set relativenumber ]])
-- vim.cmd([[ au InsertEnter * set norelativenumber ]])

-- Don't show any numbers inside terminals
-- vim.cmd([[ au TermOpen term://* setlocal nonumber norelativenumber | setfiletype terminal ]])
Expand All @@ -15,7 +15,14 @@ vim.cmd([[ au InsertEnter * set norelativenumber ]])
-- vim.cmd [[ au BufReadPost * if expand('%:p') !~# '\m/\.git/' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif ]]
-- File extension specific tabbing
vim.cmd([[ autocmd Filetype python setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4 ]])

vim.cmd([[
augroup ScrollbarInit
autocmd!
autocmd WinScrolled,VimResized,QuitPre * silent! lua require('scrollbar').show()
autocmd WinEnter,FocusGained * silent! lua require('scrollbar').show()
autocmd WinLeave,BufLeave,BufWinLeave,FocusLost * silent! lua require('scrollbar').clear()
augroup end
]])
vim.cmd([[
augroup _general_settings
autocmd!
Expand Down
2 changes: 1 addition & 1 deletion lua/core/default_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ M.options = {
mouse = "a",
number = true,
numberwidth = 4,
relativenumber = true,
relativenumber = false,
expandtab = true,
shiftwidth = 2,
smartindent = true,
Expand Down
25 changes: 18 additions & 7 deletions lua/core/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,19 @@ local neovide_config = function()
vim.g.neovide_cursor_vfx_particle_density = 5.0
end

local present, impatient = pcall(require, "impatient")
if present then
impatient.enable_profile()
end

local load_core = function()
createdir()

neovide_config()

require("core.options")
-- require("core.mapping")
-- require("keymap")
-- require("core.event")

local present, impatient = pcall(require, "impatient")
if present then
impatient.enable_profile()
end

require("core.autocmds")

require("user.alpha")
Expand Down Expand Up @@ -78,6 +76,19 @@ local load_core = function()
require("user.toggletermconf")
require("user.treesitter")
require("user.whichkey")
require("neoscroll").setup({
-- All these keys will be mapped to their corresponding default scrolling animation
mappings = { "<C-u>", "<C-d>", "<C-b>", "<C-f>", "<C-y>", "<C-e>", "zt", "zz", "zb" },
hide_cursor = true, -- Hide cursor while scrolling
stop_eof = true, -- Stop at <EOF> when scrolling downwards
use_local_scrolloff = false, -- Use the local scope of scrolloff instead of the global scope
respect_scrolloff = false, -- Stop scrolling when the cursor reaches the scrolloff margin of the file
cursor_scrolls_alone = true, -- The cursor will keep on scrolling even if the window cannot scroll further
easing_function = nil, -- Default easing function
pre_hook = nil, -- Function to run before the scrolling animation starts
post_hook = nil, -- Function to run after the scrolling animation ends
performance_mode = false, -- Disable "Performance Mode" on all buffers.
})
end

load_core()
57 changes: 56 additions & 1 deletion lua/core/options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ local options = {
signcolumn = "yes", -- always show the sign column, otherwise it would shift the text each time
wrap = false, -- display lines as one long line
scrolloff = 999, -- is one of my fav
sidescrolloff = 999,
-- sidescrolloff = 999,
guifont = "Lig Operator Mono:h12",
}
for k, v in pairs(options) do
Expand All @@ -40,6 +40,7 @@ opt.mouse = options.mouse
opt.shiftwidth = options.shiftwidth
opt.smartcase = options.smartcase
opt.smartindent = options.smartindent
opt.clipboard = options.clipboard
-- Numbers
opt.number = options.number
opt.numberwidth = options.numberwidth
Expand Down Expand Up @@ -76,3 +77,57 @@ vim.schedule(function()
vim.opt.shadafile = require("core.utils").load_config().options.shadafile
vim.cmd([[ silent! rsh ]])
end)

-- init.lua
g.symbols_outline = {
highlight_hovered_item = true,
show_guides = true,
auto_preview = true,
position = "right",
relative_width = true,
width = 75,
auto_close = true,
show_numbers = false,
show_relative_n4mbers = false,
show_symbol_details = true,
preview_bg_highlight = "Pmenu",
keymaps = { -- These keymaps can be a string or a table for multiple keys
close = { "q" },
goto_location = "<Cr>",
focus_location = "o",
hover_symbol = "<C-space>",
toggle_preview = "K",
rename_symbol = "r",
code_actions = "a",
},
lsp_blacklist = {},
symbol_blacklist = {},
symbols = {
File = { icon = "", hl = "TSURI" },
Module = { icon = "", hl = "TSNamespace" },
Namespace = { icon = "", hl = "TSNamespace" },
Package = { icon = "", hl = "TSNamespace" },
Class = { icon = "𝓒", hl = "TSType" },
Method = { icon = "ƒ", hl = "TSMethod" },
Property = { icon = "", hl = "TSMethod" },
Field = { icon = "", hl = "TSField" },
Constructor = { icon = "", hl = "TSConstructor" },
Enum = { icon = "", hl = "TSType" },
Interface = { icon = "", hl = "TSType" },
Function = { icon = "", hl = "TSFunction" },
Variable = { icon = "", hl = "TSConstant" },
Constant = { icon = "", hl = "TSConstant" },
String = { icon = "𝓐", hl = "TSString" },
Number = { icon = "#", hl = "TSNumber" },
Boolean = { icon = "", hl = "TSBoolean" },
Array = { icon = "", hl = "TSConstant" },
Object = { icon = "⦿", hl = "TSType" },
Key = { icon = "🔐", hl = "TSType" },
Null = { icon = "NULL", hl = "TSType" },
EnumMember = { icon = "", hl = "TSField" },
Struct = { icon = "𝓢", hl = "TSType" },
Event = { icon = "🗲", hl = "TSType" },
Operator = { icon = "+", hl = "TSOperator" },
TypeParameter = { icon = "𝙏", hl = "TSParameter" },
},
}
60 changes: 30 additions & 30 deletions lua/user/treesitter.lua
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
local status_ok, configs = pcall(require, "nvim-treesitter.configs")
if not status_ok then
return
return
end

configs.setup {
ensure_installed = "maintained", -- one of "all", "maintained" (parsers with maintainers), or a list of languages
sync_install = false, -- install languages synchronously (only applied to `ensure_installed`)
ignore_install = { "" }, -- List of parsers to ignore installing
autopairs = {
enable = true,
},
highlight = {
enable = true, -- false will disable the whole extension
disable = { "" }, -- list of language that will be disabled
additional_vim_regex_highlighting = true,
},
indent = { enable = true, disable = { "yaml" } },
context_commentstring = {
enable = true,
enable_autocmd = false,
},
rainbow = {
enable = true,
-- disable = { "jsx", "cpp" }, list of languages you want to disable the plugin for
extended_mode = true, -- Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean
max_file_lines = nil, -- Do not enable for files with more than n lines, int
-- colors = {}, -- table of hex strings
-- termcolors = {} -- table of colour name strings
},
playground = {
enable = true,
},
}
configs.setup({
ensure_installed = "maintained", -- one of "all", "maintained" (parsers with maintainers), or a list of languages
sync_install = false, -- install languages synchronously (only applied to `ensure_installed`)
ignore_install = { "" }, -- List of parsers to ignore installing
autopairs = {
enable = true,
},
highlight = {
enable = true, -- false will disable the whole extension
disable = { "" }, -- list of language that will be disabled
additional_vim_regex_highlighting = true,
},
indent = { enable = true, disable = { "yaml" } },
context_commentstring = {
enable = true,
enable_autocmd = false,
},
rainbow = {
enable = true,
-- disable = { "jsx", "cpp" }, -- list of languages you want to disable the plugin for
extended_mode = true, -- Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean
max_file_lines = nil, -- Do not enable for files with more than n lines, int
-- colors = {}, -- table of hex strings
-- termcolors = {} -- table of colour name strings
},
playground = {
enable = true,
},
})

0 comments on commit 763baa0

Please sign in to comment.