diff --git a/ftplugin/c.lua b/ftplugin/c.lua new file mode 100644 index 0000000..4bc90b0 --- /dev/null +++ b/ftplugin/c.lua @@ -0,0 +1,2 @@ +vim.cmd 'autocmd BufEnter * set formatoptions-=cro' +vim.cmd 'autocmd BufEnter * setlocal formatoptions-=cro' diff --git a/ftplugin/markdown.lua b/ftplugin/markdown.lua new file mode 100644 index 0000000..2848685 --- /dev/null +++ b/ftplugin/markdown.lua @@ -0,0 +1 @@ +vim.opt_local.conceallevel = 2 diff --git a/ftplugin/python.lua b/ftplugin/python.lua new file mode 100644 index 0000000..db2a493 --- /dev/null +++ b/ftplugin/python.lua @@ -0,0 +1,17 @@ +-- original from: https://stackoverflow.com/questions/76954973/how-to-set-keybindings-to-execute-python-files-in-neovim-using-the-built-in-term + +local function run_curr_python_file_in_toggleterm() + local file_name = vim.api.nvim_buf_get_name(0) + + local py_cmd = vim.api.nvim_replace_termcodes('python3 "' .. file_name .. '"', true, false, true) + -- local py_cmd = vim.api.nvim_replace_termcodes('python3 "' .. file_name .. '" :ToggleTerm', true, false, true) + local end_cmd = vim.api.nvim_replace_termcodes('', true, false, true) + vim.cmd ':ToggleTerm direction=float' + vim.api.nvim_feedkeys(py_cmd, 't', false) + vim.api.nvim_feedkeys(end_cmd, 't', false) +end + +vim.keymap.set({ 'n' }, '', '', { + desc = 'Run .py file via Neovim built-in terminal', + callback = run_curr_python_file_in_toggleterm, +}) diff --git a/init.lua b/init.lua index 56df1cd..49334c2 100644 --- a/init.lua +++ b/init.lua @@ -6,6 +6,8 @@ vim.opt.termguicolors = true -- To make sure image.nvim works with luarocks package.path = package.path .. ';' .. vim.fn.expand '$HOME' .. '/.luarocks/share/lua/5.1/?/init.lua;' package.path = package.path .. ';' .. vim.fn.expand '$HOME' .. '/.luarocks/share/lua/5.1/?.lua' + +vim.opt_local.autochdir = true -- END OF TESTING REGION --[[ @@ -176,6 +178,9 @@ vim.keymap.set('n', '', 'nohlsearch') -- Diagnostic keymaps vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) +vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' }) +vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' }) +vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) -- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier -- for people to discover. Otherwise, you normally need to press , which @@ -579,10 +584,10 @@ require('lazy').setup({ -- - settings (table): Override the default settings passed when initializing the server. -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ local servers = { - -- clangd = {}, - -- gopls = {}, - -- pyright = {}, - -- rust_analyzer = {}, + clangd = {}, + gopls = {}, + pyright = {}, + rust_analyzer = {}, -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs -- -- Some languages (like typescript) have entire language plugins that can be useful: @@ -890,12 +895,12 @@ 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.gitsigns', -- adds gitsigns recommend keymaps + 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.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. diff --git a/lua/custom/plugins/compiler.lua b/lua/custom/plugins/compiler.lua new file mode 100644 index 0000000..53144e8 --- /dev/null +++ b/lua/custom/plugins/compiler.lua @@ -0,0 +1,6 @@ +return { + 'Zeioth/compiler.nvim', + cmd = { 'CompilerOpen', 'CompilerToggleResults', 'CompilerRedo' }, + dependencies = { 'stevearc/overseer.nvim', 'nvim-telescope/telescope.nvim' }, + opts = {}, +} diff --git a/lua/custom/plugins/emoji.lua b/lua/custom/plugins/emoji.lua new file mode 100644 index 0000000..6f10fcf --- /dev/null +++ b/lua/custom/plugins/emoji.lua @@ -0,0 +1,11 @@ +return { + 'allaman/emoji.nvim', + ft = 'markdown', + dependencies = { + 'hrsh7th/nvim-cmp', + 'nvim-telescope/telescope.nvim', + }, + config = function() + require('telescope').load_extension 'emoji' + end, +} diff --git a/lua/custom/plugins/noice.lua b/lua/custom/plugins/noice.lua new file mode 100644 index 0000000..6278aba --- /dev/null +++ b/lua/custom/plugins/noice.lua @@ -0,0 +1,17 @@ +return { + { + 'folke/noice.nvim', + event = 'VeryLazy', + opts = { + -- add any options here + }, + dependencies = { + -- if you lazy-load any plugin below, make sure to add proper `module="..."` entries + 'MunifTanjim/nui.nvim', + -- OPTIONAL: + -- `nvim-notify` is only needed, if you want to use the notification view. + -- If not available, we use `mini` as the fallback + 'rcarriga/nvim-notify', + }, + }, +} diff --git a/lua/custom/plugins/obsidian.lua b/lua/custom/plugins/obsidian.lua index b001afe..7a98b71 100644 --- a/lua/custom/plugins/obsidian.lua +++ b/lua/custom/plugins/obsidian.lua @@ -22,5 +22,6 @@ return { date_format = '%Y-%m-%d', time_format = '%H:%M', }, + disable_frontmatter = true, }, } diff --git a/lua/custom/plugins/overseer.lua b/lua/custom/plugins/overseer.lua new file mode 100644 index 0000000..3e85e3c --- /dev/null +++ b/lua/custom/plugins/overseer.lua @@ -0,0 +1,13 @@ +return { + 'stevearc/overseer.nvim', + commit = '6271cab7ccc4ca840faa93f54440ffae3a3918bd', + cmd = { 'CompilerOpen', 'CompilerToggleResults', 'CompilerRedo' }, + opts = { + task_list = { + direction = 'bottom', + min_height = 25, + max_height = 25, + default_detail = 1, + }, + }, +} diff --git a/lua/custom/plugins/pastify.lua b/lua/custom/plugins/pastify.lua new file mode 100644 index 0000000..317e57b --- /dev/null +++ b/lua/custom/plugins/pastify.lua @@ -0,0 +1,46 @@ +return { + 'TobinPalmer/pastify.nvim', + cmd = { 'Pastify', 'PastifyAfter' }, + event = { 'BufReadPost' }, -- Load after the buffer is read, I like to be able to paste right away + keys = { + { noremap = true, mode = 'x', 'p', 'PastifyAfter' }, + { noremap = true, mode = 'n', 'p', 'PastifyAfter' }, + { noremap = true, mode = 'n', 'P', 'Pastify' }, + }, + config = function() + require('pastify').setup { + opts = { + absolute_path = false, -- use absolute or relative path to the working directory + apikey = '', -- Api key, required for online saving + local_path = '/assets/imgs/', -- The path to put local files in, ex ~/Projects//assets/images/.png + save = 'local', -- Either 'local' or 'online' or 'local_file' + filename = function() + return vim.fn.expand '%:t:r' .. '_' .. os.date '%Y-%m-%d_%H-%M-%S' + end, + default_ft = 'markdown', -- Default filetype to use + }, + ft = { -- Custom snippets for different filetypes, will replace $IMG$ with the image url + html = '', + markdown = '![]($IMG$)', + tex = [[\includegraphics[width=\linewidth]{$IMG$}]], + css = 'background-image: url("$IMG$");', + js = 'const img = new Image(); img.src = "$IMG$";', + xml = '', + php = '"; ?>', + python = '# $IMG$', + java = '// $IMG$', + c = '// $IMG$', + cpp = '// $IMG$', + swift = '// $IMG$', + kotlin = '// $IMG$', + go = '// $IMG$', + typescript = '// $IMG$', + ruby = '# $IMG$', + vhdl = '-- $IMG$', + verilog = '// $IMG$', + systemverilog = '// $IMG$', + lua = '-- $IMG$', + }, + } + end, +} diff --git a/lua/custom/plugins/smoji.lua b/lua/custom/plugins/smoji.lua new file mode 100644 index 0000000..fef0e9e --- /dev/null +++ b/lua/custom/plugins/smoji.lua @@ -0,0 +1,7 @@ +return { + 'zakissimo/smoji.nvim', + config = function() + require 'smoji' + vim.keymap.set('n', 'em', 'Smoji') + end, +}