diff --git a/README.md b/README.md index 3f19854cd20..a269105b63b 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ fork to your machine using one of the commands below, depending on your OS.
Linux and Mac ```sh -git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim +git clone https://github.com/schistostega/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim ```
@@ -76,15 +76,11 @@ git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HO If you're using `cmd.exe`: -``` git clone https://github.com/nvim-lua/kickstart.nvim.git %localappdata%\nvim\ -``` If you're using `powershell.exe` -``` git clone https://github.com/nvim-lua/kickstart.nvim.git $env:LOCALAPPDATA\nvim\ -``` diff --git a/after/init.lua b/after/init.lua new file mode 100644 index 00000000000..e87ecea9c44 --- /dev/null +++ b/after/init.lua @@ -0,0 +1,4 @@ +vim.o.tabstop = 4 -- A TAB character looks like 4 spaces +vim.o.expandtab = true -- Pressing the TAB key will insert spaces instead of a TAB character +vim.o.softtabstop = 4 -- Number of spaces inserted instead of a TAB character +vim.o.shiftwidth = 4 -- Number of spaces inserted when indenting diff --git a/ftdetect/filetypes.vim b/ftdetect/filetypes.vim new file mode 100644 index 00000000000..44147f6e5bb --- /dev/null +++ b/ftdetect/filetypes.vim @@ -0,0 +1,2 @@ +au BufRead,BufNewFile *.apex set filetype=apex +au BufRead,BufNewFile *.cls set filetype=apex diff --git a/init.lua b/init.lua index 220d3045268..12cddf7cd15 100644 --- a/init.lua +++ b/init.lua @@ -230,6 +230,9 @@ vim.opt.rtp:prepend(lazypath) require('lazy').setup({ -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically + 'tpope/vim-dadbod', -- Database integration + 'kristijanhusak/vim-dadbod-ui', + 'kristijanhusak/vim-dadbod-completion', -- NOTE: Plugins can also be added by using a table, -- with the first argument being the link and the following @@ -320,6 +323,7 @@ require('lazy').setup({ -- Useful for getting pretty icons, but requires a Nerd Font. { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, + { 'ThePrimeagen/harpoon' }, }, config = function() -- Telescope is a fuzzy finder that comes with a lot of different things that @@ -363,6 +367,7 @@ require('lazy').setup({ -- Enable Telescope extensions if they are installed pcall(require('telescope').load_extension, 'fzf') pcall(require('telescope').load_extension, 'ui-select') + pcall(require('telescope').load_extension, 'harpoon') -- See `:help telescope.builtin` local builtin = require 'telescope.builtin' @@ -579,9 +584,22 @@ require('lazy').setup({ -- https://github.com/pmizio/typescript-tools.nvim -- -- But for many setups, the LSP (`tsserver`) will work just fine - -- tsserver = {}, - -- - + ts_ls = {}, + html = {}, + cssls = {}, + clangd = {}, + emmet_ls = {}, + pyright = {}, + eslint = {}, + apex_ls = { + filetypes = { + 'apex', -- treesitter uses apex instead of default apexcode filetype + }, + settings = { + apex_enable_semantic_errors = false, + apex_enable_completion_statistics = false, + }, + }, lua_ls = { -- cmd = {...}, -- filetypes = { ...}, @@ -787,13 +805,21 @@ require('lazy').setup({ -- change the command in the config to whatever the name of that colorscheme is. -- -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`. - 'folke/tokyonight.nvim', + -- 'folke/tokyonight.nvim', + -- 'mathofprimes/nightvision-nvim', + -- 'audibleblink/hackthebox.vim', + 'iruzo/matrix-nvim', + -- 'rebelot/kanagawa.nvim', priority = 1000, -- Make sure to load this before all the other start plugins. init = function() -- Load the colorscheme here. -- Like many other themes, this one has different styles, and you could load -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. - vim.cmd.colorscheme 'tokyonight-night' + -- vim.cmd.colorscheme 'tokyonight-storm' + -- vim.cmd.colorscheme 'kanagawa-dragon' + -- vim.cmd.colorscheme 'hackthebox' + vim.cmd.colorscheme 'matrix' + -- vim.cmd.colorscheme 'nightvision' -- You can configure highlights by doing something like: vim.cmd.hi 'Comment gui=none' @@ -844,7 +870,24 @@ require('lazy').setup({ 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', opts = { - ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }, + ensure_installed = { + 'apex', + 'bash', + 'c', + 'diff', + 'html', + 'css', + 'java', + 'javascript', + 'lua', + 'luadoc', + 'markdown', + 'markdown_inline', + 'query', + 'vim', + 'vimdoc', + 'sql', + }, -- Autoinstall languages that are not installed auto_install = true, highlight = { @@ -881,18 +924,18 @@ require('lazy').setup({ -- Uncomment any of the lines below to enable them (you will need to restart nvim). -- -- require 'kickstart.plugins.debug', - -- require 'kickstart.plugins.indent_line', + require 'kickstart.plugins.indent_line', -- require 'kickstart.plugins.lint', - -- require 'kickstart.plugins.autopairs', + require 'kickstart.plugins.autopairs', -- require 'kickstart.plugins.neo-tree', - -- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps + require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- This is the easiest way to modularize your config. -- -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. -- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins` - -- { import = 'custom.plugins' }, + { import = 'custom.plugins' }, }, { ui = { -- If you are using a Nerd Font: set icons to an empty table which will use the diff --git a/lua/custom/icons/nerd_font.lua b/lua/custom/icons/nerd_font.lua new file mode 100644 index 00000000000..68782cf7bc4 --- /dev/null +++ b/lua/custom/icons/nerd_font.lua @@ -0,0 +1,60 @@ +return { + ActiveLSP = '', + ActiveTS = '', + ArrowLeft = '', + ArrowRight = '', + Bookmarks = '', + BufferClose = '󰅖', + DapBreakpoint = '', + DapBreakpointCondition = '', + DapBreakpointRejected = '', + DapLogPoint = '.>', + DapStopped = '󰁕', + Debugger = '', + DefaultFile = '󰈙', + Diagnostic = '󰒡', + DiagnosticError = '', + DiagnosticHint = '󰌵', + DiagnosticInfo = '󰋼', + DiagnosticWarn = '', + Ellipsis = '…', + FileNew = '', + FileModified = '', + FileReadOnly = '', + FoldClosed = '', + FoldOpened = '', + FoldSeparator = ' ', + FolderClosed = '', + FolderEmpty = '', + FolderOpen = '', + Git = '󰊢', + GitAdd = '', + GitBranch = '', + GitChange = '', + GitConflict = '', + GitDelete = '', + GitIgnored = '◌', + GitRenamed = '➜', + GitSign = '▎', + GitStaged = '✓', + GitUnstaged = '✗', + GitUntracked = '★', + LSPLoaded = '', -- TODO: Remove unused icon in AstroNvim v4 + LSPLoading1 = '', + LSPLoading2 = '󰀚', + LSPLoading3 = '', + MacroRecording = '', + Package = '󰏖', + Paste = '󰅌', + Refresh = '', + Search = '', + Selected = '❯', + Session = '󱂬', + Sort = '󰒺', + Spellcheck = '󰓆', + Tab = '󰓩', + TabClose = '󰅙', + Terminal = '', + Window = '', + WordFile = '󰈭', +} diff --git a/lua/custom/icons/text.lua b/lua/custom/icons/text.lua new file mode 100644 index 00000000000..ae699be59c1 --- /dev/null +++ b/lua/custom/icons/text.lua @@ -0,0 +1,41 @@ +return { + ActiveLSP = 'LSP:', + ArrowLeft = '<', + ArrowRight = '>', + BufferClose = 'x', + DapBreakpoint = 'B', + DapBreakpointCondition = 'C', + DapBreakpointRejected = 'R', + DapLogPoint = 'L', + DapStopped = '>', + DefaultFile = '[F]', + DiagnosticError = 'X', + DiagnosticHint = '?', + DiagnosticInfo = 'i', + DiagnosticWarn = '!', + Ellipsis = '...', + FileModified = '*', + FileReadOnly = '[lock]', + FoldClosed = '+', + FoldOpened = '-', + FoldSeparator = ' ', + FolderClosed = '[D]', + FolderEmpty = '[E]', + FolderOpen = '[O]', + GitAdd = '[+]', + GitChange = '[/]', + GitConflict = '[!]', + GitDelete = '[-]', + GitIgnored = '[I]', + GitRenamed = '[R]', + GitSign = '|', + GitStaged = '[S]', + GitUnstaged = '[U]', + GitUntracked = '[?]', + MacroRecording = 'Recording:', + Paste = '[PASTE]', + Search = '?', + Selected = '*', + Spellcheck = '[SPELL]', + TabClose = 'X', +} diff --git a/lua/custom/mappings.lua b/lua/custom/mappings.lua new file mode 100644 index 00000000000..aed3236fb55 --- /dev/null +++ b/lua/custom/mappings.lua @@ -0,0 +1,78 @@ +local utils = require 'custom.utils' + +vim.keymap.set('n', 'yn', function() + local filename = vim.fn.expand '%:t' + vim.fn.setreg('+', filename) +end, { desc = '[Y]ank file [N]ame' }) + +vim.keymap.set('n', 'yp', function() + local filepath = vim.fn.expand '%:p' + vim.fn.setreg('+', filepath) +end, { desc = '[Y]ank file [P]ath' }) + +vim.keymap.set('n', 'ys', function() + local filepath = vim.fn.expand '%:p' + local filename = vim.fn.expand '%:t' + local modify = vim.fn.fnamemodify + + local vals = { + ['BASENAME'] = modify(filename, ':r'), + ['EXTENSION'] = modify(filename, ':e'), + ['FILENAME'] = filename, + ['PATH (CWD)'] = modify(filepath, ':.'), + ['PATH (HOME)'] = modify(filepath, ':~'), + ['PATH'] = filepath, + ['URI'] = vim.uri_from_fname(filepath), + } + + local options = vim.tbl_filter(function(val) + return vals[val] ~= '' + end, vim.tbl_keys(vals)) + if vim.tbl_isempty(options) then + utils.notify('No values to copy', vim.log.levels.WARN) + return + end + table.sort(options) + vim.ui.select(options, { + prompt = 'Choose to copy to clipboard:', + format_item = function(item) + return ('%s: %s'):format(item, vals[item]) + end, + }, function(choice) + local result = vals[choice] + if result then + utils.notify(('Copied: `%s`'):format(result)) + vim.fn.setreg('+', result) + end + end) +end, { desc = '[Y]ank [S]elector' }) + +-- https://github.com/ThePrimeagen/init.lua/blob/master/lua/theprimeagen/remap.lua +-- https://youtu.be/w7i4amO_zaE?si=bRJDSVlL_vvFwmxh +-- move visually selected block upward or downward +vim.keymap.set('v', 'J', ":m '>+1gv=gv") +vim.keymap.set('v', 'K', ":m '<-2gv=gv") + +-- hold cursor in place while joining lines +vim.keymap.set('n', 'J', 'mzJ`z') + +-- hold cursor in the middle while scrolling half of a page +vim.keymap.set('n', '', 'zz') +vim.keymap.set('n', '', 'zz') + +-- hold cursor in the middle while navigation throgh search +vim.keymap.set('n', 'n', 'nzzzv') +vim.keymap.set('n', 'N', 'Nzzzv') + +vim.keymap.set('x', 'p', [["_dP]], { desc = '[P]aste and keep the copy buffer' }) +vim.keymap.set('n', 'rc', [[:%s/\<\>//gI]], { desc = '[R]ename [C]urrent word' }) +-- end Primeagen + +vim.keymap.set('n', 'n', 'enew', { desc = '[N]ew File' }) +vim.keymap.set('n', 'Q', 'qall', { desc = '[Q]uit all' }) + +-- Stay in indent mode +vim.keymap.set('v', '', '', '>gv', { desc = 'Indent line' }) + +vim.keymap.set('n', 'A', 'ggVG%', { desc = 'Select [A]ll' }) diff --git a/lua/custom/plugins/harpoon.lua b/lua/custom/plugins/harpoon.lua new file mode 100644 index 00000000000..4b2ed1b1d02 --- /dev/null +++ b/lua/custom/plugins/harpoon.lua @@ -0,0 +1,21 @@ +local mark = require 'harpoon.mark' +local ui = require 'harpoon.ui' + +vim.keymap.set('n', 'a', mark.add_file, { desc = '[A]dd harpoon mark' }) +vim.keymap.set('n', 'sm', require('telescope').extensions.harpoon.marks, { desc = '[S]earch harpoon [M]' }) +vim.keymap.set('n', '', ui.toggle_quick_menu) + +vim.keymap.set('n', '', function() + ui.nav_file(1) +end) +vim.keymap.set('n', '', function() + ui.nav_file(2) +end) +vim.keymap.set('n', '', function() + ui.nav_file(3) +end) +vim.keymap.set('n', '', function() + ui.nav_file(4) +end) + +return {} diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index be0eb9d8d7a..f6eac975fa0 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -2,4 +2,10 @@ -- I promise not to create any merge conflicts in this directory :) -- -- See the kickstart.nvim README for more information +vim.opt.relativenumber = true +vim.g.have_nerd_font = true + +require 'custom.mappings' +require 'custom.tabulation' + return {} diff --git a/lua/custom/plugins/neo-tree.lua b/lua/custom/plugins/neo-tree.lua new file mode 100644 index 00000000000..dd194198987 --- /dev/null +++ b/lua/custom/plugins/neo-tree.lua @@ -0,0 +1,129 @@ +-- Neo-tree is a Neovim plugin to browse the file system +-- https://github.com/nvim-neo-tree/neo-tree.nvim + +local utils = require 'custom.utils' +local get_icon = utils.get_icon + +return { + 'nvim-neo-tree/neo-tree.nvim', + version = '*', + dependencies = { + 'nvim-lua/plenary.nvim', + 'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended + 'MunifTanjim/nui.nvim', + }, + cmd = 'Neotree', + keys = { + { '\\', ':Neotree reveal', { desc = 'NeoTree reveal' } }, + }, + opts = { + close_if_last_window = true, + sources = { 'filesystem', 'git_status' }, + source_selector = { + winbar = true, + content_layout = 'center', + sources = { + { source = 'filesystem', display_name = get_icon('FolderClosed', 1, true) .. 'File' }, + { source = 'git_status', display_name = get_icon('Git', 1, true) .. 'Git' }, + }, + }, + default_component_configs = { + indent = { padding = 0 }, + icon = { + folder_closed = get_icon 'FolderClosed', + folder_open = get_icon 'FolderOpen', + folder_empty = get_icon 'FolderEmpty', + folder_empty_open = get_icon 'FolderEmpty', + default = get_icon 'DefaultFile', + }, + modified = { symbol = get_icon 'FileModified' }, + git_status = { + symbols = { + added = get_icon 'GitAdd', + deleted = get_icon 'GitDelete', + modified = get_icon 'GitChange', + renamed = get_icon 'GitRenamed', + untracked = get_icon 'GitUntracked', + ignored = get_icon 'GitIgnored', + unstaged = get_icon 'GitUnstaged', + staged = get_icon 'GitStaged', + conflict = get_icon 'GitConflict', + }, + }, + }, + commands = { + parent_or_close = function(state) + local node = state.tree:get_node() + if (node.type == 'directory' or node:has_children()) and node:is_expanded() then + state.commands.toggle_node(state) + else + require('neo-tree.ui.renderer').focus_node(state, node:get_parent_id()) + end + end, + child_or_open = function(state) + local node = state.tree:get_node() + if node.type == 'directory' or node:has_children() then + if not node:is_expanded() then -- if unexpanded, expand + state.commands.toggle_node(state) + else -- if expanded and has children, seleect the next child + require('neo-tree.ui.renderer').focus_node(state, node:get_child_ids()[1]) + end + else -- if not a directory just open it + state.commands.open(state) + end + end, + copy_selector = function(state) + local node = state.tree:get_node() + local filepath = node:get_id() + local filename = node.name + local modify = vim.fn.fnamemodify + local vals = { + ['BASENAME'] = modify(filename, ':r'), + ['EXTENSION'] = modify(filename, ':e'), + ['FILENAME'] = filename, + ['PATH (CWD)'] = modify(filepath, ':.'), + ['PATH (HOME)'] = modify(filepath, ':~'), + ['PATH'] = filepath, + ['URI'] = vim.uri_from_fname(filepath), + } + + local options = vim.tbl_filter(function(val) + return vals[val] ~= '' + end, vim.tbl_keys(vals)) + if vim.tbl_isempty(options) then + utils.notify('No values to copy', vim.log.levels.WARN) + return + end + table.sort(options) + vim.ui.select(options, { + prompt = 'Choose to copy to clipboard:', + format_item = function(item) + return ('%s: %s'):format(item, vals[item]) + end, + }, function(choice) + local result = vals[choice] + if result then + utils.notify(('Copied: `%s`'):format(result)) + vim.fn.setreg('+', result) + end + end) + end, + }, + window = { + mappings = { + ['[b'] = 'prev_source', + [']b'] = 'next_source', + Y = 'copy_selector', + h = 'parent_or_close', + l = 'child_or_open', + }, + }, + filesystem = { + window = { + mappings = { + ['\\'] = 'close_window', + }, + }, + }, + }, +} diff --git a/lua/custom/plugins/undotree.lua b/lua/custom/plugins/undotree.lua new file mode 100644 index 00000000000..8cbdc8e051c --- /dev/null +++ b/lua/custom/plugins/undotree.lua @@ -0,0 +1,6 @@ +return { + 'mbbill/undotree', + config = function() + vim.keymap.set('n', 'tu', vim.cmd.UndotreeToggle, { desc = '[T]oggle [U]ndo tree' }) + end, +} diff --git a/lua/custom/plugins/vim-visual-multi.lua b/lua/custom/plugins/vim-visual-multi.lua new file mode 100644 index 00000000000..27111be2f90 --- /dev/null +++ b/lua/custom/plugins/vim-visual-multi.lua @@ -0,0 +1,3 @@ +return { + 'mg979/vim-visual-multi', +} diff --git a/lua/custom/tabulation.lua b/lua/custom/tabulation.lua new file mode 100644 index 00000000000..e87ecea9c44 --- /dev/null +++ b/lua/custom/tabulation.lua @@ -0,0 +1,4 @@ +vim.o.tabstop = 4 -- A TAB character looks like 4 spaces +vim.o.expandtab = true -- Pressing the TAB key will insert spaces instead of a TAB character +vim.o.softtabstop = 4 -- Number of spaces inserted instead of a TAB character +vim.o.shiftwidth = 4 -- Number of spaces inserted when indenting diff --git a/lua/custom/utils/init.lua b/lua/custom/utils/init.lua new file mode 100644 index 00000000000..1120b4e8da9 --- /dev/null +++ b/lua/custom/utils/init.lua @@ -0,0 +1,22 @@ +local M = {} + +function M.notify(msg, type, opts) + vim.schedule(function() + vim.notify(msg, type, opts) + end) +end + +function M.get_icon(kind, padding, no_fallback) + if not vim.g.have_nerd_font and no_fallback then + return '' + end + local icon_pack = vim.g.have_nerd_font and 'icons' or 'text_icons' + if not M[icon_pack] then + M.icons = require 'custom.icons.nerd_font' + M.text_icons = require 'custom.icons.text' + end + local icon = M[icon_pack] and M[icon_pack][kind] + return icon and icon .. string.rep(' ', padding or 0) or '' +end + +return M