--[[ THESE ARE EXAMPLE CONFIGS FEEL FREE TO CHANGE TO WHATEVER YOU WANT `lvim` is the global options object ]] -- vim options vim.opt.shiftwidth = 2 vim.opt.tabstop = 2 vim.opt.relativenumber = true vim.opt.list = true -- general lvim.log.level = "info" lvim.format_on_save = { enabled = true, pattern = "*.lua", timeout = 1000, } -- to disable icons and use a minimalist setup, uncomment the following -- lvim.use_icons = false -- keymappings lvim.leader = "space" -- add your own keymapping lvim.keys.normal_mode[""] = ":w" lvim.keys.normal_mode[''] = ":Telescope fd" -- lvim.keys.normal_mode[""] = ":BufferLineCycleNext" -- lvim.keys.normal_mode[""] = ":BufferLineCyclePrev" for i = 1, 9, 1 do lvim.keys.normal_mode[""] = ":BufferLineGoToBuffer " .. i .. "" end -- -- Use which-key to add extra bindings with the leader-key prefix -- lvim.builtin.which_key.mappings["W"] = { "noautocmd w", "Save without formatting" } -- lvim.builtin.which_key.mappings["P"] = { "Telescope projects", "Projects" } -- Disable automatic changing of directory in lunarvim lvim.builtin.project.active = false lvim.builtin.project.manual_mode = true lvim.builtin.project.silent_chdir = false -- -- Change theme settings -- lvim.colorscheme = "lunar" -- lvim.builtin.alpha.active = true lvim.builtin.alpha.mode = "dashboard" lvim.builtin.terminal.active = true lvim.builtin.nvimtree.setup.view.side = "left" lvim.builtin.nvimtree.setup.renderer.icons.show.git = false lvim.builtin.terminal.execs = { { nil, "ts", "Horizontal Terminal", "horizontal", 0.3 }, { nil, "tv", "Vertical Terminal", "vertical", 0.4 }, { nil, "tf", "Float Terminal", "float", nil }, } lvim.builtin.lualine.sections.lualine_b = { 'branch', '%f' } -- Automatically install missing parsers when entering buffer lvim.builtin.treesitter.auto_install = true lvim.builtin.luasnip = { sources = { friendly_snippets = false, }, } -- lvim.builtin.treesitter.ignore_install = { "haskell" } -- -- always installed on startup, useful for parsers without a strict filetype -- lvim.builtin.treesitter.ensure_installed = { "comment", "markdown_inline", "regex" } -- -- generic LSP settings lvim.lsp.null_ls.setup.timeout_ms = 20000 -- --- disable automatic installation of servers -- lvim.lsp.installer.setup.automatic_installation = false -- ---configure a server manually. IMPORTANT: Requires `:LvimCacheReset` to take effect -- ---see the full default list `:lua =lvim.lsp.automatic_configuration.skipped_servers` -- vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "pyright" }) -- local opts = {} -- check the lspconfig documentation for a list of all possible options -- require("lvim.lsp.manager").setup("pyright", opts) -- ---remove a server from the skipped list, e.g. eslint, or emmet_ls. IMPORTANT: Requires `:LvimCacheReset` to take effect -- ---`:LvimInfo` lists which server(s) are skipped for the current filetype -- lvim.lsp.automatic_configuration.skipped_servers = vim.tbl_filter(function(server) -- return server ~= "emmet_ls" -- end, lvim.lsp.automatic_configuration.skipped_servers) -- -- you can set a custom on_attach function that will be used for all the language servers -- -- See -- lvim.lsp.on_attach_callback = function(client, bufnr) -- local function buf_set_option(...) -- vim.api.nvim_buf_set_option(bufnr, ...) -- end -- --Enable completion triggered by -- buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc") -- end -- -- linters and formatters -- local formatters = require "lvim.lsp.null-ls.formatters" -- formatters.setup { -- { -- command = "prettier", -- extra_args = { "--print-width", "100" }, -- filetypes = { "typescript", "typescriptreact", "javascript", "javascriptreact" }, -- }, -- } -- local linters = require "lvim.lsp.null-ls.linters" -- linters.setup { -- { command = "flake8", filetypes = { "python" } }, -- { -- command = "shellcheck", -- args = { "--severity", "warning" }, -- }, -- } -- Flutter snippets enable local luasnip = require("luasnip") luasnip.filetype_extend("dart", { "flutter" }) -- -- Additional Plugins -- lvim.plugins = { -- { -- "folke/trouble.nvim", -- cmd = "TroubleToggle", -- }, -- } -- -- Autocommands (`:help autocmd`) -- vim.api.nvim_create_autocmd("FileType", { -- pattern = "zsh", -- callback = function() -- -- let treesitter use bash highlight for zsh files as well -- require("nvim-treesitter.highlight").attach(0, "bash") -- end, -- }) local actions = require("telescope.actions") lvim.builtin.telescope.pickers.git_files.mappings = { i = { [''] = actions.smart_send_to_qflist + actions.open_qflist, } } lvim.builtin.telescope.pickers.live_grep.mappings = { i = { [''] = actions.smart_send_to_qflist + actions.open_qflist, } } lvim.builtin.telescope.pickers.find_files.mappings = { i = { [''] = actions.smart_send_to_qflist + actions.open_qflist, } } lvim.builtin.telescope.defaults.path_display = { shorten = 2 }; vim.cmd([[ command! -nargs=+ Gr :silent execute 'grep! -nr "" | copen' " Raw version of Gr command. command! -nargs=* Grc grep -nr " Add file header to current buffer. Depends on https://github.com/harish2704/file-header command! Header :execute "0r!file-header '%'" " Open Terminal in split window command! Termw :execute '!konsole -e bash-session &' command! Term :execute 'sp | term' command! EditSnippet :execute 'lua require("luasnip.loaders").edit_snippet_files()' " Cd to current file's directory command! Cwd :execute 'cd %:p:h' " Cd to current file's directory, but limit to current tab command! Tcd :execute ':tcd %:p:h' " Reload current buffer command! Reload :execute "bufdo execute 'checktime . bufnr('%')'" " Delete current file and close buffer command! Rm :execute '!rm %' | bd " Copy current file path to unnamedplus register command! CopyFilename :let @+=@% " Open vscode in on current line command! Code :execute "!code ./ -g %:". ( line('.')+1 ) " For Open a terminal in current directory nmap t :!xdg-terminal& " Open git-gui in current pwd nmap g :!git gui & " -> Reload current file nmap :e! " Alt-q Delete current buffer ( Close file ) nmap :BufferKill " force Close buffer nmap :bd! " Select a word and press Ctrl-h to replace all its occurance, even if the word is having special chars vmap "fy:%s#f# " Copy current word to 'f' register, search for that word vmap "fy/f " Ctrl-Enter in insert mode will append ';' to the line and insert a new line imap A; " Alt + Arrows to Moving cursor to different windows {{{ nmap k nmap j nmap l nmap h " }}} " For terminal mod {{{ tmap tmap tmap k tmap j tmap l tmap h " }}} set grepprg=ag\ --nogroup\ --nocolor nmap :Gr " Ctrl-Shift-T -> Open new tab nmap :tabedit " Ctrl-S to save file {{{ nmap :w vmap gv imap nmap :BufferLineCyclePrev nmap :BufferLineCycleNext nmap :BufferLineMovePrev nmap :BufferLineMoveNext nmap :BufferLineCyclePrev nmap :BufferLineCycleNext nmap :BufferLineMovePrev nmap :BufferLineMoveNext let g:user_emmet_mode='inv' let g:user_emmet_install_global = 0 autocmd FileType html,css,vue,jsx,php,javascriptreact EmmetInstall nmap :execute 'Telescope live_grep default_text=' . expand('') ]]) -- imap (emmet-expand-abbr) vim.keymap.set('i', '', '(emmet-expand-abbr)') vim.keymap.set('n', '', function() require('dap').continue() end) vim.keymap.set('n', '', function() require('dap').step_over() end) vim.keymap.set('n', '', function() require('dap').step_into() end) vim.keymap.set('n', '', function() require('dap').step_out() end) lvim.builtin.dap.active = true lvim.builtin.which_key.mappings["l"]["f"] = { function() require("lvim.lsp.utils").format { timeout_ms = 20000 } end, "Format", } local dap = require('dap') dap.adapters.php = { type = 'executable', command = 'node', args = { '/home/harish/tmp/nvim-configs/lunarvim/share/nvim/mason/packages/php-debug-adapter/extension/out/phpDebug.js' } } dap.configurations.php = { { type = 'php', request = 'launch', name = 'Listen for Xdebug', port = 9003 } } lvim.plugins = { { "gpanders/editorconfig.nvim", }, { 'mattn/emmet-vim' }, { "tpope/vim-fugitive", cmd = { "G", "Git", "Gdiffsplit", "Gread", "Gwrite", "Ggrep", "GMove", "GDelete", "GBrowse", "GRemove", "GRename", "Glgrep", "Gedit" }, ft = { "fugitive" } }, { "iamcco/markdown-preview.nvim", build = "cd app && npm install", ft = "markdown", config = function() vim.g.mkdp_auto_start = 1 end, }, { "turbio/bracey.vim", cmd = { "Bracey", "BracyStop", "BraceyReload", "BraceyEval" }, build = "npm install --prefix server", lazy = true, }, { "jamessan/vim-gnupg", -- lazy = true, }, { "honza/vim-snippets", lazy = true, event = "InsertEnter", config = function() -- TODO: Implement - custom snippets should go to user's directory. See below -- https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md#edit_snippets require("luasnip.loaders.from_snipmate").lazy_load { paths = get_runtime_dir() .. "/site/pack/lazy/opt/vim-snippets/snippets" } end, dependencies = { "LuaSnip", }, }, { "godlygeek/tabular" }, { "chrisbra/NrrwRgn" }, { "kylechui/nvim-surround", config = function() require("nvim-surround").setup({ -- Configuration here, or leave empty to use defaults }) end }, { 'rmagatti/auto-session', -- cmd = { 'SaveSession', 'RestoreSession', 'RestoreSessionFromFile', 'DeleteSession', 'Autosession', }, config = function() require("auto-session").setup { log_level = "error", auto_session_create_enabled = false, } end } }