Merge pull request #161 from Akianonymus/main

Code style fixes | Some saner defaults
This commit is contained in:
siduck76 2021-07-18 09:46:09 +05:30 committed by GitHub
commit cf8b2ce1cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 69 additions and 158 deletions

View file

@ -20,6 +20,9 @@ map("v", "x", [=[ "_x ]=], opt)
vim.api.nvim_set_keymap("i", "jk", "<esc>", {})
-- Don't copy the replaced text after pasting in visual mode
map("v", "p", '"_dP', opt)
-- OPEN TERMINALS --
map("n", "<C-l>", [[<Cmd>vnew term://bash <CR>]], opt) -- term over right
map("n", "<C-x>", [[<Cmd> split term://bash | resize 10 <CR>]], opt) -- term bottom
@ -133,3 +136,9 @@ map("n", "<S-x>", ":bd!<CR>", opt) -- close tab
-- move between tabs
map("n", "<TAB>", [[<Cmd>BufferLineCycleNext<CR>]], opt)
map("n", "<S-TAB>", [[<Cmd>BufferLineCyclePrev<CR>]], opt)
-- use ESC to turn off search highlighting
map("n", "<Esc>", ":noh<CR>", opts)
-- get out of terminal with ESC
map("t", "<Esc>", "<C-\\><C-n>", opts)

View file

@ -31,6 +31,10 @@ opt.expandtab = true
opt.shiftwidth = 2
opt.smartindent = true
-- go to previous/next line with h,l,left arrow and right arrow
-- when cursor reaches end/beginning of line
opt.whichwrap:append("<>hl")
g.mapleader = " "
g.auto_save = false

View file

@ -1,11 +1,6 @@
local packer
if
not pcall(
function()
packer = require "packer"
end
)
then
local present, packer = pcall(require, "packer")
if not present then
local packer_path = vim.fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
print("Cloning packer..")
@ -21,12 +16,10 @@ if
packer_path
}
)
if pcall(
function()
packer = require "packer"
end
)
then
present, packer = pcall(require, "packer")
if present then
print("Packer cloned successfully.")
else
error("Couldn't clone packer !\nPacker path: " .. packer_path)

View file

@ -1,11 +1,6 @@
local packer
if
pcall(
function()
require "packerInit"
end
)
then
local present, _ = pcall(require, "packerInit")
if present then
packer = require "packer"
else
return false

View file

@ -1,12 +1,7 @@
local autopairs, autopairs_completion
if
not pcall(
function()
autopairs = require "nvim-autopairs"
autopairs_completion = require "nvim-autopairs.completion.compe"
end
)
then
local present1, autopairs = pcall(require, "nvim-autopairs")
local present2, autopairs_completion = pcall(require, "nvim-autopairs.completion.compe")
if not (present1 or present2) then
return
end

View file

@ -1,12 +1,6 @@
-- autosave.nvim plugin disabled by default
local autosave
if
not pcall(
function()
autosave = require "autosave"
end
)
then
local present, autosave = pcall(require, "autosave")
if not present then
return
end

View file

@ -1,14 +1,8 @@
local global_theme = "themes/" .. vim.g.nvchad_theme
local colors = require(global_theme)
local bufferline
if
not pcall(
function()
bufferline = require "bufferline"
end
)
then
local present, bufferline = pcall(require, "bufferline")
if not present then
return
end

View file

@ -1,11 +1,5 @@
local compe
if
not pcall(
function()
compe = require "compe"
end
)
then
local present, compe = pcall(require, "compe")
if not present then
return
end

View file

@ -1,11 +1,5 @@
local gitsigns
if
not pcall(
function()
gitsigns = require "gitsigns"
end
)
then
local present, gitsigns = pcall(require, "gitsigns")
if not present then
return
end

View file

@ -1,11 +1,5 @@
local icons
if
not pcall(
function()
icons = require "nvim-web-devicons"
end
)
then
local present, icons = pcall(require, "nvim-web-devicons")
if not present then
return
end

View file

@ -1,12 +1,6 @@
local lspconfig, lspinstall
if
not pcall(
function()
lspconfig = require "lspconfig"
lspinstall = require "lspinstall"
end
)
then
local present1, lspconfig = pcall(require, "lspconfig")
local present2, lspinstall = pcall(require, "lspinstall")
if not (present1 or present2) then
return
end

View file

@ -1,5 +0,0 @@
pcall(
function()
require("neoscroll").setup()
end
)

View file

@ -1,14 +1,9 @@
local tree_cb
if
not pcall(
function()
tree_cb = require "nvim-tree.config".nvim_tree_callback
end
)
then
local present, tree_c = pcall(require, "nvim-tree.config")
if not present then
return
end
local tree_cb = tree_c.nvim_tree_callback
local g = vim.g
vim.o.termguicolors = true

View file

@ -1,35 +1,25 @@
local M = {}
M.colorizer = function()
local colorizer
if
not pcall(
function()
colorizer = require("colorizer")
end
)
then
return
local present, colorizer = pcall(require, "colorizer")
if present then
colorizer.setup()
vim.cmd("ColorizerReloadAllBuffers")
end
colorizer.setup()
vim.cmd("ColorizerReloadAllBuffers")
end
M.comment = function()
pcall(
function()
require("nvim_comment").setup()
end
)
local present, nvim_comment = pcall(require, "nvim_comment")
if present then
nvim_comment.setup()
end
end
M.lspkind = function()
pcall(
function()
require("lspkind").init()
end
)
local present, lspkind = pcall(require, "lspkind")
if present then
lspkind.init()
end
end
M.neoscroll = function()

View file

@ -1,12 +1,6 @@
local gl, condition
if
not pcall(
function()
gl = require "galaxyline"
condition = require "galaxyline.condition"
end
)
then
local present1, gl = pcall(require, "galaxyline")
local present2, condition = pcall(require, "galaxyline.condition")
if not (present1 or present2) then
return
end

View file

@ -1,11 +1,5 @@
local telescope
if
not pcall(
function()
telescope = require("telescope")
end
)
then
local present, telescope = pcall(require, "telescope")
if not present then
return
end

View file

@ -1,11 +1,5 @@
local ts_config
if
not pcall(
function()
ts_config = require "nvim-treesitter.configs"
end
)
then
local present, ts_config = pcall(require, "nvim-treesitter.configs")
if not present then
return
end

View file

@ -1,11 +1,5 @@
local true_zen
if
not pcall(
function()
true_zen = require "true-zen"
end
)
then
local present, true_zen = pcall(require, "true-zen")
if not present then
return
end

View file

@ -1,15 +1,10 @@
vim.g.nvchad_theme = "onedark"
local base16
if
not pcall(
function()
base16 = require "base16"
end
)
then
return false
else
local present, base16 = pcall(require, "base16")
if present then
base16(base16.themes["onedark"], true)
return true
else
return false
end