diff --git a/configs/.zshrc b/configs/.zshrc index aba0dca..62109ed 100644 --- a/configs/.zshrc +++ b/configs/.zshrc @@ -56,6 +56,10 @@ if [ -d "$HOME/.asdf" ] ; then . "$HOME/.asdf/asdf.sh" fi +if [ "$(which go)" != "" ] ; then + export PATH="$PATH:$(go env GOPATH)/bin" +fi + #If fdfind is installed force fzf to use it if type fdfind &> /dev/null ; then export FZF_DEFAULT_COMMAND='fdfind --type f' diff --git a/configs/nvim/init.lua b/configs/nvim/init.lua index 8392ba0..0ce4072 100644 --- a/configs/nvim/init.lua +++ b/configs/nvim/init.lua @@ -7,209 +7,214 @@ local g = vim.g local cmd = vim.cmd local opt = vim.opt -require ("plugins") +require("plugins") if u.has_plugin("cmp") then + vim.g.did_load_filetypes = 150 - vim.g.did_load_filetypes = 1 + -- Global options + o.number = true -- show line number + o.showmatch = true -- show matching brackets - -- Global options - o.number = true -- show line number - o.showmatch = true -- show matching brackets - o.swapfile = false + -- Indentation options + vim.cmd [[ + set autoindent + set expandtab + set shiftwidth=2 + set softtabstop=2 + set tabstop=1 + ]] - -- Indentation options - vim.cmd [[ - set autoindent - set expandtab - set shiftwidth=2 - set softtabstop=2 - set tabstop=2 - ]] + g.hidden = true -- unload buffers when hidden + g.filetype = true -- execute autocommands based on filetype + o.autoread = true - g.hidden = true --unload buffers when hidden - g.filetype = true -- execute autocommands based on filetype - o.autoread = true + -- Search + o.inccommand = "nosplit" -- show substitutions incrementally + o.ignorecase = true + o.smartcase = true + opt.wildignore:append(".git/*", "node_modules/*") + o.wildignorecase = true + o.lazyredraw = true - -- Search - o.inccommand = 'nosplit' -- show substitutions incrementally - o.ignorecase = true - o.smartcase = true - opt.wildignore:append('.git/*', 'node_modules/*') - o.wildignorecase = true - o.lazyredraw = true + opt.listchars:append( + { + extends = "#", + eol = "↴", + space = "⋅", + tab = "▸ " + } + ) - opt.listchars:append({ - extends = "#", - eol = '↴', - space = '⋅', - tab = '▸ ', - }) + -- Shortmess + cmd [[set shortmess+=F]] + g.loaded_netrw = 1 + g.loaded_netrwPlugin = 1 + g.loaded_zipPlugin = 1 + g.loaded_zip = 1 - -- Shortmess - cmd [[set shortmess+=F]] - g.loaded_netrw = 1 - g.loaded_netrwPlugin = 1 - g.loaded_zipPlugin = 1 - g.loaded_zip = 1 + g.languagetool_server_jar = "~/build/languagetool/languagetool-server.jar" + g.languagetool_lang = "de" - g.languagetool_server_jar = "~/build/languagetool/languagetool-server.jar" - g.languagetool_lang= "de" + cmd [[set mouse=a]] -- enable mouse interaction + cmd [[set undofile]] + cmd [[set fcs=eob:\ ]] -- disable showing ~ in empty lines - cmd [[set mouse=a]] -- enable mouse interaction - cmd [[set undofile]] - cmd [[set fcs=eob:\ ]] --disable showing ~ in empty lines + cmd [[set noshowmode]] -- to get rid of thing like --INSERT-- + 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 [[command Format :lua vim.lsp.buf.formatting()]] - cmd [[command FormatSync :lua vim.lsp.buf.formatting_sync()]] + cmd [[set noruler]] - cmd [[set noshowmode]] --to get rid of thing like --INSERT-- - 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 + g.ale_fixers = {"prettier", "eslint"} - cmd [[set noruler]] + -- Enable Theming / Syntax + o.syntax = "enable" + o.termguicolors = true + cmd("colorscheme nightfox") + g.material_terminal_italics = 1 + g.material_theme_style = "darker" + g.tokyonight_style = "night" + g.tokyonight_transparent_sidebar = true + require("nightfox").setup( + { + transparent = true + } + ) - g.ale_fixers = {"prettier", "eslint"} - - -- Enable Theming / Syntax - o.syntax = "enable" - o.termguicolors = true - cmd("colorscheme tokyonight") - g.material_terminal_italics = 1 - g.material_theme_style = "darker" - g.tokyonight_style = "night" - g.tokyonight_transparent_sidebar = true; - - -- Remove background color - require("transparent").setup({enable = true}) - cmd("highlight Normal guibg=none") - cmd("highlight NonText guibg=none") - - require('neoscroll').setup() - - -- Configure nvim-tree - g.nvim_tree_special_files = {} - g.nvim_tree_icons = { - default = "", - symlink = "", - git = { - unstaged = "*", - staged = "✓", - unmerged = "", - renamed = "➜", - untracked = "★", - deleted = "", - ignored = "◌" - }, - folder = { - arrow_open = ">", - arrow_closed = "<", - default = "", - open = "", - empty = "", - empty_open = "", - symlink = "", - symlink_open = "" - }, - lsp = { - hint = "", - info = "", - warning = "", - error = "" - } - } - - g.nvim_tree_highlight_opened_files = 1; - g.nvim_tree_group_empty = 1; - g.nvim_tree_indent_markers = 0; - g.nvim_tree_show_icons ={ - folder_arrows = 0, - folders = 1, - files = 1, - git = 1 - } - require("nvim-tree").setup { - auto_open = 1, - gitignore = 1, - group_empty = 1, - hijack_cursor = 1, - update_focused_file = { - enable = false, - }, - diagnostics = { + require("transparent").setup({ enable = true, - icons = { - hint = "", - info = "", - warning = "", - error = "", - }, - }, - view = { - auto_resize = true, - hide_root_folder = true, - winopts = { - signcolumn = "no" - } - } - } - require('nvim-tree.view').View.winopts.signcolumn = 'no' + extra_groups = "All" + }) - -- Configure Wiki - g.wiki_root = "~/Notes" - g.wiki_filetypes = {"md"} - g.wiki_link_extension = ".md" + -- Remove background color + cmd("highlight Normal guibg=none") + cmd("highlight NonText guibg=none") - -- KeyBindings - require "keymappings" + require("formatter-conf") - require "nvim-tmux-navigation".setup { - keybindings = { - left = "", - down = "", - up = "", - right = "", - last_active = "", - next = "" - } - } - - require'nvim-autopairs'.setup() - - -- Treesitter config - require "treesitter-conf" - - -- Autocompletion Setup - require "snippets" - require "cmp-conf" - - -- LSP Config - require "lspinstaller-conf" - require "lazy-git" - - require "autocommands" - - -- Setup rest.vim - require("rest-nvim").setup( - { - -- Open request results in a horizontal split - result_split_horizontal = false, - -- Skip SSL verification, useful for unknown certificates - skip_ssl_verification = false, - -- Highlight request on run - highlight = { - enabled = true, - timeout = 150 - }, - -- Jump to request line on run - jump_to_request = false + -- Configure nvim-tree + g.nvim_tree_special_files = {} + g.nvim_tree_icons = { + default = "", + symlink = "", + git = { + unstaged = "*", + staged = "✓", + unmerged = "", + renamed = "➜", + untracked = "★", + deleted = "", + ignored = "◌" + }, + folder = { + arrow_open = ">", + arrow_closed = "<", + default = "", + open = "", + empty = "", + empty_open = "", + symlink = "", + symlink_open = "" + }, + lsp = { + hint = "", + info = "", + warning = "", + error = "" + } } - ) - -- LSP Config - require "lspinstaller-conf" - require "lsp-conf" + g.nvim_tree_highlight_opened_files = 1 + g.nvim_tree_group_empty = 1 + g.nvim_tree_indent_markers = 0 + g.nvim_tree_show_icons = { + folder_arrows = 0, + folders = 1, + files = 1, + git = 1 + } + require("nvim-tree").setup { + auto_open = 1, + gitignore = 1, + group_empty = 1, + hijack_cursor = 1, + update_focused_file = { + enable = false + }, + diagnostics = { + enable = true, + icons = { + hint = "", + info = "", + warning = "", + error = "" + } + }, + view = { + auto_resize = true, + hide_root_folder = true, + winopts = { + signcolumn = "no" + } + } + } + require("nvim-tree.view").View.winopts.signcolumn = "no" + -- Configure Wiki + g.wiki_root = "~/Notes" + g.wiki_filetypes = {"md"} + g.wiki_link_extension = ".md" + + -- KeyBindings + require "keymappings" + + require "nvim-tmux-navigation".setup { + keybindings = { + left = "", + down = "", + up = "", + right = "", + last_active = "", + next = "" + } + } + + require "nvim-autopairs".setup() + + -- Treesitter config + require "treesitter-conf" + + -- Autocompletion Setup + require "snippets" + require "cmp-conf" + + -- LSP Config + require "lspinstaller-conf" + require "lazy-git" + + require "autocommands" + + -- Setup rest.vim + require("rest-nvim").setup( + { + -- Open request results in a horizontal split + result_split_horizontal = false, + -- Skip SSL verification, useful for unknown certificates + skip_ssl_verification = false, + -- Highlight request on run + highlight = { + enabled = true, + timeout = 150 + }, + -- Jump to request line on run + jump_to_request = false + } + ) + + -- LSP Config + require "lspinstaller-conf" + require "lsp-conf" else - vim.cmd[[PackerSync]] + vim.cmd [[PackerSync]] end diff --git a/configs/nvim/lua/cmp-conf.lua b/configs/nvim/lua/cmp-conf.lua index 914eb95..16f9888 100644 --- a/configs/nvim/lua/cmp-conf.lua +++ b/configs/nvim/lua/cmp-conf.lua @@ -1,14 +1,10 @@ -- luasnip setup +local cmd = vim.cmd; local luasnip = require "luasnip" local lspkind = require "lspkind" local cmp = require "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 { formatting = { format = lspkind.cmp_format({with_text = true, menu = ({ @@ -32,34 +28,27 @@ cmp.setup { }, mapping = { [''] = cmp.mapping.complete(), - [""] = cmp.mapping(function(fallback) + [""] = function(fallback) if cmp.visible() then cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - elseif has_words_before() then - cmp.complete() else fallback() end - end, { "i", "s" }), - + end, + [""] = function(fallback) + if cmp.visible() then + cmp.select_prev_item() + else + fallback() + end + end, [''] = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true, }), - - [""] = 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 = { + {name = "nvim-lua"}, {name = "nvim_lsp"}, {name = "luasnip"}, {name = "path"}, diff --git a/configs/nvim/lua/formatter-conf.lua b/configs/nvim/lua/formatter-conf.lua index 4c6f44f..dc597ea 100644 --- a/configs/nvim/lua/formatter-conf.lua +++ b/configs/nvim/lua/formatter-conf.lua @@ -1,8 +1,8 @@ -local cmd = vim.cmd; +local cmd = vim.cmd cmd [[ augroup auto_format au! - au BufWritePre * FormatSync + au BufWritePre * Neoformat augroup END ]] diff --git a/configs/nvim/lua/keymappings.lua b/configs/nvim/lua/keymappings.lua index b40f8da..5d60495 100644 --- a/configs/nvim/lua/keymappings.lua +++ b/configs/nvim/lua/keymappings.lua @@ -34,13 +34,15 @@ map("n", "Y", "yy", options) map("n", "k", "{",options) map("n", "j", "}",options) +-- Move lines vscode style map("n", "", "move +1", options) map("n", "", "move -2", options) map("i", "", "move +1", options) map("i", "", "move -2", options) map("v", "", ":m '>+1gv=gv", options) map("v", "", ":m '<-2gv=gv", options) - +map("n", "", "YP", options); +map("n", "", "Yp", options); -- Faster git merge map("n", "gd", ":Gvdiffsplit!", options) diff --git a/configs/nvim/lua/plugins.lua b/configs/nvim/lua/plugins.lua index e4103b6..488979d 100644 --- a/configs/nvim/lua/plugins.lua +++ b/configs/nvim/lua/plugins.lua @@ -13,7 +13,8 @@ return require("packer").startup(function() use 'lervag/vimtex' -- Theming Section - use 'folke/tokyonight.nvim' + -- use 'folke/tokyonight.nvim' + use 'EdenEast/nightfox.nvim' use "xiyaowong/nvim-transparent" -- Layout Plugins @@ -47,20 +48,16 @@ return require("packer").startup(function() "folke/trouble.nvim", requires = "kyazdani42/nvim-web-devicons", config = function() - require("trouble").setup { - -- your configuration comes here - -- or leave it empty to use the default settings - -- refer to the configuration section below - } + require("trouble").setup() end } -- Syntax / Autocomplete - use "terminalnode/sway-vim-syntax" use "neovim/nvim-lspconfig" - use "github/copilot.vim" + -- use "github/copilot.vim" use "hrsh7th/nvim-cmp" use "hrsh7th/cmp-nvim-lsp" + use "hrsh7th/cmp-nvim-lua" use "hrsh7th/cmp-path" use "hrsh7th/cmp-calc" use "hrsh7th/cmp-buffer" @@ -86,7 +83,7 @@ return require("packer").startup(function() use "ellisonleao/glow.nvim" -- Autoformat - --use "sbdchd/neoformat" + use "sbdchd/neoformat" -- use "lukas-reineke/format.nvim" -- General Popup Window diff --git a/configs/nvim/lua/utils.lua b/configs/nvim/lua/utils.lua index b5e9aa4..bb7044e 100644 --- a/configs/nvim/lua/utils.lua +++ b/configs/nvim/lua/utils.lua @@ -2,40 +2,42 @@ local M = {} local cmd = vim.cmd function M.create_augroup(autocmds, name) - cmd('augroup ' .. name) - cmd('autocmd!') - for _, autocmd in ipairs(autocmds) do - cmd('autocmd ' .. table.concat(autocmd, ' ')) - end - cmd('augroup END') + cmd("augroup " .. name) + cmd("autocmd!") + for _, autocmd in ipairs(autocmds) do + cmd("autocmd " .. table.concat(autocmd, " ")) + end + cmd("augroup END") end function M.ReloadConfig() - for name,_ in pairs(package.loaded) do - if name:match('^cnull') then - package.loaded[name] = nil - end - end + for name, _ in pairs(package.loaded) do + if name:match("^cnull") then + package.loaded[name] = nil + end + end - dofile(vim.env.MYVIMRC) + dofile(vim.env.MYVIMRC) end local function dump(o) - if type(o) == 'table' then - local s = '{ ' - for k,v in pairs(o) do - if type(k) ~= 'number' then k = '"'..k..'"' end - s = s .. '['..k..'] = ' .. dump(v) .. ',' - end - return s .. '} ' - else - return tostring(o) - end - end + if type(o) == "table" then + local s = "{ " + for k, v in pairs(o) do + if type(k) ~= "number" then + k = '"' .. k .. '"' + end + s = s .. "[" .. k .. "] = " .. dump(v) .. "," + end + return s .. "} " + else + return tostring(o) + end +end function M.has_plugin(pluginName) - local status = pcall(require, pluginName); - return status + local status = pcall(require, pluginName) + return status end return M