Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
203 changes: 158 additions & 45 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]]
-- See `:help vim.opt`
Expand All @@ -102,7 +102,7 @@ vim.g.have_nerd_font = false
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

-- Enable mouse mode, can be useful for resizing splits for example!
vim.opt.mouse = 'a'
Expand All @@ -114,9 +114,9 @@ vim.opt.showmode = false
-- Schedule the setting after `UiEnter` because it can increase startup-time.
-- Remove this option if you want your OS clipboard to remain independent.
-- See `:help 'clipboard'`
vim.schedule(function()
vim.opt.clipboard = 'unnamedplus'
end)
-- vim.schedule(function()
-- vim.opt.clipboard = 'unnamedplus'
-- end)

-- Enable break indent
vim.opt.breakindent = true
Expand Down Expand Up @@ -189,6 +189,39 @@ vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right win
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })

-- Custom keymaps for yanking file paths to system clipboard (+)
vim.keymap.set('n', '<leader>yp', ":let @+=expand('%:.')<CR>", { desc = 'Copy relative path' })
vim.keymap.set('n', '<leader>yP', ':let @+=expand("%:p")<CR>', { desc = 'Copy absolute path' })

-- 1. Yanking to System Clipboard
-- In Normal Mode: <leader>yy yanks the current line
vim.keymap.set('n', '<leader>yy', [["+yy]], { desc = 'Yank line to system clipboard' })
-- In Visual Mode: <leader>y yanks the selection
vim.keymap.set('v', '<leader>y', [["+y]], { desc = 'Yank selection to system clipboard' })
-- Yank from cursor to end of line
vim.keymap.set('n', '<leader>yY', [["+y$]], { desc = 'Yank to end of line to clipboard' })

-- 2. Pasting from System Clipboard
-- Keeps <leader>p for explicit system paste
vim.keymap.set({ 'n', 'v' }, '<leader>p', [["+p]], { desc = 'Paste from system clipboard' })
vim.keymap.set({ 'n', 'v' }, '<leader>P', [["+P]], { desc = 'Paste before from system clipboard' })

-- 3. Insert Mode Paste
-- <C-p> to paste system clipboard while typing
vim.keymap.set('i', '<C-p>', '<C-r>+', { desc = 'Paste from clipboard in insert mode' })

-- 4. Select All (standard ggVG)
vim.keymap.set('n', '<C-a>', 'ggVG', { desc = 'Select all text' })

-- [[ Filetype Detection ]]
-- Recognize .cshtml files as razor (not html) to prevent incorrect formatting
vim.filetype.add {
extension = {
cshtml = 'razor',
razor = 'razor',
},
}

-- [[ Basic Autocommands ]]
-- See `:help lua-guide-autocommands`

Expand Down Expand Up @@ -229,6 +262,17 @@ 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
{
'akinsho/toggleterm.nvim',
version = "*",
config = function()
require("toggleterm").setup({
open_mapping = [[<leader>tt]],
direction = "horizontal",
size = 10,
})
end
},

-- NOTE: Plugins can also be added by using a table,
-- with the first argument being the link and the following
Expand All @@ -254,6 +298,13 @@ require('lazy').setup({
},
},
},
{
'seblyng/roslyn.nvim',
ft = 'cs',
opts = {
-- your configuration comes here; leave empty for default settings
},
},

-- NOTE: Plugins can also be configured to run Lua code when they are loaded.
--
Expand Down Expand Up @@ -336,7 +387,6 @@ require('lazy').setup({
{ -- Fuzzy Finder (files, lsp, etc)
'nvim-telescope/telescope.nvim',
event = 'VimEnter',
branch = '0.1.x',
dependencies = {
'nvim-lua/plenary.nvim',
{ -- If encountering errors, see telescope-fzf-native README for installation instructions
Expand Down Expand Up @@ -388,7 +438,12 @@ require('lazy').setup({
-- i = { ['<c-enter>'] = 'to_fuzzy_refine' },
-- },
-- },
-- pickers = {}
pickers = {
find_files = {
hidden = true,
no_ignore = true,
},
},
extensions = {
['ui-select'] = {
require('telescope.themes').get_dropdown(),
Expand Down Expand Up @@ -458,7 +513,14 @@ require('lazy').setup({
-- Automatically install LSPs and related tools to stdpath for Neovim
-- Mason must be loaded before its dependents so we need to set it up here.
-- NOTE: `opts = {}` is the same as calling `require('mason').setup({})`
{ 'williamboman/mason.nvim', opts = {} },
{
'williamboman/mason.nvim',
opts = {
registries = {
'github:mason-org/mason-registry',
},
},
},
'williamboman/mason-lspconfig.nvim',
'WhoIsSethDaniel/mason-tool-installer.nvim',

Expand Down Expand Up @@ -616,19 +678,51 @@ 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 = {},
clangd = {},
gopls = {
settings = {
gopls = {
analyses = {
unusedparams = true,
},
staticcheck = true,
gofumpt = true,
},
},
},
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:
-- https://github.com/pmizio/typescript-tools.nvim
--
-- But for many setups, the LSP (`ts_ls`) will work just fine
-- ts_ls = {},
--
ts_ls = {},
eslint = {},
html = {
filetypes = { 'html' },
settings = {
html = {
format = {
-- Disable the LSP formatter if you are using Prettier (recommended)
-- enable = false,

-- If you want to keep using LSP formatting, adjust these:
templating = true, -- Handle {{ }} tags decently
wrapLineLength = 120, -- Don't wrap lines too early
wrapAttributes = 'auto', -- 'auto', 'force', 'force-aligned', 'force-expand-multiline'

-- Add elements here that you DON'T want formatted (e.g., if you use scripts inside specific tags)
unformatted = { 'script', 'style', 'pre', 'code', 'textarea' },

-- Sometimes helpful to prevent stripping/adding weird spaces
indentInnerHtml = true,
},
},
},
},
--
lua_ls = {
-- cmd = { ... },
-- filetypes = { ... },
Expand Down Expand Up @@ -661,6 +755,12 @@ require('lazy').setup({
local ensure_installed = vim.tbl_keys(servers or {})
vim.list_extend(ensure_installed, {
'stylua', -- Used to format Lua code
'prettierd',
'black',
'isort',
'gopls',
'goimports',
'clang-format',
})
require('mason-tool-installer').setup { ensure_installed = ensure_installed }

Expand All @@ -678,7 +778,6 @@ require('lazy').setup({
}
end,
},

{ -- Autoformat
'stevearc/conform.nvim',
event = { 'BufWritePre' },
Expand All @@ -699,7 +798,7 @@ require('lazy').setup({
-- 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 = {}
local lsp_format_opt
if disable_filetypes[vim.bo[bufnr].filetype] then
lsp_format_opt = 'never'
Expand All @@ -713,6 +812,14 @@ require('lazy').setup({
end,
formatters_by_ft = {
lua = { 'stylua' },
markdown = { 'prettierd' },
python = { 'isort', 'black' },
json = { 'prettierd' },
cs = { 'csharpier' },
razor = {},
go = { 'goimports', 'gofmt' },
c = { 'clang-format' },
cpp = { 'clang-format' },
-- Conform can also run multiple formatters sequentially
-- python = { "isort", "black" },
--
Expand Down Expand Up @@ -789,13 +896,13 @@ require('lazy').setup({
-- Accept ([y]es) the completion.
-- This will auto-import if your LSP supports it.
-- This will expand snippets if the LSP sent a snippet.
['<C-y>'] = cmp.mapping.confirm { select = true },
-- ['<C-y>'] = cmp.mapping.confirm { select = true },

-- If you prefer more traditional completion keymaps,
-- you can uncomment the following lines
--['<CR>'] = cmp.mapping.confirm { select = true },
--['<Tab>'] = cmp.mapping.select_next_item(),
--['<S-Tab>'] = cmp.mapping.select_prev_item(),
['<CR>'] = cmp.mapping.confirm { select = true },
['<Tab>'] = cmp.mapping.select_next_item(),
['<S-Tab>'] = cmp.mapping.select_prev_item(),

-- Manually trigger a completion from nvim-cmp.
-- Generally you don't need this, because nvim-cmp will display
Expand Down Expand Up @@ -843,13 +950,13 @@ 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',
'catppuccin/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 'catppuccin-mocha'

-- You can configure highlights by doing something like:
vim.cmd.hi 'Comment gui=none'
Expand Down Expand Up @@ -896,30 +1003,26 @@ require('lazy').setup({
-- Check out: https://github.com/echasnovski/mini.nvim
end,
},
{ -- Highlight, edit, and navigate code
{ -- Install treesitter parsers and queries
'nvim-treesitter/nvim-treesitter',
lazy = false,
build = ':TSUpdate',
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
opts = {
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
-- Autoinstall languages that are not installed
auto_install = true,
highlight = {
enable = true,
-- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules.
-- If you are experiencing weird indenting issues, add the language to
-- the list of additional_vim_regex_highlighting and disabled languages for indent.
additional_vim_regex_highlighting = { 'ruby' },
},
indent = { enable = true, disable = { 'ruby' } },
},
-- There are additional nvim-treesitter modules that you can use to interact
-- with nvim-treesitter. You should go explore a few and see what interests you:
--
-- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod`
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
config = function()
require('nvim-treesitter').setup {
install_dir = vim.fn.stdpath('data') .. '/site',
}

require('nvim-treesitter').install {
'bash', 'c', 'cpp', 'diff', 'html', 'lua', 'luadoc',
'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc',
'gitcommit', 'python', 'go', 'gomod', 'gowork', 'gosum',
}

-- Enable treesitter highlighting via Neovim built-in
vim.api.nvim_create_autocmd('FileType', {
callback = function() pcall(vim.treesitter.start) end,
})
end,
},

-- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the
Expand All @@ -935,14 +1038,14 @@ require('lazy').setup({
-- require 'kickstart.plugins.indent_line',
-- require 'kickstart.plugins.lint',
-- require 'kickstart.plugins.autopairs',
-- require 'kickstart.plugins.neo-tree',
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.
--
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
-- { import = 'custom.plugins' },
{ import = 'custom.plugins' },
--
-- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
-- Or use telescope!
Expand Down Expand Up @@ -972,3 +1075,13 @@ require('lazy').setup({

-- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et
--
-- Add this at the very end of your init.lua
vim.api.nvim_create_autocmd('FileType', {
pattern = { 'c', 'cpp', 'h', 'hpp' },
callback = function()
vim.opt_local.tabstop = 2 -- Visual width of a tab
vim.opt_local.shiftwidth = 2 -- Width of an auto-indent
vim.opt_local.expandtab = true -- Convert tabs to spaces
end,
})
5 changes: 5 additions & 0 deletions lua/custom/roslyn.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
require('mason').setup {
registries = {
'github:mason-org/mason-registry',
},
}
Loading