diff options
-rw-r--r-- | after/lsp/clangd.lua | 12 | ||||
-rw-r--r-- | init.lua | 65 | ||||
-rw-r--r-- | lua/plugins/lualine.lua | 38 | ||||
-rw-r--r-- | plugin/basics.lua | 2 | ||||
-rw-r--r-- | plugin/keymaps.lua | 2 | ||||
-rw-r--r-- | plugin/lsp.lua | 3 |
6 files changed, 54 insertions, 68 deletions
diff --git a/after/lsp/clangd.lua b/after/lsp/clangd.lua new file mode 100644 index 0000000..0372d3d --- /dev/null +++ b/after/lsp/clangd.lua @@ -0,0 +1,12 @@ +return { + -- Command and arguments to start the server. + cmd = { 'clangd' }, + -- Filetypes to automatically attach to. + filetypes = { 'c', 'cpp', 'h', 'hpp' }, + -- Sets the "root directory" to the parent directory of the file in the + -- current buffer that contains either a ".luarc.json" or a + -- ".luarc.jsonc" file. Files that share a root directory will reuse + -- the connection to the same LSP server. + -- Nested lists indicate equal priority, see |vim.lsp.Config|. + root_markers = { '.clangd', 'compile_commands.json' }, +} @@ -6,66 +6,5 @@ end -- Change leader to a comma vim.g.mapleader = ',' -local function get_hostname() - local f = io.open("/etc/hostname") - local hostname = f:read("*a") or "" - f:close() - hostname = string.gsub(hostname, "\n$", "") - return hostname -end - --- Load plugins on devices other than RPi -if get_hostname() ~= "shoggoth" then - -- Bootstrap lazy.nvim - local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" - if not (vim.uv or vim.loop).fs_stat(lazypath) then - local lazyrepo = "https://github.com/folke/lazy.nvim.git" - local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) - if vim.v.shell_error ~= 0 then - vim.api.nvim_echo({ - { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, - { out, "WarningMsg" }, - { "\nPress any key to exit..." }, - }, true, {}) - vim.fn.getchar() - os.exit(1) - end - end - vim.opt.rtp:prepend(lazypath) - - ---@type LazySpec - local plugins = 'plugins' - - -- Configure plugins. - require('lazy').setup(plugins, { - ui = { border = 'rounded' }, - dev = { path = vim.g.projects_dir }, - install = { - -- Do not automatically install on startup. - missing = false, - }, - -- Don't bother me when tweaking plugins. - change_detection = { notify = false }, - -- None of my plugins use luarocks so disable this. - rocks = { - enabled = false, - }, - performance = { - rtp = { - -- Stuff I don't use. - disabled_plugins = { - 'gzip', - 'netrwPlugin', - 'rplugin', - 'tarPlugin', - 'tohtml', - 'tutor', - 'zipPlugin', - }, - }, - }, - }) - - vim.cmd.colorscheme "jellybeans-nvim" -end --- Load plugins on devices other than RPi +require("config.lazy") +vim.cmd.colorscheme "jellybeans-nvim" diff --git a/lua/plugins/lualine.lua b/lua/plugins/lualine.lua index e3cf2b7..85c0155 100644 --- a/lua/plugins/lualine.lua +++ b/lua/plugins/lualine.lua @@ -15,17 +15,51 @@ return { }, ignore_focus = {}, always_divide_middle = true, + always_show_tabline = true, globalstatus = false, refresh = { statusline = 1000, tabline = 1000, winbar = 1000, + refresh_time = 16, -- ~60fps + events = { + 'WinEnter', + 'BufEnter', + 'BufWritePost', + 'SessionLoadPost', + 'FileChangedShellPost', + 'VimResized', + 'Filetype', + 'CursorMoved', + 'CursorMovedI', + 'ModeChanged', + }, } }, sections = { lualine_a = { 'mode' }, lualine_b = { 'branch', 'diff', 'diagnostics' }, - lualine_c = { 'filename' }, + lualine_c = { + { + 'filename', + file_status = true, -- Displays file status (readonly status, modified status) + newfile_status = false, -- Display new file status (new file means no write after created) + path = 1, -- 0: Just the filename + -- 1: Relative path + -- 2: Absolute path + -- 3: Absolute path, with tilde as the home directory + -- 4: Filename and parent dir, with tilde as the home directory + + shorting_target = 40, -- Shortens path to leave 40 spaces in the window + -- for other components. (terrible name, any suggestions?) + symbols = { + modified = '[+]', -- Text to show when the file is modified. + readonly = '[-]', -- Text to show when the file is non-modifiable or readonly. + unnamed = '[No Name]', -- Text to show for unnamed buffers. + newfile = '[New]', -- Text to show for newly created file before first write + } + } + }, lualine_x = { 'encoding', 'fileformat', 'filetype' }, lualine_y = { 'progress' }, lualine_z = { 'location' } @@ -41,7 +75,7 @@ return { tabline = {}, winbar = {}, inactive_winbar = {}, - extensions = {}, + extensions = {} } }, } diff --git a/plugin/basics.lua b/plugin/basics.lua index 3a5cf4a..8db4995 100644 --- a/plugin/basics.lua +++ b/plugin/basics.lua @@ -29,7 +29,7 @@ opt.incsearch = true opt.ignorecase = true opt.backspace = 'indent,eol,start' opt.exrc = true -opt.signcolumn = 'number' -- Display signs in the 'number' column. +opt.signcolumn = 'auto' -- Display only when there is a sign to display ----------------------------------------------------------- -- Tabs, indent diff --git a/plugin/keymaps.lua b/plugin/keymaps.lua index 0389aef..ec8e436 100644 --- a/plugin/keymaps.lua +++ b/plugin/keymaps.lua @@ -36,7 +36,7 @@ map('t', 'C-w', '<C-\\><C-n><C-w>') map('n', '<leader>B', ':Buffers<CR>') -- FZF show open buffers map('n', '<leader>F', ':Files<CR>') -- FZF show files -map('n', '<leader>A', ':Rg<CR>') -- FZF call ripgrep +map('n', '<leader>A', ':RG<CR>') -- FZF call ripgrep, relaunch ripgrep on every keystroke map('n', '<leader>C', ':Commits<CR>') -- FZF show git commits map('n', '<leader>M', ':Maps<CR>') -- FZF show normal mode mappings diff --git a/plugin/lsp.lua b/plugin/lsp.lua index 92d0119..5dc93ef 100644 --- a/plugin/lsp.lua +++ b/plugin/lsp.lua @@ -1,5 +1,6 @@ vim.lsp.enable({ - "lua_ls" + "lua_ls", + "clangd" }) -- Use LspAttach autocommand to only map the following keys |