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>", {}) 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 -- -- OPEN TERMINALS --
map("n", "<C-l>", [[<Cmd>vnew term://bash <CR>]], opt) -- term over right 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 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 -- move between tabs
map("n", "<TAB>", [[<Cmd>BufferLineCycleNext<CR>]], opt) map("n", "<TAB>", [[<Cmd>BufferLineCycleNext<CR>]], opt)
map("n", "<S-TAB>", [[<Cmd>BufferLineCyclePrev<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.shiftwidth = 2
opt.smartindent = true 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.mapleader = " "
g.auto_save = false g.auto_save = false

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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