commit 133fc547dc2660de698ec13dbf6121effc99e00b Author: Johannes Knopp Date: Tue Oct 29 14:10:21 2024 +0100 Initial commit diff --git a/.bashrc b/.bashrc new file mode 100644 index 0000000..bf5752a --- /dev/null +++ b/.bashrc @@ -0,0 +1,9 @@ +alias vim='nvim' + + +parse_git_branch() { + git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' +} + + +PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\[\033[33m\]$(parse_git_branch)\[\033[00m\]\$ ' diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3353ab9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,27 @@ +abrt/ +.gsd-keyboard.settings-ported +GNOME-xdg-terminals.list +dconf/ +enchant/ +evolution/ +gnome-initial-setup-done +google-chrome/ +gtk-3.0/ +gtk-4.0/ +ibus/ +keepassxc/ +monitors.xml +monitors.xml~ +pulse/ +rncbc.org/ +user-dirs.dirs +user-dirs.locale +vlc/ +xdg-terminals.list +autostart +btop/ +discord/ +obs-studio/ +QtProject.conf +pavucontrol.ini +StardewValley/ diff --git a/.vimrc_remote b/.vimrc_remote new file mode 100644 index 0000000..6aac865 --- /dev/null +++ b/.vimrc_remote @@ -0,0 +1,31 @@ +set clipboard+=unnamedplus + +set number +set relativenumber +set mouse=a +set tabstop=4 +set shiftwidth=4 +set smarttab +set encoding=utf-8 + +noremap j gj +noremap k gk +noremap gk +noremap gj + +" fold config +set foldmethod=indent +set foldlevel=1 + +let &t_SI = "\e[6 q" +let &t_EI = "\e[2 q" + +" reset the cursor on start (for older versions of vim, usually not required) +augroup myCmds +au! +autocmd VimEnter * silent !echo -ne "\e[2 q" +augroup END + +set ttimeout +set ttimeoutlen=1 +set ttyfast diff --git a/README.md b/README.md new file mode 100644 index 0000000..f4fd275 --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +## Config files + +### [Neovim](https://neovim.io) + +Install the vim plugin manager [vim-plug](https://github.com/junegunn/vim-plug). + +Install [powerline fonts](https://github.com/powerline/fonts) for powerline statusline plugins. + +Install the plugins with the following command: + +``` +:PlugInstall +``` + +### .bashrc + +Added functionality to show current git branch in terminal diff --git a/nvim/after/ftplugin/markdown.lua b/nvim/after/ftplugin/markdown.lua new file mode 100644 index 0000000..7307b61 --- /dev/null +++ b/nvim/after/ftplugin/markdown.lua @@ -0,0 +1,2 @@ +vim.opt_local.expandtab = true +vim.opt_local.shiftwidth = 2 diff --git a/nvim/after/ftplugin/scss.lua b/nvim/after/ftplugin/scss.lua new file mode 100644 index 0000000..a1efa40 --- /dev/null +++ b/nvim/after/ftplugin/scss.lua @@ -0,0 +1 @@ +vim.opt_local.shiftwidth = 4 diff --git a/nvim/after/ftplugin/vim.lua b/nvim/after/ftplugin/vim.lua new file mode 100644 index 0000000..526f29c --- /dev/null +++ b/nvim/after/ftplugin/vim.lua @@ -0,0 +1 @@ +vim.opt_local.textwidth = 0 diff --git a/nvim/init.lua b/nvim/init.lua new file mode 100644 index 0000000..d52310c --- /dev/null +++ b/nvim/init.lua @@ -0,0 +1,2 @@ +require('config.core') +require('config.lazy') diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json new file mode 100644 index 0000000..ffd892b --- /dev/null +++ b/nvim/lazy-lock.json @@ -0,0 +1,38 @@ +{ + "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" }, + "alpha-nvim": { "branch": "main", "commit": "bf3c8bb8c02ed3d9644cc5bbc48e2bdc39349cd7" }, + "auto-session": { "branch": "main", "commit": "9d02776ed42874d37869dc683396234e3724b52d" }, + "bufferline.nvim": { "branch": "main", "commit": "2e3c8cc5a57ddd32f1edd2ffd2ccb10c09421f6c" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, + "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, + "dressing.nvim": { "branch": "master", "commit": "1b7921eecc65af1baf8ac1dc06f0794934cbcfb2" }, + "friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" }, + "lazygit.nvim": { "branch": "main", "commit": "56760339a81cd1540d5a72fd9d93010a2677b55d" }, + "lspkind.nvim": { "branch": "master", "commit": "59c3f419af48a2ffb2320cea85e44e5a95f71664" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "25c11854aa25558ee6c03432edfa0df0217324be" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" }, + "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, + "monokai-nightasty.nvim": { "branch": "main", "commit": "340bed332b76d59ecd999f9dda5538a53464da3a" }, + "neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" }, + "none-ls-extras.nvim": { "branch": "main", "commit": "f2bb002c8aa644d1f253772ff5d4e75e45ff7f4f" }, + "none-ls.nvim": { "branch": "main", "commit": "dcc8cd4efdcb29275681a3c95786a816330dbca6" }, + "nvim-autopairs": { "branch": "master", "commit": "ee297f215e95a60b01fde33275cc3c820eddeebe" }, + "nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" }, + "nvim-lsp-file-operations": { "branch": "master", "commit": "92a673de7ecaa157dd230d0128def10beb56d103" }, + "nvim-lspconfig": { "branch": "master", "commit": "541f3a2781de481bb84883889e4d9f0904250a56" }, + "nvim-surround": { "branch": "main", "commit": "ec2dc7671067e0086cdf29c2f5df2dd909d5f71f" }, + "nvim-tree.lua": { "branch": "master", "commit": "f5f67892996b280ae78b1b0a2d07c4fa29ae0905" }, + "nvim-treesitter": { "branch": "master", "commit": "03452942dfbd998701d4123ccad2090e1bc7e9f1" }, + "nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" }, + "nvim-web-devicons": { "branch": "master", "commit": "19d257cf889f79f4022163c3fbb5e08639077bd8" }, + "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" }, + "telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, + "vim-airline": { "branch": "master", "commit": "81eca994860645acbb58442285cdd70df5c71d2b" }, + "vim-airline-themes": { "branch": "master", "commit": "a9aa25ce323b2dd04a52706f4d1b044f4feb7617" }, + "vim-floaterm": { "branch": "master", "commit": "4e28c8dd0271e10a5f55142fb6fe9b1599ee6160" }, + "which-key.nvim": { "branch": "main", "commit": "8badb359f7ab8711e2575ef75dfe6fbbd87e4821" } +} diff --git a/nvim/lua/config/core/init.lua b/nvim/lua/config/core/init.lua new file mode 100644 index 0000000..480ac51 --- /dev/null +++ b/nvim/lua/config/core/init.lua @@ -0,0 +1,2 @@ +require('config.core.keymaps') +require('config.core.options') diff --git a/nvim/lua/config/core/keymaps.lua b/nvim/lua/config/core/keymaps.lua new file mode 100644 index 0000000..3126e7b --- /dev/null +++ b/nvim/lua/config/core/keymaps.lua @@ -0,0 +1,27 @@ +local keymap = vim.keymap + + +local opts = { noremap = true, silent = true } + +-- INSERT MODE + +-- map `ctrl + backspace` to delete previous word in insert mode +keymap.set('i', '', '', opts) + +-- map `ctrl + delete` to delete next word in insert mode +keymap.set('i', '', 'dw', opts) + + +-- NORMAL MODE + +-- navigate in visual linewraps +keymap.set('n', 'k', 'gk', opts) +keymap.set('n', 'j', 'gj', opts) +keymap.set('n', '', 'gk', opts) +keymap.set('n', '', 'gj', opts) + + +-- COMMANDS + +-- print current working directory +vim.api.nvim_create_user_command('Cwd', function() print(vim.fn.getcwd()) end, {}) diff --git a/nvim/lua/config/core/options.lua b/nvim/lua/config/core/options.lua new file mode 100644 index 0000000..7b4afd6 --- /dev/null +++ b/nvim/lua/config/core/options.lua @@ -0,0 +1,38 @@ +local opt = vim.opt + +-- numbers +opt.relativenumber = true +opt.number = true + +-- enable mouse in all modes +opt.mouse = 'a' +-- opt.mousemoveevent = true + +-- tabs +opt.autoindent = true +opt.tabstop = 4 +opt.softtabstop = 4 +opt.shiftwidth = 4 +opt.smarttab = true + +-- default encodings to utf-8 +opt.encoding = 'utf-8' +opt.fileencoding = 'utf-8' +-- opt.termencoding = 'utf-8' -- currently broken + +-- folds +opt.foldmethod = 'indent' +opt.foldlevelstart = 99 +opt.foldlevel = 1 + +-- search +opt.ignorecase = true +opt.smartcase = true + +-- styling +opt.scrolloff = 5 +opt.wrap = true +opt.showbreak = '++' +opt.breakindent = true +opt.linebreak = true +opt.termguicolors = true diff --git a/nvim/lua/config/lazy.lua b/nvim/lua/config/lazy.lua new file mode 100644 index 0000000..42b7387 --- /dev/null +++ b/nvim/lua/config/lazy.lua @@ -0,0 +1,28 @@ +local lazypath = vim.fn.stdpath('data') .. 'lazy/lazy.nvim' + +-- bootstrap lazy +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = 'https://github.com/folke/lazy.nvim.git' + local out = vim.fn.system({ 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { 'Failed to clone lazy.nvim:\n', 'ErrorMsg' }, + { out, 'WarningMsg' }, + { '\nPress any key to exit...' }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +vim.g.mapleader = ' ' +vim.g.maplocalleader = '\\' + +-- setup lazy and import plugins +require('lazy').setup({ + spec = { + { import = 'config.plugins' }, + { import = 'config.plugins.lsp' }, + }, +}) diff --git a/nvim/lua/config/plugins/airline.lua b/nvim/lua/config/plugins/airline.lua new file mode 100644 index 0000000..7ea948a --- /dev/null +++ b/nvim/lua/config/plugins/airline.lua @@ -0,0 +1,35 @@ +return { + 'vim-airline/vim-airline', + dependencies = { + 'vim-airline/vim-airline-themes', + 'nvim-tree/nvim-web-devicons', + }, + config = function() + vim.g.airline_theme = 'base16_monokai' + vim.g.airline_powerline_fonts = 1 + -- vim.g.airline_symbols = {} + + -- unicode symbols + vim.g.airline_left_sep = '»' + vim.g.airline_left_sep = '▶' + vim.g.airline_right_sep = '«' + vim.g.airline_right_sep = '◀' + vim.g.airline_symbols.linenr = '␊' + vim.g.airline_symbols.linenr = '␤' + vim.g.airline_symbols.linenr = '¶' + vim.g.airline_symbols.branch = '⎇' + vim.g.airline_symbols.paste = 'ρ' + vim.g.airline_symbols.paste = 'Þ' + vim.g.airline_symbols.paste = '∥' + vim.g.airline_symbols.whitespace = 'Ξ' + + -- airline symbols + vim.g.airline_left_sep = '' + vim.g.airline_left_alt_sep = '' + vim.g.airline_right_sep = '' + vim.g.airline_right_alt_sep = '' + vim.g.airline_symbols.branch = '' + vim.g.airline_symbols.readonly = '' + vim.g.airline_symbols.linenr = '' + end, +} diff --git a/nvim/lua/config/plugins/alpha.lua b/nvim/lua/config/plugins/alpha.lua new file mode 100644 index 0000000..bcf5552 --- /dev/null +++ b/nvim/lua/config/plugins/alpha.lua @@ -0,0 +1,40 @@ +return { + 'goolord/alpha-nvim', + dependencies = { + 'nvim-tree/nvim-web-devicons', + }, + event = 'VimEnter', + config = function() + local alpha = require('alpha') + local startify = require('alpha.themes.startify') + + -- startify.section.header.val = { + -- '░▒▓███████▓▒░ ░▒▓████████▓▒░░▒▓██████▓▒░ ░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓██████████████▓▒░ ', + -- '░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░', + -- '░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░', + -- '░▒▓█▓▒░░▒▓█▓▒░░▒▓██████▓▒░ ░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░', + -- '░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░', + -- '░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░ ░▒▓█▓▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░', + -- '░▒▓█▓▒░░▒▓█▓▒░░▒▓████████▓▒░░▒▓██████▓▒░ ░▒▓██▓▒░ ░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░░▒▓█▓▒░', + -- ' ' + -- } + + alpha.setup(startify.opts) + + local alpha_start_group = vim.api.nvim_create_augroup('AlphaStart', { clear = true }) + vim.api.nvim_create_autocmd('TabNewEntered', { + callback = function() + local bufnr = vim.api.nvim_get_current_buf() + local bufname = vim.api.nvim_buf_get_name(bufnr) + + -- Start alpha if no file associated with buffer + if bufname == '' then + alpha.start() + end + end, + group = alpha_start_group + }) + + -- vim.cmd([[autocmd FileType alpha setlocal nofoldenable]]) + end +} diff --git a/nvim/lua/config/plugins/auto-session.lua b/nvim/lua/config/plugins/auto-session.lua new file mode 100644 index 0000000..e8a2ee5 --- /dev/null +++ b/nvim/lua/config/plugins/auto-session.lua @@ -0,0 +1,55 @@ +return { + 'rmagatti/auto-session', + lazy = false, + config = function() + local auto_session = require('auto-session') + auto_session.setup({ + auto_save = false, + auto_restore = false, + post_restore_cmds = { + function () + local buf_exists = function(bufname) + for _, buf in ipairs(vim.fn.getbufinfo({ bufloaded = true })) do + if buf.name:match(bufname) then + return true + end + end + return false + end + + -- If NvimTree was opened when the session was saved, show it + if buf_exists('NvimTree_') then + require('nvim-tree.api').tree.open() + end + end + } + }) + + local opts = { silent = true, noremap = true } + + local keymap = vim.keymap + keymap.set('n', 'ss', 'SessionSave', opts) + keymap.set('n', 'sq', 'SessionSavewaqa', opts) + keymap.set('n', 'sl', 'SessionSearch', opts) + keymap.set('n', 'sr', 'SessionRestore', opts) + keymap.set('n', 'sd', 'Autosession delete', opts) + + local function named_save() + vim.ui.input({ prompt = 'Enter Session name: ' }, function(input) + auto_session.SaveSession(input) + end) + end + keymap.set('n', 'sS', named_save, opts) + + local wk = require('which-key') + wk.add({ + { 's', group = 'auto-session' }, + { 'ss', desc = 'SessionSave' }, + { 'sS', desc = 'NamedSessionSave' }, + { 'sq', desc = 'Save and Quit' }, + { 'sl', desc = 'SessionList (SessionSearch)'}, + { 'sr', desc = 'SessionRestore'}, + { 'sd', desc = 'SessionDelete'}, + }) + end, +} diff --git a/nvim/lua/config/plugins/autopairs.lua b/nvim/lua/config/plugins/autopairs.lua new file mode 100644 index 0000000..e9e749e --- /dev/null +++ b/nvim/lua/config/plugins/autopairs.lua @@ -0,0 +1,22 @@ +return { + 'windwp/nvim-autopairs', + event = { 'InsertEnter' }, + dependencies = { + 'hrsh7th/nvim-cmp', + }, + config = function() + local autopairs = require('nvim-autopairs') + + autopairs.setup({ + check_ts = true, + ts_config = { + javascript = { 'template_string' }, + }, + }) + + local cmp_autopairs = require('nvim-autopairs.completion.cmp') + local cmp = require('cmp') + + cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done()) + end, +} diff --git a/nvim/lua/config/plugins/bufferline.lua b/nvim/lua/config/plugins/bufferline.lua new file mode 100644 index 0000000..a6dccf6 --- /dev/null +++ b/nvim/lua/config/plugins/bufferline.lua @@ -0,0 +1,24 @@ +return { + 'akinsho/bufferline.nvim', + lazy = false, + version = '*', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + config = function () + local bufferline = require('bufferline') + bufferline.setup({ + options = { + hover = { + enabled = true, + delay = 200, + reveal = {'close'} + }, + } + }) + + local map = vim.keymap.set + local opts = { noremap = true, silent = true } + + map('n', '', 'BufferLineCyclePrev', opts) + map('n', '', 'BufferLineCycleNext', opts) + end +} diff --git a/nvim/lua/config/plugins/cmp.lua b/nvim/lua/config/plugins/cmp.lua new file mode 100644 index 0000000..3f006bc --- /dev/null +++ b/nvim/lua/config/plugins/cmp.lua @@ -0,0 +1,55 @@ +return { + 'hrsh7th/nvim-cmp', + event = 'InsertEnter', + dependencies = { + "hrsh7th/cmp-buffer", -- source for text in buffer + "hrsh7th/cmp-path", -- source for file system paths + { + "L3MON4D3/LuaSnip", + -- follow latest release. + version = "v2.*", -- Replace by the latest released major (first number of latest release) + -- install jsregexp (optional!). + build = "make install_jsregexp", + }, + "saadparwaiz1/cmp_luasnip", -- for autocompletion + "rafamadriz/friendly-snippets", -- useful snippets + "onsails/lspkind.nvim", -- vs-code like pictograms + }, + config = function() + -- TODO keybindings + local cmp = require('cmp') + local luasnip = require('luasnip') + local lspkind = require('lspkind') + -- require('lspkind.loaders.from_vscode').lazy_load() + + cmp.setup({ + -- preselect = nil, + completion = { + completeopt = 'menu,menuone,preview', + }, + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), + [''] = cmp.mapping.confirm({ select = true }), + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'luasnip' }, + { name = 'buffer' }, + { name = 'path' }, + }), + -- formatting = { + -- format = lspkind.cmp_format({ + -- maxwidth = 50, + -- ellipsis_char = '...', + -- }), + -- }, + }) + end, +} diff --git a/nvim/lua/config/plugins/colorscheme.lua b/nvim/lua/config/plugins/colorscheme.lua new file mode 100644 index 0000000..4791c2f --- /dev/null +++ b/nvim/lua/config/plugins/colorscheme.lua @@ -0,0 +1,8 @@ +return { + 'polirritmico/monokai-nightasty.nvim', + priority = 1000, + config = function() + require('monokai-nightasty').setup() + vim.cmd('colorscheme monokai-nightasty') + end, +} diff --git a/nvim/lua/config/plugins/diffview.lua b/nvim/lua/config/plugins/diffview.lua new file mode 100644 index 0000000..7c9e082 --- /dev/null +++ b/nvim/lua/config/plugins/diffview.lua @@ -0,0 +1,3 @@ +return { + 'sindrets/diffview.nvim' +} diff --git a/nvim/lua/config/plugins/dressing.lua b/nvim/lua/config/plugins/dressing.lua new file mode 100644 index 0000000..1c30c7a --- /dev/null +++ b/nvim/lua/config/plugins/dressing.lua @@ -0,0 +1,4 @@ +return { + 'stevearc/dressing.nvim', + opts = {} +} diff --git a/nvim/lua/config/plugins/floaterm.lua b/nvim/lua/config/plugins/floaterm.lua new file mode 100644 index 0000000..41c8a3f --- /dev/null +++ b/nvim/lua/config/plugins/floaterm.lua @@ -0,0 +1,18 @@ +return { + 'voldikss/vim-floaterm', + config = function () + local keymap = vim.keymap + local opts = { noremap = true, silent = true } + keymap.set('n', '', 'FloatermToggle', opts) + keymap.set('t', '', 'FloatermToggle', opts) + keymap.set('t', '', 'FloatermPrev', opts) + keymap.set('t', '', 'FloatermNext', opts) + + local wk = require('which-key') + wk.add({ + { 't', group = 'Floaterm', icon = { icon = ' ', color = 'red' } }, + { 'tn', 'tn', desc = 'New Terminal', noremap = true, silent = true }, + { 'tt', 'tt', desc = 'Toggle Terminal', noremap = true, silent = true }, + }) + end +} diff --git a/nvim/lua/config/plugins/init.lua b/nvim/lua/config/plugins/init.lua new file mode 100644 index 0000000..432c9a7 --- /dev/null +++ b/nvim/lua/config/plugins/init.lua @@ -0,0 +1,3 @@ +return { + 'nvim-lua/plenary.nvim', -- dependency of many plungins +} diff --git a/nvim/lua/config/plugins/lazygit.lua b/nvim/lua/config/plugins/lazygit.lua new file mode 100644 index 0000000..20aa8b0 --- /dev/null +++ b/nvim/lua/config/plugins/lazygit.lua @@ -0,0 +1,14 @@ +return { + 'kdheepak/lazygit.nvim', + lazy = true, + cmd = { + 'LazyGit', + 'LazyGitConfig', + 'LazyGitCurrentFile', + 'LazyGitFilter', + 'LazyGitFilterCurrentFile', + }, + depedencies = { + 'nvim-lua/plenary.nvim', + }, +} diff --git a/nvim/lua/config/plugins/lsp/lspconfig.lua b/nvim/lua/config/plugins/lsp/lspconfig.lua new file mode 100644 index 0000000..aee3662 --- /dev/null +++ b/nvim/lua/config/plugins/lsp/lspconfig.lua @@ -0,0 +1,81 @@ +return { + 'neovim/nvim-lspconfig', + event = { 'BufReadPre', 'BufNewFile' }, + dependencies = { + 'williamboman/mason.nvim', + 'hrsh7th/cmp-nvim-lsp', + { 'antosha417/nvim-lsp-file-operations', config = true }, + { 'folke/neodev.nvim', opts = {} }, + }, + config = function() + local lspconfig = require('lspconfig') + local mason_lspconfig = require('mason-lspconfig') + local cmp_nvim_lsp = require('cmp_nvim_lsp') + local keymap = vim.keymap + local wk = require('which-key') + + vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('UserLspConfig', {}), + callback = function(ev) + local function opts(desc) + return { desc = desc, buffer = ev.buf, silent = true } + end + + keymap.set('n', 'K', vim.lsp.buf.hover, opts('Show documentation')) + keymap.set('n', 'gR', 'Telescope lsp_references', opts('Show LSP references')) + keymap.set('n', 'gD', vim.lsp.buf.declaration, opts('Go to declaration')) + keymap.set('n', 'gd', 'Telescope lsp_definitions', opts('Show LSP definitions')) + keymap.set('n', 'gi', 'Telescope lsp_implementations', opts('Show LSP implementations')) + keymap.set('n', 'gt', 'Telescope lsp_type_definitions', opts('Show LSP type definitions')) + keymap.set({ 'n', 'v' }, 'ga', vim.lsp.buf.code_action, opts('Show available code actions')) + wk.add({ + { 'r', group = 'Rename' }, + { 'rn', vim.lsp.buf.rename, desc = 'Smart Rename' }, + }) + end, + }) + + local capabilities = cmp_nvim_lsp.default_capabilities() + mason_lspconfig.setup_handlers({ + -- default handler for installed servers + function(server_name) + lspconfig[server_name].setup({ + capabilities = capabilities, + }) + end, + -- TODO add lsp configs + ['lua_ls'] = function() + lspconfig['lua_ls'].setup({ + capabilities = capabilities, + settings = { + Lua = { + diagnostics = { + globals = { 'vim' }, + }, + completion = { + callSnippet = 'Replace' + }, + } + } + }) + end, + ['emmet_ls'] = function() + -- capabilities.textDocument.completion.completionItem.snippetSupport = true + lspconfig['emmet_ls'].setup({ + capabilities = capabilities, + filetypes = { + 'html', + 'css', + 'sass', + 'scss', + 'less', + 'javascript', + 'javascriptreact', + 'svelte', + 'vue', + } + }) + end, + }) + end +} diff --git a/nvim/lua/config/plugins/lsp/mason.lua b/nvim/lua/config/plugins/lsp/mason.lua new file mode 100644 index 0000000..73d05fd --- /dev/null +++ b/nvim/lua/config/plugins/lsp/mason.lua @@ -0,0 +1,46 @@ +return { + 'williamboman/mason.nvim', + dependencies = { + 'williamboman/mason-lspconfig.nvim', + 'WhoIsSethDaniel/mason-tool-installer.nvim', + }, + config = function() + local mason = require('mason') + local mason_lspconfig = require('mason-lspconfig') + local mason_tool_installer = require('mason-tool-installer') + + mason.setup({ + ui = { + icons = { + package_installed = "✓", + package_pending = "➜", + package_uninstalled = "✗", + }, + }, + pip = { + upgrade_pip = true, + } + }) + + mason_lspconfig.setup({ + ensure_installed = { + 'lua_ls', + 'html', + 'cssls', + 'pyright', + 'emmet_ls', + 'bashls', + }, + }) + + mason_tool_installer.setup({ + ensure_installed = { + 'prettier', + 'isort', + 'black', + 'pylint', + 'eslint_d', + } + }) + end, +} diff --git a/nvim/lua/config/plugins/lsp/null-ls.lua b/nvim/lua/config/plugins/lsp/null-ls.lua new file mode 100644 index 0000000..ee64aba --- /dev/null +++ b/nvim/lua/config/plugins/lsp/null-ls.lua @@ -0,0 +1,41 @@ +return { + 'nvimtools/none-ls.nvim', + dependencies = { + 'nvimtools/none-ls-extras.nvim' + }, + config = function() + local null_ls = require('null-ls') + + local sources = { + null_ls.builtins.formatting.prettier.with({ + filetypes = { 'javascript', 'typescript', 'css', 'html', 'json', 'markdown', 'yaml' } + }), + null_ls.builtins.formatting.black, + null_ls.builtins.formatting.djlint, + null_ls.builtins.formatting.isort, + null_ls.builtins.formatting.stylua, + require('none-ls.diagnostics.eslint_d'), + } + + null_ls.setup({ + sources = sources, + -- on_attach = function(client, bufnr) + -- if client.server_capabilities.documentFormattingProvider then + -- vim. + -- end + -- end, + }) + + local keymap = vim.keymap + local fmt_func = function() + vim.lsp.buf.format({ async = true }) + end + keymap.set('n', 'ii', fmt_func, { noremap = true, silent = true }) + + local wk = require('which-key') + wk.add({ + { 'i', group = 'Formatting' }, + { 'ii', desc = 'Format File' }, + }) + end, +} diff --git a/nvim/lua/config/plugins/nvim-tree.lua b/nvim/lua/config/plugins/nvim-tree.lua new file mode 100644 index 0000000..1d957a7 --- /dev/null +++ b/nvim/lua/config/plugins/nvim-tree.lua @@ -0,0 +1,24 @@ +return { + 'nvim-tree/nvim-tree.lua', + dependencies = { + 'nvim-tree/nvim-web-devicons', + }, + config = function () + local nvim_tree = require('nvim-tree') + local api = require('nvim-tree.api') + + vim.g.loaded_netrw = 1 + vim.g.loaded_netrwPlugin = 1 + + nvim_tree.setup() + + local keymap = vim.keymap + keymap.set('n', 'ee', api.tree.toggle, { noremap = true, silent = true }) + + local wk = require('which-key') + wk.add({ + { 'e', group = 'nvim-tree', icon = { icon = ' ', color = 'orange' } }, + { 'ee', group = 'Toggle tree' } + }) + end +} diff --git a/nvim/lua/config/plugins/surround.lua b/nvim/lua/config/plugins/surround.lua new file mode 100644 index 0000000..f19d73e --- /dev/null +++ b/nvim/lua/config/plugins/surround.lua @@ -0,0 +1,6 @@ +return { + 'kylechui/nvim-surround', + event = { 'BufReadPre', 'BufNewFile' }, + version = '*', + config = true, +} diff --git a/nvim/lua/config/plugins/telescope.lua b/nvim/lua/config/plugins/telescope.lua new file mode 100644 index 0000000..969b793 --- /dev/null +++ b/nvim/lua/config/plugins/telescope.lua @@ -0,0 +1,43 @@ +return { + 'nvim-telescope/telescope.nvim', + branch = '0.1.x', + dependencies = { + 'nvim-lua/plenary.nvim', + { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, + "nvim-tree/nvim-web-devicons", + }, + config = function() + local telescope = require('telescope') + -- local actions = require('telescope.actions') + -- local transform_mod = require('telescope.actions.mt').transform_mod + -- local trouble = require('trouble') + -- local trouble_telescope = require('trouble.sources.telescope') + + telescope.setup({ + defaults = { + path_display = { 'smart' }, + }, + }) + + telescope.load_extension('fzf') + + local opts = { noremap = true, silent = true } + + local keymap = vim.keymap + local builtin = require('telescope.builtin') + + keymap.set('n', 'ff', builtin.find_files, opts) + keymap.set('n', 'fh', builtin.oldfiles, opts) + keymap.set('n', 'fs', builtin.live_grep, opts) + keymap.set('n', 'fc', builtin.grep_string, opts) + + local wk = require('which-key') + wk.add({ + { 'f', group = 'telescope' }, + { 'ff', desc = 'Find Files'}, + { 'fh', desc = 'Recent Files'}, + { 'fs', desc = 'Search Text in Files'}, + { 'fc', desc = 'Search Text under Cursor'}, + }) + end, +} diff --git a/nvim/lua/config/plugins/treesitter.lua b/nvim/lua/config/plugins/treesitter.lua new file mode 100644 index 0000000..ceaf518 --- /dev/null +++ b/nvim/lua/config/plugins/treesitter.lua @@ -0,0 +1,51 @@ +return { + "nvim-treesitter/nvim-treesitter", + event = { "BufReadPre", "BufNewFile" }, + build = ":TSUpdate", + dependencies = { + "windwp/nvim-ts-autotag", + }, + config = function() + local treesitter = require('nvim-treesitter.configs') + + treesitter.setup({ + auto_install = true, + sync_install = false, + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + }, + indent = { enable = true }, + autotag = { enable = true }, + ensure_installed = { + 'json', + 'javascript', + 'typescript', + 'yaml', + 'html', + 'htmldjango', + 'css', + 'scss', + 'markdown', + 'markdown_inline', + 'bash', + 'lua', + 'vim', + 'dockerfile', + 'python', + 'gitignore', + 'c', + }, + ignore_install = {}, + incremental_selection = { + enable = true, + keymaps = { + init_selection = '', + node_incremental = '', + scope_incremental = false, + node_decremental = '', + }, + }, + }) + end, +} diff --git a/nvim/lua/config/plugins/which-key.lua b/nvim/lua/config/plugins/which-key.lua new file mode 100644 index 0000000..07b028d --- /dev/null +++ b/nvim/lua/config/plugins/which-key.lua @@ -0,0 +1,12 @@ +return { + 'folke/which-key.nvim', + event = 'VeryLazy', + config = function() + local wk = require('which-key') + wk.add({ + { 'nh', 'nohl', desc = 'No Highlight' }, + { 'l', group = 'LazyGit', icon = { icon = '', color = 'cyan' } }, + { 'lg', 'LazyGit', desc = 'Open LazyGit', icon = { icon = '', color = 'cyan' } }, + }) + end +} diff --git a/starship.toml b/starship.toml new file mode 100644 index 0000000..983acba --- /dev/null +++ b/starship.toml @@ -0,0 +1,144 @@ +format = """ +[](#9A348E)\ +$os\ +$username\ +[](bg:#DA627D fg:#9A348E)\ +$directory\ +[](fg:#DA627D bg:#FCA17D)\ +$git_branch\ +$git_status\ +[](fg:#FCA17D bg:#86BBD8)\ +$c\ +$elixir\ +$elm\ +$golang\ +$gradle\ +$haskell\ +$java\ +$julia\ +$nodejs\ +$nim\ +$rust\ +$scala\ +[](fg:#86BBD8 bg:#06969A)\ +$docker_context\ +[](fg:#06969A bg:#33658A)\ +$time\ +[ ](fg:#33658A)\ +""" + +# Disable the blank line at the start of the prompt +# add_newline = false + +# You can also replace your username with a neat symbol like  or disable this +# and use the os module below +[username] +show_always = true +style_user = "bg:#9A348E" +style_root = "bg:#9A348E" +format = '[$user ]($style)' +disabled = false + +# An alternative to the username module which displays a symbol that +# represents the current operating system +[os] +style = "bg:#9A348E" +disabled = true # Disabled by default + +[directory] +style = "bg:#DA627D" +format = "[ $path ]($style)" +truncation_length = 3 +truncation_symbol = "…/" + +# Here is how you can shorten some long paths by text replacement +# similar to mapped_locations in Oh My Posh: +[directory.substitutions] +"Documents" = "󰈙 " +"Downloads" = " " +"Music" = " " +"Pictures" = " " +# Keep in mind that the order matters. For example: +# "Important Documents" = " 󰈙 " +# will not be replaced, because "Documents" was already substituted before. +# So either put "Important Documents" before "Documents" or use the substituted version: +# "Important 󰈙 " = " 󰈙 " + +[c] +symbol = " " +style = "bg:#86BBD8" +format = '[ $symbol ($version) ]($style)' + +[docker_context] +symbol = " " +style = "bg:#06969A" +format = '[ $symbol $context ]($style)' + +[elixir] +symbol = " " +style = "bg:#86BBD8" +format = '[ $symbol ($version) ]($style)' + +[elm] +symbol = " " +style = "bg:#86BBD8" +format = '[ $symbol ($version) ]($style)' + +[git_branch] +symbol = "" +style = "bg:#FCA17D" +format = '[ $symbol $branch ]($style)' + +[git_status] +style = "bg:#FCA17D" +format = '[$all_status$ahead_behind ]($style)' + +[golang] +symbol = " " +style = "bg:#86BBD8" +format = '[ $symbol ($version) ]($style)' + +[gradle] +style = "bg:#86BBD8" +format = '[ $symbol ($version) ]($style)' + +[haskell] +symbol = " " +style = "bg:#86BBD8" +format = '[ $symbol ($version) ]($style)' + +[java] +symbol = " " +style = "bg:#86BBD8" +format = '[ $symbol ($version) ]($style)' + +[julia] +symbol = " " +style = "bg:#86BBD8" +format = '[ $symbol ($version) ]($style)' + +[nodejs] +symbol = "" +style = "bg:#86BBD8" +format = '[ $symbol ($version) ]($style)' + +[nim] +symbol = "󰆥 " +style = "bg:#86BBD8" +format = '[ $symbol ($version) ]($style)' + +[rust] +symbol = "" +style = "bg:#86BBD8" +format = '[ $symbol ($version) ]($style)' + +[scala] +symbol = " " +style = "bg:#86BBD8" +format = '[ $symbol ($version) ]($style)' + +[time] +disabled = false +time_format = "%R" # Hour:Minute Format +style = "bg:#33658A" +format = '[ ♥ $time ]($style)'