diff --git a/init.lua b/init.lua index cbf9ff65..56d0d96a 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 ]] -- See `:help vim.opt` @@ -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' diff --git a/lua/custom/plugins/formatting.lua b/lua/custom/plugins/formatting.lua new file mode 100644 index 00000000..4c34029e --- /dev/null +++ b/lua/custom/plugins/formatting.lua @@ -0,0 +1,38 @@ +return { + 'stevearc/conform.nvim', + event = { 'BufReadPre', 'BufNewFile' }, + config = function() + local conform = require 'conform' + + conform.setup { + formatters_by_ft = { + javascript = { 'prettier' }, + typescript = { 'prettier' }, + javascriptreact = { 'prettier' }, + typescriptreact = { 'prettier' }, + svelte = { 'prettier' }, + css = { 'prettier' }, + html = { 'prettier' }, + json = { 'prettier' }, + yaml = { 'prettier' }, + markdown = { 'prettier' }, + graphql = { 'prettier' }, + lua = { 'stylua' }, + python = { 'isort', 'black', 'ruff' }, + }, + format_on_save = { + lsp_fallback = true, + async = false, + timeout_ms = 500, + }, + } + + vim.keymap.set({ 'n', 'v' }, 'mp', function() + conform.format { + lsp_fallback = true, + async = false, + timeout_ms = 1000, + } + end, { desc = 'Format file or range (in visual mode)' }) + end, +} diff --git a/lua/custom/plugins/vimconfig.lua b/lua/custom/plugins/vimconfig.lua new file mode 100644 index 00000000..8f3cf504 --- /dev/null +++ b/lua/custom/plugins/vimconfig.lua @@ -0,0 +1,18 @@ +-- disable netrw +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 + +-- Disable line wrap +vim.opt.wrap = false + +-- No swap file +vim.opt.swapfile = false + +-- Set shiftwidth and tabstop +vim.opt.shiftwidth = 4 +vim.opt.tabstop = 4 +vim.opt.softtabstop = 4 + +vim.opt.termguicolors = true + +return {}