feat: some stuff

This commit is contained in:
max_richter 2021-12-18 14:41:37 +01:00
parent a6721b9de2
commit 6d0af46768
7 changed files with 240 additions and 241 deletions

View File

@ -56,6 +56,10 @@ if [ -d "$HOME/.asdf" ] ; then
. "$HOME/.asdf/asdf.sh" . "$HOME/.asdf/asdf.sh"
fi fi
if [ "$(which go)" != "" ] ; then
export PATH="$PATH:$(go env GOPATH)/bin"
fi
#If fdfind is installed force fzf to use it #If fdfind is installed force fzf to use it
if type fdfind &> /dev/null ; then if type fdfind &> /dev/null ; then
export FZF_DEFAULT_COMMAND='fdfind --type f' export FZF_DEFAULT_COMMAND='fdfind --type f'

View File

@ -10,13 +10,11 @@ local opt = vim.opt
require("plugins") require("plugins")
if u.has_plugin("cmp") then if u.has_plugin("cmp") then
vim.g.did_load_filetypes = 150
vim.g.did_load_filetypes = 1
-- Global options -- Global options
o.number = true -- show line number o.number = true -- show line number
o.showmatch = true -- show matching brackets o.showmatch = true -- show matching brackets
o.swapfile = false
-- Indentation options -- Indentation options
vim.cmd [[ vim.cmd [[
@ -24,7 +22,7 @@ if u.has_plugin("cmp") then
set expandtab set expandtab
set shiftwidth=2 set shiftwidth=2
set softtabstop=2 set softtabstop=2
set tabstop=2 set tabstop=1
]] ]]
g.hidden = true -- unload buffers when hidden g.hidden = true -- unload buffers when hidden
@ -32,19 +30,21 @@ if u.has_plugin("cmp") then
o.autoread = true o.autoread = true
-- Search -- Search
o.inccommand = 'nosplit' -- show substitutions incrementally o.inccommand = "nosplit" -- show substitutions incrementally
o.ignorecase = true o.ignorecase = true
o.smartcase = true o.smartcase = true
opt.wildignore:append('.git/*', 'node_modules/*') opt.wildignore:append(".git/*", "node_modules/*")
o.wildignorecase = true o.wildignorecase = true
o.lazyredraw = true o.lazyredraw = true
opt.listchars:append({ opt.listchars:append(
{
extends = "#", extends = "#",
eol = '', eol = "",
space = '', space = "",
tab = '', tab = ""
}) }
)
-- Shortmess -- Shortmess
cmd [[set shortmess+=F]] cmd [[set shortmess+=F]]
@ -60,9 +60,6 @@ if u.has_plugin("cmp") then
cmd [[set undofile]] cmd [[set undofile]]
cmd [[set fcs=eob:\ ]] -- disable showing ~ in empty lines cmd [[set fcs=eob:\ ]] -- disable showing ~ in empty lines
cmd [[command Format :lua vim.lsp.buf.formatting()]]
cmd [[command FormatSync :lua vim.lsp.buf.formatting_sync()]]
cmd [[set noshowmode]] -- to get rid of thing like --INSERT-- cmd [[set noshowmode]] -- to get rid of thing like --INSERT--
cmd [[set noshowcmd]] -- to get rid of display of last command cmd [[set noshowcmd]] -- to get rid of display of last command
cmd [[set shortmess+=F]] -- to get rid of the file name displayed in the command line bar cmd [[set shortmess+=F]] -- to get rid of the file name displayed in the command line bar
@ -74,18 +71,27 @@ if u.has_plugin("cmp") then
-- Enable Theming / Syntax -- Enable Theming / Syntax
o.syntax = "enable" o.syntax = "enable"
o.termguicolors = true o.termguicolors = true
cmd("colorscheme tokyonight") cmd("colorscheme nightfox")
g.material_terminal_italics = 1 g.material_terminal_italics = 1
g.material_theme_style = "darker" g.material_theme_style = "darker"
g.tokyonight_style = "night" g.tokyonight_style = "night"
g.tokyonight_transparent_sidebar = true; g.tokyonight_transparent_sidebar = true
require("nightfox").setup(
{
transparent = true
}
)
require("transparent").setup({
enable = true,
extra_groups = "All"
})
-- Remove background color -- Remove background color
require("transparent").setup({enable = true})
cmd("highlight Normal guibg=none") cmd("highlight Normal guibg=none")
cmd("highlight NonText guibg=none") cmd("highlight NonText guibg=none")
require('neoscroll').setup() require("formatter-conf")
-- Configure nvim-tree -- Configure nvim-tree
g.nvim_tree_special_files = {} g.nvim_tree_special_files = {}
@ -119,9 +125,9 @@ if u.has_plugin("cmp") then
} }
} }
g.nvim_tree_highlight_opened_files = 1; g.nvim_tree_highlight_opened_files = 1
g.nvim_tree_group_empty = 1; g.nvim_tree_group_empty = 1
g.nvim_tree_indent_markers = 0; g.nvim_tree_indent_markers = 0
g.nvim_tree_show_icons = { g.nvim_tree_show_icons = {
folder_arrows = 0, folder_arrows = 0,
folders = 1, folders = 1,
@ -134,7 +140,7 @@ if u.has_plugin("cmp") then
group_empty = 1, group_empty = 1,
hijack_cursor = 1, hijack_cursor = 1,
update_focused_file = { update_focused_file = {
enable = false, enable = false
}, },
diagnostics = { diagnostics = {
enable = true, enable = true,
@ -142,8 +148,8 @@ if u.has_plugin("cmp") then
hint = "", hint = "",
info = "", info = "",
warning = "", warning = "",
error = "", error = ""
}, }
}, },
view = { view = {
auto_resize = true, auto_resize = true,
@ -153,7 +159,7 @@ if u.has_plugin("cmp") then
} }
} }
} }
require('nvim-tree.view').View.winopts.signcolumn = 'no' require("nvim-tree.view").View.winopts.signcolumn = "no"
-- Configure Wiki -- Configure Wiki
g.wiki_root = "~/Notes" g.wiki_root = "~/Notes"
@ -174,7 +180,7 @@ if u.has_plugin("cmp") then
} }
} }
require'nvim-autopairs'.setup() require "nvim-autopairs".setup()
-- Treesitter config -- Treesitter config
require "treesitter-conf" require "treesitter-conf"
@ -209,7 +215,6 @@ if u.has_plugin("cmp") then
-- LSP Config -- LSP Config
require "lspinstaller-conf" require "lspinstaller-conf"
require "lsp-conf" require "lsp-conf"
else else
vim.cmd [[PackerSync]] vim.cmd [[PackerSync]]
end end

