vim.opt.mouse = 'a' -- Enables mouse support in all modes vim.opt.nu = true -- Enables line numbers vim.opt.relativenumber = true -- Displays relative line numbers in the buffer vim.opt.tabstop = 4 -- Sets the number of spaces that a tab character represents vim.opt.softtabstop = 4 -- Sets the number of spaces per tab in the editor's buffer vim.opt.shiftwidth = 4 -- Sets the width for autoindents vim.opt.expandtab = true -- Converts tabs to spaces vim.opt.smartindent = true -- Enables intelligent autoindenting for new lines vim.opt.wrap = false -- Disables text wrapping vim.opt.swapfile = false -- Disables swap file creation vim.opt.backup = false -- Disables making a backup before overwriting a file vim.opt.ignorecase = true -- Makes searches case insensitive vim.opt.smartcase = true -- Makes searches case sensitive if there's a capital letter vim.opt.hlsearch = true -- Highlights all matches of the search pattern vim.opt.incsearch = true -- Starts searching before typing is finished vim.opt.termguicolors = true -- Enables true color support vim.opt.scrolloff = 20 -- Keeps 8 lines visible above/below the cursor vim.opt.signcolumn = "yes" -- Always show the sign column vim.opt.isfname:append("@-@") -- Allows '@' in filenames vim.opt.clipboard = "unnamedplus" -- Uses the system clipboard for all yank, delete, change and put operations vim.opt.undofile = true -- Enables persistent undo vim.opt.updatetime = 50 -- Sets the time after which the swap file is written (in milliseconds) vim.o.breakindent = true -- Makes wrapped lines visually indented vim.o.termguicolors = true -- Enables true color support (duplicated setting) vim.o.splitright = true -- Set horizontal splits to the right as default vim.o.splitbelow = true -- Set vertical splits to the bottom as default vim.o.completeopt = 'menuone,noselect' -- Configures how the completion menu works vim.o.winborder = 'rounded' -- LSP hover borders vim.opt.showmode = false vim.opt.laststatus = 0 --------------------------------------------------------------------------------- -- [[ PLUGINS ]] --------------------------------------------------------------------------------- vim.pack.add({ { src = "https://github.com/rebelot/kanagawa.nvim" }, { src = "https://github.com/neovim/nvim-lspconfig" }, { src = "https://github.com/nvim-mini/mini.nvim" }, { src = "https://github.com/stevearc/oil.nvim" }, { src = "https://github.com/akinsho/toggleterm.nvim" }, { src = "https://github.com/folke/trouble.nvim" }, { src = "https://github.com/saghen/blink.cmp" }, { src = "https://github.com/tribela/transparent.nvim" }, { src = "https://github.com/nvim-treesitter/nvim-treesitter", version = "master" }, { src = "https://github.com/Teatek/gdscript-extended-lsp.nvim" }, }) require('winbar').setup() require("trouble").setup() require("mini.pick").setup() require("mini.pairs").setup() require("mini.surround").setup() require('gdscript-extended-lsp').setup() require("oil").setup({ view_options = { show_hidden = true, } }) require("toggleterm").setup({ open_mapping = [[]], direction = "float" }) require('nvim-treesitter.configs').setup({ highlight = { enable = true, } }) require('blink.cmp').setup({ keymap = { preset = 'none', [''] = { 'show', 'select_next', 'snippet_forward', 'fallback' }, [''] = { 'select_prev', 'snippet_backward', 'fallback' }, [''] = { 'accept', 'fallback' }, }, completion = { documentation = { auto_show = false } }, sources = { default = { 'path', 'buffer', 'lsp' }, }, fuzzy = { implementation = "lua" } }) vim.cmd.colorscheme("kanagawa") --------------------------------------------------------------------------------- -- [[ KEYMAPS ]] --------------------------------------------------------------------------------- vim.g.mapleader = " " vim.keymap.set('n', '', 'noh', { silent = true }) vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) vim.keymap.set('n', 'cr', 'lua vim.lsp.buf.rename()') vim.keymap.set('n', 'ca', 'lua vim.lsp.buf.code_action()') vim.keymap.set("v", "", "", ">gv") vim.keymap.set("v", "J", ":m '>+1gv=gv") vim.keymap.set("v", "K", ":m '<-2gv=gv") vim.keymap.set("n", "p", "b#") vim.keymap.set("n", "x", "bd") vim.keymap.set("n", "f", ":Pick files") vim.keymap.set("n", "h", ":Pick help") vim.keymap.set("n", "s", ":Pick grep_live") vim.keymap.set("n", "b", ":Pick buffers") vim.keymap.set("n", "q", ":Trouble diagnostics toggle") vim.keymap.set("n", "e", ":Oil") -------------------------------------------------------------------------------- -- [[ LSP ]] --------------------------------------------------------------------------------- local servers = { "gopls", "gdscript" } for _, server in ipairs(servers) do vim.lsp.enable(server) end -------------------------------------------------------------------------------- -- [[ AUTOCMDS ]] --------------------------------------------------------------------------------- -- Highlight on Yank vim.api.nvim_create_autocmd('TextYankPost', { group = vim.api.nvim_create_augroup('YankHighlight', { clear = true }), callback = function() vim.highlight.on_yank() end, pattern = '*', }) -------------------------------------------------------------------------------- -- [[ Godot ]] --------------------------------------------------------------------------------- -- paths to check for project.godot file local paths_to_check = {'/', '/../'} local is_godot_project = false local godot_project_path = '' local cwd = vim.fn.getcwd() -- iterate over paths and check for key, value in pairs(paths_to_check) do if vim.uv.fs_stat(cwd .. value .. 'project.godot') then is_godot_project = true godot_project_path = cwd .. value break end end -- check if server is already running in godot project path local is_server_running = vim.uv.fs_stat(godot_project_path .. '/server.pipe') if is_godot_project and not is_server_running then vim.fn.serverstart(godot_project_path .. '/server.pipe') end