From 8eb6159ae3426ec1fa501abcf8412cbf062684d0 Mon Sep 17 00:00:00 2001 From: Jordan Orelli Date: Sat, 15 Jun 2024 16:58:41 -0500 Subject: [PATCH] workin on nvim --- nvim/after/ftplugin/python.lua | 1 + nvim/{lua => after/plugin}/colors.lua | 0 nvim/after/plugin/fugitive.lua | 0 nvim/after/plugin/gitsigns.lua | 47 +++++++++++++++ nvim/after/plugin/init.lua | 10 ---- nvim/after/plugin/lsp.lua | 1 + nvim/after/plugin/treesitter.lua | 63 ++++++++++++++++++++ nvim/init.lua | 10 ++++ nvim/lua/keys.lua | 8 +++ nvim/lua/plugins.lua | 20 +++++++ nvim/lua/prefs.lua | 84 +++++++++++++++++++++++++++ 11 files changed, 234 insertions(+), 10 deletions(-) create mode 100644 nvim/after/ftplugin/python.lua rename nvim/{lua => after/plugin}/colors.lua (100%) create mode 100644 nvim/after/plugin/fugitive.lua create mode 100644 nvim/after/plugin/gitsigns.lua delete mode 100644 nvim/after/plugin/init.lua create mode 100644 nvim/after/plugin/lsp.lua create mode 100644 nvim/after/plugin/treesitter.lua create mode 100644 nvim/lua/prefs.lua diff --git a/nvim/after/ftplugin/python.lua b/nvim/after/ftplugin/python.lua new file mode 100644 index 0000000..2b10adc --- /dev/null +++ b/nvim/after/ftplugin/python.lua @@ -0,0 +1 @@ +print("You are in Python") diff --git a/nvim/lua/colors.lua b/nvim/after/plugin/colors.lua similarity index 100% rename from nvim/lua/colors.lua rename to nvim/after/plugin/colors.lua diff --git a/nvim/after/plugin/fugitive.lua b/nvim/after/plugin/fugitive.lua new file mode 100644 index 0000000..e69de29 diff --git a/nvim/after/plugin/gitsigns.lua b/nvim/after/plugin/gitsigns.lua new file mode 100644 index 0000000..30e62b6 --- /dev/null +++ b/nvim/after/plugin/gitsigns.lua @@ -0,0 +1,47 @@ +print("Configuring gitsigns") + +local gitsigns = require('gitsigns') + +gitsigns.setup { + signs = { + add = { text = '┃' }, + change = { text = '┃' }, + delete = { text = '_' }, + topdelete = { text = '‾' }, + changedelete = { text = '~' }, + untracked = { text = '┆' }, + }, + signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` + numhl = false, -- Toggle with `:Gitsigns toggle_numhl` + linehl = false, -- Toggle with `:Gitsigns toggle_linehl` + word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` + watch_gitdir = { + follow_files = true + }, + auto_attach = true, + attach_to_untracked = false, + current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame` + current_line_blame_opts = { + virt_text = true, + virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align' + delay = 1000, + ignore_whitespace = false, + virt_text_priority = 100, + }, + current_line_blame_formatter = ', - ', + current_line_blame_formatter_opts = { + relative_time = false, + }, + sign_priority = 6, + update_debounce = 100, + status_formatter = nil, -- Use default + max_file_length = 40000, -- Disable if file is longer than this (in lines) + preview_config = { + -- Options passed to nvim_open_win + border = 'single', + style = 'minimal', + relative = 'cursor', + row = 0, + col = 1 + }, +} diff --git a/nvim/after/plugin/init.lua b/nvim/after/plugin/init.lua deleted file mode 100644 index d00fc15..0000000 --- a/nvim/after/plugin/init.lua +++ /dev/null @@ -1,10 +0,0 @@ -print("All Plugins are loaded") - -for k, v in pairs(packer_plugins) do - print(k, v) -end - -require("keys") -require("colors") - - diff --git a/nvim/after/plugin/lsp.lua b/nvim/after/plugin/lsp.lua new file mode 100644 index 0000000..343a080 --- /dev/null +++ b/nvim/after/plugin/lsp.lua @@ -0,0 +1 @@ +print("LSP setting up") diff --git a/nvim/after/plugin/treesitter.lua b/nvim/after/plugin/treesitter.lua new file mode 100644 index 0000000..347a717 --- /dev/null +++ b/nvim/after/plugin/treesitter.lua @@ -0,0 +1,63 @@ +print("Configuring Treesitter") + + +require'nvim-treesitter.configs'.setup { + -- A list of parser names, or "all" + ensure_installed = { + "c", + "c_sharp", + "cmake", + "cpp", + "css", + "diff", + "dockerfile", + "elixir", + "go", + "graphql", + "hcl", + "javascript", + "lua", + "nix", + "proto", + "python", + "query", + "ruby", + "rust", + "toml", + "typescript", + "vim", + "vimdoc", + "yaml", + "zig", + }, + + -- Install parsers asynchronously + sync_install = false, + + -- Automatically install missing parsers when entering buffer + -- Recommendation: set to false if you don't have + -- `tree-sitter` CLI installed locally + auto_install = true, + + -- List of parsers to ignore installing (or "all") + ignore_install = { }, + + highlight = { + enable = true, + + -- Disable treesitter on super large files + disable = function(lang, buf) + local max_filesize = 100 * 1024 -- 100 KB + local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf)) + if ok and stats and stats.size > max_filesize then + return true + end + end, + + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = false, + }, +} diff --git a/nvim/init.lua b/nvim/init.lua index 1798cb7..71897d6 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -1,2 +1,12 @@ print("Init start") + +-- set leader to space +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 + require("plugins") +require("prefs") +require("keys") diff --git a/nvim/lua/keys.lua b/nvim/lua/keys.lua index b0a7101..393221f 100644 --- a/nvim/lua/keys.lua +++ b/nvim/lua/keys.lua @@ -2,3 +2,11 @@ print("Loading key mappings") local telescope = require('telescope.builtin') vim.keymap.set('n', '', telescope.find_files, {}) + +-- vim.keymap.set("v", "J", ":m '>+1gv=gv") +-- vim.keymap.set("v", "K", ":m '>-2gv=gv") + +-- using J to join lines doesn't move your cursor +-- vim.keymap.set("n", "J", "mzJ`z") + +-- vim.keymap.set('n', '', '', { + desc = 'Exit terminal mode' +}) + +