diff --git a/nvim/init.lua b/nvim/init.lua index 4ad6590..5220dba 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -21,3 +21,8 @@ require "settings.haskell" require "settings.keymaps" require "settings.null-ls" require "settings.prettier" +require "settings.gitsigns" +require "settings.rainbow" +require "settings.cpp-dap" +require "settings.dap-ui" +require "settings.telescope" diff --git a/nvim/lua/settings/cmp.lua b/nvim/lua/settings/cmp.lua index df5c052..ef9069a 100644 --- a/nvim/lua/settings/cmp.lua +++ b/nvim/lua/settings/cmp.lua @@ -8,7 +8,9 @@ if not snip_status_ok then return end +vim.cmd('let g:snipMate = {"snippet_version" : 1 }') require("luasnip/loaders/from_vscode").lazy_load() +require("luasnip.loaders.from_snipmate").lazy_load() local check_backspace = function() local col = vim.fn.col "." - 1 diff --git a/nvim/lua/settings/cpp-dap.lua b/nvim/lua/settings/cpp-dap.lua new file mode 100644 index 0000000..564ed7e --- /dev/null +++ b/nvim/lua/settings/cpp-dap.lua @@ -0,0 +1,45 @@ +local dap = require('dap') +dap.adapters.cppdbg = { + id = 'cppdbg', + type = 'executable', + command = '/home/dashie/.config/nvim/plugged/cpptools/extension/debugAdapters/bin/OpenDebugAD7', +} + +dap.configurations.cpp = { + { + name = "Launch file", + type = "cppdbg", + request = "launch", + program = function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/build/', 'file') + end, + cwd = '${workspaceFolder}', + stopAtEntry = true, + }, + { + name = "Launch file --gui", + type = "cppdbg", + request = "launch", + program = function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/build/', 'file') + end, + args = '[--gui]', + cwd = '${workspaceFolder}', + stopAtEntry = true, + }, + { + name = 'Attach to gdbserver :1234', + type = 'cppdbg', + request = 'launch', + MIMode = 'gdb', + miDebuggerServerAddress = 'localhost:1234', + miDebuggerPath = '/usr/bin/gdb', + cwd = '${workspaceFolder}', + program = function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/build/', 'file') + end, + }, +} + +dap.configurations.c = dap.configurations.cpp +dap.configurations.rust = dap.configurations.cpp diff --git a/nvim/lua/settings/dap-ui.lua b/nvim/lua/settings/dap-ui.lua new file mode 100644 index 0000000..cbd3d24 --- /dev/null +++ b/nvim/lua/settings/dap-ui.lua @@ -0,0 +1,73 @@ +require("dapui").setup({ + icons = { expanded = "▾", collapsed = "▸", current_frame = "▸" }, + mappings = { + -- Use a table to apply multiple mappings + expand = { "", "<2-LeftMouse>" }, + open = "o", + remove = "d", + edit = "e", + repl = "r", + toggle = "t", + }, + -- Expand lines larger than the window + -- Requires >= 0.7 + expand_lines = vim.fn.has("nvim-0.7") == 1, + -- Layouts define sections of the screen to place windows. + -- The position can be "left", "right", "top" or "bottom". + -- The size specifies the height/width depending on position. It can be an Int + -- or a Float. Integer specifies height/width directly (i.e. 20 lines/columns) while + -- Float value specifies percentage (i.e. 0.3 - 30% of available lines/columns) + -- Elements are the elements shown in the layout (in order). + -- Layouts are opened in order so that earlier layouts take priority in window sizing. + layouts = { + { + elements = { + -- Elements can be strings or table with id and size keys. + { id = "scopes", size = 0.25 }, + "breakpoints", + "stacks", + "watches", + }, + size = 40, -- 40 columns + position = "left", + }, + { + elements = { + "repl", + "console", + }, + size = 0.25, -- 25% of total lines + position = "bottom", + }, + }, + controls = { + -- Requires Neovim nightly (or 0.8 when released) + enabled = true, + -- Display controls in this element + element = "repl", + icons = { + pause = "", + play = "", + step_into = "", + step_over = "", + step_out = "", + step_back = "", + run_last = "↻", + terminate = "□", + }, + }, + floating = { + max_height = nil, -- These can be integers or a float between 0 and 1. + max_width = nil, -- Floats will be treated as percentage of your screen. + border = "single", -- Border style. Can be "single", "double" or "rounded" + mappings = { + close = { "q", "" }, + }, + }, + windows = { indent = 1 }, + render = { + max_type_length = nil, -- Can be integer or nil. + max_value_lines = 100, -- Can be integer or nil. + } +}) +require("dapui").setup() diff --git a/nvim/lua/settings/nvim-tree.lua b/nvim/lua/settings/nvim-tree.lua index 56b917d..f401abd 100644 --- a/nvim/lua/settings/nvim-tree.lua +++ b/nvim/lua/settings/nvim-tree.lua @@ -75,7 +75,7 @@ nvim_tree.setup { -- BEGIN_DEFAULT_OPTS }, renderer = { add_trailing = false, - group_empty = false, + group_empty = true, highlight_git = false, full_name = false, highlight_opened_files = "none", @@ -229,4 +229,6 @@ nvim_tree.setup { -- BEGIN_DEFAULT_OPTS watcher = false, }, }, - } -- END_DEFAULT_OPTS + } + +vim.g.nvim_tree_group_empty = 1 diff --git a/nvim/lua/settings/plugins.lua b/nvim/lua/settings/plugins.lua index 417ad99..f453e15 100644 --- a/nvim/lua/settings/plugins.lua +++ b/nvim/lua/settings/plugins.lua @@ -22,6 +22,9 @@ Plug('hrsh7th/cmp-path') Plug('hrsh7th/cmp-cmdline') Plug('saadparwaiz1/cmp_luasnip') Plug('L3MON4D3/LuaSnip') +Plug 'MarcWeber/vim-addon-mw-utils' +Plug 'tomtom/tlib_vim' +Plug 'garbas/vim-snipmate' Plug('kyazdani42/nvim-tree.lua') Plug('windwp/nvim-autopairs') Plug('akinsho/bufferline.nvim') @@ -38,5 +41,13 @@ Plug('weilbith/nvim-code-action-menu') Plug('mfussenegger/nvim-lint') Plug 'jose-elias-alvarez/null-ls.nvim' Plug 'MunifTanjim/prettier.nvim' +Plug 'rafamadriz/friendly-snippets' +Plug 'p00f/nvim-ts-rainbow' +Plug 'mfussenegger/nvim-dap' +Plug 'rcarriga/nvim-dap-ui' +Plug 'theHamsta/nvim-dap-virtual-text' +Plug 'nvim-telescope/telescope-ui-select.nvim' +Plug 'nvim-telescope/telescope-file-browser.nvim' +Plug 'nvim-telescope/telescope-fzy-native.nvim' vim.call('plug#end') diff --git a/nvim/lua/settings/rainbow.lua b/nvim/lua/settings/rainbow.lua new file mode 100644 index 0000000..a070e04 --- /dev/null +++ b/nvim/lua/settings/rainbow.lua @@ -0,0 +1,14 @@ +require("nvim-treesitter.configs").setup { + highlight = { + -- ... + }, + -- ... + rainbow = { + enable = true, + -- disable = { "jsx", "cpp" }, list of languages you want to disable the plugin for + extended_mode = true, -- Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean + max_file_lines = nil, -- Do not enable for files with more than n lines, int + -- colors = {}, -- table of hex strings + -- termcolors = {} -- table of colour name strings + } +} diff --git a/nvim/lua/settings/telescope.lua b/nvim/lua/settings/telescope.lua new file mode 100644 index 0000000..790836a --- /dev/null +++ b/nvim/lua/settings/telescope.lua @@ -0,0 +1,8 @@ +local builtin = require('telescope.builtin') +local async = require "plenary.async" +require('telescope').setup{} +require('telescope').load_extension('fzy_native') +vim.keymap.set('n', 'ff', builtin.find_files, {}) +vim.keymap.set('n', 'fg', builtin.live_grep, {}) +vim.keymap.set('n', 'fb', builtin.buffers, {}) +vim.keymap.set('n', 'fh', builtin.help_tags, {}) diff --git a/nvim/lua/settings/vimtex.lua b/nvim/lua/settings/vimtex.lua index 2111117..9677bf0 100644 --- a/nvim/lua/settings/vimtex.lua +++ b/nvim/lua/settings/vimtex.lua @@ -1,13 +1,13 @@ --vim.cmd('let g:vimtex_view_method = "zathura"') - vim.cmd('let g:vimtex_view_general_viewer = "evince"') --let g:vimtex_view_general_options = '--unique file:@pdf\#src:@line@tex' -vim.cmd('let g:vimtex_compiler_latexmk = { "options" : [ "-shell-escape", "-interaction=nonstopmode" , "-synctex=1" ], }') +--vim.cmd('let g:vimtex_compiler_latexmk = { "options" : [ "-shell-escape", "-interaction=nonstopmode" , "-synctex=1" ], }') vim.cmd('let g:vimtex_compiler_method = "latexmk"') -vim.cmd('let b:tex_use_shell_escape = 1') + +--vim.cmd('let b:tex_use_shell_escape = 1') --let maplocalleader = "," diff --git a/nvim/snippets/tex.snippets b/nvim/snippets/tex.snippets new file mode 100644 index 0000000..4afec87 --- /dev/null +++ b/nvim/snippets/tex.snippets @@ -0,0 +1,36 @@ + +snippet mini \minipg{}{}[] + \\minipg{ + $1 + } + {${2}}[${3}] + +snippet code "code" + \\begin{lstlisting} + $1 + \\end{lstlisting} + +snippet list "list" + \\begin{itemize} + \\item $1 + \\end{itemize} + +snippet enum "enumerate" + \\begin{enumerate} + \\item + \\end{enumerate} + +snippet table "table" + \\begin{table}[ht!] + \\section{${1}} + \\begin{tabular}{|m{0.2\linewidth}|m{0.755\linewidth}|} + \hline + $2 + \hline + \\end{tabular} + \\end{table} + +snippet tabular "tabular" + \\begin{tabular}{|m{0.2\linewidth}|m{0.755\linewidth}|} + $1 + \\end{tabular}