add better comments and clean up

This commit is contained in:
siduck76 2021-04-02 11:06:20 +05:30
parent 49b63d38bc
commit aff50c8c15
7 changed files with 68 additions and 63 deletions

View file

@ -9,11 +9,9 @@ end
-- copy any selected text with pressing y -- copy any selected text with pressing y
map("", "<leader>c", '"+y') map("", "<leader>c", '"+y')
-- OPEN TERMINALS -- -- OPEN TERMINALS --
map("n", "<C-l>", [[<Cmd>vnew term://bash <CR>]], opt) -- open term over right
map("n", "<C-x>", [[<Cmd> split term://bash | resize 10 <CR>]], opt) -- open term bottom
-- split term vertically , over the right -- COPY EVERYTHING --
map("n", "<C-l>", [[<Cmd>vnew term://bash <CR>]], opt) map("n", "<C-a>", [[ <Cmd> %y+<CR>]], opt)
-- split term vertically , over the right
map("n", "<C-x>", [[<Cmd> split term://bash | resize 10 <CR>]], opt)

View file

@ -43,6 +43,7 @@ local check_back_space = function()
end end
end end
-- tab completion
_G.tab_complete = function() _G.tab_complete = function()
if vim.fn.pumvisible() == 1 then if vim.fn.pumvisible() == 1 then

View file

@ -1,31 +1,35 @@
vim.cmd [[packadd nvim-lspconfig]] vim.cmd [[packadd nvim-lspconfig]]
vim.cmd [[packadd nvim-compe]] vim.cmd [[packadd nvim-compe]]
local nvim_lsp = require('lspconfig')
local nvim_lsp = require("lspconfig")
function on_attach(client) function on_attach(client)
local function buf_set_keymap(...)
vim.api.nvim_buf_set_keymap(bufnr, ...)
end
local function buf_set_option(...)
vim.api.nvim_buf_set_option(bufnr, ...)
end
buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
-- Mappings. -- Mappings.
local opts = {noremap = true, silent = true} local opts = {noremap = true, silent = true}
buf_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts) buf_set_keymap("n", "gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", opts)
buf_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts) buf_set_keymap("n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", opts)
buf_set_keymap('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts) buf_set_keymap("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>", opts)
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts) buf_set_keymap("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts) buf_set_keymap("n", "<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts) buf_set_keymap("n", "<space>wa", "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>", opts)
buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts) buf_set_keymap("n", "<space>wr", "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>", opts)
buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts) buf_set_keymap("n", "<space>wl", "<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>", opts)
buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts) buf_set_keymap("n", "<space>D", "<cmd>lua vim.lsp.buf.type_definition()<CR>", opts)
buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts) buf_set_keymap("n", "<space>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts) buf_set_keymap("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
buf_set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts) buf_set_keymap("n", "<space>e", "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", opts)
buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts) buf_set_keymap("n", "[d", "<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>", opts)
buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts) buf_set_keymap("n", "]d", "<cmd>lua vim.lsp.diagnostic.goto_next()<CR>", opts)
buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts) buf_set_keymap("n", "<space>q", "<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>", opts)
-- Set some keybinds conditional on server capabilities -- Set some keybinds conditional on server capabilities
if client.resolved_capabilities.document_formatting then if client.resolved_capabilities.document_formatting then
@ -33,7 +37,6 @@ function on_attach(client)
elseif client.resolved_capabilities.document_range_formatting then elseif client.resolved_capabilities.document_range_formatting then
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.range_formatting()<CR>", opts) buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.range_formatting()<CR>", opts)
end end
end end
local servers = {"tsserver", "cssls", "pyls", "html"} local servers = {"tsserver", "cssls", "pyls", "html"}

View file

@ -2,27 +2,29 @@ vim.cmd [[packadd nvim-tree.lua]]
vim.o.termguicolors = true vim.o.termguicolors = true
vim.g.nvim_tree_side = "left" local g = vim.g
vim.g.nvim_tree_width = 25
vim.g.nvim_tree_ignore = {".git", "node_modules", ".cache"}
vim.g.nvim_tree_auto_open = 0
vim.g.nvim_tree_auto_close = 0
vim.g.nvim_tree_quit_on_open = 0
vim.g.nvim_tree_follow = 1
vim.g.nvim_tree_indent_markers = 1
vim.g.nvim_tree_hide_dotfiles = 1
vim.g.nvim_tree_git_hl = 1
vim.g.nvim_tree_root_folder_modifier = ":~"
vim.g.nvim_tree_tab_open = 1
vim.g.nvim_tree_allow_resize = 1
vim.g.nvim_tree_show_icons = { g.nvim_tree_side = "left"
g.nvim_tree_width = 25
g.nvim_tree_ignore = {".git", "node_modules", ".cache"}
g.nvim_tree_auto_open = 0
g.nvim_tree_auto_close = 0
g.nvim_tree_quit_on_open = 0
g.nvim_tree_follow = 1
g.nvim_tree_indent_markers = 1
g.nvim_tree_hide_dotfiles = 1
g.nvim_tree_git_hl = 1
g.nvim_tree_root_folder_modifier = ":~"
g.nvim_tree_tab_open = 1
g.nvim_tree_allow_resize = 1
g.nvim_tree_show_icons = {
git = 1, git = 1,
folders = 1, folders = 1,
files = 1 files = 1
} }
vim.g.nvim_tree_icons = { g.nvim_tree_icons = {
default = "", default = "",
symlink = "", symlink = "",
git = { git = {
@ -55,7 +57,7 @@ vim.api.nvim_set_keymap(
} }
) )
vim.g.nvim_tree_bindings = { g.nvim_tree_bindings = {
["<CR>"] = get_lua_cb("edit"), ["<CR>"] = get_lua_cb("edit"),
["o"] = get_lua_cb("edit"), ["o"] = get_lua_cb("edit"),
["<2-LeftMouse>"] = get_lua_cb("edit"), ["<2-LeftMouse>"] = get_lua_cb("edit"),

View file

@ -1,6 +1,7 @@
-- check if packer is installed (~/local/share/nvim/site/pack) -- check if packer is installed (~/local/share/nvim/site/pack)
local packer_exists = pcall(vim.cmd, [[packadd packer.nvim]]) local packer_exists = pcall(vim.cmd, [[packadd packer.nvim]])
-- add { } , when the plugin needs a different branch, loading the plugin with certain commands
return require("packer").startup( return require("packer").startup(
function() function()
use {"wbthomason/packer.nvim", opt = true} use {"wbthomason/packer.nvim", opt = true}

View file

@ -1,6 +1,7 @@
local gl = require("galaxyline") local gl = require("galaxyline")
local gls = gl.section local gls = gl.section
gl.short_line_list = {" "}
gl.short_line_list = {" "} -- keeping this table { } as empty will show inactive statuslines
local colors = { local colors = {
bg = "#282c34", bg = "#282c34",
@ -31,7 +32,7 @@ gls.left[1] = {
} }
gls.left[2] = { gls.left[2] = {
ViMode = { statusIcon = {
provider = function() provider = function()
return "" return ""
end, end,
@ -168,7 +169,7 @@ gls.right[3] = {
} }
gls.right[4] = { gls.right[4] = {
SiMode = { ViMode = {
provider = function() provider = function()
local alias = { local alias = {
n = "NORMAL", n = "NORMAL",

View file

@ -68,9 +68,8 @@ vim.api.nvim_set_keymap(
[[<Cmd>lua require('telescope').extensions.media_files.media_files()<CR>]], [[<Cmd>lua require('telescope').extensions.media_files.media_files()<CR>]],
opt opt
) )
vim.api.nvim_set_keymap("n", "<Leader>fb", [[<Cmd>lua require('telescope.builtin').buffers()<CR>]], opt) vim.api.nvim_set_keymap("n", "<Leader>fb", [[<Cmd>lua require('telescope.builtin').buffers()<CR>]], opt)
vim.api.nvim_set_keymap("n", "<Leader>fh", [[<Cmd>lua require('telescope.builtin').help_tags()<CR>]], opt) vim.api.nvim_set_keymap("n", "<Leader>fh", [[<Cmd>lua require('telescope.builtin').help_tags()<CR>]], opt)
vim.api.nvim_set_keymap("n", "<Leader>fo", [[<Cmd>lua require('telescope.builtin').oldfiles()<CR>]], opt) vim.api.nvim_set_keymap("n", "<Leader>fo", [[<Cmd>lua require('telescope.builtin').oldfiles()<CR>]], opt)
vim.api.nvim_set_keymap("n", "<Leader>fm", [[<Cmd> Neoformat<CR>]], opt) vim.api.nvim_set_keymap("n", "<Leader>fm", [[<Cmd> Neoformat<CR>]], opt)
vim.api.nvim_set_keymap("n", "<C-a>", [[ <Cmd> %y+<CR>]], opt)