View File

@ -1,14 +1,10 @@
-- luasnip setup -- luasnip setup
local cmd = vim.cmd;
local luasnip = require "luasnip" local luasnip = require "luasnip"
local lspkind = require "lspkind" local lspkind = require "lspkind"
local cmp = require "cmp" local cmp = require "cmp"
local cmp_autopairs = require('nvim-autopairs.completion.cmp') local cmp_autopairs = require('nvim-autopairs.completion.cmp')
local has_words_before = function()
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
cmp.setup { cmp.setup {
formatting = { formatting = {
format = lspkind.cmp_format({with_text = true, menu = ({ format = lspkind.cmp_format({with_text = true, menu = ({
@ -32,34 +28,27 @@ cmp.setup {
}, },
mapping = { mapping = {
['<C-Leader>'] = cmp.mapping.complete(), ['<C-Leader>'] = cmp.mapping.complete(),
["<Tab>"] = cmp.mapping(function(fallback) ["<Tab>"] = function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.select_next_item() cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else else
fallback() fallback()
end end
end, { "i", "s" }), end,
["<S-Tab>"] = function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
end,
['<CR>'] = cmp.mapping.confirm({ ['<CR>'] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace, behavior = cmp.ConfirmBehavior.Replace,
select = true, select = true,
}), }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
}, },
sources = { sources = {
{name = "nvim-lua"},
{name = "nvim_lsp"}, {name = "nvim_lsp"},
{name = "luasnip"}, {name = "luasnip"},
{name = "path"}, {name = "path"},

View File

@ -1,8 +1,8 @@
local cmd = vim.cmd; local cmd = vim.cmd
cmd [[ cmd [[
augroup auto_format augroup auto_format
au! au!
au BufWritePre * FormatSync au BufWritePre * Neoformat
augroup END augroup END
]] ]]

View File

@ -34,13 +34,15 @@ map("n", "Y", "yy", options)
map("n", "<Leader>k", "{",options) map("n", "<Leader>k", "{",options)
map("n", "<Leader>j", "}",options) map("n", "<Leader>j", "}",options)
-- Move lines vscode style
map("n", "<A-j>", "<cmd>move +1<CR>", options) map("n", "<A-j>", "<cmd>move +1<CR>", options)
map("n", "<A-k>", "<cmd>move -2<CR>", options) map("n", "<A-k>", "<cmd>move -2<CR>", options)
map("i", "<A-j>", "<cmd>move +1<CR>", options) map("i", "<A-j>", "<cmd>move +1<CR>", options)
map("i", "<A-k>", "<cmd>move -2<CR>", options) map("i", "<A-k>", "<cmd>move -2<CR>", options)
map("v", "<A-j>", ":m '>+1<CR>gv=gv", options) map("v", "<A-j>", ":m '>+1<CR>gv=gv", options)
map("v", "<A-k>", ":m '<-2<CR>gv=gv", options) map("v", "<A-k>", ":m '<-2<CR>gv=gv", options)
map("n", "<A-S-k>", "YP", options);
map("n", "<A-S-j>", "Yp", options);
-- Faster git merge -- Faster git merge
map("n", "<Leader>gd", ":Gvdiffsplit!<CR>", options) map("n", "<Leader>gd", ":Gvdiffsplit!<CR>", options)

View File

@ -13,7 +13,8 @@ return require("packer").startup(function()
use 'lervag/vimtex' use 'lervag/vimtex'
-- Theming Section -- Theming Section
use 'folke/tokyonight.nvim' -- use 'folke/tokyonight.nvim'
use 'EdenEast/nightfox.nvim'
use "xiyaowong/nvim-transparent" use "xiyaowong/nvim-transparent"
-- Layout Plugins -- Layout Plugins
@ -47,20 +48,16 @@ return require("packer").startup(function()
"folke/trouble.nvim", "folke/trouble.nvim",
requires = "kyazdani42/nvim-web-devicons", requires = "kyazdani42/nvim-web-devicons",
config = function() config = function()
require("trouble").setup { require("trouble").setup()
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
end end
} }
-- Syntax / Autocomplete -- Syntax / Autocomplete
use "terminalnode/sway-vim-syntax"
use "neovim/nvim-lspconfig" use "neovim/nvim-lspconfig"
use "github/copilot.vim" -- use "github/copilot.vim"
use "hrsh7th/nvim-cmp" use "hrsh7th/nvim-cmp"
use "hrsh7th/cmp-nvim-lsp" use "hrsh7th/cmp-nvim-lsp"
use "hrsh7th/cmp-nvim-lua"
use "hrsh7th/cmp-path" use "hrsh7th/cmp-path"
use "hrsh7th/cmp-calc" use "hrsh7th/cmp-calc"
use "hrsh7th/cmp-buffer" use "hrsh7th/cmp-buffer"
@ -86,7 +83,7 @@ return require("packer").startup(function()
use "ellisonleao/glow.nvim" use "ellisonleao/glow.nvim"
-- Autoformat -- Autoformat
--use "sbdchd/neoformat" use "sbdchd/neoformat"
-- use "lukas-reineke/format.nvim" -- use "lukas-reineke/format.nvim"
-- General Popup Window -- General Popup Window

View File

@ -2,17 +2,17 @@ local M = {}
local cmd = vim.cmd local cmd = vim.cmd
function M.create_augroup(autocmds, name) function M.create_augroup(autocmds, name)
cmd('augroup ' .. name) cmd("augroup " .. name)
cmd('autocmd!') cmd("autocmd!")
for _, autocmd in ipairs(autocmds) do for _, autocmd in ipairs(autocmds) do
cmd('autocmd ' .. table.concat(autocmd, ' ')) cmd("autocmd " .. table.concat(autocmd, " "))
end end
cmd('augroup END') cmd("augroup END")
end end
function M.ReloadConfig() function M.ReloadConfig()
for name, _ in pairs(package.loaded) do for name, _ in pairs(package.loaded) do
if name:match('^cnull') then if name:match("^cnull") then
package.loaded[name] = nil package.loaded[name] = nil
end end
end end
@ -21,20 +21,22 @@ function M.ReloadConfig()
end end
local function dump(o) local function dump(o)
if type(o) == 'table' then if type(o) == "table" then
local s = '{ ' local s = "{ "
for k, v in pairs(o) do for k, v in pairs(o) do
if type(k) ~= 'number' then k = '"'..k..'"' end if type(k) ~= "number" then
s = s .. '['..k..'] = ' .. dump(v) .. ',' k = '"' .. k .. '"'
end end
return s .. '} ' s = s .. "[" .. k .. "] = " .. dump(v) .. ","
end
return s .. "} "
else else
return tostring(o) return tostring(o)
end end
end end
function M.has_plugin(pluginName) function M.has_plugin(pluginName)
local status = pcall(require, pluginName); local status = pcall(require, pluginName)
return status return status
end end