diff --git a/README.md b/README.md index dbd925f8a9..63ee51e1ec 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ fork to your machine using one of the commands below, depending on your OS. > **NOTE** > Your fork's url will be something like this: -> `https://github.com//kickstart-modular.nvim.git` +> `https://github.com/ScilentAssasin/kickstart-modular.nvim.git` #### Clone kickstart.nvim > **NOTE** @@ -68,7 +68,7 @@ fork to your machine using one of the commands below, depending on your OS.
Linux and Mac ```sh -git clone https://github.com/dam9000/kickstart-modular.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim +git clone https://github.com/ScilentAssasin/kickstart-modular.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim ```
diff --git a/init.lua b/init.lua index 3784c1a18c..6c6d42bd32 100644 --- a/init.lua +++ b/init.lua @@ -91,7 +91,7 @@ vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' -- Set to true if you have a Nerd Font installed and selected in the terminal -vim.g.have_nerd_font = false +vim.g.have_nerd_font = true -- [[ Setting options ]] require 'options' diff --git a/lua/custom/plugins/autopairs.lua b/lua/custom/plugins/autopairs.lua new file mode 100644 index 0000000000..3f3d978941 --- /dev/null +++ b/lua/custom/plugins/autopairs.lua @@ -0,0 +1,17 @@ +-- File: lua/custom/plugins/autopairs.lua + +return { + "windwp/nvim-autopairs", + -- Optional dependency + dependencies = { 'hrsh7th/nvim-cmp' }, + config = function() + require("nvim-autopairs").setup {} + -- If you want to automatically add `(` after selecting a function or method + 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/lua/custom/plugins/competitest.lua b/lua/custom/plugins/competitest.lua new file mode 100644 index 0000000000..5eeb9c44bd --- /dev/null +++ b/lua/custom/plugins/competitest.lua @@ -0,0 +1,40 @@ +return { + 'xeluxee/competitest.nvim', + dependencies = 'MunifTanjim/nui.nvim', + config = function() + require('competitest').setup { + cpp = { + exec = 'g++', + args = { + '-std=c++17', + '-g', + '$(FNAME)', + '-o', + '$(FNOEXT)', + }, + }, + template_file = { + cpp = '~/Coding/code-compitative/c++/template.cpp', + }, + save_current_file = true, + view_output_diff = true, + evaluate_template_modifiers = true, + received_problems_path = '$(CWD)/$(GROUP)/$(PROBLEM).$(FEXT)', + received_contests_directory = '$(CWD)/$(GROUP)', + testcases_directory = './tests', + layout = { + { 1, { + { 1, 'so' }, + { 1, { + { 1, 'tc' }, + { 1, 'se' }, + } }, + } }, + { 1, { + { 1, 'eo' }, + { 1, 'si' }, + } }, + }, + } + end, +} diff --git a/lua/custom/plugins/statusline.lua b/lua/custom/plugins/statusline.lua new file mode 100644 index 0000000000..af38a428ac --- /dev/null +++ b/lua/custom/plugins/statusline.lua @@ -0,0 +1,13 @@ +return { + -- Set lualine as statusline + 'nvim-lualine/lualine.nvim', + -- See `:help lualine.txt` + opts = { + options = { + icons_enabled = true, + theme = 'auto', + component_separators = '|', + section_separators = '', + }, + }, +} diff --git a/lua/keymaps.lua b/lua/keymaps.lua index c6c87b15dc..10eea47c75 100644 --- a/lua/keymaps.lua +++ b/lua/keymaps.lua @@ -48,4 +48,9 @@ vim.api.nvim_create_autocmd('TextYankPost', { end, }) +-- set tabs size for c, c++ files +vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, { + pattern = { '*.c', '*.cpp', '*.h' }, + command = 'setlocal autoindent expandtab tabstop=2 shiftwidth=2', +}) -- vim: ts=2 sts=2 sw=2 et diff --git a/lua/kickstart/plugins/cmp.lua b/lua/kickstart/plugins/cmp.lua index 6d893aa199..ead7d903c2 100644 --- a/lua/kickstart/plugins/cmp.lua +++ b/lua/kickstart/plugins/cmp.lua @@ -19,12 +19,12 @@ return { -- `friendly-snippets` contains a variety of premade snippets. -- See the README about individual language/framework/plugin snippets: -- https://github.com/rafamadriz/friendly-snippets - -- { - -- 'rafamadriz/friendly-snippets', - -- config = function() - -- require('luasnip.loaders.from_vscode').lazy_load() - -- end, - -- }, + { + 'rafamadriz/friendly-snippets', + config = function() + require('luasnip.loaders.from_vscode').lazy_load() + end, + }, }, }, 'saadparwaiz1/cmp_luasnip', diff --git a/lua/kickstart/plugins/conform.lua b/lua/kickstart/plugins/conform.lua index 50577371f1..43713fc969 100644 --- a/lua/kickstart/plugins/conform.lua +++ b/lua/kickstart/plugins/conform.lua @@ -18,7 +18,7 @@ return { -- Disable "format_on_save lsp_fallback" for languages that don't -- have a well standardized coding style. You can add additional -- languages here or re-enable it for the disabled ones. - local disable_filetypes = { c = true, cpp = true } + local disable_filetypes = { c = true, cpp = false } return { timeout_ms = 500, lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype], diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index 7be4abdbd9..fde561beb8 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -14,6 +14,9 @@ return { -- Creates a beautiful debugger UI 'rcarriga/nvim-dap-ui', + -- Shows Virtual Text while debugging + 'theHamsta/nvim-dap-virtual-text', + -- Required dependency for nvim-dap-ui 'nvim-neotest/nvim-nio', @@ -22,7 +25,9 @@ return { 'jay-babu/mason-nvim-dap.nvim', -- Add your own debuggers here - 'leoluz/nvim-dap-go', + -- 'leoluz/nvim-dap-go', + 'mfussenegger/nvim-dap-python', + 'microsoft/vscode-cpptools', }, config = function() local dap = require 'dap' @@ -41,10 +46,14 @@ return { -- online, please don't ask me how to install them :) ensure_installed = { -- Update this to ensure that you have the debuggers for the langs you want - 'delve', + --'delve', + 'cpptools', + 'debugpy', }, } + require('nvim-dap-virtual-text').setup() + -- Basic debugging keymaps, feel free to change to your liking! vim.keymap.set('n', '', dap.continue, { desc = 'Debug: Start/Continue' }) vim.keymap.set('n', '', dap.step_into, { desc = 'Debug: Step Into' }) @@ -85,6 +94,12 @@ return { dap.listeners.before.event_exited['dapui_config'] = dapui.close -- Install golang specific config - require('dap-go').setup() + -- require('dap-go').setup() + local cppdbg_path = '/home/scilent/.local/share/nvim/mason/bin/OpenDebugAD7' + dap.adapters.cppdbg = { + id = 'cppdbg', + type = 'executable', + command = cppdbg_path, + } end, } diff --git a/lua/kickstart/plugins/treesitter.lua b/lua/kickstart/plugins/treesitter.lua index 4bf12fe550..65c59129eb 100644 --- a/lua/kickstart/plugins/treesitter.lua +++ b/lua/kickstart/plugins/treesitter.lua @@ -2,8 +2,12 @@ return { { -- Highlight, edit, and navigate code 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', + dependencies = { + 'nvim-treesitter/nvim-treesitter-context', + 'nvim-treesitter/nvim-treesitter-textobjects', + }, opts = { - ensure_installed = { 'bash', 'c', 'html', 'lua', 'luadoc', 'markdown', 'vim', 'vimdoc' }, + ensure_installed = { 'bash', 'cpp', 'html', 'lua', 'luadoc', 'markdown', 'vim', 'vimdoc', 'javascript', 'css', 'rust' }, -- Autoinstall languages that are not installed auto_install = true, highlight = { @@ -14,6 +18,15 @@ return { additional_vim_regex_highlighting = { 'ruby' }, }, indent = { enable = true, disable = { 'ruby' } }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = 'gnn', + node_incremental = 'grn', + scope_incremental = 'grc', + node_decremental = 'grm', + }, + }, }, config = function(_, opts) -- [[ Configure Treesitter ]] See `:help nvim-treesitter` diff --git a/lua/lazy-plugins.lua b/lua/lazy-plugins.lua index e93e1932e9..e3b0aa51fe 100644 --- a/lua/lazy-plugins.lua +++ b/lua/lazy-plugins.lua @@ -11,6 +11,11 @@ -- NOTE: Here is where you install your plugins. require('lazy').setup({ -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). + + -- Git related plugins + 'tpope/vim-fugitive', + 'tpope/vim-rhubarb', + 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically -- NOTE: Plugins can also be added by using a table, @@ -57,18 +62,18 @@ require('lazy').setup({ -- Here are some example plugins that I've included in the Kickstart repository. -- 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.lint', - -- require 'kickstart.plugins.autopairs', - -- require 'kickstart.plugins.neo-tree', + require 'kickstart.plugins.debug', + require 'kickstart.plugins.indent_line', + require 'kickstart.plugins.lint', + require 'kickstart.plugins.autopairs', + require 'kickstart.plugins.neo-tree', -- 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/options.lua b/lua/options.lua index c97d75feb0..620d75113a 100644 --- a/lua/options.lua +++ b/lua/options.lua @@ -7,7 +7,18 @@ vim.opt.number = true -- You can also add relative line numbers, to help with jumping. -- Experiment for yourself to see if you like it! --- vim.opt.relativenumber = true +vim.opt.relativenumber = true + +-- AutoCommand to toggle number +vim.api.nvim_create_autocmd({ 'BufEnter', 'FocusGained', 'InsertLeave', 'WinEnter' }, { + pattern = { '*' }, + command = "if &nu && mode() != 'i' | set rnu | endif", +}) + +vim.api.nvim_create_autocmd({ 'BufLeave', 'FocusLost', 'InsertEnter', 'WinLeave' }, { + pattern = { '*' }, + command = 'if &nu | set nornu | endif', +}) -- Enable mouse mode, can be useful for resizing splits for example! vim.opt.mouse = 'a'