Skip to content

Prikaz98/office-utils

Repository files navigation

Office utils

Scalai

Concat imports

After call scalai-pretty-imports following import will be concat to compact form. Sorted by alphabet.

There is an additional behavior when class names compared with rest of the file and comment them. Custom: scalai-ignore-import-list - to keep some special imports in any case.

Benefits: Removes only duplicates

Default behavior

Before:

import com.office.domain.Person
import com.office.domain.Invoce
import com.office.maintenance.InvoceCalculator
import com.office.maintenance.UserAggregator
import com.office.UselessService

class Main {
  def main(args: Array[String]) = ???
}

After:

import com.office.UselessService
import com.office.domain.{Invoce, Person}
import com.office.maintenance.{InvoceCalculator, UserAggregator}

class Main {
  def main(args: Array[String]) = ???
}

Comment extra imports behavior

Before:

import com.office.domain.Person
import com.office.domain.Invoce
import com.office.maintenance.InvoceCalculator
import com.office.maintenance.UserAggregator
import com.office.UselessService

class Main {
  def main(args: Array[String]) = {
    val person = new Person("vasya", "petrovic", age = 21)
    UserAggregator.registerUser(person)
  }
}

After:

import com.office.UselessService
import com.office.domain.Person
//import com.office.domain.Invoce
import com.office.maintenance.UserAggregator
//import com.office.maintenance.InvoceCalculator

class Main {
  def main(args: Array[String]) = {
    val person = new Person("vasya", "petrovic", age = 21)
    UserAggregator.registerUser(person)
    UselessService.putAsUseless(person)
  }
}

Seporate line arguments for function

scalai-sep-args

Before:

def main(    v: String, a:    Seq[(String, Any)],   b: Map[Any, _]) = ???
case class Person(    v: String, a:    Seq[(String, Any)],   b: Map[Any, _])

After:

def main(
    v: String,
    a: Seq[(String, Any)],
    b: Map[Any, _]
) = ???

case class Person(
    v: String,
    a: Seq[(String, Any)],
    b: Map[Any, _]
)

Customize:

  • scalai-function-args-indention

Jira

Transform .org to jira markdown Call function jira-from-org-kill in .org file and get converted data in clipboard.

Jsoni

Just one function to minimize json jsoni-minimalize in whole buffer

Before:

{
    "string": "some value",
    "array": [
        "hi there",
        "hi there again"
    ],
    "object": {
        "key1": "value",
        "key2": 999
    },
    "int": 100,
    "boolean": true,
    "booleanFalse": false
}

After:

{"string":"some value","array":["hi there","hi there again"],"object":{"key1":"value","key2":999},"int":100,"boolean":true,"booleanFalse":false}

Mermaid

Text-util

In general there are common function to edit files.

text-util-from-camel-case-range - TransforCamelCaseRange to snake_case_range

Restclienti

A few function which help me works with .http files

Demo:

restclienti.gif

About

Utility functions for efficient work in Emacs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published