Last active
July 16, 2024 17:13
-
-
Save jimnanney/d235745c5b3078dea25c0468c67062b3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Set \ as the leader key | |
| -- See `:help mapleader` | |
| -- NOTE: Must happen before plugins are required (otherwise wrong leader will be used) | |
| vim.g.mapleader = '\\' | |
| vim.g.maplocalleader = '\\' | |
| vim.g.have_nerd_font = true | |
| -- Install package manager | |
| -- https://github.com/folke/lazy.nvim | |
| -- `:help lazy.nvim.txt` for more info | |
| local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' | |
| if not vim.loop.fs_stat(lazypath) then | |
| vim.fn.system { | |
| 'git', | |
| 'clone', | |
| '--filter=blob:none', | |
| 'https://github.com/folke/lazy.nvim.git', | |
| '--branch=stable', -- latest stable release | |
| lazypath, | |
| } | |
| end | |
| vim.opt.rtp:prepend(lazypath) | |
| -- NOTE: Here is where you install your plugins. | |
| -- You can configure plugins using the `config` key. | |
| -- | |
| -- You can also configure plugins after the setup call, | |
| -- as they will be available in your neovim runtime. | |
| require('lazy').setup({ | |
| -- NOTE: First, some plugins that don't require any configuration | |
| -- Git related plugins | |
| 'tpope/vim-fugitive', | |
| 'tpope/vim-rhubarb', | |
| -- Detect tabstop and shiftwidth automatically | |
| 'tpope/vim-sleuth', | |
| -- NOTE: This is where your plugins related to LSP can be installed. | |
| -- The configuration is done below. Search for lspconfig to find it below. | |
| { -- LSP Configuration & Plugins | |
| 'neovim/nvim-lspconfig', | |
| dependencies = { | |
| -- Automatically install LSPs to stdpath for neovim | |
| 'williamboman/mason.nvim', | |
| 'williamboman/mason-lspconfig.nvim', | |
| -- Useful status updates for LSP | |
| -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` | |
| { 'j-hui/fidget.nvim', opts = {} }, | |
| -- Additional lua configuration, makes nvim stuff amazing! | |
| { | |
| 'folke/lazydev.nvim', | |
| ft = "lua", | |
| }, | |
| }, | |
| }, | |
| { -- Icons | |
| 'nvim-tree/nvim-web-devicons' | |
| }, | |
| { -- Autocompletion | |
| 'hrsh7th/nvim-cmp', | |
| dependencies = { | |
| 'hrsh7th/cmp-buffer', | |
| 'hrsh7th/cmp-nvim-lsp', | |
| 'saadparwaiz1/cmp_luasnip', | |
| 'onsails/lspkind.nvim', | |
| 'hrsh7th/cmp-nvim-lua', | |
| { | |
| 'L3MON4D3/LuaSnip', | |
| version = "v2.*", | |
| build = "make install_jsregexp", | |
| dependencies = | |
| { | |
| 'rafamadriz/friendly-snippets' | |
| } | |
| } | |
| }, | |
| }, | |
| { -- Useful plugin to show you pending keybinds. | |
| 'folke/which-key.nvim', | |
| opts = { | |
| -- triggers_blacklist = { | |
| -- c = { '%' } | |
| -- } | |
| } | |
| }, | |
| { | |
| 'github/copilot.vim', | |
| }, | |
| { -- Adds git releated signs to the gutter, as well as utilities for managing changes | |
| 'lewis6991/gitsigns.nvim', | |
| opts = { | |
| -- See `:help gitsigns.txt` | |
| signs = { | |
| add = { text = '+' }, | |
| change = { text = '~' }, | |
| delete = { text = '_' }, | |
| topdelete = { text = '‾' }, | |
| changedelete = { text = '~' }, | |
| }, | |
| }, | |
| }, | |
| { -- Lush colorscheme setup | |
| 'rktjmp/lush.nvim' | |
| }, | |
| { -- Set lualine as statusline | |
| 'nvim-lualine/lualine.nvim', | |
| -- See `:help lualine.txt` | |
| opts = { | |
| options = { | |
| icons_enabled = true, | |
| theme = 'auto', | |
| component_separators = '|', | |
| section_separators = '', | |
| }, | |
| }, | |
| }, | |
| { | |
| "nvimdev/dashboard-nvim", | |
| event = "VimEnter", | |
| config = function() | |
| local logo = { | |
| '', | |
| '', | |
| '', | |
| '', | |
| '', | |
| ' ▄▄▄██▀▀▀██▓ ███▄ ▄███▓ ██████ ██▒ █▓ ██▓ ███▄ ▄███▓', | |
| ' ▒██ ▓██▒▓██▒▀█▀ ██▒▒██ ▒ ▓██░ █▒▓██▒▓██▒▀█▀ ██▒', | |
| ' ░██ ▒██▒▓██ ▓██░░ ▓██▄ ▓██ █▒░▒██▒▓██ ▓██░', | |
| '▓██▄██▓ ░██░▒██ ▒██ ▒ ██▒ ▒██ █░░░██░▒██ ▒██ ', | |
| ' ▓███▒ ░██░▒██▒ ░██▒▒██████▒▒ ▒▀█░ ░██░▒██▒ ░██▒', | |
| ' ▒▓▒▒░ ░▓ ░ ▒░ ░ ░▒ ▒▓▒ ▒ ░ ░ ▐░ ░▓ ░ ▒░ ░ ░', | |
| ' ▒ ░▒░ ▒ ░░ ░ ░░ ░▒ ░ ░ ░ ░░ ▒ ░░ ░ ░', | |
| ' ░ ░ ░ ▒ ░░ ░ ░ ░ ░ ░░ ▒ ░░ ░ ', | |
| ' ░ ░ ░ ░ ░ ░ ░ ░ ', | |
| ' ░ ', | |
| '', | |
| '', | |
| '', | |
| } | |
| require("dashboard").setup { | |
| theme = 'hyper', | |
| config = { | |
| shortcut = { | |
| { desc = ' Update', group = '@property', action = 'Lazy update', key = 'u' }, | |
| { | |
| icon = ' ', | |
| icon_hl = '@variable', | |
| desc = 'Files', | |
| group = 'Label', | |
| action = 'Telescope find_files', | |
| key = 'f', | |
| }, | |
| { | |
| desc = ' Git Changes', | |
| group = 'Number', | |
| action = function() | |
| require('telescope.builtin').git_files( | |
| { | |
| git_command = { "git", "ls-files", "-mo", "--exclude-standard" } | |
| } | |
| ) | |
| end, | |
| 'Telescope dotfiles', | |
| key = 'c', | |
| }, | |
| }, | |
| header = logo, | |
| } | |
| } | |
| end, | |
| dependencies = { | |
| { "nvim-tree/nvim-web-devicons" } | |
| }, | |
| }, | |
| { -- Add indentation guides even on blank lines | |
| 'lukas-reineke/indent-blankline.nvim', | |
| -- Enable `lukas-reineke/indent-blankline.nvim` | |
| -- See `:help indent_blankline.txt` | |
| main = "ibl", | |
| -- opts = { | |
| -- char = '┊', | |
| -- show_trailing_blankline_indent = false, | |
| -- }, | |
| }, | |
| -- "gc" to comment visual regions/lines | |
| { 'numToStr/Comment.nvim', opts = {} }, | |
| -- Fuzzy Finder (files, lsp, etc) | |
| { 'nvim-telescope/telescope.nvim', version = '*', dependencies = { 'nvim-lua/plenary.nvim' } }, | |
| -- Fuzzy Finder Algorithm which requires local dependencies to be built. | |
| -- Only load if `make` is available. Make sure you have the system | |
| -- requirements installed. | |
| { | |
| 'nvim-telescope/telescope-fzf-native.nvim', | |
| -- NOTE: If you are having trouble with this installation, | |
| -- refer to the README for telescope-fzf-native for more instructions. | |
| build = 'make', | |
| cond = function() | |
| return vim.fn.executable 'make' == 1 | |
| end, | |
| }, | |
| { -- Highlight, edit, and navigate code | |
| 'nvim-treesitter/nvim-treesitter', | |
| dependencies = { | |
| 'nvim-treesitter/nvim-treesitter-textobjects', | |
| }, | |
| config = function() | |
| pcall(require('nvim-treesitter.install').update { with_sync = true }) | |
| end, | |
| }, | |
| -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart | |
| -- These are some example plugins that I've included in the kickstart repository. | |
| -- Uncomment any of the lines below to enable them. | |
| -- require 'kickstart.plugins.autoformat', | |
| -- require 'kickstart.plugins.debug', | |
| -- NOTE: The import below automatically adds your own plugins, configuration, etc from `lua/custom/plugins/*.lua` | |
| -- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping | |
| -- up-to-date with whatever is in the kickstart repo. | |
| -- | |
| -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins | |
| -- | |
| -- An additional note is that if you only copied in the `init.lua`, you can just comment this line | |
| -- to get rid of the warning telling you that there are not plugins in `lua/custom/plugins/`. | |
| { import = 'custom.plugins' }, | |
| }, {}) | |
| -- [[ Setting options ]] | |
| -- See `:help vim.o` | |
| vim.opt.undofile = true | |
| vim.wo.signcolumn = 'yes' | |
| vim.opt.number = true | |
| vim.opt.mouse = '' | |
| vim.opt.showmode = false | |
| vim.opt.clipboard = 'unnamedplus' | |
| vim.opt.breakindent = true | |
| vim.opt.undofile = true | |
| vim.opt.ignorecase = true | |
| vim.opt.smartcase = true | |
| vim.opt.signcolumn = 'yes' | |
| vim.opt.updatetime = 250 | |
| vim.opt.timeout = true | |
| vim.opt.completeopt = 'menuone,noselect' | |
| vim.opt.termguicolors = true | |
| vim.opt.timeoutlen = 300 | |
| vim.opt.splitright = true | |
| vim.opt.splitbelow = true | |
| vim.opt.list = true | |
| vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' } | |
| vim.opt.inccommand = 'split' | |
| vim.opt.cursorline = true | |
| vim.opt.scrolloff = 5 | |
| vim.opt.hlsearch = true | |
| -- [[ Basic Keymaps ]] | |
| -- Keymaps for better default experience | |
| -- See `:help vim.keymap.set()` | |
| vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true }) | |
| -- Remap for dealing with word wrap | |
| 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 }) | |
| -- [[ Highlight on yank ]] | |
| -- See `:help vim.highlight.on_yank()` | |
| local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true }) | |
| vim.api.nvim_create_autocmd('TextYankPost', { | |
| callback = function() | |
| vim.highlight.on_yank() | |
| end, | |
| group = highlight_group, | |
| pattern = '*', | |
| }) | |
| -- [[ Configure Telescope ]] | |
| -- See `:help telescope` and `:help telescope.setup()` | |
| require('telescope').setup { | |
| defaults = { | |
| mappings = { | |
| i = { | |
| ['<C-u>'] = false, | |
| ['<C-d>'] = false, | |
| }, | |
| }, | |
| }, | |
| } | |
| -- Enable telescope fzf native, if installed | |
| pcall(require('telescope').load_extension, 'fzf') | |
| -- See `:help telescope.builtin` | |
| vim.keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' }) | |
| vim.keymap.set('n', '<leader><space>', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' }) | |
| vim.keymap.set('n', '<leader>/', function() | |
| -- You can pass additional configuration to telescope to change theme, layout, etc. | |
| require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { | |
| winblend = 10, | |
| previewer = false, | |
| }) | |
| end, { desc = '[/] Fuzzily search in current buffer' }) | |
| vim.keymap.set('n', '<leader>ff', require('telescope.builtin').find_files, { desc = '[F]ind [F]iles' }) | |
| vim.keymap.set('n', '<leader>fh', require('telescope.builtin').help_tags, { desc = '[F]ind [H]elp' }) | |
| vim.keymap.set('n', '<leader>fw', require('telescope.builtin').grep_string, { desc = '[F]ind current [W]ord' }) | |
| vim.keymap.set('n', '<leader>fg', require('telescope.builtin').live_grep, { desc = '[F]ind by [G]rep' }) | |
| vim.keymap.set('n', '<leader>fc', function() | |
| require('telescope.builtin').git_files( | |
| { | |
| git_command = { "git", "ls-files", "-mo", "--exclude-standard" } | |
| } | |
| ) | |
| end, { desc = '[F]ind [C]hanged files'}) | |
| vim.keymap.set('n', '<leader>fd', require('telescope.builtin').diagnostics, { desc = '[F]ind [D]iagnostics' }) | |
| -- [[ Configure Treesitter ]] | |
| -- See `:help nvim-treesitter` | |
| require('nvim-treesitter.configs').setup { | |
| -- Add languages to be installed here that you want installed for treesitter | |
| ensure_installed = { 'ruby', 'javascript', 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'typescript', 'help', 'vim', 'yaml' }, | |
| -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) | |
| auto_install = false, | |
| highlight = { enable = true }, | |
| indent = { enable = true, disable = { 'python', 'ruby' } }, | |
| incremental_selection = { | |
| enable = true, | |
| keymaps = { | |
| init_selection = '<c-space>', | |
| node_incremental = '<c-space>', | |
| scope_incremental = '<c-s>', | |
| node_decremental = '<M-space>', | |
| }, | |
| }, | |
| textobjects = { | |
| select = { | |
| enable = true, | |
| lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim | |
| keymaps = { | |
| -- You can use the capture groups defined in textobjects.scm | |
| ['aa'] = '@parameter.outer', | |
| ['ia'] = '@parameter.inner', | |
| ['af'] = '@function.outer', | |
| ['if'] = '@function.inner', | |
| ['ac'] = '@class.outer', | |
| ['ic'] = '@class.inner', | |
| }, | |
| }, | |
| move = { | |
| enable = true, | |
| set_jumps = true, -- whether to set jumps in the jumplist | |
| goto_next_start = { | |
| [']m'] = '@function.outer', | |
| [']]'] = '@class.outer', | |
| }, | |
| goto_next_end = { | |
| [']M'] = '@function.outer', | |
| [']['] = '@class.outer', | |
| }, | |
| goto_previous_start = { | |
| ['[m'] = '@function.outer', | |
| ['[['] = '@class.outer', | |
| }, | |
| goto_previous_end = { | |
| ['[M'] = '@function.outer', | |
| ['[]'] = '@class.outer', | |
| }, | |
| }, | |
| swap = { | |
| enable = true, | |
| swap_next = { | |
| ['<leader>a'] = '@parameter.inner', | |
| }, | |
| swap_previous = { | |
| ['<leader>A'] = '@parameter.inner', | |
| }, | |
| }, | |
| }, | |
| } | |
| -- Diagnostic keymaps | |
| vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = "Go to previous diagnostic message" }) | |
| vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = "Go to next diagnostic message" }) | |
| vim.keymap.set('n', '<leader>de', vim.diagnostic.open_float, { desc = "Open floating diagnostic message" }) | |
| vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = "Open diagnostics list" }) | |
| -- LSP settings. | |
| -- This function gets run when an LSP connects to a particular buffer. | |
| local on_attach = function(_, bufnr) | |
| -- NOTE: Remember that lua is a real programming language, and as such it is possible | |
| -- to define small helper and utility functions so you don't have to repeat yourself | |
| -- many times. | |
| -- | |
| -- In this case, we create a function that lets us more easily define mappings specific | |
| -- for LSP related items. It sets the mode, buffer and description for us each time. | |
| local nmap = function(keys, func, desc) | |
| if desc then | |
| desc = 'LSP: ' .. desc | |
| end | |
| vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc }) | |
| end | |
| nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame') | |
| nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction') | |
| nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition') | |
| nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') | |
| nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation') | |
| nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition') | |
| nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') | |
| nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') | |
| -- See `:help K` for why this keymap | |
| nmap('K', vim.lsp.buf.hover, 'Hover Documentation') | |
| nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation') | |
| -- Lesser used LSP functionality | |
| nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') | |
| nmap('<leader>wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder') | |
| nmap('<leader>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder') | |
| nmap('<leader>wl', function() | |
| print(vim.inspect(vim.lsp.buf.list_workspace_folders())) | |
| end, '[W]orkspace [L]ist Folders') | |
| -- Create a command `:Format` local to the LSP buffer | |
| vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_) | |
| vim.lsp.buf.format() | |
| end, { desc = 'Format current buffer with LSP' }) | |
| end | |
| -- Enable the following language servers | |
| -- Feel free to add/remove any LSPs that you want here. They will automatically be installed. | |
| -- | |
| -- Add any additional override configuration in the following tables. They will be passed to | |
| -- the `settings` field of the server config. You must look up that documentation yourself. | |
| local servers = { | |
| -- clangd = {}, | |
| -- gopls = {}, | |
| -- pyright = {}, | |
| -- rust_analyzer = {}, | |
| ruby_lsp = {}, | |
| tsserver = {}, | |
| -- solargraph = {}, | |
| lua_ls = { | |
| Lua = { | |
| workspace = { checkThirdParty = false }, | |
| telemetry = { enable = false }, | |
| }, | |
| }, | |
| } | |
| -- nvim-cmp supports additional completion capabilities, so broadcast that to servers | |
| local capabilities = vim.lsp.protocol.make_client_capabilities() | |
| capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) | |
| -- Setup mason so it can manage external tooling | |
| require('mason').setup() | |
| -- Ensure the servers above are installed | |
| local mason_lspconfig = require 'mason-lspconfig' | |
| mason_lspconfig.setup { | |
| ensure_installed = vim.tbl_keys(servers), | |
| } | |
| mason_lspconfig.setup_handlers { | |
| function(server_name) | |
| require('lspconfig')[server_name].setup { | |
| capabilities = capabilities, | |
| on_attach = on_attach, | |
| settings = servers[server_name], | |
| } | |
| end, | |
| } | |
| -- nvim-cmp setup | |
| local cmp = require 'cmp' | |
| local luasnip = require 'luasnip' | |
| luasnip.filetype_extend("ruby", {"rails"}) | |
| require("luasnip.loaders.from_vscode").lazy_load() | |
| local lspkind = require 'lspkind' | |
| -- local cmp_jira = require 'custom.plugins.cmp-jira' | |
| -- require('Jira') | |
| luasnip.config.setup {} | |
| -- require'lspconfig'.solargraph.setup{} | |
| -- require'lspconfig'.ruby_ls.setup{} | |
| -- cmp.register_source('cmp-jira', cmp_jira) | |
| cmp.setup { | |
| snippet = { | |
| expand = function(args) | |
| luasnip.lsp_expand(args.body) | |
| end, | |
| }, | |
| mapping = cmp.mapping.preset.insert { | |
| ['<C-d>'] = cmp.mapping.scroll_docs(-4), | |
| ['<C-f>'] = cmp.mapping.scroll_docs(4), | |
| ['<C-Space>'] = cmp.mapping.complete {}, | |
| ['<CR>'] = cmp.mapping.confirm { | |
| behavior = cmp.ConfirmBehavior.Replace, | |
| select = true, | |
| }, | |
| ['<Tab>'] = cmp.mapping(function(fallback) | |
| if cmp.visible() then | |
| cmp.select_next_item() | |
| elseif luasnip.expand_or_jumpable() then | |
| luasnip.expand_or_jump() | |
| else | |
| fallback() | |
| end | |
| end, { 'i', 's' }), | |
| ['<S-Tab>'] = cmp.mapping(function(fallback) | |
| if cmp.visible() then | |
| cmp.select_prev_item() | |
| elseif luasnip.jumpable(-1) then | |
| luasnip.jump(-1) | |
| else | |
| fallback() | |
| end | |
| end, { 'i', 's' }), | |
| }, | |
| sources = { | |
| { name = 'nvim_lsp', keyword_length = 3 }, | |
| { name = 'nvim_lua', keyword_length = 3 }, | |
| { name = 'luasnip', keyword_length = 2 }, | |
| { name = 'buffer', keyword_length = 3 }, | |
| -- { name = 'cmp_jira' } | |
| }, | |
| formatting = { | |
| format = lspkind.cmp_format { | |
| mode = 'symbol_text', | |
| maxwidth = 50, | |
| elipsis_char = '...', | |
| menu = { | |
| buffer = '[buf]', | |
| nvim_lsp = '[LSP]', | |
| luasnip = 'snip', | |
| path = 'path' | |
| } | |
| } | |
| } | |
| } | |
| -- vim: ts=2 sts=2 sw=2 et |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| vim.opt.tags = { '.tags', '.git/tags', '.gemtags' } | |
| -- Spelling because I can't learn to spell | |
| vim.cmd('iab thier their') | |
| vim.cmd('iab recieve receive') | |
| vim.cmd('iab reciept receipt') | |
| vim.cmd('abbr jursidiction jurisdiction') | |
| vim.opt.showmatch = true | |
| vim.opt.ignorecase = true | |
| vim.opt.smartcase = true | |
| vim.opt.cursorline = true | |
| vim.opt.cmdheight = 2 | |
| vim.opt.switchbuf="useopen" | |
| vim.opt.numberwidth=5 | |
| vim.opt.showtabline=2 | |
| vim.opt.winwidth=79 | |
| vim.opt.scrolloff=3 | |
| vim.opt.backup=true | |
| local backupdirs = { | |
| vim.fn.expand('~/.vim-tmp'), | |
| vim.fn.expand('~/.tmp'), | |
| vim.fn.expand('~/tmp'), | |
| vim.fn.expand('/var/tmp'), | |
| vim.fn.expand('/tmp') | |
| } | |
| vim.opt.backupdir=backupdirs | |
| vim.opt.directory=backupdirs | |
| vim.opt.wildmode={'longest', 'list'} | |
| vim.opt.undodir={ vim.fn.expand('~/.vim/undo') } | |
| vim.opt.ttimeoutlen=100 | |
| vim.opt.modeline=true | |
| vim.opt.modelines=3 | |
| vim.opt.wildignore={ 'tmp/*' } | |
| vim.opt.splitbelow=true | |
| vim.opt.splitright=true | |
| vim.keymap.set('n','<leader>.', ':A<cr>', { desc = 'Alternate File'}) | |
| vim.keymap.set('n','<leader><leader>', '<c-^>', { desc = 'Alternate File'}) | |
| vim.keymap.set('c','%%', '<C-R>=expand(%:h).\'/\'<cr>', { desc = 'Current Directory'}) | |
| vim.keymap.set('n','<leader>e', ':edit %%', { desc = 'Current Directory'}) | |
| vim.keymap.set('n','<leader>v', ':view %%', { desc = 'Current Directory'}) | |
| vim.keymap.set('n', '<cr>', ':nohlsearch<cr>', { desc = 'Kill current Highlights' }) | |
| vim.keymap.set('n', '<leader>t', ':Rails<cr>', { desc = 'Run current [t]est file' }) | |
| vim.keymap.set('n', '<leader>T', ':.Rails<cr>', { desc = 'Run current [T]est file at line #' }) | |
| vim.keymap.set('n', '<leader>gc', ":lua require('telescope.builtin').find_files({ cwd='app/controllers' })<cr>", { desc = '[G]oto [C]ontrollers' }) | |
| vim.keymap.set('n', '<leader>gf', ":lua require('telescope.builtin').find_files({ cwd='spec/factories' })<cr>", { desc = '[G]oto [F]actories' }) | |
| vim.keymap.set('n', '<leader>gh', ":lua require('telescope.builtin').find_files({ cwd='app/helpers' })<cr>", { desc = '[G]oto [H]helpers' }) | |
| vim.keymap.set('n', '<leader>gl', ":lua require('telescope.builtin').find_files({ cwd='lib' })<cr>", { desc = '[G]oto [L]ib' }) | |
| vim.keymap.set('n', '<leader>gm', ":lua require('telescope.builtin').find_files({ cwd='app/models' })<cr>", { desc = '[G]oto [M]odels' }) | |
| vim.keymap.set('n', '<leader>gs', ":lua require('telescope.builtin').find_files({ cwd='app/services' })<cr>", { desc = '[G]oto [S]service' }) | |
| vim.keymap.set('n', '<leader>gv', ":lua require('telescope.builtin').find_files({ cwd='app/views' })<cr>", { desc = '[G]oto [V]iews' }) | |
| -- when opeing a file, go to the last cursor line | |
| vim.api.nvim_create_autocmd('BufRead', { | |
| callback = function(opts) | |
| vim.api.nvim_create_autocmd('BufWinEnter', { | |
| once = true, | |
| buffer = opts.buf, | |
| callback = function() | |
| local ft = vim.bo[opts.buf].filetype | |
| local last_known_line = vim.api.nvim_buf_get_mark(opts.buf, '"')[1] | |
| if | |
| not (ft:match('commit') and ft:match('rebase')) | |
| and last_known_line > 1 | |
| and last_known_line <= vim.api.nvim_buf_line_count(opts.buf) | |
| then | |
| vim.api.nvim_feedkeys([[g`"]], 'x', false) | |
| end | |
| end, | |
| }) | |
| end, | |
| }) | |
| vim.api.nvim_create_user_command('Test', function() | |
| package.loaded.Refactor = nil | |
| require('Refactor').promote_to_let() | |
| end, {}) | |
| return { | |
| 'tpope/vim-bundler', | |
| 'tpope/vim-fugitive', | |
| 'tpope/vim-rails', | |
| 'tpope/vim-repeat', | |
| 'tpope/vim-surround', | |
| 'tpope/vim-unimpaired', | |
| 'tpope/vim-abolish', | |
| 'tpope/vim-dispatch', | |
| 'vim-ruby/vim-ruby', | |
| 'carakan/new-railscasts-theme', | |
| 'jpo/vim-railscasts-theme', | |
| { | |
| 'tpope/vim-projectionist', | |
| config = function() | |
| local config = { | |
| ["app/views/**/*.json.jbuilder"] = { alternate = "spec/views/{}/{}.json.jbuilder_spec.rb" }, | |
| ["spec/views/**/*.json.jbuilder_spec.rb"] = { alternate = "app/views/{}/{}.json.jbuilder", dispatch = "rspec {file}" }, | |
| ["app/views/**/*.erb"] = { alternate = "spec/views/{}/{}.erb_spec.rb" }, | |
| ["spec/views/**/*.erb_spec.rb"] = { alternate = "app/views/{}/{}.erb", dispatch = "rspec {file}" }, | |
| ["app/**/*.rb"] = { alternate = "spec/{}/{}_spec.rb" }, | |
| ["spec/**/*_spec.rb"] = { alternate = "app/{}/{}.rb", dispatch = "rspec {file}" }, | |
| } | |
| if vim.g.projectionist_heuristics then | |
| vim.tbl_extend("force", vim.g.projectionist_heuristics, config) | |
| else | |
| vim.g.projectionist_heuristics = config | |
| end | |
| end | |
| }, | |
| { | |
| "klen/nvim-test", | |
| config = function() | |
| require('nvim-test').setup {} | |
| end | |
| }, | |
| { | |
| 'stevearc/dressing.nvim', | |
| config = function() | |
| require('dressing').setup { | |
| enabled = true, | |
| input = { | |
| relative = 'win' | |
| } | |
| } | |
| end | |
| }, | |
| { -- Theme inspired by Atom | |
| 'navarasu/onedark.nvim', | |
| priority = 1000, | |
| config = function() | |
| require('onedark').setup { | |
| style = 'deep', | |
| transparent = true, | |
| term_colors = true, | |
| toggle_style_key = '<leader>ts', | |
| } | |
| require('onedark').load() | |
| vim.cmd("hi DashboardHeader guifg=#41a7fc") | |
| end, | |
| }, | |
| { | |
| 'nvim-treesitter/nvim-treesitter-context', | |
| config = function() | |
| require('treesitter-context').setup{} | |
| end | |
| }, | |
| } | |
| -- autocmd BufRead * autocmd FileType <buffer> ++once | |
| -- \ if &ft !~# 'commit\|rebase' && line("'\"") > 1 && line("'\"") <= line("$") | exe 'normal! g`"' | endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment